From xen-changelog-bounces@lists.xenproject.org Mon Dec 02 08:55:17 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 02 Dec 2024 08:55:17 +0000
Received: from list by lists.xenproject.org with outflank-mailman.846370.1261538 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tI2Cy-0006gG-BS; Mon, 02 Dec 2024 08:55:08 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 846370.1261538; Mon, 02 Dec 2024 08:55:08 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tI2Cy-0006g8-8o; Mon, 02 Dec 2024 08:55:08 +0000
Received: by outflank-mailman (input) for mailman id 846370;
 Mon, 02 Dec 2024 08:55:07 +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 1tI2Cx-0006fy-Rk
 for xen-changelog@lists.xenproject.org; Mon, 02 Dec 2024 08:55:07 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1tI2Cx-0009Y0-1H
 for xen-changelog@lists.xenproject.org;
 Mon, 02 Dec 2024 08:55:07 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1tI2Cx-009peB-1x
 for xen-changelog@lists.xenproject.org;
 Mon, 02 Dec 2024 08:55:07 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xl: Keep monitoring suspended domain
Message-Id: <E1tI2Cx-009peB-1x@xenbits.xenproject.org>
Date: Mon, 02 Dec 2024 08:55:07 +0000

commit 6b8c85872ed877ab2526afc2899477f517d563ce
Author:     Jason Andryuk <jason.andryuk@amd.com>
AuthorDate: Mon Dec 2 09:49:38 2024 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Dec 2 09:49:38 2024 +0100

    xl: Keep monitoring suspended domain
    
    When a VM transitioned to LIBXL_SHUTDOWN_REASON_SUSPEND, the xl daemon
    was exiting as 0 = DOMAIN_RESTART_NONE "No domain restart".
    Later, when the VM actually shutdown, the missing xl daemon meant the
    domain wasn't cleaned up properly.
    
    Add a new DOMAIN_RESTART_SUSPENDED to handle the case.  The xl daemon
    keeps running to react to future shutdown events.
    
    The domain death event needs to be re-enabled to catch subsequent
    events.  The libxl_evgen_domain_death is moved from death_list to
    death_reported, and then it isn't found on subsequent iterations through
    death_list.  We enable the new event before disabling the old event, to
    keep the xenstore watch active.  If it is unregistered and
    re-registered, it'll fire immediately for our suspended domain which
    will end up continuously re-triggering.
    
    Signed-off-by: Jason Andryuk <jason.andryuk@amd.com>
    Reviewed-by: Anthony PERARD <anthony.perard@vates.tech>
---
 tools/xl/xl.h           |  1 +
 tools/xl/xl_vmcontrol.c | 18 +++++++++++++++++-
 2 files changed, 18 insertions(+), 1 deletion(-)

diff --git a/tools/xl/xl.h b/tools/xl/xl.h
index 9c86bb1d98..967d034cfe 100644
--- a/tools/xl/xl.h
+++ b/tools/xl/xl.h
@@ -301,6 +301,7 @@ typedef enum {
     DOMAIN_RESTART_NORMAL,       /* Domain should be restarted */
     DOMAIN_RESTART_RENAME,       /* Domain should be renamed and restarted */
     DOMAIN_RESTART_SOFT_RESET,   /* Soft reset should be performed */
+    DOMAIN_RESTART_SUSPENDED,    /* Domain suspended - keep looping */
 } domain_restart_type;
 
 extern void printf_info_sexp(int domid, libxl_domain_config *d_config, FILE *fh);
diff --git a/tools/xl/xl_vmcontrol.c b/tools/xl/xl_vmcontrol.c
index fa1a4420e3..c45d497c28 100644
--- a/tools/xl/xl_vmcontrol.c
+++ b/tools/xl/xl_vmcontrol.c
@@ -417,7 +417,7 @@ static domain_restart_type handle_domain_death(uint32_t *r_domid,
         break;
     case LIBXL_SHUTDOWN_REASON_SUSPEND:
         LOG("Domain has suspended.");
-        return 0;
+        return DOMAIN_RESTART_SUSPENDED;
     case LIBXL_SHUTDOWN_REASON_CRASH:
         action = d_config->on_crash;
         break;
@@ -1030,6 +1030,7 @@ start:
         }
     }
     while (1) {
+        libxl_evgen_domain_death *deathw2 = NULL;
         libxl_event *event;
         ret = domain_wait_event(domid, &event);
         if (ret) goto out;
@@ -1100,9 +1101,24 @@ start:
                 ret = 0;
                 goto out;
 
+            case DOMAIN_RESTART_SUSPENDED:
+                LOG("Continue waiting for domain %u", domid);
+                /*
+                 * Enable a new event before disabling the old.  This ensures
+                 * the xenstore watch remains active.  Otherwise it'll fire
+                 * immediately on re-registration and find our suspended domain.
+                 */
+                ret = libxl_evenable_domain_death(ctx, domid, 0, &deathw2);
+                if (ret) goto out;
+                libxl_evdisable_domain_death(ctx, deathw);
+                deathw = deathw2;
+                deathw2 = NULL;
+                break;
+
             default:
                 abort();
             }
+            break;
 
         case LIBXL_EVENT_TYPE_DOMAIN_DEATH:
             LOG("Domain %u has been destroyed.", domid);
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Dec 02 08:55:18 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 02 Dec 2024 08:55:18 +0000
Received: from list by lists.xenproject.org with outflank-mailman.846371.1261541 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tI2D8-0006iH-Ce; Mon, 02 Dec 2024 08:55:18 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 846371.1261541; Mon, 02 Dec 2024 08:55: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 1tI2D8-0006iA-AD; Mon, 02 Dec 2024 08:55:18 +0000
Received: by outflank-mailman (input) for mailman id 846371;
 Mon, 02 Dec 2024 08:55:17 +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 1tI2D7-0006hy-S3
 for xen-changelog@lists.xenproject.org; Mon, 02 Dec 2024 08:55:17 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1tI2D7-0009YD-1g
 for xen-changelog@lists.xenproject.org;
 Mon, 02 Dec 2024 08:55:17 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1tI2D7-009pfM-2R
 for xen-changelog@lists.xenproject.org;
 Mon, 02 Dec 2024 08:55:17 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86emul: MOVBE requires a memory operand
Message-Id: <E1tI2D7-009pfM-2R@xenbits.xenproject.org>
Date: Mon, 02 Dec 2024 08:55:17 +0000

commit 4c5d9a01f8fa81417a9c431e9624fb71361ec4f9
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Mon Dec 2 09:50:14 2024 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Dec 2 09:50:14 2024 +0100

    x86emul: MOVBE requires a memory operand
    
    The reg-reg forms should cause #UD; they come into existence only with
    APX, where MOVBE also extends BSWAP (for the latter not being "eligible"
    to a REX2 prefix).
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/x86_emulate/x86_emulate.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/xen/arch/x86/x86_emulate/x86_emulate.c b/xen/arch/x86/x86_emulate/x86_emulate.c
index 0600df789c..b89d440133 100644
--- a/xen/arch/x86/x86_emulate/x86_emulate.c
+++ b/xen/arch/x86/x86_emulate/x86_emulate.c
@@ -6824,6 +6824,7 @@ x86_emulate(
 
     case X86EMUL_OPC(0x0f38, 0xf0): /* movbe m,r */
     case X86EMUL_OPC(0x0f38, 0xf1): /* movbe r,m */
+        generate_exception_if(ea.type != OP_MEM, X86_EXC_UD);
         vcpu_must_have(movbe);
         switch ( op_bytes )
         {
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Dec 02 08:55:29 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 02 Dec 2024 08:55:29 +0000
Received: from list by lists.xenproject.org with outflank-mailman.846372.1261546 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tI2DJ-0006lA-Ef; Mon, 02 Dec 2024 08:55:29 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 846372.1261546; Mon, 02 Dec 2024 08:55:29 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tI2DJ-0006l2-Bu; Mon, 02 Dec 2024 08:55:29 +0000
Received: by outflank-mailman (input) for mailman id 846372;
 Mon, 02 Dec 2024 08:55:28 +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 1tI2DH-0006kq-VR
 for xen-changelog@lists.xenproject.org; Mon, 02 Dec 2024 08:55:27 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1tI2DH-0009YJ-26
 for xen-changelog@lists.xenproject.org;
 Mon, 02 Dec 2024 08:55:27 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1tI2DH-009pgX-2p
 for xen-changelog@lists.xenproject.org;
 Mon, 02 Dec 2024 08:55:27 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86emul: correct VPBROADCASTMW2D predicate testing
Message-Id: <E1tI2DH-009pgX-2p@xenbits.xenproject.org>
Date: Mon, 02 Dec 2024 08:55:27 +0000

commit 3df8812f90d78b65bee1754bb0b3bfc93d9ec3e3
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Mon Dec 2 09:51:28 2024 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Dec 2 09:51:28 2024 +0100

    x86emul: correct VPBROADCASTMW2D predicate testing
    
    Due to presumably a copy-and-paste mistake VPBROADCASTMB2Q was tested
    twice instead.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 tools/tests/x86_emulator/predicates.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/tests/x86_emulator/predicates.c b/tools/tests/x86_emulator/predicates.c
index 270a18e546..afe2e297d9 100644
--- a/tools/tests/x86_emulator/predicates.c
+++ b/tools/tests/x86_emulator/predicates.c
@@ -1889,7 +1889,7 @@ static const struct evex {
     { { 0x39 }, 2, T, R, pfx_66, Wn, Ln }, /* vpmins{d,q} */
     { { 0x39, 0xc0 }, 2, F, N, pfx_f3, Wn, Ln }, /* vpmov{d,q}2m */
     { { 0x3a }, 2, T, R, pfx_66, WIG, Ln }, /* vpminuw */
-    { { 0x2a, 0xc0 }, 2, F, N, pfx_f3, W0, Ln }, /* vpbroadcastmw2d */
+    { { 0x3a, 0xc0 }, 2, F, N, pfx_f3, W0, Ln }, /* vpbroadcastmw2d */
     { { 0x3b }, 2, T, R, pfx_66, Wn, Ln }, /* vpminu{d,q} */
     { { 0x3c }, 2, T, R, pfx_66, WIG, Ln }, /* vpmaxsb */
     { { 0x3d }, 2, T, R, pfx_66, Wn, Ln }, /* vpmaxs{d,q} */
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Dec 02 08:55:39 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 02 Dec 2024 08:55:39 +0000
Received: from list by lists.xenproject.org with outflank-mailman.846373.1261550 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tI2DT-0006o7-Fx; Mon, 02 Dec 2024 08:55:39 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 846373.1261550; Mon, 02 Dec 2024 08:55:39 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tI2DT-0006nz-DO; Mon, 02 Dec 2024 08:55:39 +0000
Received: by outflank-mailman (input) for mailman id 846373;
 Mon, 02 Dec 2024 08:55:38 +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 1tI2DS-0006nf-3l
 for xen-changelog@lists.xenproject.org; Mon, 02 Dec 2024 08:55:38 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1tI2DR-0009Ym-2Y
 for xen-changelog@lists.xenproject.org;
 Mon, 02 Dec 2024 08:55:38 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1tI2DS-009pho-00
 for xen-changelog@lists.xenproject.org;
 Mon, 02 Dec 2024 08:55:38 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] libxl: extend IGD check
Message-Id: <E1tI2DS-009pho-00@xenbits.xenproject.org>
Date: Mon, 02 Dec 2024 08:55:38 +0000

commit 4191619e0893eabd77d979789a0f99f135bbc470
Author:     Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
AuthorDate: Mon Dec 2 09:52:05 2024 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Dec 2 09:52:05 2024 +0100

    libxl: extend IGD check
    
    Consider also "Display controller" an IGD, not only "VGA compatible
    controller". Specifically, IGD on Raptor Lake has 0x038000 class, not
    0x030000.
    
    Signed-off-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
    Acked-by: Anthony PERARD <anthony.perard@vates.tech>
---
 tools/libs/light/libxl_pci.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/libs/light/libxl_pci.c b/tools/libs/light/libxl_pci.c
index 8ef6a7b5fe..1647fd6f47 100644
--- a/tools/libs/light/libxl_pci.c
+++ b/tools/libs/light/libxl_pci.c
@@ -633,7 +633,7 @@ bool libxl__is_igd_vga_passthru(libxl__gc *gc,
 
         if (sysfs_dev_get_class(gc, pci, &class))
             continue;
-        if (class == 0x030000)
+        if (class == 0x030000 || class == 0x038000)
             return true;
     }
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Dec 02 10:22:08 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 02 Dec 2024 10:22:08 +0000
Received: from list by lists.xenproject.org with outflank-mailman.846531.1261688 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tI3Z5-0001Vi-Kl; Mon, 02 Dec 2024 10:22:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 846531.1261688; Mon, 02 Dec 2024 10:22:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tI3Z5-0001Va-I7; Mon, 02 Dec 2024 10:22:03 +0000
Received: by outflank-mailman (input) for mailman id 846531;
 Mon, 02 Dec 2024 10: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 1tI3Z4-0001VU-MR
 for xen-changelog@lists.xenproject.org; Mon, 02 Dec 2024 10:22:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1tI3Z4-000BLp-0I
 for xen-changelog@lists.xenproject.org;
 Mon, 02 Dec 2024 10:22:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1tI3Z4-009zhH-13
 for xen-changelog@lists.xenproject.org;
 Mon, 02 Dec 2024 10: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>
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xl: Keep monitoring suspended domain
Message-Id: <E1tI3Z4-009zhH-13@xenbits.xenproject.org>
Date: Mon, 02 Dec 2024 10:22:02 +0000

commit 6b8c85872ed877ab2526afc2899477f517d563ce
Author:     Jason Andryuk <jason.andryuk@amd.com>
AuthorDate: Mon Dec 2 09:49:38 2024 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Dec 2 09:49:38 2024 +0100

    xl: Keep monitoring suspended domain
    
    When a VM transitioned to LIBXL_SHUTDOWN_REASON_SUSPEND, the xl daemon
    was exiting as 0 = DOMAIN_RESTART_NONE "No domain restart".
    Later, when the VM actually shutdown, the missing xl daemon meant the
    domain wasn't cleaned up properly.
    
    Add a new DOMAIN_RESTART_SUSPENDED to handle the case.  The xl daemon
    keeps running to react to future shutdown events.
    
    The domain death event needs to be re-enabled to catch subsequent
    events.  The libxl_evgen_domain_death is moved from death_list to
    death_reported, and then it isn't found on subsequent iterations through
    death_list.  We enable the new event before disabling the old event, to
    keep the xenstore watch active.  If it is unregistered and
    re-registered, it'll fire immediately for our suspended domain which
    will end up continuously re-triggering.
    
    Signed-off-by: Jason Andryuk <jason.andryuk@amd.com>
    Reviewed-by: Anthony PERARD <anthony.perard@vates.tech>
---
 tools/xl/xl.h           |  1 +
 tools/xl/xl_vmcontrol.c | 18 +++++++++++++++++-
 2 files changed, 18 insertions(+), 1 deletion(-)

diff --git a/tools/xl/xl.h b/tools/xl/xl.h
index 9c86bb1d98..967d034cfe 100644
--- a/tools/xl/xl.h
+++ b/tools/xl/xl.h
@@ -301,6 +301,7 @@ typedef enum {
     DOMAIN_RESTART_NORMAL,       /* Domain should be restarted */
     DOMAIN_RESTART_RENAME,       /* Domain should be renamed and restarted */
     DOMAIN_RESTART_SOFT_RESET,   /* Soft reset should be performed */
+    DOMAIN_RESTART_SUSPENDED,    /* Domain suspended - keep looping */
 } domain_restart_type;
 
 extern void printf_info_sexp(int domid, libxl_domain_config *d_config, FILE *fh);
diff --git a/tools/xl/xl_vmcontrol.c b/tools/xl/xl_vmcontrol.c
index fa1a4420e3..c45d497c28 100644
--- a/tools/xl/xl_vmcontrol.c
+++ b/tools/xl/xl_vmcontrol.c
@@ -417,7 +417,7 @@ static domain_restart_type handle_domain_death(uint32_t *r_domid,
         break;
     case LIBXL_SHUTDOWN_REASON_SUSPEND:
         LOG("Domain has suspended.");
-        return 0;
+        return DOMAIN_RESTART_SUSPENDED;
     case LIBXL_SHUTDOWN_REASON_CRASH:
         action = d_config->on_crash;
         break;
@@ -1030,6 +1030,7 @@ start:
         }
     }
     while (1) {
+        libxl_evgen_domain_death *deathw2 = NULL;
         libxl_event *event;
         ret = domain_wait_event(domid, &event);
         if (ret) goto out;
@@ -1100,9 +1101,24 @@ start:
                 ret = 0;
                 goto out;
 
+            case DOMAIN_RESTART_SUSPENDED:
+                LOG("Continue waiting for domain %u", domid);
+                /*
+                 * Enable a new event before disabling the old.  This ensures
+                 * the xenstore watch remains active.  Otherwise it'll fire
+                 * immediately on re-registration and find our suspended domain.
+                 */
+                ret = libxl_evenable_domain_death(ctx, domid, 0, &deathw2);
+                if (ret) goto out;
+                libxl_evdisable_domain_death(ctx, deathw);
+                deathw = deathw2;
+                deathw2 = NULL;
+                break;
+
             default:
                 abort();
             }
+            break;
 
         case LIBXL_EVENT_TYPE_DOMAIN_DEATH:
             LOG("Domain %u has been destroyed.", domid);
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Mon Dec 02 10:22:13 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 02 Dec 2024 10:22:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.846532.1261692 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tI3ZF-0001XQ-MX; Mon, 02 Dec 2024 10:22:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 846532.1261692; Mon, 02 Dec 2024 10:22:13 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tI3ZF-0001XJ-Jb; Mon, 02 Dec 2024 10:22:13 +0000
Received: by outflank-mailman (input) for mailman id 846532;
 Mon, 02 Dec 2024 10: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 1tI3ZE-0001XB-IT
 for xen-changelog@lists.xenproject.org; Mon, 02 Dec 2024 10:22:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1tI3ZE-000BLt-0i
 for xen-changelog@lists.xenproject.org;
 Mon, 02 Dec 2024 10:22:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1tI3ZE-009zhu-1T
 for xen-changelog@lists.xenproject.org;
 Mon, 02 Dec 2024 10: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>
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86emul: MOVBE requires a memory operand
Message-Id: <E1tI3ZE-009zhu-1T@xenbits.xenproject.org>
Date: Mon, 02 Dec 2024 10:22:12 +0000

commit 4c5d9a01f8fa81417a9c431e9624fb71361ec4f9
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Mon Dec 2 09:50:14 2024 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Dec 2 09:50:14 2024 +0100

    x86emul: MOVBE requires a memory operand
    
    The reg-reg forms should cause #UD; they come into existence only with
    APX, where MOVBE also extends BSWAP (for the latter not being "eligible"
    to a REX2 prefix).
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/x86_emulate/x86_emulate.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/xen/arch/x86/x86_emulate/x86_emulate.c b/xen/arch/x86/x86_emulate/x86_emulate.c
index 0600df789c..b89d440133 100644
--- a/xen/arch/x86/x86_emulate/x86_emulate.c
+++ b/xen/arch/x86/x86_emulate/x86_emulate.c
@@ -6824,6 +6824,7 @@ x86_emulate(
 
     case X86EMUL_OPC(0x0f38, 0xf0): /* movbe m,r */
     case X86EMUL_OPC(0x0f38, 0xf1): /* movbe r,m */
+        generate_exception_if(ea.type != OP_MEM, X86_EXC_UD);
         vcpu_must_have(movbe);
         switch ( op_bytes )
         {
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Mon Dec 02 10:22:23 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 02 Dec 2024 10:22:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.846533.1261695 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tI3ZP-0001Zr-Ng; Mon, 02 Dec 2024 10:22:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 846533.1261695; Mon, 02 Dec 2024 10:22:23 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tI3ZP-0001Zj-LB; Mon, 02 Dec 2024 10:22:23 +0000
Received: by outflank-mailman (input) for mailman id 846533;
 Mon, 02 Dec 2024 10: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 1tI3ZO-0001ZZ-Lq
 for xen-changelog@lists.xenproject.org; Mon, 02 Dec 2024 10:22:22 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1tI3ZO-000BM1-15
 for xen-changelog@lists.xenproject.org;
 Mon, 02 Dec 2024 10:22:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1tI3ZO-009ziM-1q
 for xen-changelog@lists.xenproject.org;
 Mon, 02 Dec 2024 10: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>
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86emul: correct VPBROADCASTMW2D predicate testing
Message-Id: <E1tI3ZO-009ziM-1q@xenbits.xenproject.org>
Date: Mon, 02 Dec 2024 10:22:22 +0000

commit 3df8812f90d78b65bee1754bb0b3bfc93d9ec3e3
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Mon Dec 2 09:51:28 2024 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Dec 2 09:51:28 2024 +0100

    x86emul: correct VPBROADCASTMW2D predicate testing
    
    Due to presumably a copy-and-paste mistake VPBROADCASTMB2Q was tested
    twice instead.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 tools/tests/x86_emulator/predicates.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/tests/x86_emulator/predicates.c b/tools/tests/x86_emulator/predicates.c
index 270a18e546..afe2e297d9 100644
--- a/tools/tests/x86_emulator/predicates.c
+++ b/tools/tests/x86_emulator/predicates.c
@@ -1889,7 +1889,7 @@ static const struct evex {
     { { 0x39 }, 2, T, R, pfx_66, Wn, Ln }, /* vpmins{d,q} */
     { { 0x39, 0xc0 }, 2, F, N, pfx_f3, Wn, Ln }, /* vpmov{d,q}2m */
     { { 0x3a }, 2, T, R, pfx_66, WIG, Ln }, /* vpminuw */
-    { { 0x2a, 0xc0 }, 2, F, N, pfx_f3, W0, Ln }, /* vpbroadcastmw2d */
+    { { 0x3a, 0xc0 }, 2, F, N, pfx_f3, W0, Ln }, /* vpbroadcastmw2d */
     { { 0x3b }, 2, T, R, pfx_66, Wn, Ln }, /* vpminu{d,q} */
     { { 0x3c }, 2, T, R, pfx_66, WIG, Ln }, /* vpmaxsb */
     { { 0x3d }, 2, T, R, pfx_66, Wn, Ln }, /* vpmaxs{d,q} */
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Mon Dec 02 10:22:33 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 02 Dec 2024 10:22:33 +0000
Received: from list by lists.xenproject.org with outflank-mailman.846534.1261699 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tI3ZZ-0001cm-PB; Mon, 02 Dec 2024 10:22:33 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 846534.1261699; Mon, 02 Dec 2024 10:22:33 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tI3ZZ-0001ce-Mc; Mon, 02 Dec 2024 10:22:33 +0000
Received: by outflank-mailman (input) for mailman id 846534;
 Mon, 02 Dec 2024 10: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 1tI3ZY-0001cU-PB
 for xen-changelog@lists.xenproject.org; Mon, 02 Dec 2024 10:22:32 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1tI3ZY-000BM5-1T
 for xen-changelog@lists.xenproject.org;
 Mon, 02 Dec 2024 10:22:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1tI3ZY-009zin-2C
 for xen-changelog@lists.xenproject.org;
 Mon, 02 Dec 2024 10: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>
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] libxl: extend IGD check
Message-Id: <E1tI3ZY-009zin-2C@xenbits.xenproject.org>
Date: Mon, 02 Dec 2024 10:22:32 +0000

commit 4191619e0893eabd77d979789a0f99f135bbc470
Author:     Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
AuthorDate: Mon Dec 2 09:52:05 2024 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Dec 2 09:52:05 2024 +0100

    libxl: extend IGD check
    
    Consider also "Display controller" an IGD, not only "VGA compatible
    controller". Specifically, IGD on Raptor Lake has 0x038000 class, not
    0x030000.
    
    Signed-off-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
    Acked-by: Anthony PERARD <anthony.perard@vates.tech>
---
 tools/libs/light/libxl_pci.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/libs/light/libxl_pci.c b/tools/libs/light/libxl_pci.c
index 8ef6a7b5fe..1647fd6f47 100644
--- a/tools/libs/light/libxl_pci.c
+++ b/tools/libs/light/libxl_pci.c
@@ -633,7 +633,7 @@ bool libxl__is_igd_vga_passthru(libxl__gc *gc,
 
         if (sysfs_dev_get_class(gc, pci, &class))
             continue;
-        if (class == 0x030000)
+        if (class == 0x030000 || class == 0x038000)
             return true;
     }
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Mon Dec 02 14:33:14 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 02 Dec 2024 14:33:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.846718.1261862 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tI7U5-0005z6-Co; Mon, 02 Dec 2024 14:33:09 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 846718.1261862; Mon, 02 Dec 2024 14:33:09 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tI7U5-0005yy-AM; Mon, 02 Dec 2024 14:33:09 +0000
Received: by outflank-mailman (input) for mailman id 846718;
 Mon, 02 Dec 2024 14:33:07 +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 1tI7U3-0005ys-TS
 for xen-changelog@lists.xenproject.org; Mon, 02 Dec 2024 14:33:07 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1tI7U3-000GXC-1D
 for xen-changelog@lists.xenproject.org;
 Mon, 02 Dec 2024 14:33:07 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1tI7U3-00AQK7-20
 for xen-changelog@lists.xenproject.org;
 Mon, 02 Dec 2024 14:33:07 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/Kconfig: livepatch-build-tools requires debug information
Message-Id: <E1tI7U3-00AQK7-20@xenbits.xenproject.org>
Date: Mon, 02 Dec 2024 14:33:07 +0000

commit 126b0a6e537ce1d486a29e35cfeec1f222a74d11
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Mon Dec 2 15:22:05 2024 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Dec 2 15:22:05 2024 +0100

    xen/Kconfig: livepatch-build-tools requires debug information
    
    The tools infrastructure used to build livepatches for Xen
    (livepatch-build-tools) consumes some DWARF debug information present in
    xen-syms to generate a livepatch (see livepatch-build script usage of readelf
    -wi).
    
    The current Kconfig defaults however will enable LIVEPATCH without DEBUG_INFO
    on release builds, thus providing a default Kconfig selection that's not
    suitable for livepatch-build-tools even when LIVEPATCH support is enabled,
    because it's missing the DWARF debug section.
    
    Fix by defaulting DEBUG_INFO to enabled when LIVEPATCH is.
    
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/Kconfig.debug | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/Kconfig.debug b/xen/Kconfig.debug
index 07ff7eb7ba..c4a8d86912 100644
--- a/xen/Kconfig.debug
+++ b/xen/Kconfig.debug
@@ -133,7 +133,7 @@ endif # DEBUG || EXPERT
 
 config DEBUG_INFO
 	bool "Compile Xen with debug info"
-	default DEBUG
+	default DEBUG || LIVEPATCH
 	help
 	  Say Y here if you want to build Xen with debug information. This
 	  information is needed e.g. for doing crash dump analysis of the
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Dec 02 15:22:09 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 02 Dec 2024 15:22:09 +0000
Received: from list by lists.xenproject.org with outflank-mailman.846722.1261867 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tI8FP-00030h-NO; Mon, 02 Dec 2024 15:22:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 846722.1261867; Mon, 02 Dec 2024 15:22:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tI8FP-00030Z-Kw; Mon, 02 Dec 2024 15:22:03 +0000
Received: by outflank-mailman (input) for mailman id 846722;
 Mon, 02 Dec 2024 15:22: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 1tI8FN-00030T-QZ
 for xen-changelog@lists.xenproject.org; Mon, 02 Dec 2024 15:22:01 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1tI8FN-000HbB-0u
 for xen-changelog@lists.xenproject.org;
 Mon, 02 Dec 2024 15:22:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1tI8FN-00AVgp-1b
 for xen-changelog@lists.xenproject.org;
 Mon, 02 Dec 2024 15: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>
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/Kconfig: livepatch-build-tools requires debug information
Message-Id: <E1tI8FN-00AVgp-1b@xenbits.xenproject.org>
Date: Mon, 02 Dec 2024 15:22:01 +0000

commit 126b0a6e537ce1d486a29e35cfeec1f222a74d11
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Mon Dec 2 15:22:05 2024 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Dec 2 15:22:05 2024 +0100

    xen/Kconfig: livepatch-build-tools requires debug information
    
    The tools infrastructure used to build livepatches for Xen
    (livepatch-build-tools) consumes some DWARF debug information present in
    xen-syms to generate a livepatch (see livepatch-build script usage of readelf
    -wi).
    
    The current Kconfig defaults however will enable LIVEPATCH without DEBUG_INFO
    on release builds, thus providing a default Kconfig selection that's not
    suitable for livepatch-build-tools even when LIVEPATCH support is enabled,
    because it's missing the DWARF debug section.
    
    Fix by defaulting DEBUG_INFO to enabled when LIVEPATCH is.
    
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/Kconfig.debug | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/Kconfig.debug b/xen/Kconfig.debug
index 07ff7eb7ba..c4a8d86912 100644
--- a/xen/Kconfig.debug
+++ b/xen/Kconfig.debug
@@ -133,7 +133,7 @@ endif # DEBUG || EXPERT
 
 config DEBUG_INFO
 	bool "Compile Xen with debug info"
-	default DEBUG
+	default DEBUG || LIVEPATCH
 	help
 	  Say Y here if you want to build Xen with debug information. This
 	  information is needed e.g. for doing crash dump analysis of the
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Mon Dec 02 18:33:14 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 02 Dec 2024 18:33:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.846967.1262096 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tIBEK-0000kB-PL; Mon, 02 Dec 2024 18:33:08 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 846967.1262096; Mon, 02 Dec 2024 18:33:08 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tIBEK-0000k1-MR; Mon, 02 Dec 2024 18:33:08 +0000
Received: by outflank-mailman (input) for mailman id 846967;
 Mon, 02 Dec 2024 18:33:07 +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 1tIBEJ-0000jN-N0
 for xen-changelog@lists.xenproject.org; Mon, 02 Dec 2024 18:33:07 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1tIBEJ-000M3M-1F
 for xen-changelog@lists.xenproject.org;
 Mon, 02 Dec 2024 18:33:07 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1tIBEJ-00AvVs-23
 for xen-changelog@lists.xenproject.org;
 Mon, 02 Dec 2024 18:33:07 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/arm32: Get rid of __memzero()
Message-Id: <E1tIBEJ-00AvVs-23@xenbits.xenproject.org>
Date: Mon, 02 Dec 2024 18:33:07 +0000

commit b30bad383260b012d5314d08b01ec07c7918e1c1
Author:     Julien Grall <jgrall@amazon.com>
AuthorDate: Wed Nov 27 10:55:12 2024 +0000
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Mon Dec 2 18:23:49 2024 +0000

    xen/arm32: Get rid of __memzero()
    
    All the code in arch/arm32/lib/ where copied from Linux 3.16
    and never re-synced since then.
    
    A few years ago, Linux got rid of __memzero() because the implementation
    is very similar to memset(p,0,n) and the current use of __memzero()
    interferes with optimization. See full commit message from Linux below.
    
    So it makes sense to get rid of __memzero in Xen as well.
    
        From ff5fdafc9e9702846480e0cea55ba861f72140a2 Mon Sep 17 00:00:00 2001
        From: Nicolas Pitre <nicolas.pitre@linaro.org>
        Date: Fri, 19 Jan 2018 18:17:46 +0100
        Subject: [PATCH] ARM: 8745/1: get rid of __memzero()
    
        The __memzero assembly code is almost identical to memset's except for
        two orr instructions. The runtime performance of __memset(p, n) and
        memset(p, 0, n) is accordingly almost identical.
    
        However, the memset() macro used to guard against a zero length and to
        call __memzero at compile time when the fill value is a constant zero
        interferes with compiler optimizations.
    
        Arnd found tha the test against a zero length brings up some new
        warnings with gcc v8:
    
          https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82103
    
        And successively rremoving the test against a zero length and the call
        to __memzero optimization produces the following kernel sizes for
        defconfig with gcc 6:
    
            text     data     bss       dec       hex  filename
        12248142  6278960  413588  18940690   1210312  vmlinux.orig
        12244474  6278960  413588  18937022   120f4be  vmlinux.no_zero_test
        12239160  6278960  413588  18931708   120dffc  vmlinux.no_memzero
    
        So it is probably not worth keeping __memzero around given that the
        compiler can do a better job at inlining trivial memset(p,0,n) on its
        own. And the memset code already handles a zero length just fine.
    
        Suggested-by: Arnd Bergmann <arnd@arndb.de>
        Signed-off-by: Nicolas Pitre <nico@linaro.org>
        Acked-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
        Acked-by: Arnd Bergmann <arnd@arndb.de>
        Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
    
    Origin: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git ff5fdafc9e97
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Michal Orzel <michal.orzel@amd.com>
    Signed-off-by: Julien Grall <jgrall@amazon.com>
---
 xen/arch/arm/README.LinuxPrimitives |   4 +-
 xen/arch/arm/arm32/lib/Makefile     |   2 +-
 xen/arch/arm/arm32/lib/memzero.S    | 124 ------------------------------------
 xen/arch/arm/include/asm/string.h   |  18 ------
 4 files changed, 2 insertions(+), 146 deletions(-)

diff --git a/xen/arch/arm/README.LinuxPrimitives b/xen/arch/arm/README.LinuxPrimitives
index 301c0271bb..2c62ba7699 100644
--- a/xen/arch/arm/README.LinuxPrimitives
+++ b/xen/arch/arm/README.LinuxPrimitives
@@ -108,10 +108,8 @@ linux/arch/arm/lib/memchr.S             xen/arch/arm/arm32/lib/memchr.S
 linux/arch/arm/lib/memcpy.S             xen/arch/arm/arm32/lib/memcpy.S
 linux/arch/arm/lib/memmove.S            xen/arch/arm/arm32/lib/memmove.S
 linux/arch/arm/lib/memset.S             xen/arch/arm/arm32/lib/memset.S
-linux/arch/arm/lib/memzero.S            xen/arch/arm/arm32/lib/memzero.S
 
-for i in copy_template.S memchr.S memcpy.S memmove.S memset.S \
-         memzero.S ; do
+for i in copy_template.S memchr.S memcpy.S memmove.S memset.S; do
     diff -u linux/arch/arm/lib/$i xen/arch/arm/arm32/lib/$i
 done
 
diff --git a/xen/arch/arm/arm32/lib/Makefile b/xen/arch/arm/arm32/lib/Makefile
index b1457c89dc..18326b284e 100644
--- a/xen/arch/arm/arm32/lib/Makefile
+++ b/xen/arch/arm/arm32/lib/Makefile
@@ -1,4 +1,4 @@
-obj-y += memcpy.o memmove.o memset.o memchr.o memzero.o
+obj-y += memcpy.o memmove.o memset.o memchr.o
 obj-y += findbit.o
 obj-y += bitops.o
 obj-y += strchr.o strrchr.o
diff --git a/xen/arch/arm/arm32/lib/memzero.S b/xen/arch/arm/arm32/lib/memzero.S
deleted file mode 100644
index dca5867c24..0000000000
--- a/xen/arch/arm/arm32/lib/memzero.S
+++ /dev/null
@@ -1,124 +0,0 @@
-/*
- *  linux/arch/arm/lib/memzero.S
- *
- *  Copyright (C) 1995-2000 Russell King
- *
- * 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 "assembler.h"
-
-	.text
-	.align	5
-	.word	0
-/*
- * Align the pointer in r0.  r3 contains the number of bytes that we are
- * mis-aligned by, and r1 is the number of bytes.  If r1 < 4, then we
- * don't bother; we use byte stores instead.
- */
-1:	subs	r1, r1, #4		@ 1 do we have enough
-	blt	5f			@ 1 bytes to align with?
-	cmp	r3, #2			@ 1
-	strltb	r2, [r0], #1		@ 1
-	strleb	r2, [r0], #1		@ 1
-	strb	r2, [r0], #1		@ 1
-	add	r1, r1, r3		@ 1 (r1 = r1 - (4 - r3))
-/*
- * The pointer is now aligned and the length is adjusted.  Try doing the
- * memzero again.
- */
-
-ENTRY(__memzero)
-	mov	r2, #0			@ 1
-	ands	r3, r0, #3		@ 1 unaligned?
-	bne	1b			@ 1
-/*
- * r3 = 0, and we know that the pointer in r0 is aligned to a word boundary.
- */
-	cmp	r1, #16			@ 1 we can skip this chunk if we
-	blt	4f			@ 1 have < 16 bytes
-
-#if ! CALGN(1)+0
-
-/*
- * We need an extra register for this loop - save the return address and
- * use the LR
- */
-	str	lr, [sp, #-4]!		@ 1
-	mov	ip, r2			@ 1
-	mov	lr, r2			@ 1
-
-3:	subs	r1, r1, #64		@ 1 write 32 bytes out per loop
-	stmgeia	r0!, {r2, r3, ip, lr}	@ 4
-	stmgeia	r0!, {r2, r3, ip, lr}	@ 4
-	stmgeia	r0!, {r2, r3, ip, lr}	@ 4
-	stmgeia	r0!, {r2, r3, ip, lr}	@ 4
-	bgt	3b			@ 1
-	ldmeqfd	sp!, {pc}		@ 1/2 quick exit
-/*
- * No need to correct the count; we're only testing bits from now on
- */
-	tst	r1, #32			@ 1
-	stmneia	r0!, {r2, r3, ip, lr}	@ 4
-	stmneia	r0!, {r2, r3, ip, lr}	@ 4
-	tst	r1, #16			@ 1 16 bytes or more?
-	stmneia	r0!, {r2, r3, ip, lr}	@ 4
-	ldr	lr, [sp], #4		@ 1
-
-#else
-
-/*
- * This version aligns the destination pointer in order to write
- * whole cache lines at once.
- */
-
-	stmfd	sp!, {r4-r7, lr}
-	mov	r4, r2
-	mov	r5, r2
-	mov	r6, r2
-	mov	r7, r2
-	mov	ip, r2
-	mov	lr, r2
-
-	cmp	r1, #96
-	andgts	ip, r0, #31
-	ble	3f
-
-	rsb	ip, ip, #32
-	sub	r1, r1, ip
-	movs	ip, ip, lsl #(32 - 4)
-	stmcsia	r0!, {r4, r5, r6, r7}
-	stmmiia	r0!, {r4, r5}
-	movs	ip, ip, lsl #2
-	strcs	r2, [r0], #4
-
-3:	subs	r1, r1, #64
-	stmgeia	r0!, {r2-r7, ip, lr}
-	stmgeia	r0!, {r2-r7, ip, lr}
-	bgt	3b
-	ldmeqfd	sp!, {r4-r7, pc}
-
-	tst	r1, #32
-	stmneia	r0!, {r2-r7, ip, lr}
-	tst	r1, #16
-	stmneia	r0!, {r4-r7}
-	ldmfd	sp!, {r4-r7, lr}
-
-#endif
-
-4:	tst	r1, #8			@ 1 8 bytes or more?
-	stmneia	r0!, {r2, r3}		@ 2
-	tst	r1, #4			@ 1 4 bytes or more?
-	strne	r2, [r0], #4		@ 1
-/*
- * When we get here, we've got less than 4 bytes to zero.  We
- * may have an unaligned pointer as well.
- */
-5:	tst	r1, #2			@ 1 2 bytes or more?
-	strneb	r2, [r0], #1		@ 1
-	strneb	r2, [r0], #1		@ 1
-	tst	r1, #1			@ 1 a byte left over
-	strneb	r2, [r0], #1		@ 1
-	mov	pc, lr			@ 1
-ENDPROC(__memzero)
diff --git a/xen/arch/arm/include/asm/string.h b/xen/arch/arm/include/asm/string.h
index b485e49044..7cbc8ecc76 100644
--- a/xen/arch/arm/include/asm/string.h
+++ b/xen/arch/arm/include/asm/string.h
@@ -24,24 +24,6 @@
 #define __HAVE_ARCH_MEMSET
 #define __HAVE_ARCH_MEMCHR
 
-#if defined(CONFIG_ARM_32)
-
-void __memzero(void *ptr, size_t n);
-
-#define memset(p, v, n)                                                 \
-        ({                                                              \
-                void *__p = (p); size_t __n = n;                        \
-                if ((__n) != 0) {                                       \
-                        if (__builtin_constant_p((v)) && (v) == 0)      \
-                                __memzero((__p),(__n));                 \
-                        else                                            \
-                                memset((__p),(v),(__n));                \
-                }                                                       \
-                (__p);                                                  \
-        })
-
-#endif
-
 #endif /* __ARM_STRING_H__ */
 /*
  * Local variables:
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Dec 02 18:33:18 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 02 Dec 2024 18:33:18 +0000
Received: from list by lists.xenproject.org with outflank-mailman.846973.1262100 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tIBEU-0000xW-Qm; Mon, 02 Dec 2024 18:33:18 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 846973.1262100; Mon, 02 Dec 2024 18:33: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 1tIBEU-0000xO-Ny; Mon, 02 Dec 2024 18:33:18 +0000
Received: by outflank-mailman (input) for mailman id 846973;
 Mon, 02 Dec 2024 18:33:17 +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 1tIBET-0000x4-Rf
 for xen-changelog@lists.xenproject.org; Mon, 02 Dec 2024 18:33:17 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1tIBET-000M3Q-1i
 for xen-changelog@lists.xenproject.org;
 Mon, 02 Dec 2024 18:33:17 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1tIBET-00AvXB-2Q
 for xen-changelog@lists.xenproject.org;
 Mon, 02 Dec 2024 18:33:17 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/arm: mpu: Create boot-time MPU protection regions
Message-Id: <E1tIBET-00AvXB-2Q@xenbits.xenproject.org>
Date: Mon, 02 Dec 2024 18:33:17 +0000

commit 868fe87c462dffb1ab7ef6be0a25d7fe59cb7ee7
Author:     Ayan Kumar Halder <ayan.kumar.halder@amd.com>
AuthorDate: Mon Nov 18 12:12:48 2024 +0000
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Mon Dec 2 18:28:37 2024 +0000

    xen/arm: mpu: Create boot-time MPU protection regions
    
    Define enable_boot_cpu_mm() for the Armv8-R AArch64.
    
    Like boot-time page table in MMU system, we need a boot-time MPU protection
    region configuration in MPU system so Xen can fetch code and data from normal
    memory.
    
    To do this, Xen maps the following sections of the binary as separate regions
    (with permissions) :-
    1. Text (Read only at EL2, execution is permitted)
    2. RO data (Read only at EL2)
    3. RO after init data and RW data (Read/Write at EL2)
    4. Init Text (Read only at EL2, execution is permitted)
    5. Init data and BSS (Read/Write at EL2)
    
    Before creating a region, we check if the count exceeds the number defined in
    MPUIR_EL2. If so, then the boot fails.
    
    Also we check if the region is empty or not. IOW, if the start and end address
    are same, we skip mapping the region.
    
    To map a region, Xen uses the PRBAR_EL2, PRLAR_EL2 and PRSELR_EL2 registers.
    One can refer to ARM DDI 0600B.a ID062922 G1.3  "General System Control
    Registers", to get the definitions of these registers. Also, refer to G1.2
    "Accessing MPU memory region registers", the following
    
    ```
    The MPU provides two register interfaces to program the MPU regions:
    - Access to any of the MPU regions via PRSELR_ELx, PRBAR<n>_ELx, and
    PRLAR<n>_ELx.
    ```
    
    We use the above mechanism to create the MPU memory regions.
    
    Also, the compiler needs the flag ("-march=armv8-r") in order to build Xen for
    Armv8-R AArch64 MPU based systems. There will be no need for us to explicitly
    define MPU specific registers.
    
    Signed-off-by: Ayan Kumar Halder <ayan.kumar.halder@amd.com>
    Reviewed-by: Luca Fancellu <luca.fancellu@arm.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
---
 xen/arch/arm/arch.mk                 |   4 ++
 xen/arch/arm/arm64/mpu/Makefile      |   1 +
 xen/arch/arm/arm64/mpu/head.S        | 125 +++++++++++++++++++++++++++++++++++
 xen/arch/arm/include/asm/arm64/mpu.h |  25 +++++++
 xen/arch/arm/include/asm/mm.h        |   2 +-
 xen/arch/arm/xen.lds.S               |   1 +
 6 files changed, 157 insertions(+), 1 deletion(-)

diff --git a/xen/arch/arm/arch.mk b/xen/arch/arm/arch.mk
index 022dcda192..9c4bedfb3b 100644
--- a/xen/arch/arm/arch.mk
+++ b/xen/arch/arm/arch.mk
@@ -9,7 +9,11 @@ CFLAGS-$(CONFIG_ARM_32) += -msoft-float
 CFLAGS-$(CONFIG_ARM_32) += -mcpu=cortex-a15
 CFLAGS-$(CONFIG_ARM_32) += -mno-unaligned-access
 
+ifeq ($(CONFIG_MPU),y)
+CFLAGS-$(CONFIG_ARM_64) += -march=armv8-r
+else
 CFLAGS-$(CONFIG_ARM_64) += -mcpu=generic
+endif
 CFLAGS-$(CONFIG_ARM_64) += -mgeneral-regs-only # No fp registers etc
 $(call cc-option-add,CFLAGS-$(CONFIG_ARM_64),CC,-mno-outline-atomics)
 
diff --git a/xen/arch/arm/arm64/mpu/Makefile b/xen/arch/arm/arm64/mpu/Makefile
index b18cec4836..a8a750a3d0 100644
--- a/xen/arch/arm/arm64/mpu/Makefile
+++ b/xen/arch/arm/arm64/mpu/Makefile
@@ -1 +1,2 @@
+obj-y += head.o
 obj-y += mm.o
diff --git a/xen/arch/arm/arm64/mpu/head.S b/xen/arch/arm/arm64/mpu/head.S
new file mode 100644
index 0000000000..a06589566f
--- /dev/null
+++ b/xen/arch/arm/arm64/mpu/head.S
@@ -0,0 +1,125 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+/*
+ * Start-of-day code for an Armv8-R MPU system.
+ */
+
+#include <asm/arm64/mpu.h>
+
+#define REGION_TEXT_PRBAR       0x38    /* SH=11 AP=10 XN=00 */
+#define REGION_RO_PRBAR         0x3A    /* SH=11 AP=10 XN=10 */
+#define REGION_DATA_PRBAR       0x32    /* SH=11 AP=00 XN=10 */
+
+#define REGION_NORMAL_PRLAR     0x0f    /* NS=0 ATTR=111 EN=1 */
+
+/*
+ * Macro to prepare and set a EL2 MPU memory region.
+ * We will also create an according MPU memory region entry, which
+ * is a structure of pr_t,  in table \prmap.
+ *
+ * sel:         region selector
+ * base:        reg storing base address
+ * limit:       reg storing limit address
+ * prbar:       store computed PRBAR_EL2 value
+ * prlar:       store computed PRLAR_EL2 value
+ * maxcount:    maximum number of EL2 regions supported
+ * attr_prbar:  PRBAR_EL2-related memory attributes. If not specified it will be
+ *              REGION_DATA_PRBAR
+ * attr_prlar:  PRLAR_EL2-related memory attributes. If not specified it will be
+ *              REGION_NORMAL_PRLAR
+ *
+ * Preserves \maxcount
+ * Output:
+ *  \sel: Next available region selector index.
+ * Clobbers \base, \limit, \prbar, \prlar
+ *
+ * Note that all parameters using registers should be distinct.
+ */
+.macro prepare_xen_region, sel, base, limit, prbar, prlar, maxcount, attr_prbar=REGION_DATA_PRBAR, attr_prlar=REGION_NORMAL_PRLAR
+    /* Check if the region is empty */
+    cmp   \base, \limit
+    beq   1f
+
+    /* Check if the number of regions exceeded the count specified in MPUIR_EL2 */
+    cmp   \sel, \maxcount
+    bge   fail_insufficient_regions
+
+    /* Prepare value for PRBAR_EL2 reg and preserve it in \prbar.*/
+    and   \base, \base, #MPU_REGION_MASK
+    mov   \prbar, #\attr_prbar
+    orr   \prbar, \prbar, \base
+
+    /* Limit address should be inclusive */
+    sub   \limit, \limit, #1
+    and   \limit, \limit, #MPU_REGION_MASK
+    mov   \prlar, #\attr_prlar
+    orr   \prlar, \prlar, \limit
+
+    msr   PRSELR_EL2, \sel
+    isb
+    msr   PRBAR_EL2, \prbar
+    msr   PRLAR_EL2, \prlar
+    dsb   sy
+    isb
+
+    add   \sel, \sel, #1
+
+1:
+.endm
+
+/*
+ * Failure caused due to insufficient MPU regions.
+ */
+FUNC_LOCAL(fail_insufficient_regions)
+    PRINT("- Selected MPU region is above the implemented number in MPUIR_EL2 -\r\n")
+1:  wfe
+    b   1b
+END(fail_insufficient_regions)
+
+/*
+ * Maps the various sections of Xen (described in xen.lds.S) as different MPU
+ * regions.
+ *
+ * Clobbers x0 - x5
+ *
+ */
+FUNC(enable_boot_cpu_mm)
+    /* Get the number of regions specified in MPUIR_EL2 */
+    mrs   x5, MPUIR_EL2
+    and   x5, x5, #NUM_MPU_REGIONS_MASK
+
+    /* x0: region sel */
+    mov   x0, xzr
+    /* Xen text section. */
+    ldr   x1, =_stext
+    ldr   x2, =_etext
+    prepare_xen_region x0, x1, x2, x3, x4, x5, attr_prbar=REGION_TEXT_PRBAR
+
+    /* Xen read-only data section. */
+    ldr   x1, =_srodata
+    ldr   x2, =_erodata
+    prepare_xen_region x0, x1, x2, x3, x4, x5, attr_prbar=REGION_RO_PRBAR
+
+    /* Xen read-only after init and data section. (RW data) */
+    ldr   x1, =__ro_after_init_start
+    ldr   x2, =__init_begin
+    prepare_xen_region x0, x1, x2, x3, x4, x5
+
+    /* Xen code section. */
+    ldr   x1, =__init_begin
+    ldr   x2, =__init_data_begin
+    prepare_xen_region x0, x1, x2, x3, x4, x5, attr_prbar=REGION_TEXT_PRBAR
+
+    /* Xen data and BSS section. */
+    ldr   x1, =__init_data_begin
+    ldr   x2, =__bss_end
+    prepare_xen_region x0, x1, x2, x3, x4, x5
+
+    ret
+END(enable_boot_cpu_mm)
+
+/*
+ * Local variables:
+ * mode: ASM
+ * indent-tabs-mode: nil
+ * End:
+ */
diff --git a/xen/arch/arm/include/asm/arm64/mpu.h b/xen/arch/arm/include/asm/arm64/mpu.h
new file mode 100644
index 0000000000..f8a029f1a1
--- /dev/null
+++ b/xen/arch/arm/include/asm/arm64/mpu.h
@@ -0,0 +1,25 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+/*
+ * mpu.h: Arm Memory Protection Unit definitions.
+ */
+
+#ifndef __ARM64_MPU_H__
+#define __ARM64_MPU_H__
+
+#define MPU_REGION_SHIFT  6
+#define MPU_REGION_ALIGN  (_AC(1, UL) << MPU_REGION_SHIFT)
+#define MPU_REGION_MASK   (~(MPU_REGION_ALIGN - 1))
+
+#define NUM_MPU_REGIONS_SHIFT   8
+#define NUM_MPU_REGIONS         (_AC(1, UL) << NUM_MPU_REGIONS_SHIFT)
+#define NUM_MPU_REGIONS_MASK    (NUM_MPU_REGIONS - 1)
+#endif /* __ARM64_MPU_H__ */
+
+/*
+ * Local variables:
+ * mode: C
+ * c-file-style: "BSD"
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
diff --git a/xen/arch/arm/include/asm/mm.h b/xen/arch/arm/include/asm/mm.h
index 5abd4b0d1c..59b774b7b8 100644
--- a/xen/arch/arm/include/asm/mm.h
+++ b/xen/arch/arm/include/asm/mm.h
@@ -16,7 +16,7 @@
 
 #if defined(CONFIG_MMU)
 # include <asm/mmu/mm.h>
-#else
+#elif !defined(CONFIG_MPU)
 # error "Unknown memory management layout"
 #endif
 
diff --git a/xen/arch/arm/xen.lds.S b/xen/arch/arm/xen.lds.S
index d1e579e8a8..bbccff1a03 100644
--- a/xen/arch/arm/xen.lds.S
+++ b/xen/arch/arm/xen.lds.S
@@ -147,6 +147,7 @@ SECTIONS
        *(.altinstr_replacement)
   } :text
   . = ALIGN(PAGE_SIZE);
+  __init_data_begin = .;
   .init.data : {
        *(.init.rodata)
        *(.init.rodata.*)
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Dec 02 18:33:28 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 02 Dec 2024 18:33:28 +0000
Received: from list by lists.xenproject.org with outflank-mailman.846976.1262104 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tIBEe-00013D-Ry; Mon, 02 Dec 2024 18:33:28 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 846976.1262104; Mon, 02 Dec 2024 18:33: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 1tIBEe-000133-PR; Mon, 02 Dec 2024 18:33:28 +0000
Received: by outflank-mailman (input) for mailman id 846976;
 Mon, 02 Dec 2024 18:33:27 +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 1tIBEd-00012p-UP
 for xen-changelog@lists.xenproject.org; Mon, 02 Dec 2024 18:33:27 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1tIBEd-000M3U-1y
 for xen-changelog@lists.xenproject.org;
 Mon, 02 Dec 2024 18:33:27 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1tIBEd-00AvYa-2q
 for xen-changelog@lists.xenproject.org;
 Mon, 02 Dec 2024 18:33:27 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/arm: mpu: Enable MPU
Message-Id: <E1tIBEd-00AvYa-2q@xenbits.xenproject.org>
Date: Mon, 02 Dec 2024 18:33:27 +0000

commit 5423a08eae391e781a457fa2b819431ab36f85bd
Author:     Ayan Kumar Halder <ayan.kumar.halder@amd.com>
AuthorDate: Mon Nov 18 12:12:49 2024 +0000
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Mon Dec 2 18:28:54 2024 +0000

    xen/arm: mpu: Enable MPU
    
    After the regions have been created, now we enable the MPU. For this we disable
    the background region so that the new memory map created for the regions take
    effect. Also, we treat all RW regions as non executable and the data cache is
    enabled.
    
    Signed-off-by: Ayan Kumar Halder <ayan.kumar.halder@amd.com>
    Reviewed-by: Luca Fancellu <luca.fancellu@arm.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
---
 xen/arch/arm/arm64/mpu/head.S | 27 +++++++++++++++++++++++++++
 1 file changed, 27 insertions(+)

diff --git a/xen/arch/arm/arm64/mpu/head.S b/xen/arch/arm/arm64/mpu/head.S
index a06589566f..bacf8315f9 100644
--- a/xen/arch/arm/arm64/mpu/head.S
+++ b/xen/arch/arm/arm64/mpu/head.S
@@ -5,6 +5,9 @@
 
 #include <asm/arm64/mpu.h>
 
+/* Backgroud region enable/disable */
+#define SCTLR_ELx_BR    BIT(17, UL)
+
 #define REGION_TEXT_PRBAR       0x38    /* SH=11 AP=10 XN=00 */
 #define REGION_RO_PRBAR         0x3A    /* SH=11 AP=10 XN=10 */
 #define REGION_DATA_PRBAR       0x32    /* SH=11 AP=00 XN=10 */
@@ -75,6 +78,29 @@ FUNC_LOCAL(fail_insufficient_regions)
     b   1b
 END(fail_insufficient_regions)
 
+/*
+ * Enable EL2 MPU and data cache
+ * If the Background region is enabled, then the MPU uses the default memory
+ * map as the Background region for generating the memory
+ * attributes when MPU is disabled.
+ * Since the default memory map of the Armv8-R AArch64 architecture is
+ * IMPLEMENTATION DEFINED, we intend to turn off the Background region here.
+ *
+ * Clobbers x0
+ *
+ */
+FUNC_LOCAL(enable_mpu)
+    mrs   x0, SCTLR_EL2
+    bic   x0, x0, #SCTLR_ELx_BR       /* Disable Background region */
+    orr   x0, x0, #SCTLR_Axx_ELx_M    /* Enable MPU */
+    orr   x0, x0, #SCTLR_Axx_ELx_C    /* Enable D-cache */
+    orr   x0, x0, #SCTLR_Axx_ELx_WXN  /* Enable WXN */
+    msr   SCTLR_EL2, x0
+    isb
+
+    ret
+END(enable_mpu)
+
 /*
  * Maps the various sections of Xen (described in xen.lds.S) as different MPU
  * regions.
@@ -114,6 +140,7 @@ FUNC(enable_boot_cpu_mm)
     ldr   x2, =__bss_end
     prepare_xen_region x0, x1, x2, x3, x4, x5
 
+    b    enable_mpu
     ret
 END(enable_boot_cpu_mm)
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Dec 02 18:33:38 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 02 Dec 2024 18:33:38 +0000
Received: from list by lists.xenproject.org with outflank-mailman.846977.1262107 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tIBEo-000175-Uk; Mon, 02 Dec 2024 18:33:38 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 846977.1262107; Mon, 02 Dec 2024 18:33:38 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tIBEo-00016w-S5; Mon, 02 Dec 2024 18:33:38 +0000
Received: by outflank-mailman (input) for mailman id 846977;
 Mon, 02 Dec 2024 18:33:38 +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 1tIBEo-00016j-0w
 for xen-changelog@lists.xenproject.org; Mon, 02 Dec 2024 18:33:38 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1tIBEn-000M3Y-2G
 for xen-changelog@lists.xenproject.org;
 Mon, 02 Dec 2024 18:33:38 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1tIBEn-00Avb7-36
 for xen-changelog@lists.xenproject.org;
 Mon, 02 Dec 2024 18:33:37 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/arm: mpu: Implement a dummy enable_secondary_cpu_mm
Message-Id: <E1tIBEn-00Avb7-36@xenbits.xenproject.org>
Date: Mon, 02 Dec 2024 18:33:37 +0000

commit ee7edb0d29cc17ab69524a7991e86b0c411426df
Author:     Ayan Kumar Halder <ayan.kumar.halder@amd.com>
AuthorDate: Mon Nov 18 12:12:50 2024 +0000
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Mon Dec 2 18:28:54 2024 +0000

    xen/arm: mpu: Implement a dummy enable_secondary_cpu_mm
    
    Secondary cpus initialization is not yet supported. Thus, we print an
    appropriate message and put the secondary cpus in WFE state.
    And we introduce to BUILD_BUG_ON to prevent users using from building Xen
    on multiprocessor based MPU systems.
    
    In Arm, there is no clean way to disable SMP. As of now, we wish to support
    MPU on UNP only. So, we have defined the default range of NR_CPUs to be 1 for
    MPU.
    
    Signed-off-by: Ayan Kumar Halder <ayan.kumar.halder@amd.com>
    Reviewed-by: Luca Fancellu <luca.fancellu@arm.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
---
 xen/arch/Kconfig              |  2 ++
 xen/arch/arm/arm64/mpu/head.S | 10 ++++++++++
 xen/arch/arm/smp.c            | 11 +++++++++++
 3 files changed, 23 insertions(+)

diff --git a/xen/arch/Kconfig b/xen/arch/Kconfig
index 308ce129a8..9f4835e37f 100644
--- a/xen/arch/Kconfig
+++ b/xen/arch/Kconfig
@@ -6,8 +6,10 @@ config PHYS_ADDR_T_32
 
 config NR_CPUS
 	int "Maximum number of CPUs"
+	range 1 1 if ARM && MPU
 	range 1 16383
 	default "256" if X86
+	default "1" if ARM && MPU
 	default "8" if ARM && RCAR3
 	default "4" if ARM && QEMU
 	default "4" if ARM && MPSOC
diff --git a/xen/arch/arm/arm64/mpu/head.S b/xen/arch/arm/arm64/mpu/head.S
index bacf8315f9..d3db5e53af 100644
--- a/xen/arch/arm/arm64/mpu/head.S
+++ b/xen/arch/arm/arm64/mpu/head.S
@@ -144,6 +144,16 @@ FUNC(enable_boot_cpu_mm)
     ret
 END(enable_boot_cpu_mm)
 
+/*
+ * We don't yet support secondary CPUs bring-up. Implement a dummy helper to
+ * please the common code.
+ */
+ENTRY(enable_secondary_cpu_mm)
+    PRINT("- SMP not enabled yet -\r\n")
+1:  wfe
+    b 1b
+ENDPROC(enable_secondary_cpu_mm)
+
 /*
  * Local variables:
  * mode: ASM
diff --git a/xen/arch/arm/smp.c b/xen/arch/arm/smp.c
index c11bba93ad..b372472188 100644
--- a/xen/arch/arm/smp.c
+++ b/xen/arch/arm/smp.c
@@ -1,4 +1,5 @@
 /* SPDX-License-Identifier: GPL-2.0-only */
+#include <xen/init.h>
 #include <xen/mm.h>
 #include <asm/system.h>
 #include <asm/smp.h>
@@ -6,6 +7,16 @@
 #include <asm/gic.h>
 #include <asm/flushtlb.h>
 
+static void __init __maybe_unused build_assertions(void)
+{
+#ifdef CONFIG_MPU
+    /*
+     * Currently, SMP is not enabled on MPU based systems.
+     */
+    BUILD_BUG_ON(NR_CPUS > 1);
+#endif
+}
+
 void arch_flush_tlb_mask(const cpumask_t *mask)
 {
     /* No need to IPI other processors on ARM, the processor takes care of it. */
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Dec 02 19:11:07 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 02 Dec 2024 19:11:07 +0000
Received: from list by lists.xenproject.org with outflank-mailman.846990.1262122 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tIBp0-0006bs-Oc; Mon, 02 Dec 2024 19:11:02 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 846990.1262122; Mon, 02 Dec 2024 19:11:02 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tIBp0-0006bi-LU; Mon, 02 Dec 2024 19:11:02 +0000
Received: by outflank-mailman (input) for mailman id 846990;
 Mon, 02 Dec 2024 19: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 1tIBoz-0006bc-TH
 for xen-changelog@lists.xenproject.org; Mon, 02 Dec 2024 19:11:01 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1tIBoz-000MnA-10
 for xen-changelog@lists.xenproject.org;
 Mon, 02 Dec 2024 19:11:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1tIBoz-00AzMk-1j
 for xen-changelog@lists.xenproject.org;
 Mon, 02 Dec 2024 19:11:01 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/arm32: Get rid of __memzero()
Message-Id: <E1tIBoz-00AzMk-1j@xenbits.xenproject.org>
Date: Mon, 02 Dec 2024 19:11:01 +0000

commit b30bad383260b012d5314d08b01ec07c7918e1c1
Author:     Julien Grall <jgrall@amazon.com>
AuthorDate: Wed Nov 27 10:55:12 2024 +0000
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Mon Dec 2 18:23:49 2024 +0000

    xen/arm32: Get rid of __memzero()
    
    All the code in arch/arm32/lib/ where copied from Linux 3.16
    and never re-synced since then.
    
    A few years ago, Linux got rid of __memzero() because the implementation
    is very similar to memset(p,0,n) and the current use of __memzero()
    interferes with optimization. See full commit message from Linux below.
    
    So it makes sense to get rid of __memzero in Xen as well.
    
        From ff5fdafc9e9702846480e0cea55ba861f72140a2 Mon Sep 17 00:00:00 2001
        From: Nicolas Pitre <nicolas.pitre@linaro.org>
        Date: Fri, 19 Jan 2018 18:17:46 +0100
        Subject: [PATCH] ARM: 8745/1: get rid of __memzero()
    
        The __memzero assembly code is almost identical to memset's except for
        two orr instructions. The runtime performance of __memset(p, n) and
        memset(p, 0, n) is accordingly almost identical.
    
        However, the memset() macro used to guard against a zero length and to
        call __memzero at compile time when the fill value is a constant zero
        interferes with compiler optimizations.
    
        Arnd found tha the test against a zero length brings up some new
        warnings with gcc v8:
    
          https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82103
    
        And successively rremoving the test against a zero length and the call
        to __memzero optimization produces the following kernel sizes for
        defconfig with gcc 6:
    
            text     data     bss       dec       hex  filename
        12248142  6278960  413588  18940690   1210312  vmlinux.orig
        12244474  6278960  413588  18937022   120f4be  vmlinux.no_zero_test
        12239160  6278960  413588  18931708   120dffc  vmlinux.no_memzero
    
        So it is probably not worth keeping __memzero around given that the
        compiler can do a better job at inlining trivial memset(p,0,n) on its
        own. And the memset code already handles a zero length just fine.
    
        Suggested-by: Arnd Bergmann <arnd@arndb.de>
        Signed-off-by: Nicolas Pitre <nico@linaro.org>
        Acked-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
        Acked-by: Arnd Bergmann <arnd@arndb.de>
        Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
    
    Origin: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git ff5fdafc9e97
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Michal Orzel <michal.orzel@amd.com>
    Signed-off-by: Julien Grall <jgrall@amazon.com>
---
 xen/arch/arm/README.LinuxPrimitives |   4 +-
 xen/arch/arm/arm32/lib/Makefile     |   2 +-
 xen/arch/arm/arm32/lib/memzero.S    | 124 ------------------------------------
 xen/arch/arm/include/asm/string.h   |  18 ------
 4 files changed, 2 insertions(+), 146 deletions(-)

diff --git a/xen/arch/arm/README.LinuxPrimitives b/xen/arch/arm/README.LinuxPrimitives
index 301c0271bb..2c62ba7699 100644
--- a/xen/arch/arm/README.LinuxPrimitives
+++ b/xen/arch/arm/README.LinuxPrimitives
@@ -108,10 +108,8 @@ linux/arch/arm/lib/memchr.S             xen/arch/arm/arm32/lib/memchr.S
 linux/arch/arm/lib/memcpy.S             xen/arch/arm/arm32/lib/memcpy.S
 linux/arch/arm/lib/memmove.S            xen/arch/arm/arm32/lib/memmove.S
 linux/arch/arm/lib/memset.S             xen/arch/arm/arm32/lib/memset.S
-linux/arch/arm/lib/memzero.S            xen/arch/arm/arm32/lib/memzero.S
 
-for i in copy_template.S memchr.S memcpy.S memmove.S memset.S \
-         memzero.S ; do
+for i in copy_template.S memchr.S memcpy.S memmove.S memset.S; do
     diff -u linux/arch/arm/lib/$i xen/arch/arm/arm32/lib/$i
 done
 
diff --git a/xen/arch/arm/arm32/lib/Makefile b/xen/arch/arm/arm32/lib/Makefile
index b1457c89dc..18326b284e 100644
--- a/xen/arch/arm/arm32/lib/Makefile
+++ b/xen/arch/arm/arm32/lib/Makefile
@@ -1,4 +1,4 @@
-obj-y += memcpy.o memmove.o memset.o memchr.o memzero.o
+obj-y += memcpy.o memmove.o memset.o memchr.o
 obj-y += findbit.o
 obj-y += bitops.o
 obj-y += strchr.o strrchr.o
diff --git a/xen/arch/arm/arm32/lib/memzero.S b/xen/arch/arm/arm32/lib/memzero.S
deleted file mode 100644
index dca5867c24..0000000000
--- a/xen/arch/arm/arm32/lib/memzero.S
+++ /dev/null
@@ -1,124 +0,0 @@
-/*
- *  linux/arch/arm/lib/memzero.S
- *
- *  Copyright (C) 1995-2000 Russell King
- *
- * 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 "assembler.h"
-
-	.text
-	.align	5
-	.word	0
-/*
- * Align the pointer in r0.  r3 contains the number of bytes that we are
- * mis-aligned by, and r1 is the number of bytes.  If r1 < 4, then we
- * don't bother; we use byte stores instead.
- */
-1:	subs	r1, r1, #4		@ 1 do we have enough
-	blt	5f			@ 1 bytes to align with?
-	cmp	r3, #2			@ 1
-	strltb	r2, [r0], #1		@ 1
-	strleb	r2, [r0], #1		@ 1
-	strb	r2, [r0], #1		@ 1
-	add	r1, r1, r3		@ 1 (r1 = r1 - (4 - r3))
-/*
- * The pointer is now aligned and the length is adjusted.  Try doing the
- * memzero again.
- */
-
-ENTRY(__memzero)
-	mov	r2, #0			@ 1
-	ands	r3, r0, #3		@ 1 unaligned?
-	bne	1b			@ 1
-/*
- * r3 = 0, and we know that the pointer in r0 is aligned to a word boundary.
- */
-	cmp	r1, #16			@ 1 we can skip this chunk if we
-	blt	4f			@ 1 have < 16 bytes
-
-#if ! CALGN(1)+0
-
-/*
- * We need an extra register for this loop - save the return address and
- * use the LR
- */
-	str	lr, [sp, #-4]!		@ 1
-	mov	ip, r2			@ 1
-	mov	lr, r2			@ 1
-
-3:	subs	r1, r1, #64		@ 1 write 32 bytes out per loop
-	stmgeia	r0!, {r2, r3, ip, lr}	@ 4
-	stmgeia	r0!, {r2, r3, ip, lr}	@ 4
-	stmgeia	r0!, {r2, r3, ip, lr}	@ 4
-	stmgeia	r0!, {r2, r3, ip, lr}	@ 4
-	bgt	3b			@ 1
-	ldmeqfd	sp!, {pc}		@ 1/2 quick exit
-/*
- * No need to correct the count; we're only testing bits from now on
- */
-	tst	r1, #32			@ 1
-	stmneia	r0!, {r2, r3, ip, lr}	@ 4
-	stmneia	r0!, {r2, r3, ip, lr}	@ 4
-	tst	r1, #16			@ 1 16 bytes or more?
-	stmneia	r0!, {r2, r3, ip, lr}	@ 4
-	ldr	lr, [sp], #4		@ 1
-
-#else
-
-/*
- * This version aligns the destination pointer in order to write
- * whole cache lines at once.
- */
-
-	stmfd	sp!, {r4-r7, lr}
-	mov	r4, r2
-	mov	r5, r2
-	mov	r6, r2
-	mov	r7, r2
-	mov	ip, r2
-	mov	lr, r2
-
-	cmp	r1, #96
-	andgts	ip, r0, #31
-	ble	3f
-
-	rsb	ip, ip, #32
-	sub	r1, r1, ip
-	movs	ip, ip, lsl #(32 - 4)
-	stmcsia	r0!, {r4, r5, r6, r7}
-	stmmiia	r0!, {r4, r5}
-	movs	ip, ip, lsl #2
-	strcs	r2, [r0], #4
-
-3:	subs	r1, r1, #64
-	stmgeia	r0!, {r2-r7, ip, lr}
-	stmgeia	r0!, {r2-r7, ip, lr}
-	bgt	3b
-	ldmeqfd	sp!, {r4-r7, pc}
-
-	tst	r1, #32
-	stmneia	r0!, {r2-r7, ip, lr}
-	tst	r1, #16
-	stmneia	r0!, {r4-r7}
-	ldmfd	sp!, {r4-r7, lr}
-
-#endif
-
-4:	tst	r1, #8			@ 1 8 bytes or more?
-	stmneia	r0!, {r2, r3}		@ 2
-	tst	r1, #4			@ 1 4 bytes or more?
-	strne	r2, [r0], #4		@ 1
-/*
- * When we get here, we've got less than 4 bytes to zero.  We
- * may have an unaligned pointer as well.
- */
-5:	tst	r1, #2			@ 1 2 bytes or more?
-	strneb	r2, [r0], #1		@ 1
-	strneb	r2, [r0], #1		@ 1
-	tst	r1, #1			@ 1 a byte left over
-	strneb	r2, [r0], #1		@ 1
-	mov	pc, lr			@ 1
-ENDPROC(__memzero)
diff --git a/xen/arch/arm/include/asm/string.h b/xen/arch/arm/include/asm/string.h
index b485e49044..7cbc8ecc76 100644
--- a/xen/arch/arm/include/asm/string.h
+++ b/xen/arch/arm/include/asm/string.h
@@ -24,24 +24,6 @@
 #define __HAVE_ARCH_MEMSET
 #define __HAVE_ARCH_MEMCHR
 
-#if defined(CONFIG_ARM_32)
-
-void __memzero(void *ptr, size_t n);
-
-#define memset(p, v, n)                                                 \
-        ({                                                              \
-                void *__p = (p); size_t __n = n;                        \
-                if ((__n) != 0) {                                       \
-                        if (__builtin_constant_p((v)) && (v) == 0)      \
-                                __memzero((__p),(__n));                 \
-                        else                                            \
-                                memset((__p),(v),(__n));                \
-                }                                                       \
-                (__p);                                                  \
-        })
-
-#endif
-
 #endif /* __ARM_STRING_H__ */
 /*
  * Local variables:
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Mon Dec 02 20:00:09 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 02 Dec 2024 20:00:09 +0000
Received: from list by lists.xenproject.org with outflank-mailman.847064.1262185 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tICaR-0007BD-25; Mon, 02 Dec 2024 20:00:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 847064.1262185; Mon, 02 Dec 2024 20: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 1tICaQ-0007An-Vg; Mon, 02 Dec 2024 20:00:02 +0000
Received: by outflank-mailman (input) for mailman id 847064;
 Mon, 02 Dec 2024 20: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 1tICaP-0006uS-TH
 for xen-changelog@lists.xenproject.org; Mon, 02 Dec 2024 20:00:01 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1tICaP-000NtV-17
 for xen-changelog@lists.xenproject.org;
 Mon, 02 Dec 2024 20:00:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1tICaP-00B4QZ-1u
 for xen-changelog@lists.xenproject.org;
 Mon, 02 Dec 2024 20: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>
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/arm: mpu: Create boot-time MPU protection regions
Message-Id: <E1tICaP-00B4QZ-1u@xenbits.xenproject.org>
Date: Mon, 02 Dec 2024 20:00:01 +0000

commit 868fe87c462dffb1ab7ef6be0a25d7fe59cb7ee7
Author:     Ayan Kumar Halder <ayan.kumar.halder@amd.com>
AuthorDate: Mon Nov 18 12:12:48 2024 +0000
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Mon Dec 2 18:28:37 2024 +0000

    xen/arm: mpu: Create boot-time MPU protection regions
    
    Define enable_boot_cpu_mm() for the Armv8-R AArch64.
    
    Like boot-time page table in MMU system, we need a boot-time MPU protection
    region configuration in MPU system so Xen can fetch code and data from normal
    memory.
    
    To do this, Xen maps the following sections of the binary as separate regions
    (with permissions) :-
    1. Text (Read only at EL2, execution is permitted)
    2. RO data (Read only at EL2)
    3. RO after init data and RW data (Read/Write at EL2)
    4. Init Text (Read only at EL2, execution is permitted)
    5. Init data and BSS (Read/Write at EL2)
    
    Before creating a region, we check if the count exceeds the number defined in
    MPUIR_EL2. If so, then the boot fails.
    
    Also we check if the region is empty or not. IOW, if the start and end address
    are same, we skip mapping the region.
    
    To map a region, Xen uses the PRBAR_EL2, PRLAR_EL2 and PRSELR_EL2 registers.
    One can refer to ARM DDI 0600B.a ID062922 G1.3  "General System Control
    Registers", to get the definitions of these registers. Also, refer to G1.2
    "Accessing MPU memory region registers", the following
    
    ```
    The MPU provides two register interfaces to program the MPU regions:
    - Access to any of the MPU regions via PRSELR_ELx, PRBAR<n>_ELx, and
    PRLAR<n>_ELx.
    ```
    
    We use the above mechanism to create the MPU memory regions.
    
    Also, the compiler needs the flag ("-march=armv8-r") in order to build Xen for
    Armv8-R AArch64 MPU based systems. There will be no need for us to explicitly
    define MPU specific registers.
    
    Signed-off-by: Ayan Kumar Halder <ayan.kumar.halder@amd.com>
    Reviewed-by: Luca Fancellu <luca.fancellu@arm.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
---
 xen/arch/arm/arch.mk                 |   4 ++
 xen/arch/arm/arm64/mpu/Makefile      |   1 +
 xen/arch/arm/arm64/mpu/head.S        | 125 +++++++++++++++++++++++++++++++++++
 xen/arch/arm/include/asm/arm64/mpu.h |  25 +++++++
 xen/arch/arm/include/asm/mm.h        |   2 +-
 xen/arch/arm/xen.lds.S               |   1 +
 6 files changed, 157 insertions(+), 1 deletion(-)

diff --git a/xen/arch/arm/arch.mk b/xen/arch/arm/arch.mk
index 022dcda192..9c4bedfb3b 100644
--- a/xen/arch/arm/arch.mk
+++ b/xen/arch/arm/arch.mk
@@ -9,7 +9,11 @@ CFLAGS-$(CONFIG_ARM_32) += -msoft-float
 CFLAGS-$(CONFIG_ARM_32) += -mcpu=cortex-a15
 CFLAGS-$(CONFIG_ARM_32) += -mno-unaligned-access
 
+ifeq ($(CONFIG_MPU),y)
+CFLAGS-$(CONFIG_ARM_64) += -march=armv8-r
+else
 CFLAGS-$(CONFIG_ARM_64) += -mcpu=generic
+endif
 CFLAGS-$(CONFIG_ARM_64) += -mgeneral-regs-only # No fp registers etc
 $(call cc-option-add,CFLAGS-$(CONFIG_ARM_64),CC,-mno-outline-atomics)
 
diff --git a/xen/arch/arm/arm64/mpu/Makefile b/xen/arch/arm/arm64/mpu/Makefile
index b18cec4836..a8a750a3d0 100644
--- a/xen/arch/arm/arm64/mpu/Makefile
+++ b/xen/arch/arm/arm64/mpu/Makefile
@@ -1 +1,2 @@
+obj-y += head.o
 obj-y += mm.o
diff --git a/xen/arch/arm/arm64/mpu/head.S b/xen/arch/arm/arm64/mpu/head.S
new file mode 100644
index 0000000000..a06589566f
--- /dev/null
+++ b/xen/arch/arm/arm64/mpu/head.S
@@ -0,0 +1,125 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+/*
+ * Start-of-day code for an Armv8-R MPU system.
+ */
+
+#include <asm/arm64/mpu.h>
+
+#define REGION_TEXT_PRBAR       0x38    /* SH=11 AP=10 XN=00 */
+#define REGION_RO_PRBAR         0x3A    /* SH=11 AP=10 XN=10 */
+#define REGION_DATA_PRBAR       0x32    /* SH=11 AP=00 XN=10 */
+
+#define REGION_NORMAL_PRLAR     0x0f    /* NS=0 ATTR=111 EN=1 */
+
+/*
+ * Macro to prepare and set a EL2 MPU memory region.
+ * We will also create an according MPU memory region entry, which
+ * is a structure of pr_t,  in table \prmap.
+ *
+ * sel:         region selector
+ * base:        reg storing base address
+ * limit:       reg storing limit address
+ * prbar:       store computed PRBAR_EL2 value
+ * prlar:       store computed PRLAR_EL2 value
+ * maxcount:    maximum number of EL2 regions supported
+ * attr_prbar:  PRBAR_EL2-related memory attributes. If not specified it will be
+ *              REGION_DATA_PRBAR
+ * attr_prlar:  PRLAR_EL2-related memory attributes. If not specified it will be
+ *              REGION_NORMAL_PRLAR
+ *
+ * Preserves \maxcount
+ * Output:
+ *  \sel: Next available region selector index.
+ * Clobbers \base, \limit, \prbar, \prlar
+ *
+ * Note that all parameters using registers should be distinct.
+ */
+.macro prepare_xen_region, sel, base, limit, prbar, prlar, maxcount, attr_prbar=REGION_DATA_PRBAR, attr_prlar=REGION_NORMAL_PRLAR
+    /* Check if the region is empty */
+    cmp   \base, \limit
+    beq   1f
+
+    /* Check if the number of regions exceeded the count specified in MPUIR_EL2 */
+    cmp   \sel, \maxcount
+    bge   fail_insufficient_regions
+
+    /* Prepare value for PRBAR_EL2 reg and preserve it in \prbar.*/
+    and   \base, \base, #MPU_REGION_MASK
+    mov   \prbar, #\attr_prbar
+    orr   \prbar, \prbar, \base
+
+    /* Limit address should be inclusive */
+    sub   \limit, \limit, #1
+    and   \limit, \limit, #MPU_REGION_MASK
+    mov   \prlar, #\attr_prlar
+    orr   \prlar, \prlar, \limit
+
+    msr   PRSELR_EL2, \sel
+    isb
+    msr   PRBAR_EL2, \prbar
+    msr   PRLAR_EL2, \prlar
+    dsb   sy
+    isb
+
+    add   \sel, \sel, #1
+
+1:
+.endm
+
+/*
+ * Failure caused due to insufficient MPU regions.
+ */
+FUNC_LOCAL(fail_insufficient_regions)
+    PRINT("- Selected MPU region is above the implemented number in MPUIR_EL2 -\r\n")
+1:  wfe
+    b   1b
+END(fail_insufficient_regions)
+
+/*
+ * Maps the various sections of Xen (described in xen.lds.S) as different MPU
+ * regions.
+ *
+ * Clobbers x0 - x5
+ *
+ */
+FUNC(enable_boot_cpu_mm)
+    /* Get the number of regions specified in MPUIR_EL2 */
+    mrs   x5, MPUIR_EL2
+    and   x5, x5, #NUM_MPU_REGIONS_MASK
+
+    /* x0: region sel */
+    mov   x0, xzr
+    /* Xen text section. */
+    ldr   x1, =_stext
+    ldr   x2, =_etext
+    prepare_xen_region x0, x1, x2, x3, x4, x5, attr_prbar=REGION_TEXT_PRBAR
+
+    /* Xen read-only data section. */
+    ldr   x1, =_srodata
+    ldr   x2, =_erodata
+    prepare_xen_region x0, x1, x2, x3, x4, x5, attr_prbar=REGION_RO_PRBAR
+
+    /* Xen read-only after init and data section. (RW data) */
+    ldr   x1, =__ro_after_init_start
+    ldr   x2, =__init_begin
+    prepare_xen_region x0, x1, x2, x3, x4, x5
+
+    /* Xen code section. */
+    ldr   x1, =__init_begin
+    ldr   x2, =__init_data_begin
+    prepare_xen_region x0, x1, x2, x3, x4, x5, attr_prbar=REGION_TEXT_PRBAR
+
+    /* Xen data and BSS section. */
+    ldr   x1, =__init_data_begin
+    ldr   x2, =__bss_end
+    prepare_xen_region x0, x1, x2, x3, x4, x5
+
+    ret
+END(enable_boot_cpu_mm)
+
+/*
+ * Local variables:
+ * mode: ASM
+ * indent-tabs-mode: nil
+ * End:
+ */
diff --git a/xen/arch/arm/include/asm/arm64/mpu.h b/xen/arch/arm/include/asm/arm64/mpu.h
new file mode 100644
index 0000000000..f8a029f1a1
--- /dev/null
+++ b/xen/arch/arm/include/asm/arm64/mpu.h
@@ -0,0 +1,25 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+/*
+ * mpu.h: Arm Memory Protection Unit definitions.
+ */
+
+#ifndef __ARM64_MPU_H__
+#define __ARM64_MPU_H__
+
+#define MPU_REGION_SHIFT  6
+#define MPU_REGION_ALIGN  (_AC(1, UL) << MPU_REGION_SHIFT)
+#define MPU_REGION_MASK   (~(MPU_REGION_ALIGN - 1))
+
+#define NUM_MPU_REGIONS_SHIFT   8
+#define NUM_MPU_REGIONS         (_AC(1, UL) << NUM_MPU_REGIONS_SHIFT)
+#define NUM_MPU_REGIONS_MASK    (NUM_MPU_REGIONS - 1)
+#endif /* __ARM64_MPU_H__ */
+
+/*
+ * Local variables:
+ * mode: C
+ * c-file-style: "BSD"
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
diff --git a/xen/arch/arm/include/asm/mm.h b/xen/arch/arm/include/asm/mm.h
index 5abd4b0d1c..59b774b7b8 100644
--- a/xen/arch/arm/include/asm/mm.h
+++ b/xen/arch/arm/include/asm/mm.h
@@ -16,7 +16,7 @@
 
 #if defined(CONFIG_MMU)
 # include <asm/mmu/mm.h>
-#else
+#elif !defined(CONFIG_MPU)
 # error "Unknown memory management layout"
 #endif
 
diff --git a/xen/arch/arm/xen.lds.S b/xen/arch/arm/xen.lds.S
index d1e579e8a8..bbccff1a03 100644
--- a/xen/arch/arm/xen.lds.S
+++ b/xen/arch/arm/xen.lds.S
@@ -147,6 +147,7 @@ SECTIONS
        *(.altinstr_replacement)
   } :text
   . = ALIGN(PAGE_SIZE);
+  __init_data_begin = .;
   .init.data : {
        *(.init.rodata)
        *(.init.rodata.*)
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Mon Dec 02 20:00:13 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 02 Dec 2024 20:00:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.847065.1262190 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tICab-0007ul-3f; Mon, 02 Dec 2024 20:00:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 847065.1262190; Mon, 02 Dec 2024 20: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 1tICab-0007ub-0s; Mon, 02 Dec 2024 20:00:13 +0000
Received: by outflank-mailman (input) for mailman id 847065;
 Mon, 02 Dec 2024 20: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 1tICaZ-0007uT-QR
 for xen-changelog@lists.xenproject.org; Mon, 02 Dec 2024 20:00:11 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1tICaZ-000Ntb-1V
 for xen-changelog@lists.xenproject.org;
 Mon, 02 Dec 2024 20:00:11 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1tICaZ-00B4TA-2G
 for xen-changelog@lists.xenproject.org;
 Mon, 02 Dec 2024 20: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>
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/arm: mpu: Enable MPU
Message-Id: <E1tICaZ-00B4TA-2G@xenbits.xenproject.org>
Date: Mon, 02 Dec 2024 20:00:11 +0000

commit 5423a08eae391e781a457fa2b819431ab36f85bd
Author:     Ayan Kumar Halder <ayan.kumar.halder@amd.com>
AuthorDate: Mon Nov 18 12:12:49 2024 +0000
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Mon Dec 2 18:28:54 2024 +0000

    xen/arm: mpu: Enable MPU
    
    After the regions have been created, now we enable the MPU. For this we disable
    the background region so that the new memory map created for the regions take
    effect. Also, we treat all RW regions as non executable and the data cache is
    enabled.
    
    Signed-off-by: Ayan Kumar Halder <ayan.kumar.halder@amd.com>
    Reviewed-by: Luca Fancellu <luca.fancellu@arm.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
---
 xen/arch/arm/arm64/mpu/head.S | 27 +++++++++++++++++++++++++++
 1 file changed, 27 insertions(+)

diff --git a/xen/arch/arm/arm64/mpu/head.S b/xen/arch/arm/arm64/mpu/head.S
index a06589566f..bacf8315f9 100644
--- a/xen/arch/arm/arm64/mpu/head.S
+++ b/xen/arch/arm/arm64/mpu/head.S
@@ -5,6 +5,9 @@
 
 #include <asm/arm64/mpu.h>
 
+/* Backgroud region enable/disable */
+#define SCTLR_ELx_BR    BIT(17, UL)
+
 #define REGION_TEXT_PRBAR       0x38    /* SH=11 AP=10 XN=00 */
 #define REGION_RO_PRBAR         0x3A    /* SH=11 AP=10 XN=10 */
 #define REGION_DATA_PRBAR       0x32    /* SH=11 AP=00 XN=10 */
@@ -75,6 +78,29 @@ FUNC_LOCAL(fail_insufficient_regions)
     b   1b
 END(fail_insufficient_regions)
 
+/*
+ * Enable EL2 MPU and data cache
+ * If the Background region is enabled, then the MPU uses the default memory
+ * map as the Background region for generating the memory
+ * attributes when MPU is disabled.
+ * Since the default memory map of the Armv8-R AArch64 architecture is
+ * IMPLEMENTATION DEFINED, we intend to turn off the Background region here.
+ *
+ * Clobbers x0
+ *
+ */
+FUNC_LOCAL(enable_mpu)
+    mrs   x0, SCTLR_EL2
+    bic   x0, x0, #SCTLR_ELx_BR       /* Disable Background region */
+    orr   x0, x0, #SCTLR_Axx_ELx_M    /* Enable MPU */
+    orr   x0, x0, #SCTLR_Axx_ELx_C    /* Enable D-cache */
+    orr   x0, x0, #SCTLR_Axx_ELx_WXN  /* Enable WXN */
+    msr   SCTLR_EL2, x0
+    isb
+
+    ret
+END(enable_mpu)
+
 /*
  * Maps the various sections of Xen (described in xen.lds.S) as different MPU
  * regions.
@@ -114,6 +140,7 @@ FUNC(enable_boot_cpu_mm)
     ldr   x2, =__bss_end
     prepare_xen_region x0, x1, x2, x3, x4, x5
 
+    b    enable_mpu
     ret
 END(enable_boot_cpu_mm)
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Mon Dec 02 20:00:23 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 02 Dec 2024 20:00:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.847066.1262194 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tICal-0007x9-5Q; Mon, 02 Dec 2024 20:00:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 847066.1262194; Mon, 02 Dec 2024 20: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 1tICal-0007x2-2N; Mon, 02 Dec 2024 20:00:23 +0000
Received: by outflank-mailman (input) for mailman id 847066;
 Mon, 02 Dec 2024 20: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 1tICaj-0007ws-TV
 for xen-changelog@lists.xenproject.org; Mon, 02 Dec 2024 20:00:21 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1tICaj-000Nth-1t
 for xen-changelog@lists.xenproject.org;
 Mon, 02 Dec 2024 20:00:21 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1tICaj-00B4UH-2d
 for xen-changelog@lists.xenproject.org;
 Mon, 02 Dec 2024 20: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>
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/arm: mpu: Implement a dummy enable_secondary_cpu_mm
Message-Id: <E1tICaj-00B4UH-2d@xenbits.xenproject.org>
Date: Mon, 02 Dec 2024 20:00:21 +0000

commit ee7edb0d29cc17ab69524a7991e86b0c411426df
Author:     Ayan Kumar Halder <ayan.kumar.halder@amd.com>
AuthorDate: Mon Nov 18 12:12:50 2024 +0000
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Mon Dec 2 18:28:54 2024 +0000

    xen/arm: mpu: Implement a dummy enable_secondary_cpu_mm
    
    Secondary cpus initialization is not yet supported. Thus, we print an
    appropriate message and put the secondary cpus in WFE state.
    And we introduce to BUILD_BUG_ON to prevent users using from building Xen
    on multiprocessor based MPU systems.
    
    In Arm, there is no clean way to disable SMP. As of now, we wish to support
    MPU on UNP only. So, we have defined the default range of NR_CPUs to be 1 for
    MPU.
    
    Signed-off-by: Ayan Kumar Halder <ayan.kumar.halder@amd.com>
    Reviewed-by: Luca Fancellu <luca.fancellu@arm.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
---
 xen/arch/Kconfig              |  2 ++
 xen/arch/arm/arm64/mpu/head.S | 10 ++++++++++
 xen/arch/arm/smp.c            | 11 +++++++++++
 3 files changed, 23 insertions(+)

diff --git a/xen/arch/Kconfig b/xen/arch/Kconfig
index 308ce129a8..9f4835e37f 100644
--- a/xen/arch/Kconfig
+++ b/xen/arch/Kconfig
@@ -6,8 +6,10 @@ config PHYS_ADDR_T_32
 
 config NR_CPUS
 	int "Maximum number of CPUs"
+	range 1 1 if ARM && MPU
 	range 1 16383
 	default "256" if X86
+	default "1" if ARM && MPU
 	default "8" if ARM && RCAR3
 	default "4" if ARM && QEMU
 	default "4" if ARM && MPSOC
diff --git a/xen/arch/arm/arm64/mpu/head.S b/xen/arch/arm/arm64/mpu/head.S
index bacf8315f9..d3db5e53af 100644
--- a/xen/arch/arm/arm64/mpu/head.S
+++ b/xen/arch/arm/arm64/mpu/head.S
@@ -144,6 +144,16 @@ FUNC(enable_boot_cpu_mm)
     ret
 END(enable_boot_cpu_mm)
 
+/*
+ * We don't yet support secondary CPUs bring-up. Implement a dummy helper to
+ * please the common code.
+ */
+ENTRY(enable_secondary_cpu_mm)
+    PRINT("- SMP not enabled yet -\r\n")
+1:  wfe
+    b 1b
+ENDPROC(enable_secondary_cpu_mm)
+
 /*
  * Local variables:
  * mode: ASM
diff --git a/xen/arch/arm/smp.c b/xen/arch/arm/smp.c
index c11bba93ad..b372472188 100644
--- a/xen/arch/arm/smp.c
+++ b/xen/arch/arm/smp.c
@@ -1,4 +1,5 @@
 /* SPDX-License-Identifier: GPL-2.0-only */
+#include <xen/init.h>
 #include <xen/mm.h>
 #include <asm/system.h>
 #include <asm/smp.h>
@@ -6,6 +7,16 @@
 #include <asm/gic.h>
 #include <asm/flushtlb.h>
 
+static void __init __maybe_unused build_assertions(void)
+{
+#ifdef CONFIG_MPU
+    /*
+     * Currently, SMP is not enabled on MPU based systems.
+     */
+    BUILD_BUG_ON(NR_CPUS > 1);
+#endif
+}
+
 void arch_flush_tlb_mask(const cpumask_t *mask)
 {
     /* No need to IPI other processors on ARM, the processor takes care of it. */
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Dec 03 12:22:15 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 03 Dec 2024 12:22:15 +0000
Received: from list by lists.xenproject.org with outflank-mailman.848018.1263017 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tIRur-0006JI-L7; Tue, 03 Dec 2024 12:22:09 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 848018.1263017; Tue, 03 Dec 2024 12:22:09 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tIRur-0006JA-IV; Tue, 03 Dec 2024 12:22:09 +0000
Received: by outflank-mailman (input) for mailman id 848018;
 Tue, 03 Dec 2024 12:22:08 +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 1tIRuq-0006J3-1t
 for xen-changelog@lists.xenproject.org; Tue, 03 Dec 2024 12:22:08 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1tIRup-001vc6-1W
 for xen-changelog@lists.xenproject.org;
 Tue, 03 Dec 2024 12:22:07 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1tIRup-00ChSG-2D
 for xen-changelog@lists.xenproject.org;
 Tue, 03 Dec 2024 12:22:07 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] CI: Update to FreeBSD 14.2
Message-Id: <E1tIRup-00ChSG-2D@xenbits.xenproject.org>
Date: Tue, 03 Dec 2024 12:22:07 +0000

commit 0cc8845fb9fd4300313da49374b6c12346889f9a
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Tue Dec 3 08:14:46 2024 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Dec 3 12:20:41 2024 +0000

    CI: Update to FreeBSD 14.2
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    ---
    CC: Roger Pau Monné <roger.pau@citrix.com>
    CC: Anthony PERARD <anthony.perard@vates.tech>
    CC: Stefano Stabellini <sstabellini@kernel.org>
    
    https://cirrus-ci.com/task/5913096629256192
---
 .cirrus.yml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/.cirrus.yml b/.cirrus.yml
index 00e4c57678..4a120fad41 100644
--- a/.cirrus.yml
+++ b/.cirrus.yml
@@ -24,7 +24,7 @@ task:
 task:
   name: 'FreeBSD 14'
   freebsd_instance:
-    image_family: freebsd-14-1
+    image_family: freebsd-14-2
   << : *FREEBSD_TEMPLATE
 
 task:
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Dec 03 12:22:19 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 03 Dec 2024 12:22:19 +0000
Received: from list by lists.xenproject.org with outflank-mailman.848019.1263022 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tIRv1-0006Kw-MU; Tue, 03 Dec 2024 12:22:19 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 848019.1263022; Tue, 03 Dec 2024 12:22:19 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tIRv1-0006Ko-Jq; Tue, 03 Dec 2024 12:22:19 +0000
Received: by outflank-mailman (input) for mailman id 848019;
 Tue, 03 Dec 2024 12:22:17 +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 1tIRuz-0006Kg-U3
 for xen-changelog@lists.xenproject.org; Tue, 03 Dec 2024 12:22:17 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1tIRuz-001vcA-1w
 for xen-changelog@lists.xenproject.org;
 Tue, 03 Dec 2024 12:22:17 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1tIRuz-00ChTe-2f
 for xen-changelog@lists.xenproject.org;
 Tue, 03 Dec 2024 12:22:17 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] libs/guest: Fix migration compatibility with a security-patched Xen 4.13
Message-Id: <E1tIRuz-00ChTe-2f@xenbits.xenproject.org>
Date: Tue, 03 Dec 2024 12:22:17 +0000

commit 28301682f492c1df2ff9c3e01a0aab6262bd925a
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Mon Dec 2 17:27:05 2024 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Dec 3 12:20:41 2024 +0000

    libs/guest: Fix migration compatibility with a security-patched Xen 4.13
    
    xc_cpuid_apply_policy() provides compatibility for migration of a pre-4.14 VM
    where no CPUID data was provided in the stream.
    
    It guesses the various max-leaf limits, based on what was true at the time of
    writing, but this was not correctly adapted when speculative security issues
    forced the advertisement of new feature bits.  Of note are:
    
     * LFENCE-DISPATCH, in leaf 0x80000021.eax
     * BHI-CTRL, in leaf 0x7[2].edx
    
    In both cases, a VM booted on a security-patched Xen 4.13, and then migrated
    on to any newer version of Xen on the same or compatible hardware would have
    these features stripped back because Xen is still editing the cpu-policy for
    sanity behind the back of the toolstack.
    
    For VMs using BHI_DIS_S to mitigate Native-BHI, this resulted in a failure to
    restore the guests MSR_SPEC_CTRL setting:
    
      (XEN) HVM d7v0 load MSR 0x48 with value 0x401 failed
      (XEN) HVM7 restore: failed to load entry 20/0 rc -6
    
    Fixes: e9b4fe263649 ("x86/cpuid: support LFENCE always serialising CPUID bit")
    Fixes: f3709b15fc86 ("x86/cpuid: Infrastructure for cpuid word 7:2.edx")
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 tools/libs/guest/xg_cpuid_x86.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/tools/libs/guest/xg_cpuid_x86.c b/tools/libs/guest/xg_cpuid_x86.c
index 4453178100..263a9d4787 100644
--- a/tools/libs/guest/xg_cpuid_x86.c
+++ b/tools/libs/guest/xg_cpuid_x86.c
@@ -640,7 +640,8 @@ int xc_cpuid_apply_policy(xc_interface *xch, uint32_t domid, bool restore,
          *
          * This restore path is used for incoming VMs with no CPUID data
          * i.e. originated on Xen 4.13 or earlier.  We must invent a policy
-         * compatible with what Xen 4.13 would have done on the same hardware.
+         * compatible with what a security-patched Xen 4.13 would have done on
+         * the same hardware.
          *
          * Specifically:
          * - Clamp max leaves.
@@ -657,8 +658,8 @@ int xc_cpuid_apply_policy(xc_interface *xch, uint32_t domid, bool restore,
         }
 
         p->policy.basic.max_leaf = min(p->policy.basic.max_leaf, 0xdu);
-        p->policy.feat.max_subleaf = 0;
-        p->policy.extd.max_leaf = min(p->policy.extd.max_leaf, 0x8000001c);
+        p->policy.feat.max_subleaf = min(p->policy.feat.max_subleaf, 0x2u);
+        p->policy.extd.max_leaf = min(p->policy.extd.max_leaf, 0x80000021);
     }
 
     if ( featureset )
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Dec 03 12:22:29 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 03 Dec 2024 12:22:29 +0000
Received: from list by lists.xenproject.org with outflank-mailman.848020.1263026 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tIRvB-0006NQ-Nu; Tue, 03 Dec 2024 12:22:29 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 848020.1263026; Tue, 03 Dec 2024 12:22:29 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tIRvB-0006NI-LK; Tue, 03 Dec 2024 12:22:29 +0000
Received: by outflank-mailman (input) for mailman id 848020;
 Tue, 03 Dec 2024 12:22:28 +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 1tIRvA-0006N6-1m
 for xen-changelog@lists.xenproject.org; Tue, 03 Dec 2024 12:22:28 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1tIRv9-001vcE-2M
 for xen-changelog@lists.xenproject.org;
 Tue, 03 Dec 2024 12:22:28 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1tIRv9-00ChUf-34
 for xen-changelog@lists.xenproject.org;
 Tue, 03 Dec 2024 12:22:27 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] bootfdt: Add missing trailing commas in BOOTINFO_{ACPI,SHMEM}_INIT
Message-Id: <E1tIRv9-00ChUf-34@xenbits.xenproject.org>
Date: Tue, 03 Dec 2024 12:22:27 +0000

commit 5a455a52eae1420619df14c8e55fd17ced70538e
Author:     Michal Orzel <michal.orzel@amd.com>
AuthorDate: Tue Dec 3 10:22:14 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Dec 3 12:20:41 2024 +0000

    bootfdt: Add missing trailing commas in BOOTINFO_{ACPI,SHMEM}_INIT
    
    Commit a14593e3995a extended BOOTINFO_{ACPI,SHMEM}_INIT initializers
    list with a new 'type' member but forgot to add trailing commas (they
    were present before). This results in a build failure when building
    with CONFIG_ACPI=y and CONFIG_STATIC_SHM=y:
    ./include/xen/bootfdt.h:155:5: error: request for member 'shmem' in something not a structure or union
      155 |     .shmem.common.max_banks = NR_SHMEM_BANKS,       \
          |     ^
    ./include/xen/bootfdt.h:168:5: note: in expansion of macro 'BOOTINFO_SHMEM_INIT'
      168 |     BOOTINFO_SHMEM_INIT                             \
          |     ^~~~~~~~~~~~~~~~~~~
    common/device-tree/bootinfo.c:22:39: note: in expansion of macro 'BOOTINFO_INIT'
       22 | struct bootinfo __initdata bootinfo = BOOTINFO_INIT;
    
    Fixes: a14593e3995a ("xen/device-tree: Allow region overlapping with /memreserve/ ranges")
    Signed-off-by: Michal Orzel <michal.orzel@amd.com>
    Reviewed-by: Bertrand Marquis <bertrand.marquis@arm.com>
    Reviewed-by: Luca Fancellu <luca.fancellu@arm.com>
---
 xen/include/xen/bootfdt.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/xen/include/xen/bootfdt.h b/xen/include/xen/bootfdt.h
index cea40ee117..343c48b73d 100644
--- a/xen/include/xen/bootfdt.h
+++ b/xen/include/xen/bootfdt.h
@@ -145,7 +145,7 @@ struct bootinfo {
 #ifdef CONFIG_ACPI
 #define BOOTINFO_ACPI_INIT                          \
     .acpi.common.max_banks = NR_MEM_BANKS,          \
-    .acpi.common.type = MEMORY
+    .acpi.common.type = MEMORY,
 #else
 #define BOOTINFO_ACPI_INIT
 #endif
@@ -153,7 +153,7 @@ struct bootinfo {
 #ifdef CONFIG_STATIC_SHM
 #define BOOTINFO_SHMEM_INIT                         \
     .shmem.common.max_banks = NR_SHMEM_BANKS,       \
-    .shmem.common.type = STATIC_SHARED_MEMORY
+    .shmem.common.type = STATIC_SHARED_MEMORY,
 #else
 #define BOOTINFO_SHMEM_INIT
 #endif
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Dec 03 13:55:07 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 03 Dec 2024 13:55:07 +0000
Received: from list by lists.xenproject.org with outflank-mailman.848043.1263050 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tITMl-0000x1-D4; Tue, 03 Dec 2024 13:55:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 848043.1263050; Tue, 03 Dec 2024 13:55:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tITMl-0000wt-AM; Tue, 03 Dec 2024 13:55:03 +0000
Received: by outflank-mailman (input) for mailman id 848043;
 Tue, 03 Dec 2024 13: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 1tITMj-0000wn-FL
 for xen-changelog@lists.xenproject.org; Tue, 03 Dec 2024 13:55:01 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1tITMj-001xTc-0T
 for xen-changelog@lists.xenproject.org;
 Tue, 03 Dec 2024 13:55:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1tITMj-00CqkM-1I
 for xen-changelog@lists.xenproject.org;
 Tue, 03 Dec 2024 13:55:01 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] CI: Update to FreeBSD 14.2
Message-Id: <E1tITMj-00CqkM-1I@xenbits.xenproject.org>
Date: Tue, 03 Dec 2024 13:55:01 +0000

commit 0cc8845fb9fd4300313da49374b6c12346889f9a
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Tue Dec 3 08:14:46 2024 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Dec 3 12:20:41 2024 +0000

    CI: Update to FreeBSD 14.2
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    ---
    CC: Roger Pau Monné <roger.pau@citrix.com>
    CC: Anthony PERARD <anthony.perard@vates.tech>
    CC: Stefano Stabellini <sstabellini@kernel.org>
    
    https://cirrus-ci.com/task/5913096629256192
---
 .cirrus.yml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/.cirrus.yml b/.cirrus.yml
index 00e4c57678..4a120fad41 100644
--- a/.cirrus.yml
+++ b/.cirrus.yml
@@ -24,7 +24,7 @@ task:
 task:
   name: 'FreeBSD 14'
   freebsd_instance:
-    image_family: freebsd-14-1
+    image_family: freebsd-14-2
   << : *FREEBSD_TEMPLATE
 
 task:
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Dec 03 13:55:13 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 03 Dec 2024 13:55:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.848044.1263053 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tITMv-0000z4-EG; Tue, 03 Dec 2024 13:55:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 848044.1263053; Tue, 03 Dec 2024 13:55:13 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tITMv-0000yw-Bm; Tue, 03 Dec 2024 13:55:13 +0000
Received: by outflank-mailman (input) for mailman id 848044;
 Tue, 03 Dec 2024 13: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 1tITMt-0000ym-JA
 for xen-changelog@lists.xenproject.org; Tue, 03 Dec 2024 13:55:11 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1tITMt-001xTi-0r
 for xen-changelog@lists.xenproject.org;
 Tue, 03 Dec 2024 13:55:11 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1tITMt-00CqlC-1c
 for xen-changelog@lists.xenproject.org;
 Tue, 03 Dec 2024 13: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>
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] libs/guest: Fix migration compatibility with a security-patched Xen 4.13
Message-Id: <E1tITMt-00CqlC-1c@xenbits.xenproject.org>
Date: Tue, 03 Dec 2024 13:55:11 +0000

commit 28301682f492c1df2ff9c3e01a0aab6262bd925a
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Mon Dec 2 17:27:05 2024 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Dec 3 12:20:41 2024 +0000

    libs/guest: Fix migration compatibility with a security-patched Xen 4.13
    
    xc_cpuid_apply_policy() provides compatibility for migration of a pre-4.14 VM
    where no CPUID data was provided in the stream.
    
    It guesses the various max-leaf limits, based on what was true at the time of
    writing, but this was not correctly adapted when speculative security issues
    forced the advertisement of new feature bits.  Of note are:
    
     * LFENCE-DISPATCH, in leaf 0x80000021.eax
     * BHI-CTRL, in leaf 0x7[2].edx
    
    In both cases, a VM booted on a security-patched Xen 4.13, and then migrated
    on to any newer version of Xen on the same or compatible hardware would have
    these features stripped back because Xen is still editing the cpu-policy for
    sanity behind the back of the toolstack.
    
    For VMs using BHI_DIS_S to mitigate Native-BHI, this resulted in a failure to
    restore the guests MSR_SPEC_CTRL setting:
    
      (XEN) HVM d7v0 load MSR 0x48 with value 0x401 failed
      (XEN) HVM7 restore: failed to load entry 20/0 rc -6
    
    Fixes: e9b4fe263649 ("x86/cpuid: support LFENCE always serialising CPUID bit")
    Fixes: f3709b15fc86 ("x86/cpuid: Infrastructure for cpuid word 7:2.edx")
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 tools/libs/guest/xg_cpuid_x86.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/tools/libs/guest/xg_cpuid_x86.c b/tools/libs/guest/xg_cpuid_x86.c
index 4453178100..263a9d4787 100644
--- a/tools/libs/guest/xg_cpuid_x86.c
+++ b/tools/libs/guest/xg_cpuid_x86.c
@@ -640,7 +640,8 @@ int xc_cpuid_apply_policy(xc_interface *xch, uint32_t domid, bool restore,
          *
          * This restore path is used for incoming VMs with no CPUID data
          * i.e. originated on Xen 4.13 or earlier.  We must invent a policy
-         * compatible with what Xen 4.13 would have done on the same hardware.
+         * compatible with what a security-patched Xen 4.13 would have done on
+         * the same hardware.
          *
          * Specifically:
          * - Clamp max leaves.
@@ -657,8 +658,8 @@ int xc_cpuid_apply_policy(xc_interface *xch, uint32_t domid, bool restore,
         }
 
         p->policy.basic.max_leaf = min(p->policy.basic.max_leaf, 0xdu);
-        p->policy.feat.max_subleaf = 0;
-        p->policy.extd.max_leaf = min(p->policy.extd.max_leaf, 0x8000001c);
+        p->policy.feat.max_subleaf = min(p->policy.feat.max_subleaf, 0x2u);
+        p->policy.extd.max_leaf = min(p->policy.extd.max_leaf, 0x80000021);
     }
 
     if ( featureset )
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Dec 03 13:55:23 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 03 Dec 2024 13:55:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.848045.1263058 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tITN5-00011M-Ff; Tue, 03 Dec 2024 13:55:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 848045.1263058; Tue, 03 Dec 2024 13:55:23 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tITN5-00011E-DD; Tue, 03 Dec 2024 13:55:23 +0000
Received: by outflank-mailman (input) for mailman id 848045;
 Tue, 03 Dec 2024 13: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 1tITN3-000112-Mw
 for xen-changelog@lists.xenproject.org; Tue, 03 Dec 2024 13:55:21 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1tITN3-001xTm-1C
 for xen-changelog@lists.xenproject.org;
 Tue, 03 Dec 2024 13:55:21 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1tITN3-00Cqlu-1z
 for xen-changelog@lists.xenproject.org;
 Tue, 03 Dec 2024 13: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>
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] bootfdt: Add missing trailing commas in BOOTINFO_{ACPI,SHMEM}_INIT
Message-Id: <E1tITN3-00Cqlu-1z@xenbits.xenproject.org>
Date: Tue, 03 Dec 2024 13:55:21 +0000

commit 5a455a52eae1420619df14c8e55fd17ced70538e
Author:     Michal Orzel <michal.orzel@amd.com>
AuthorDate: Tue Dec 3 10:22:14 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Dec 3 12:20:41 2024 +0000

    bootfdt: Add missing trailing commas in BOOTINFO_{ACPI,SHMEM}_INIT
    
    Commit a14593e3995a extended BOOTINFO_{ACPI,SHMEM}_INIT initializers
    list with a new 'type' member but forgot to add trailing commas (they
    were present before). This results in a build failure when building
    with CONFIG_ACPI=y and CONFIG_STATIC_SHM=y:
    ./include/xen/bootfdt.h:155:5: error: request for member 'shmem' in something not a structure or union
      155 |     .shmem.common.max_banks = NR_SHMEM_BANKS,       \
          |     ^
    ./include/xen/bootfdt.h:168:5: note: in expansion of macro 'BOOTINFO_SHMEM_INIT'
      168 |     BOOTINFO_SHMEM_INIT                             \
          |     ^~~~~~~~~~~~~~~~~~~
    common/device-tree/bootinfo.c:22:39: note: in expansion of macro 'BOOTINFO_INIT'
       22 | struct bootinfo __initdata bootinfo = BOOTINFO_INIT;
    
    Fixes: a14593e3995a ("xen/device-tree: Allow region overlapping with /memreserve/ ranges")
    Signed-off-by: Michal Orzel <michal.orzel@amd.com>
    Reviewed-by: Bertrand Marquis <bertrand.marquis@arm.com>
    Reviewed-by: Luca Fancellu <luca.fancellu@arm.com>
---
 xen/include/xen/bootfdt.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/xen/include/xen/bootfdt.h b/xen/include/xen/bootfdt.h
index cea40ee117..343c48b73d 100644
--- a/xen/include/xen/bootfdt.h
+++ b/xen/include/xen/bootfdt.h
@@ -145,7 +145,7 @@ struct bootinfo {
 #ifdef CONFIG_ACPI
 #define BOOTINFO_ACPI_INIT                          \
     .acpi.common.max_banks = NR_MEM_BANKS,          \
-    .acpi.common.type = MEMORY
+    .acpi.common.type = MEMORY,
 #else
 #define BOOTINFO_ACPI_INIT
 #endif
@@ -153,7 +153,7 @@ struct bootinfo {
 #ifdef CONFIG_STATIC_SHM
 #define BOOTINFO_SHMEM_INIT                         \
     .shmem.common.max_banks = NR_SHMEM_BANKS,       \
-    .shmem.common.type = STATIC_SHARED_MEMORY
+    .shmem.common.type = STATIC_SHARED_MEMORY,
 #else
 #define BOOTINFO_SHMEM_INIT
 #endif
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Dec 04 07:55:21 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 04 Dec 2024 07:55:21 +0000
Received: from list by lists.xenproject.org with outflank-mailman.848323.1263239 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tIkE1-0007Jl-Qi; Wed, 04 Dec 2024 07:55:09 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 848323.1263239; Wed, 04 Dec 2024 07:55:09 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tIkE1-0007Je-OH; Wed, 04 Dec 2024 07:55:09 +0000
Received: by outflank-mailman (input) for mailman id 848323;
 Wed, 04 Dec 2024 07:55:08 +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 1tIkE0-0007JY-KN
 for xen-changelog@lists.xenproject.org; Wed, 04 Dec 2024 07:55:08 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1tIkDz-003WOa-3B
 for xen-changelog@lists.xenproject.org;
 Wed, 04 Dec 2024 07:55:08 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1tIkE0-00EgcQ-0V
 for xen-changelog@lists.xenproject.org;
 Wed, 04 Dec 2024 07:55:08 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.19] update Xen version to 4.19.1
Message-Id: <E1tIkE0-00EgcQ-0V@xenbits.xenproject.org>
Date: Wed, 04 Dec 2024 07:55:08 +0000

commit ccf400846780289ae779c62ef0c94757ff43bb60
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Wed Dec 4 08:52:37 2024 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Dec 4 08:52:37 2024 +0100

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

diff --git a/Config.mk b/Config.mk
index 531e782fcd..ca6a96155c 100644
--- a/Config.mk
+++ b/Config.mk
@@ -221,10 +221,10 @@ OVMF_UPSTREAM_URL ?= https://xenbits.xen.org/git-http/ovmf.git
 OVMF_UPSTREAM_REVISION ?= ba91d0292e593df8528b66f99c1b0b14fadc8e16
 
 QEMU_UPSTREAM_URL ?= https://xenbits.xen.org/git-http/qemu-xen.git
-QEMU_UPSTREAM_REVISION ?= qemu-xen-4.19.0
+QEMU_UPSTREAM_REVISION ?= qemu-xen-4.19.1
 
 MINIOS_UPSTREAM_URL ?= https://xenbits.xen.org/git-http/mini-os.git
-MINIOS_UPSTREAM_REVISION ?= a400dd51706867565ed1382b23d3475bb30668c2
+MINIOS_UPSTREAM_REVISION ?= xen-RELEASE-4.19.1
 
 SEABIOS_UPSTREAM_URL ?= https://xenbits.xen.org/git-http/seabios.git
 SEABIOS_UPSTREAM_REVISION ?= rel-1.16.3
diff --git a/xen/Makefile b/xen/Makefile
index 59dac504b3..0a942894dd 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    = 19
-export XEN_EXTRAVERSION ?= .1-pre$(XEN_VENDORVERSION)
+export XEN_EXTRAVERSION ?= .1$(XEN_VENDORVERSION)
 export XEN_FULLVERSION   = $(XEN_VERSION).$(XEN_SUBVERSION)$(XEN_EXTRAVERSION)
 -include xen-version
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.19


From xen-changelog-bounces@lists.xenproject.org Wed Dec 04 08:44:07 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 04 Dec 2024 08:44:07 +0000
Received: from list by lists.xenproject.org with outflank-mailman.848438.1263320 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tIkzL-0001Ci-EX; Wed, 04 Dec 2024 08:44:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 848438.1263320; Wed, 04 Dec 2024 08:44:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tIkzL-0001CZ-Bt; Wed, 04 Dec 2024 08:44:03 +0000
Received: by outflank-mailman (input) for mailman id 848438;
 Wed, 04 Dec 2024 08: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 1tIkzK-0001CT-7f
 for xen-changelog@lists.xenproject.org; Wed, 04 Dec 2024 08:44:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1tIkzJ-003Xw8-2C
 for xen-changelog@lists.xenproject.org;
 Wed, 04 Dec 2024 08:44:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1tIkzJ-00ElS9-2t
 for xen-changelog@lists.xenproject.org;
 Wed, 04 Dec 2024 08:44:01 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.19] update Xen version to 4.19.1
Message-Id: <E1tIkzJ-00ElS9-2t@xenbits.xenproject.org>
Date: Wed, 04 Dec 2024 08:44:01 +0000

commit ccf400846780289ae779c62ef0c94757ff43bb60
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Wed Dec 4 08:52:37 2024 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Dec 4 08:52:37 2024 +0100

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

diff --git a/Config.mk b/Config.mk
index 531e782fcd..ca6a96155c 100644
--- a/Config.mk
+++ b/Config.mk
@@ -221,10 +221,10 @@ OVMF_UPSTREAM_URL ?= https://xenbits.xen.org/git-http/ovmf.git
 OVMF_UPSTREAM_REVISION ?= ba91d0292e593df8528b66f99c1b0b14fadc8e16
 
 QEMU_UPSTREAM_URL ?= https://xenbits.xen.org/git-http/qemu-xen.git
-QEMU_UPSTREAM_REVISION ?= qemu-xen-4.19.0
+QEMU_UPSTREAM_REVISION ?= qemu-xen-4.19.1
 
 MINIOS_UPSTREAM_URL ?= https://xenbits.xen.org/git-http/mini-os.git
-MINIOS_UPSTREAM_REVISION ?= a400dd51706867565ed1382b23d3475bb30668c2
+MINIOS_UPSTREAM_REVISION ?= xen-RELEASE-4.19.1
 
 SEABIOS_UPSTREAM_URL ?= https://xenbits.xen.org/git-http/seabios.git
 SEABIOS_UPSTREAM_REVISION ?= rel-1.16.3
diff --git a/xen/Makefile b/xen/Makefile
index 59dac504b3..0a942894dd 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    = 19
-export XEN_EXTRAVERSION ?= .1-pre$(XEN_VENDORVERSION)
+export XEN_EXTRAVERSION ?= .1$(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.19


From xen-changelog-bounces@lists.xenproject.org Wed Dec 04 11:22:18 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 04 Dec 2024 11:22:18 +0000
Received: from list by lists.xenproject.org with outflank-mailman.848541.1263393 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tInSL-0007mQ-UI; Wed, 04 Dec 2024 11:22:09 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 848541.1263393; Wed, 04 Dec 2024 11:22:09 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tInSL-0007mI-Rh; Wed, 04 Dec 2024 11:22:09 +0000
Received: by outflank-mailman (input) for mailman id 848541;
 Wed, 04 Dec 2024 11:22:08 +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 1tInSK-0007mC-5N
 for xen-changelog@lists.xenproject.org; Wed, 04 Dec 2024 11:22:08 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1tInSJ-003bA3-2h
 for xen-changelog@lists.xenproject.org;
 Wed, 04 Dec 2024 11:22:08 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1tInSK-00F2Ou-0F
 for xen-changelog@lists.xenproject.org;
 Wed, 04 Dec 2024 11:22:08 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.16] update Xen version to 4.16.7
Message-Id: <E1tInSK-00F2Ou-0F@xenbits.xenproject.org>
Date: Wed, 04 Dec 2024 11:22:08 +0000

commit b15e1f07954949759dfb355c0c4045ba58b8376a
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Wed Dec 4 12:11:49 2024 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Dec 4 12:11:49 2024 +0100

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

diff --git a/Config.mk b/Config.mk
index 21a0e231a0..7240f1aaa0 100644
--- a/Config.mk
+++ b/Config.mk
@@ -239,7 +239,7 @@ MINIOS_UPSTREAM_URL ?= git://xenbits.xen.org/mini-os.git
 endif
 OVMF_UPSTREAM_REVISION ?= 7b4a99be8a39c12d3a7fc4b8db9f0eab4ac688d5
 QEMU_UPSTREAM_REVISION ?= qemu-xen-4.16.5
-MINIOS_UPSTREAM_REVISION ?= a60612a2d009bf72b3e50655d13f61d152fe3d87
+MINIOS_UPSTREAM_REVISION ?= xen-RELEASE-4.16.7
 
 SEABIOS_UPSTREAM_REVISION ?= rel-1.16.0
 
diff --git a/xen/Makefile b/xen/Makefile
index cd10d93c0b..630d0fe463 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 ?= .6$(XEN_VENDORVERSION)
+export XEN_EXTRAVERSION ?= .7$(XEN_VENDORVERSION)
 export XEN_FULLVERSION   = $(XEN_VERSION).$(XEN_SUBVERSION)$(XEN_EXTRAVERSION)
 -include xen-version
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.16


From xen-changelog-bounces@lists.xenproject.org Wed Dec 04 12:00:08 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 04 Dec 2024 12:00:08 +0000
Received: from list by lists.xenproject.org with outflank-mailman.848545.1263399 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tIo31-0003hu-Qi; Wed, 04 Dec 2024 12:00:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 848545.1263399; Wed, 04 Dec 2024 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 1tIo31-0003hY-N9; Wed, 04 Dec 2024 12:00:03 +0000
Received: by outflank-mailman (input) for mailman id 848545;
 Wed, 04 Dec 2024 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 1tIo30-0003MC-4u
 for xen-changelog@lists.xenproject.org; Wed, 04 Dec 2024 12:00:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1tIo2z-003bu4-29
 for xen-changelog@lists.xenproject.org;
 Wed, 04 Dec 2024 12:00:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1tIo2z-00F5xe-2w
 for xen-changelog@lists.xenproject.org;
 Wed, 04 Dec 2024 12: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>
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.7
Message-Id: <E1tIo2z-00F5xe-2w@xenbits.xenproject.org>
Date: Wed, 04 Dec 2024 12:00:01 +0000

commit b15e1f07954949759dfb355c0c4045ba58b8376a
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Wed Dec 4 12:11:49 2024 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Dec 4 12:11:49 2024 +0100

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

diff --git a/Config.mk b/Config.mk
index 21a0e231a0..7240f1aaa0 100644
--- a/Config.mk
+++ b/Config.mk
@@ -239,7 +239,7 @@ MINIOS_UPSTREAM_URL ?= git://xenbits.xen.org/mini-os.git
 endif
 OVMF_UPSTREAM_REVISION ?= 7b4a99be8a39c12d3a7fc4b8db9f0eab4ac688d5
 QEMU_UPSTREAM_REVISION ?= qemu-xen-4.16.5
-MINIOS_UPSTREAM_REVISION ?= a60612a2d009bf72b3e50655d13f61d152fe3d87
+MINIOS_UPSTREAM_REVISION ?= xen-RELEASE-4.16.7
 
 SEABIOS_UPSTREAM_REVISION ?= rel-1.16.0
 
diff --git a/xen/Makefile b/xen/Makefile
index cd10d93c0b..630d0fe463 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 ?= .6$(XEN_VENDORVERSION)
+export XEN_EXTRAVERSION ?= .7$(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 Thu Dec 05 19:33:15 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 05 Dec 2024 19:33:15 +0000
Received: from list by lists.xenproject.org with outflank-mailman.849261.1263890 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tJHb3-0002Xg-EN; Thu, 05 Dec 2024 19:33:09 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 849261.1263890; Thu, 05 Dec 2024 19:33:09 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tJHb3-0002XY-Bv; Thu, 05 Dec 2024 19:33:09 +0000
Received: by outflank-mailman (input) for mailman id 849261;
 Thu, 05 Dec 2024 19:33:07 +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 1tJHb1-0002XL-RO
 for xen-changelog@lists.xenproject.org; Thu, 05 Dec 2024 19:33:07 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1tJHb1-005Tr5-14
 for xen-changelog@lists.xenproject.org;
 Thu, 05 Dec 2024 19:33:07 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1tJHb1-000jfC-1j
 for xen-changelog@lists.xenproject.org;
 Thu, 05 Dec 2024 19:33:07 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] tools/xl: add suspend and resume subcommands
Message-Id: <E1tJHb1-000jfC-1j@xenbits.xenproject.org>
Date: Thu, 05 Dec 2024 19:33:07 +0000

commit dc8e1b33a525d31989c0d1ffe6ae7794484e1d99
Author:     zithro / Cyril Rébert <slack@rabbit.lu>
AuthorDate: Tue Dec 3 17:06:41 2024 -0500
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Dec 5 19:28:44 2024 +0000

    tools/xl: add suspend and resume subcommands
    
    The xl command doesn't provide suspend/resume, so add them :
      xl suspend <Domain>
      xl resume <Domain>
    
    This patch follows a discussion on XenDevel: when you want the
    virtualized equivalent of "sleep"-ing a host, it's better to
    suspend/resume than to pause/unpause a domain.
    
    Suggested-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Suggested-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
    Signed-off-by: Cyril Rébert (zithro) <slack@rabbit.lu>
    Signed-off-by: Jason Andryuk <jason.andryuk@amd.com>
    Reviewed-by: Anthony PERARD <anthony.perard@vates.tech>
---
 docs/man/xl.1.pod.in    | 12 ++++++++++++
 tools/xl/xl.h           |  2 ++
 tools/xl/xl_cmdtable.c  | 10 ++++++++++
 tools/xl/xl_vmcontrol.c | 38 ++++++++++++++++++++++++++++++++++++++
 4 files changed, 62 insertions(+)

diff --git a/docs/man/xl.1.pod.in b/docs/man/xl.1.pod.in
index bed8393473..fe38724b2b 100644
--- a/docs/man/xl.1.pod.in
+++ b/docs/man/xl.1.pod.in
@@ -682,6 +682,10 @@ Pass the VNC password to vncviewer via stdin.
 
 =back
 
+=item B<resume> I<domain-id>
+
+Resume a domain, after having been suspended.
+
 =item B<save> [I<OPTIONS>] I<domain-id> I<checkpointfile> [I<configfile>]
 
 Saves a running domain to a state file so that it can be restored
@@ -760,6 +764,14 @@ in response to this event.
 
 =back
 
+=item B<suspend> I<domain-id>
+
+Suspend a domain.  This is a cooperative operation where the domain must
+respond to the xenstore trigger.  When in a suspended state the domain
+still consumes allocated resources (such as memory), but is not eligible
+for scheduling by the Xen hypervisor.  It is in a shutdown state, but
+not dying.
+
 =item B<sysrq> I<domain-id> I<letter>
 
 Send a <Magic System Request> to the domain, each type of request is
diff --git a/tools/xl/xl.h b/tools/xl/xl.h
index 967d034cfe..45745f0dbb 100644
--- a/tools/xl/xl.h
+++ b/tools/xl/xl.h
@@ -129,6 +129,8 @@ int main_restore(int argc, char **argv);
 int main_migrate_receive(int argc, char **argv);
 int main_save(int argc, char **argv);
 int main_migrate(int argc, char **argv);
+int main_suspend(int argc, char **argv);
+int main_resume(int argc, char **argv);
 #endif
 int main_dump_core(int argc, char **argv);
 int main_pause(int argc, char **argv);
diff --git a/tools/xl/xl_cmdtable.c b/tools/xl/xl_cmdtable.c
index 53fc22d344..06a0039718 100644
--- a/tools/xl/xl_cmdtable.c
+++ b/tools/xl/xl_cmdtable.c
@@ -193,6 +193,16 @@ const struct cmd_spec cmd_table[] = {
       "Restore a domain from a saved state",
       "- for internal use only",
     },
+    { "suspend",
+      &main_suspend, 0, 1,
+      "Suspend a domain to RAM",
+      "<Domain>",
+    },
+    { "resume",
+      &main_resume, 0, 1,
+      "Resume a domain from RAM",
+      "<Domain>",
+    },
 #endif
     { "dump-core",
       &main_dump_core, 0, 1,
diff --git a/tools/xl/xl_vmcontrol.c b/tools/xl/xl_vmcontrol.c
index c45d497c28..c813732838 100644
--- a/tools/xl/xl_vmcontrol.c
+++ b/tools/xl/xl_vmcontrol.c
@@ -32,6 +32,44 @@
 
 static int fd_lock = -1;
 
+#ifndef LIBXL_HAVE_NO_SUSPEND_RESUME
+static void suspend_domain(uint32_t domid)
+{
+    libxl_domain_suspend_only(ctx, domid, NULL);
+}
+
+static void resume_domain(uint32_t domid)
+{
+    libxl_domain_resume(ctx, domid, 1, NULL);
+}
+
+int main_suspend(int argc, char **argv)
+{
+    int opt;
+
+    SWITCH_FOREACH_OPT(opt, "", NULL, "suspend", 1) {
+        /* No options */
+    }
+
+    suspend_domain(find_domain(argv[optind]));
+
+    return EXIT_SUCCESS;
+}
+
+int main_resume(int argc, char **argv)
+{
+    int opt;
+
+    SWITCH_FOREACH_OPT(opt, "", NULL, "resume", 1) {
+        /* No options */
+    }
+
+    resume_domain(find_domain(argv[optind]));
+
+    return EXIT_SUCCESS;
+}
+#endif
+
 static void pause_domain(uint32_t domid)
 {
     libxl_domain_pause(ctx, domid, NULL);
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Dec 05 20:22:07 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 05 Dec 2024 20:22:07 +0000
Received: from list by lists.xenproject.org with outflank-mailman.849286.1263914 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tJIMM-0001RW-7j; Thu, 05 Dec 2024 20:22:02 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 849286.1263914; Thu, 05 Dec 2024 20: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 1tJIMM-0001RP-5A; Thu, 05 Dec 2024 20:22:02 +0000
Received: by outflank-mailman (input) for mailman id 849286;
 Thu, 05 Dec 2024 20:22: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 1tJIML-0001RJ-Mu
 for xen-changelog@lists.xenproject.org; Thu, 05 Dec 2024 20:22:01 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1tJIML-005UoT-0u
 for xen-changelog@lists.xenproject.org;
 Thu, 05 Dec 2024 20:22:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1tJIML-000osN-1a
 for xen-changelog@lists.xenproject.org;
 Thu, 05 Dec 2024 20: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>
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools/xl: add suspend and resume subcommands
Message-Id: <E1tJIML-000osN-1a@xenbits.xenproject.org>
Date: Thu, 05 Dec 2024 20:22:01 +0000

commit dc8e1b33a525d31989c0d1ffe6ae7794484e1d99
Author:     zithro / Cyril Rébert <slack@rabbit.lu>
AuthorDate: Tue Dec 3 17:06:41 2024 -0500
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Dec 5 19:28:44 2024 +0000

    tools/xl: add suspend and resume subcommands
    
    The xl command doesn't provide suspend/resume, so add them :
      xl suspend <Domain>
      xl resume <Domain>
    
    This patch follows a discussion on XenDevel: when you want the
    virtualized equivalent of "sleep"-ing a host, it's better to
    suspend/resume than to pause/unpause a domain.
    
    Suggested-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Suggested-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
    Signed-off-by: Cyril Rébert (zithro) <slack@rabbit.lu>
    Signed-off-by: Jason Andryuk <jason.andryuk@amd.com>
    Reviewed-by: Anthony PERARD <anthony.perard@vates.tech>
---
 docs/man/xl.1.pod.in    | 12 ++++++++++++
 tools/xl/xl.h           |  2 ++
 tools/xl/xl_cmdtable.c  | 10 ++++++++++
 tools/xl/xl_vmcontrol.c | 38 ++++++++++++++++++++++++++++++++++++++
 4 files changed, 62 insertions(+)

diff --git a/docs/man/xl.1.pod.in b/docs/man/xl.1.pod.in
index bed8393473..fe38724b2b 100644
--- a/docs/man/xl.1.pod.in
+++ b/docs/man/xl.1.pod.in
@@ -682,6 +682,10 @@ Pass the VNC password to vncviewer via stdin.
 
 =back
 
+=item B<resume> I<domain-id>
+
+Resume a domain, after having been suspended.
+
 =item B<save> [I<OPTIONS>] I<domain-id> I<checkpointfile> [I<configfile>]
 
 Saves a running domain to a state file so that it can be restored
@@ -760,6 +764,14 @@ in response to this event.
 
 =back
 
+=item B<suspend> I<domain-id>
+
+Suspend a domain.  This is a cooperative operation where the domain must
+respond to the xenstore trigger.  When in a suspended state the domain
+still consumes allocated resources (such as memory), but is not eligible
+for scheduling by the Xen hypervisor.  It is in a shutdown state, but
+not dying.
+
 =item B<sysrq> I<domain-id> I<letter>
 
 Send a <Magic System Request> to the domain, each type of request is
diff --git a/tools/xl/xl.h b/tools/xl/xl.h
index 967d034cfe..45745f0dbb 100644
--- a/tools/xl/xl.h
+++ b/tools/xl/xl.h
@@ -129,6 +129,8 @@ int main_restore(int argc, char **argv);
 int main_migrate_receive(int argc, char **argv);
 int main_save(int argc, char **argv);
 int main_migrate(int argc, char **argv);
+int main_suspend(int argc, char **argv);
+int main_resume(int argc, char **argv);
 #endif
 int main_dump_core(int argc, char **argv);
 int main_pause(int argc, char **argv);
diff --git a/tools/xl/xl_cmdtable.c b/tools/xl/xl_cmdtable.c
index 53fc22d344..06a0039718 100644
--- a/tools/xl/xl_cmdtable.c
+++ b/tools/xl/xl_cmdtable.c
@@ -193,6 +193,16 @@ const struct cmd_spec cmd_table[] = {
       "Restore a domain from a saved state",
       "- for internal use only",
     },
+    { "suspend",
+      &main_suspend, 0, 1,
+      "Suspend a domain to RAM",
+      "<Domain>",
+    },
+    { "resume",
+      &main_resume, 0, 1,
+      "Resume a domain from RAM",
+      "<Domain>",
+    },
 #endif
     { "dump-core",
       &main_dump_core, 0, 1,
diff --git a/tools/xl/xl_vmcontrol.c b/tools/xl/xl_vmcontrol.c
index c45d497c28..c813732838 100644
--- a/tools/xl/xl_vmcontrol.c
+++ b/tools/xl/xl_vmcontrol.c
@@ -32,6 +32,44 @@
 
 static int fd_lock = -1;
 
+#ifndef LIBXL_HAVE_NO_SUSPEND_RESUME
+static void suspend_domain(uint32_t domid)
+{
+    libxl_domain_suspend_only(ctx, domid, NULL);
+}
+
+static void resume_domain(uint32_t domid)
+{
+    libxl_domain_resume(ctx, domid, 1, NULL);
+}
+
+int main_suspend(int argc, char **argv)
+{
+    int opt;
+
+    SWITCH_FOREACH_OPT(opt, "", NULL, "suspend", 1) {
+        /* No options */
+    }
+
+    suspend_domain(find_domain(argv[optind]));
+
+    return EXIT_SUCCESS;
+}
+
+int main_resume(int argc, char **argv)
+{
+    int opt;
+
+    SWITCH_FOREACH_OPT(opt, "", NULL, "resume", 1) {
+        /* No options */
+    }
+
+    resume_domain(find_domain(argv[optind]));
+
+    return EXIT_SUCCESS;
+}
+#endif
+
 static void pause_domain(uint32_t domid)
 {
     libxl_domain_pause(ctx, domid, NULL);
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Dec 06 19:11:15 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 06 Dec 2024 19:11:15 +0000
Received: from list by lists.xenproject.org with outflank-mailman.850416.1264824 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tJdjJ-0005eo-BF; Fri, 06 Dec 2024 19:11:09 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 850416.1264824; Fri, 06 Dec 2024 19:11:09 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tJdjJ-0005eg-8I; Fri, 06 Dec 2024 19:11:09 +0000
Received: by outflank-mailman (input) for mailman id 850416;
 Fri, 06 Dec 2024 19:11:08 +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 1tJdjH-0005eS-VA
 for xen-changelog@lists.xenproject.org; Fri, 06 Dec 2024 19:11:07 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1tJdjH-0079sa-1N
 for xen-changelog@lists.xenproject.org;
 Fri, 06 Dec 2024 19:11:07 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1tJdjH-0031NK-27
 for xen-changelog@lists.xenproject.org;
 Fri, 06 Dec 2024 19:11:07 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/mpu: Map early uart when earlyprintk on
Message-Id: <E1tJdjH-0031NK-27@xenbits.xenproject.org>
Date: Fri, 06 Dec 2024 19:11:07 +0000

commit 214f9cc67b8cd179df0f5ab460413e9be46ff148
Author:     Ayan Kumar Halder <ayan.kumar.halder@amd.com>
AuthorDate: Wed Dec 4 17:22:42 2024 +0000
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Fri Dec 6 19:06:27 2024 +0000

    xen/mpu: Map early uart when earlyprintk on
    
    CONFIG_EARLY_UART_SIZE is introduced to let user provide physical size of
    early UART. Unlike MMU where we map a page in the virtual address space,
    here we need to know the exact physical size to be mapped.
    As VA == PA in case of MPU, the memory layout follows exactly the hardware
    configuration. As a consequence, we set  EARLY_UART_VIRTUAL_ADDRESS as physical
    address.
    
    EARLY_UART_BASE_ADDRESS and EARLY_UART_SIZE should be aligned to the minimum
    size of MPU region (ie 64 bits) as per the hardware restrictions. Refer ARM
    DDI 0600A.d ID120821 A1.3 "A minimum protection region size of 64 bytes.".
    
    UART is mapped as nGnRE region (as specified by ATTR=100 , refer G1.3.13,
    MAIR_EL2, "---0100 Device memory nGnRE"). Also, it is mapped as outer shareable,
    RW at EL2 only and execution of instructions from the region is not permitted.
    
    Signed-off-by: Ayan Kumar Halder <ayan.kumar.halder@amd.com>
    Reviewed-by: Luca Fancellu <luca.fancellu@arm.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
---
 xen/arch/arm/Kconfig.debug              |  7 +++++++
 xen/arch/arm/arm64/mpu/head.S           | 10 ++++++++++
 xen/arch/arm/include/asm/early_printk.h | 28 +++++++++++++++++++++++++++-
 3 files changed, 44 insertions(+), 1 deletion(-)

diff --git a/xen/arch/arm/Kconfig.debug b/xen/arch/arm/Kconfig.debug
index 7660e599c0..84a0616102 100644
--- a/xen/arch/arm/Kconfig.debug
+++ b/xen/arch/arm/Kconfig.debug
@@ -121,6 +121,13 @@ config EARLY_UART_BASE_ADDRESS
 	hex "Early printk, physical base address of debug UART"
 	range 0x0 0xffffffff if ARM_32
 
+config EARLY_UART_SIZE
+       depends on EARLY_PRINTK
+       depends on MPU
+       hex "Early printk, physical size of debug UART"
+       range 0x0 0xffffffff if ARM_32
+       default 0x1000
+
 config EARLY_UART_PL011_BAUD_RATE
 	depends on EARLY_UART_PL011
 	int "Early printk UART baud rate for pl011"
diff --git a/xen/arch/arm/arm64/mpu/head.S b/xen/arch/arm/arm64/mpu/head.S
index d3db5e53af..e4f2021f45 100644
--- a/xen/arch/arm/arm64/mpu/head.S
+++ b/xen/arch/arm/arm64/mpu/head.S
@@ -4,6 +4,7 @@
  */
 
 #include <asm/arm64/mpu.h>
+#include <asm/early_printk.h>
 
 /* Backgroud region enable/disable */
 #define SCTLR_ELx_BR    BIT(17, UL)
@@ -11,8 +12,10 @@
 #define REGION_TEXT_PRBAR       0x38    /* SH=11 AP=10 XN=00 */
 #define REGION_RO_PRBAR         0x3A    /* SH=11 AP=10 XN=10 */
 #define REGION_DATA_PRBAR       0x32    /* SH=11 AP=00 XN=10 */
+#define REGION_DEVICE_PRBAR     0x22    /* SH=10 AP=00 XN=10 */
 
 #define REGION_NORMAL_PRLAR     0x0f    /* NS=0 ATTR=111 EN=1 */
+#define REGION_DEVICE_PRLAR     0x09    /* NS=0 ATTR=100 EN=1 */
 
 /*
  * Macro to prepare and set a EL2 MPU memory region.
@@ -140,6 +143,13 @@ FUNC(enable_boot_cpu_mm)
     ldr   x2, =__bss_end
     prepare_xen_region x0, x1, x2, x3, x4, x5
 
+#ifdef CONFIG_EARLY_PRINTK
+    /* Xen early UART section. */
+    ldr   x1, =CONFIG_EARLY_UART_BASE_ADDRESS
+    ldr   x2, =(CONFIG_EARLY_UART_BASE_ADDRESS + CONFIG_EARLY_UART_SIZE)
+    prepare_xen_region x0, x1, x2, x3, x4, x5, attr_prbar=REGION_DEVICE_PRBAR, attr_prlar=REGION_DEVICE_PRLAR
+#endif
+
     b    enable_mpu
     ret
 END(enable_boot_cpu_mm)
diff --git a/xen/arch/arm/include/asm/early_printk.h b/xen/arch/arm/include/asm/early_printk.h
index 46a5e562dd..219705a8b6 100644
--- a/xen/arch/arm/include/asm/early_printk.h
+++ b/xen/arch/arm/include/asm/early_printk.h
@@ -11,10 +11,33 @@
 #define __ARM_EARLY_PRINTK_H__
 
 #include <xen/page-size.h>
+#include <asm/arm64/mpu.h>
 #include <asm/fixmap.h>
 
 #ifdef CONFIG_EARLY_PRINTK
 
+#if defined(CONFIG_MPU)
+
+/*
+ * For MPU systems, there is no VMSA support in EL2, so we use VA == PA
+ * for EARLY_UART_VIRTUAL_ADDRESS.
+ */
+#define EARLY_UART_VIRTUAL_ADDRESS CONFIG_EARLY_UART_BASE_ADDRESS
+
+/*
+ * User-defined EARLY_UART_BASE_ADDRESS and EARLY_UART_SIZE must be aligned to
+ * minimum size of MPU region.
+ */
+#if (CONFIG_EARLY_UART_BASE_ADDRESS % MPU_REGION_ALIGN) != 0
+#error "EARLY_UART_BASE_ADDRESS must be aligned to minimum MPU region size"
+#endif
+
+#if (CONFIG_EARLY_UART_SIZE % MPU_REGION_ALIGN) != 0
+#error "EARLY_UART_SIZE must be aligned to minimum MPU region size"
+#endif
+
+#elif defined(CONFIG_MMU)
+
 /* need to add the uart address offset in page to the fixmap address */
 #define EARLY_UART_VIRTUAL_ADDRESS \
     (FIXMAP_ADDR(FIX_CONSOLE) + (CONFIG_EARLY_UART_BASE_ADDRESS & ~PAGE_MASK))
@@ -22,6 +45,9 @@
 #define TEMPORARY_EARLY_UART_VIRTUAL_ADDRESS \
     (TEMPORARY_FIXMAP_ADDR(FIX_CONSOLE) + (CONFIG_EARLY_UART_BASE_ADDRESS & ~PAGE_MASK))
 
-#endif /* !CONFIG_EARLY_PRINTK */
+#else
+#error "Unknown Memory management system"
+#endif
 
+#endif /* !CONFIG_EARLY_PRINTK */
 #endif
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Dec 06 19:11:19 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 06 Dec 2024 19:11:19 +0000
Received: from list by lists.xenproject.org with outflank-mailman.850417.1264828 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tJdjT-0005gh-CK; Fri, 06 Dec 2024 19:11:19 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 850417.1264828; Fri, 06 Dec 2024 19:11:19 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tJdjT-0005gZ-9m; Fri, 06 Dec 2024 19:11:19 +0000
Received: by outflank-mailman (input) for mailman id 850417;
 Fri, 06 Dec 2024 19:11:17 +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 1tJdjR-0005gO-RS
 for xen-changelog@lists.xenproject.org; Fri, 06 Dec 2024 19:11:17 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1tJdjR-0079si-1h
 for xen-changelog@lists.xenproject.org;
 Fri, 06 Dec 2024 19:11:17 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1tJdjR-0031O7-2V
 for xen-changelog@lists.xenproject.org;
 Fri, 06 Dec 2024 19:11:17 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/mmu: enable SMMU subsystem only in MMU
Message-Id: <E1tJdjR-0031O7-2V@xenbits.xenproject.org>
Date: Fri, 06 Dec 2024 19:11:17 +0000

commit d39a92aefe54c557b964bdf91b39e54e8409ccf2
Author:     Penny Zheng <Penny.Zheng@arm.com>
AuthorDate: Wed Dec 4 17:22:43 2024 +0000
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Fri Dec 6 19:06:27 2024 +0000

    xen/mmu: enable SMMU subsystem only in MMU
    
    In Xen, SMMU subsystem is supported for MMU system only. The reason being SMMU
    driver uses the same page tables as MMU.
    Thus, we make it dependent on CONFIG_MMU.
    
    Signed-off-by: Penny Zheng <Penny.Zheng@arm.com>
    Signed-off-by: Ayan Kumar Halder <ayan.kumar.halder@amd.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
---
 xen/arch/arm/Kconfig | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/xen/arch/arm/Kconfig b/xen/arch/arm/Kconfig
index 23bbc91aad..604aba4996 100644
--- a/xen/arch/arm/Kconfig
+++ b/xen/arch/arm/Kconfig
@@ -15,9 +15,7 @@ config ARM
 	select GENERIC_UART_INIT
 	select HAS_ALTERNATIVE if HAS_VMAP
 	select HAS_DEVICE_TREE
-	select HAS_PASSTHROUGH
 	select HAS_UBSAN
-	select IOMMU_FORCE_PT_SHARE
 
 config ARCH_DEFCONFIG
 	string
@@ -79,6 +77,8 @@ config MMU
 	bool "MMU"
 	select HAS_PMAP
 	select HAS_VMAP
+	select HAS_PASSTHROUGH
+	select IOMMU_FORCE_PT_SHARE
 	help
 	  Select it if you plan to run Xen on A-profile Armv7+
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Dec 06 19:33:13 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 06 Dec 2024 19:33:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.850453.1264862 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tJe4a-0001yS-Id; Fri, 06 Dec 2024 19:33:08 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 850453.1264862; Fri, 06 Dec 2024 19:33:08 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tJe4a-0001yL-FH; Fri, 06 Dec 2024 19:33:08 +0000
Received: by outflank-mailman (input) for mailman id 850453;
 Fri, 06 Dec 2024 19:33:07 +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 1tJe4Z-0001yE-ON
 for xen-changelog@lists.xenproject.org; Fri, 06 Dec 2024 19:33:07 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1tJe4Z-007AJc-0j
 for xen-changelog@lists.xenproject.org;
 Fri, 06 Dec 2024 19:33:07 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1tJe4Z-0033nZ-1a
 for xen-changelog@lists.xenproject.org;
 Fri, 06 Dec 2024 19:33:07 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] common/vmap: Fall back to simple allocator when !HAS_VMAP
Message-Id: <E1tJe4Z-0033nZ-1a@xenbits.xenproject.org>
Date: Fri, 06 Dec 2024 19:33:07 +0000

commit 57fe471f5646ac07330ede94a26c4db5a4da5fb0
Author:     Luca Fancellu <luca.fancellu@arm.com>
AuthorDate: Tue Dec 3 09:48:06 2024 +0000
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Fri Dec 6 19:24:25 2024 +0000

    common/vmap: Fall back to simple allocator when !HAS_VMAP
    
    When HAS_VMAP is disabled, the xv{malloc,zalloc,...} functions
    should fall back to the simple x{malloc,zalloc,...} variant,
    implement that because MPU systems won't have virtual memory.
    
    Additionally remove VMAP_VIRT_START from vmap.h guards since
    MPU systems won't have it defined.
    
    Signed-off-by: Luca Fancellu <luca.fancellu@arm.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/include/xen/vmap.h     |  2 +-
 xen/include/xen/xvmalloc.h | 21 ++++++++++++++++-----
 2 files changed, 17 insertions(+), 6 deletions(-)

diff --git a/xen/include/xen/vmap.h b/xen/include/xen/vmap.h
index c1dd7ac22f..26c831757a 100644
--- a/xen/include/xen/vmap.h
+++ b/xen/include/xen/vmap.h
@@ -5,7 +5,7 @@
  * purpose area (VMAP_DEFAULT) and a livepatch-specific area (VMAP_XEN). The
  * latter is used when loading livepatches and the former for everything else.
  */
-#if !defined(__XEN_VMAP_H__) && defined(VMAP_VIRT_START)
+#ifndef __XEN_VMAP_H__
 #define __XEN_VMAP_H__
 
 #include <xen/mm-frame.h>
diff --git a/xen/include/xen/xvmalloc.h b/xen/include/xen/xvmalloc.h
index 440d85a284..7686d49f81 100644
--- a/xen/include/xen/xvmalloc.h
+++ b/xen/include/xen/xvmalloc.h
@@ -40,20 +40,31 @@
     ((typeof(ptr))_xvrealloc(ptr, offsetof(typeof(*(ptr)), field[nr]), \
                              __alignof__(typeof(*(ptr)))))
 
+#ifdef CONFIG_HAS_VMAP
+
 /* Free any of the above. */
 void xvfree(void *va);
 
+/* Underlying functions */
+void *_xvmalloc(size_t size, unsigned int align);
+void *_xvzalloc(size_t size, unsigned int align);
+void *_xvrealloc(void *va, size_t size, unsigned int align);
+
+#else /* !CONFIG_HAS_VMAP */
+
+#define xvfree      xfree
+#define _xvmalloc   _xmalloc
+#define _xvzalloc   _xzalloc
+#define _xvrealloc  _xrealloc
+
+#endif /* CONFIG_HAS_VMAP */
+
 /* Free an allocation, and zero the pointer to it. */
 #define XVFREE(p) do { \
     xvfree(p);         \
     (p) = NULL;        \
 } while ( false )
 
-/* Underlying functions */
-void *_xvmalloc(size_t size, unsigned int align);
-void *_xvzalloc(size_t size, unsigned int align);
-void *_xvrealloc(void *va, size_t size, unsigned int align);
-
 static inline void *_xvmalloc_array(
     size_t size, unsigned int align, unsigned long num)
 {
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Dec 06 19:33:18 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 06 Dec 2024 19:33:18 +0000
Received: from list by lists.xenproject.org with outflank-mailman.850454.1264865 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tJe4k-00020J-JK; Fri, 06 Dec 2024 19:33:18 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 850454.1264865; Fri, 06 Dec 2024 19:33: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 1tJe4k-00020B-Gl; Fri, 06 Dec 2024 19:33:18 +0000
Received: by outflank-mailman (input) for mailman id 850454;
 Fri, 06 Dec 2024 19:33:17 +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 1tJe4j-000203-Kq
 for xen-changelog@lists.xenproject.org; Fri, 06 Dec 2024 19:33:17 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1tJe4j-007AJg-11
 for xen-changelog@lists.xenproject.org;
 Fri, 06 Dec 2024 19:33:17 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1tJe4j-0033oA-1r
 for xen-changelog@lists.xenproject.org;
 Fri, 06 Dec 2024 19:33:17 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] arm/setup: Move MMU specific extern declarations to mmu/setup.h
Message-Id: <E1tJe4j-0033oA-1r@xenbits.xenproject.org>
Date: Fri, 06 Dec 2024 19:33:17 +0000

commit b772a9f517a644c6e2dfe142373903f5ede4f24f
Author:     Luca Fancellu <luca.fancellu@arm.com>
AuthorDate: Tue Dec 3 09:48:07 2024 +0000
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Fri Dec 6 19:24:25 2024 +0000

    arm/setup: Move MMU specific extern declarations to mmu/setup.h
    
    Move some extern declarations related to MMU structures and define
    from asm/setup.h to asm/mmu/setup.h, in order to increase encapsulation
    and allow the MPU part to build, since it has no clue about them.
    
    Signed-off-by: Luca Fancellu <luca.fancellu@arm.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
---
 xen/arch/arm/include/asm/mmu/setup.h | 31 +++++++++++++++++++++++++++++++
 xen/arch/arm/include/asm/setup.h     | 20 ++++++--------------
 2 files changed, 37 insertions(+), 14 deletions(-)

diff --git a/xen/arch/arm/include/asm/mmu/setup.h b/xen/arch/arm/include/asm/mmu/setup.h
new file mode 100644
index 0000000000..3fe752b04c
--- /dev/null
+++ b/xen/arch/arm/include/asm/mmu/setup.h
@@ -0,0 +1,31 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
+#ifndef __ARM_MMU_SETUP_H__
+#define __ARM_MMU_SETUP_H__
+
+#include <asm/lpae.h>
+#include <asm/mmu/layout.h>
+
+extern lpae_t boot_pgtable[XEN_PT_LPAE_ENTRIES];
+
+#ifdef CONFIG_ARM_64
+extern lpae_t boot_first[XEN_PT_LPAE_ENTRIES];
+extern lpae_t boot_first_id[XEN_PT_LPAE_ENTRIES];
+#endif
+extern lpae_t boot_second[XEN_PT_LPAE_ENTRIES];
+extern lpae_t boot_second_id[XEN_PT_LPAE_ENTRIES];
+extern lpae_t boot_third[XEN_PT_LPAE_ENTRIES * XEN_NR_ENTRIES(2)];
+extern lpae_t boot_third_id[XEN_PT_LPAE_ENTRIES];
+
+/* Find where Xen will be residing at runtime and return a PT entry */
+lpae_t pte_of_xenaddr(vaddr_t va);
+
+#endif /* __ARM_MMU_SETUP_H__ */
+
+/*
+ * Local variables:
+ * mode: C
+ * c-file-style: "BSD"
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
diff --git a/xen/arch/arm/include/asm/setup.h b/xen/arch/arm/include/asm/setup.h
index 64c227d171..a5a80d9b47 100644
--- a/xen/arch/arm/include/asm/setup.h
+++ b/xen/arch/arm/include/asm/setup.h
@@ -6,6 +6,12 @@
 #include <xen/bootfdt.h>
 #include <xen/device_tree.h>
 
+#if defined(CONFIG_MMU)
+# include <asm/mmu/setup.h>
+#elif !defined(CONFIG_MPU)
+# error "Unknown memory management layout"
+#endif
+
 #define MAX_FDT_SIZE SZ_2M
 
 struct map_range_data
@@ -65,20 +71,6 @@ int map_irq_to_domain(struct domain *d, unsigned int irq,
 int map_range_to_domain(const struct dt_device_node *dev,
                         uint64_t addr, uint64_t len, void *data);
 
-extern lpae_t boot_pgtable[XEN_PT_LPAE_ENTRIES];
-
-#ifdef CONFIG_ARM_64
-extern lpae_t boot_first[XEN_PT_LPAE_ENTRIES];
-extern lpae_t boot_first_id[XEN_PT_LPAE_ENTRIES];
-#endif
-extern lpae_t boot_second[XEN_PT_LPAE_ENTRIES];
-extern lpae_t boot_second_id[XEN_PT_LPAE_ENTRIES];
-extern lpae_t boot_third[XEN_PT_LPAE_ENTRIES * XEN_NR_ENTRIES(2)];
-extern lpae_t boot_third_id[XEN_PT_LPAE_ENTRIES];
-
-/* Find where Xen will be residing at runtime and return a PT entry */
-lpae_t pte_of_xenaddr(vaddr_t va);
-
 extern const char __ro_after_init_start[], __ro_after_init_end[];
 
 struct init_info
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Dec 06 19:33:28 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 06 Dec 2024 19:33:28 +0000
Received: from list by lists.xenproject.org with outflank-mailman.850455.1264869 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tJe4u-00024O-Kt; Fri, 06 Dec 2024 19:33:28 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 850455.1264869; Fri, 06 Dec 2024 19:33: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 1tJe4u-00024G-IE; Fri, 06 Dec 2024 19:33:28 +0000
Received: by outflank-mailman (input) for mailman id 850455;
 Fri, 06 Dec 2024 19:33:27 +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 1tJe4t-00023w-O0
 for xen-changelog@lists.xenproject.org; Fri, 06 Dec 2024 19:33:27 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1tJe4t-007AJm-1L
 for xen-changelog@lists.xenproject.org;
 Fri, 06 Dec 2024 19:33:27 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1tJe4t-0033pj-29
 for xen-changelog@lists.xenproject.org;
 Fri, 06 Dec 2024 19:33:27 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/arm: Use vmap_contig instead of __vmap where it's possible
Message-Id: <E1tJe4t-0033pj-29@xenbits.xenproject.org>
Date: Fri, 06 Dec 2024 19:33:27 +0000

commit c8e59af7ad1e98479a91700334e5e1c1dbbe0781
Author:     Luca Fancellu <luca.fancellu@arm.com>
AuthorDate: Tue Dec 3 09:48:08 2024 +0000
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Fri Dec 6 19:24:25 2024 +0000

    xen/arm: Use vmap_contig instead of __vmap where it's possible
    
    Currently the arm code uses __vmap function in few parts to map
    physically contiguous pages, vmap_contig was introduced recently
    and does the same because it's a wrapper for __vmap, so use the
    latter instead of the direct __vmap function.
    
    Signed-off-by: Luca Fancellu <luca.fancellu@arm.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
    Acked-by: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/arch/arm/alternative.c | 3 +--
 xen/arch/arm/cpuerrata.c   | 5 ++---
 xen/arch/arm/kernel.c      | 2 +-
 xen/arch/arm/livepatch.c   | 3 +--
 4 files changed, 5 insertions(+), 8 deletions(-)

diff --git a/xen/arch/arm/alternative.c b/xen/arch/arm/alternative.c
index d99b507093..fec7dbd2cd 100644
--- a/xen/arch/arm/alternative.c
+++ b/xen/arch/arm/alternative.c
@@ -209,8 +209,7 @@ void __init apply_alternatives_all(void)
      * The text and inittext section are read-only. So re-map Xen to
      * be able to patch the code.
      */
-    xenmap = __vmap(&xen_mfn, 1U << xen_order, 1, 1, PAGE_HYPERVISOR,
-                    VMAP_DEFAULT);
+    xenmap = vmap_contig(xen_mfn, 1U << xen_order);
     /* Re-mapping Xen is not expected to fail during boot. */
     BUG_ON(!xenmap);
 
diff --git a/xen/arch/arm/cpuerrata.c b/xen/arch/arm/cpuerrata.c
index eef9c0ea0e..17cf134f1b 100644
--- a/xen/arch/arm/cpuerrata.c
+++ b/xen/arch/arm/cpuerrata.c
@@ -61,9 +61,8 @@ static bool copy_hyp_vect_bpi(unsigned int slot, const char *hyp_vec_start,
      * Vectors are part of the text that are mapped read-only. So re-map
      * the vector table to be able to update vectors.
      */
-    dst_remapped = __vmap(&dst_mfn,
-                          1UL << get_order_from_bytes(VECTOR_TABLE_SIZE),
-                          1, 1, PAGE_HYPERVISOR, VMAP_DEFAULT);
+    dst_remapped = vmap_contig(dst_mfn,
+                               1UL << get_order_from_bytes(VECTOR_TABLE_SIZE));
     if ( !dst_remapped )
         return false;
 
diff --git a/xen/arch/arm/kernel.c b/xen/arch/arm/kernel.c
index 669d143cee..293d7efaed 100644
--- a/xen/arch/arm/kernel.c
+++ b/xen/arch/arm/kernel.c
@@ -211,7 +211,7 @@ static __init int kernel_decompress(struct bootmodule *mod, uint32_t offset)
         return -ENOMEM;
     }
     mfn = page_to_mfn(pages);
-    output = __vmap(&mfn, 1 << kernel_order_out, 1, 1, PAGE_HYPERVISOR, VMAP_DEFAULT);
+    output = vmap_contig(mfn, 1 << kernel_order_out);
 
     rc = perform_gunzip(output, input, size);
     clean_dcache_va_range(output, output_size);
diff --git a/xen/arch/arm/livepatch.c b/xen/arch/arm/livepatch.c
index 037746d952..3805b29746 100644
--- a/xen/arch/arm/livepatch.c
+++ b/xen/arch/arm/livepatch.c
@@ -39,8 +39,7 @@ int arch_livepatch_quiesce(void)
      * The text section is read-only. So re-map Xen to be able to patch
      * the code.
      */
-    vmap_of_xen_text = __vmap(&text_mfn, 1U << text_order, 1, 1, PAGE_HYPERVISOR,
-                              VMAP_DEFAULT);
+    vmap_of_xen_text = vmap_contig(text_mfn, 1U << text_order);
 
     if ( !vmap_of_xen_text )
     {
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Dec 06 19:33:38 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 06 Dec 2024 19:33:38 +0000
Received: from list by lists.xenproject.org with outflank-mailman.850456.1264874 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tJe54-000273-MY; Fri, 06 Dec 2024 19:33:38 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 850456.1264874; Fri, 06 Dec 2024 19:33:38 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tJe54-00026v-Jc; Fri, 06 Dec 2024 19:33:38 +0000
Received: by outflank-mailman (input) for mailman id 850456;
 Fri, 06 Dec 2024 19:33:37 +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 1tJe53-00026n-RU
 for xen-changelog@lists.xenproject.org; Fri, 06 Dec 2024 19:33:37 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1tJe53-007AJs-1g
 for xen-changelog@lists.xenproject.org;
 Fri, 06 Dec 2024 19:33:37 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1tJe53-0033qf-2T
 for xen-changelog@lists.xenproject.org;
 Fri, 06 Dec 2024 19:33:37 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/arm: Move setup_frametable_mappings to arm/mmu
Message-Id: <E1tJe53-0033qf-2T@xenbits.xenproject.org>
Date: Fri, 06 Dec 2024 19:33:37 +0000

commit 1645bb7997cb1eccb45235ab350872733c74b305
Author:     Luca Fancellu <luca.fancellu@arm.com>
AuthorDate: Tue Dec 3 09:48:10 2024 +0000
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Fri Dec 6 19:24:25 2024 +0000

    xen/arm: Move setup_frametable_mappings to arm/mmu
    
    Move the current setup_frametable_mappings implementation to
    arm/mmu under a new file mm.c, this implementation depends on
    virtual memory and won't be used as it is for MPU systems.
    
    Take the occasion to fix code style issues related to the line
    length.
    
    Moved also frametable_virt_end since it is used only on MMU
    systems.
    
    Signed-off-by: Luca Fancellu <luca.fancellu@arm.com>
---
 xen/arch/arm/mm.c         | 40 -------------------------------
 xen/arch/arm/mmu/Makefile |  1 +
 xen/arch/arm/mmu/mm.c     | 61 +++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 62 insertions(+), 40 deletions(-)

diff --git a/xen/arch/arm/mm.c b/xen/arch/arm/mm.c
index def939172c..a56e20ba2b 100644
--- a/xen/arch/arm/mm.c
+++ b/xen/arch/arm/mm.c
@@ -22,7 +22,6 @@
 #define virt_to_mfn(va) _mfn(__virt_to_mfn(va))
 
 unsigned long frametable_base_pdx __read_mostly;
-unsigned long frametable_virt_end __read_mostly;
 
 void flush_page_to_ram(unsigned long mfn, bool sync_icache)
 {
@@ -43,45 +42,6 @@ void flush_page_to_ram(unsigned long mfn, bool sync_icache)
         invalidate_icache();
 }
 
-/* Map a frame table to cover physical addresses ps through pe */
-void __init setup_frametable_mappings(paddr_t ps, paddr_t pe)
-{
-    unsigned long nr_pdxs = mfn_to_pdx(mfn_add(maddr_to_mfn(pe), -1)) -
-                            mfn_to_pdx(maddr_to_mfn(ps)) + 1;
-    unsigned long frametable_size = nr_pdxs * sizeof(struct page_info);
-    mfn_t base_mfn;
-    const unsigned long mapping_size = frametable_size < MB(32) ? MB(2) : MB(32);
-    int rc;
-
-    /*
-     * The size of paddr_t should be sufficient for the complete range of
-     * physical address.
-     */
-    BUILD_BUG_ON((sizeof(paddr_t) * BITS_PER_BYTE) < PADDR_BITS);
-    BUILD_BUG_ON(sizeof(struct page_info) != PAGE_INFO_SIZE);
-
-    if ( frametable_size > FRAMETABLE_SIZE )
-        panic("The frametable cannot cover the physical region %#"PRIpaddr" - %#"PRIpaddr"\n",
-              ps, pe);
-
-    frametable_base_pdx = mfn_to_pdx(maddr_to_mfn(ps));
-    /* Round up to 2M or 32M boundary, as appropriate. */
-    frametable_size = ROUNDUP(frametable_size, mapping_size);
-    base_mfn = alloc_boot_pages(frametable_size >> PAGE_SHIFT, 32<<(20-12));
-
-    rc = map_pages_to_xen(FRAMETABLE_VIRT_START, base_mfn,
-                          frametable_size >> PAGE_SHIFT,
-                          PAGE_HYPERVISOR_RW | _PAGE_BLOCK);
-    if ( rc )
-        panic("Unable to setup the frametable mappings.\n");
-
-    memset(&frame_table[0], 0, nr_pdxs * sizeof(struct page_info));
-    memset(&frame_table[nr_pdxs], -1,
-           frametable_size - (nr_pdxs * sizeof(struct page_info)));
-
-    frametable_virt_end = FRAMETABLE_VIRT_START + (nr_pdxs * sizeof(struct page_info));
-}
-
 int steal_page(
     struct domain *d, struct page_info *page, unsigned int memflags)
 {
diff --git a/xen/arch/arm/mmu/Makefile b/xen/arch/arm/mmu/Makefile
index 2cb44b857d..1c89602947 100644
--- a/xen/arch/arm/mmu/Makefile
+++ b/xen/arch/arm/mmu/Makefile
@@ -1,3 +1,4 @@
+obj-y += mm.o
 obj-y += p2m.o
 obj-y += pt.o
 obj-y += setup.o
diff --git a/xen/arch/arm/mmu/mm.c b/xen/arch/arm/mmu/mm.c
new file mode 100644
index 0000000000..9c50479c63
--- /dev/null
+++ b/xen/arch/arm/mmu/mm.c
@@ -0,0 +1,61 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
+
+#include <xen/init.h>
+#include <xen/lib.h>
+#include <xen/macros.h>
+#include <xen/mm.h>
+#include <xen/mm-frame.h>
+#include <xen/pdx.h>
+#include <xen/string.h>
+
+unsigned long frametable_virt_end __read_mostly;
+
+/* Map a frame table to cover physical addresses ps through pe */
+void __init setup_frametable_mappings(paddr_t ps, paddr_t pe)
+{
+    unsigned long nr_pdxs = mfn_to_pdx(mfn_add(maddr_to_mfn(pe), -1)) -
+                            mfn_to_pdx(maddr_to_mfn(ps)) + 1;
+    unsigned long frametable_size = nr_pdxs * sizeof(struct page_info);
+    mfn_t base_mfn;
+    const unsigned long mapping_size = frametable_size < MB(32) ? MB(2)
+                                                                : MB(32);
+    int rc;
+
+    /*
+     * The size of paddr_t should be sufficient for the complete range of
+     * physical address.
+     */
+    BUILD_BUG_ON((sizeof(paddr_t) * BITS_PER_BYTE) < PADDR_BITS);
+    BUILD_BUG_ON(sizeof(struct page_info) != PAGE_INFO_SIZE);
+
+    if ( frametable_size > FRAMETABLE_SIZE )
+        panic("The frametable cannot cover the physical region %#"PRIpaddr" - %#"PRIpaddr"\n",
+              ps, pe);
+
+    frametable_base_pdx = mfn_to_pdx(maddr_to_mfn(ps));
+    /* Round up to 2M or 32M boundary, as appropriate. */
+    frametable_size = ROUNDUP(frametable_size, mapping_size);
+    base_mfn = alloc_boot_pages(frametable_size >> PAGE_SHIFT, 32<<(20-12));
+
+    rc = map_pages_to_xen(FRAMETABLE_VIRT_START, base_mfn,
+                          frametable_size >> PAGE_SHIFT,
+                          PAGE_HYPERVISOR_RW | _PAGE_BLOCK);
+    if ( rc )
+        panic("Unable to setup the frametable mappings.\n");
+
+    memset(&frame_table[0], 0, nr_pdxs * sizeof(struct page_info));
+    memset(&frame_table[nr_pdxs], -1,
+           frametable_size - (nr_pdxs * sizeof(struct page_info)));
+
+    frametable_virt_end = FRAMETABLE_VIRT_START + (nr_pdxs *
+                                                   sizeof(struct page_info));
+}
+
+/*
+ * Local variables:
+ * mode: C
+ * c-file-style: "BSD"
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Dec 06 21:55:09 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 06 Dec 2024 21:55:09 +0000
Received: from list by lists.xenproject.org with outflank-mailman.850526.1264928 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tJgHw-0006Ir-6G; Fri, 06 Dec 2024 21:55:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 850526.1264928; Fri, 06 Dec 2024 21:55:04 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tJgHw-0006Ik-3f; Fri, 06 Dec 2024 21:55:04 +0000
Received: by outflank-mailman (input) for mailman id 850526;
 Fri, 06 Dec 2024 21: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 1tJgHu-0006Ie-9G
 for xen-changelog@lists.xenproject.org; Fri, 06 Dec 2024 21:55:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1tJgHt-007DBV-2V
 for xen-changelog@lists.xenproject.org;
 Fri, 06 Dec 2024 21:55:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1tJgHt-003GXF-3A
 for xen-changelog@lists.xenproject.org;
 Fri, 06 Dec 2024 21: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>
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/mpu: Map early uart when earlyprintk on
Message-Id: <E1tJgHt-003GXF-3A@xenbits.xenproject.org>
Date: Fri, 06 Dec 2024 21:55:01 +0000

commit 214f9cc67b8cd179df0f5ab460413e9be46ff148
Author:     Ayan Kumar Halder <ayan.kumar.halder@amd.com>
AuthorDate: Wed Dec 4 17:22:42 2024 +0000
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Fri Dec 6 19:06:27 2024 +0000

    xen/mpu: Map early uart when earlyprintk on
    
    CONFIG_EARLY_UART_SIZE is introduced to let user provide physical size of
    early UART. Unlike MMU where we map a page in the virtual address space,
    here we need to know the exact physical size to be mapped.
    As VA == PA in case of MPU, the memory layout follows exactly the hardware
    configuration. As a consequence, we set  EARLY_UART_VIRTUAL_ADDRESS as physical
    address.
    
    EARLY_UART_BASE_ADDRESS and EARLY_UART_SIZE should be aligned to the minimum
    size of MPU region (ie 64 bits) as per the hardware restrictions. Refer ARM
    DDI 0600A.d ID120821 A1.3 "A minimum protection region size of 64 bytes.".
    
    UART is mapped as nGnRE region (as specified by ATTR=100 , refer G1.3.13,
    MAIR_EL2, "---0100 Device memory nGnRE"). Also, it is mapped as outer shareable,
    RW at EL2 only and execution of instructions from the region is not permitted.
    
    Signed-off-by: Ayan Kumar Halder <ayan.kumar.halder@amd.com>
    Reviewed-by: Luca Fancellu <luca.fancellu@arm.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
---
 xen/arch/arm/Kconfig.debug              |  7 +++++++
 xen/arch/arm/arm64/mpu/head.S           | 10 ++++++++++
 xen/arch/arm/include/asm/early_printk.h | 28 +++++++++++++++++++++++++++-
 3 files changed, 44 insertions(+), 1 deletion(-)

diff --git a/xen/arch/arm/Kconfig.debug b/xen/arch/arm/Kconfig.debug
index 7660e599c0..84a0616102 100644
--- a/xen/arch/arm/Kconfig.debug
+++ b/xen/arch/arm/Kconfig.debug
@@ -121,6 +121,13 @@ config EARLY_UART_BASE_ADDRESS
 	hex "Early printk, physical base address of debug UART"
 	range 0x0 0xffffffff if ARM_32
 
+config EARLY_UART_SIZE
+       depends on EARLY_PRINTK
+       depends on MPU
+       hex "Early printk, physical size of debug UART"
+       range 0x0 0xffffffff if ARM_32
+       default 0x1000
+
 config EARLY_UART_PL011_BAUD_RATE
 	depends on EARLY_UART_PL011
 	int "Early printk UART baud rate for pl011"
diff --git a/xen/arch/arm/arm64/mpu/head.S b/xen/arch/arm/arm64/mpu/head.S
index d3db5e53af..e4f2021f45 100644
--- a/xen/arch/arm/arm64/mpu/head.S
+++ b/xen/arch/arm/arm64/mpu/head.S
@@ -4,6 +4,7 @@
  */
 
 #include <asm/arm64/mpu.h>
+#include <asm/early_printk.h>
 
 /* Backgroud region enable/disable */
 #define SCTLR_ELx_BR    BIT(17, UL)
@@ -11,8 +12,10 @@
 #define REGION_TEXT_PRBAR       0x38    /* SH=11 AP=10 XN=00 */
 #define REGION_RO_PRBAR         0x3A    /* SH=11 AP=10 XN=10 */
 #define REGION_DATA_PRBAR       0x32    /* SH=11 AP=00 XN=10 */
+#define REGION_DEVICE_PRBAR     0x22    /* SH=10 AP=00 XN=10 */
 
 #define REGION_NORMAL_PRLAR     0x0f    /* NS=0 ATTR=111 EN=1 */
+#define REGION_DEVICE_PRLAR     0x09    /* NS=0 ATTR=100 EN=1 */
 
 /*
  * Macro to prepare and set a EL2 MPU memory region.
@@ -140,6 +143,13 @@ FUNC(enable_boot_cpu_mm)
     ldr   x2, =__bss_end
     prepare_xen_region x0, x1, x2, x3, x4, x5
 
+#ifdef CONFIG_EARLY_PRINTK
+    /* Xen early UART section. */
+    ldr   x1, =CONFIG_EARLY_UART_BASE_ADDRESS
+    ldr   x2, =(CONFIG_EARLY_UART_BASE_ADDRESS + CONFIG_EARLY_UART_SIZE)
+    prepare_xen_region x0, x1, x2, x3, x4, x5, attr_prbar=REGION_DEVICE_PRBAR, attr_prlar=REGION_DEVICE_PRLAR
+#endif
+
     b    enable_mpu
     ret
 END(enable_boot_cpu_mm)
diff --git a/xen/arch/arm/include/asm/early_printk.h b/xen/arch/arm/include/asm/early_printk.h
index 46a5e562dd..219705a8b6 100644
--- a/xen/arch/arm/include/asm/early_printk.h
+++ b/xen/arch/arm/include/asm/early_printk.h
@@ -11,10 +11,33 @@
 #define __ARM_EARLY_PRINTK_H__
 
 #include <xen/page-size.h>
+#include <asm/arm64/mpu.h>
 #include <asm/fixmap.h>
 
 #ifdef CONFIG_EARLY_PRINTK
 
+#if defined(CONFIG_MPU)
+
+/*
+ * For MPU systems, there is no VMSA support in EL2, so we use VA == PA
+ * for EARLY_UART_VIRTUAL_ADDRESS.
+ */
+#define EARLY_UART_VIRTUAL_ADDRESS CONFIG_EARLY_UART_BASE_ADDRESS
+
+/*
+ * User-defined EARLY_UART_BASE_ADDRESS and EARLY_UART_SIZE must be aligned to
+ * minimum size of MPU region.
+ */
+#if (CONFIG_EARLY_UART_BASE_ADDRESS % MPU_REGION_ALIGN) != 0
+#error "EARLY_UART_BASE_ADDRESS must be aligned to minimum MPU region size"
+#endif
+
+#if (CONFIG_EARLY_UART_SIZE % MPU_REGION_ALIGN) != 0
+#error "EARLY_UART_SIZE must be aligned to minimum MPU region size"
+#endif
+
+#elif defined(CONFIG_MMU)
+
 /* need to add the uart address offset in page to the fixmap address */
 #define EARLY_UART_VIRTUAL_ADDRESS \
     (FIXMAP_ADDR(FIX_CONSOLE) + (CONFIG_EARLY_UART_BASE_ADDRESS & ~PAGE_MASK))
@@ -22,6 +45,9 @@
 #define TEMPORARY_EARLY_UART_VIRTUAL_ADDRESS \
     (TEMPORARY_FIXMAP_ADDR(FIX_CONSOLE) + (CONFIG_EARLY_UART_BASE_ADDRESS & ~PAGE_MASK))
 
-#endif /* !CONFIG_EARLY_PRINTK */
+#else
+#error "Unknown Memory management system"
+#endif
 
+#endif /* !CONFIG_EARLY_PRINTK */
 #endif
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Dec 06 21:55:14 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 06 Dec 2024 21:55:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.850527.1264932 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tJgI6-0006KZ-7v; Fri, 06 Dec 2024 21:55:14 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 850527.1264932; Fri, 06 Dec 2024 21:55:14 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tJgI6-0006KR-5I; Fri, 06 Dec 2024 21:55:14 +0000
Received: by outflank-mailman (input) for mailman id 850527;
 Fri, 06 Dec 2024 21: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 1tJgI4-0006KD-95
 for xen-changelog@lists.xenproject.org; Fri, 06 Dec 2024 21:55:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1tJgI3-007DBw-2y
 for xen-changelog@lists.xenproject.org;
 Fri, 06 Dec 2024 21:55:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1tJgI4-003GXy-0Q
 for xen-changelog@lists.xenproject.org;
 Fri, 06 Dec 2024 21: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>
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/mmu: enable SMMU subsystem only in MMU
Message-Id: <E1tJgI4-003GXy-0Q@xenbits.xenproject.org>
Date: Fri, 06 Dec 2024 21:55:12 +0000

commit d39a92aefe54c557b964bdf91b39e54e8409ccf2
Author:     Penny Zheng <Penny.Zheng@arm.com>
AuthorDate: Wed Dec 4 17:22:43 2024 +0000
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Fri Dec 6 19:06:27 2024 +0000

    xen/mmu: enable SMMU subsystem only in MMU
    
    In Xen, SMMU subsystem is supported for MMU system only. The reason being SMMU
    driver uses the same page tables as MMU.
    Thus, we make it dependent on CONFIG_MMU.
    
    Signed-off-by: Penny Zheng <Penny.Zheng@arm.com>
    Signed-off-by: Ayan Kumar Halder <ayan.kumar.halder@amd.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
---
 xen/arch/arm/Kconfig | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/xen/arch/arm/Kconfig b/xen/arch/arm/Kconfig
index 23bbc91aad..604aba4996 100644
--- a/xen/arch/arm/Kconfig
+++ b/xen/arch/arm/Kconfig
@@ -15,9 +15,7 @@ config ARM
 	select GENERIC_UART_INIT
 	select HAS_ALTERNATIVE if HAS_VMAP
 	select HAS_DEVICE_TREE
-	select HAS_PASSTHROUGH
 	select HAS_UBSAN
-	select IOMMU_FORCE_PT_SHARE
 
 config ARCH_DEFCONFIG
 	string
@@ -79,6 +77,8 @@ config MMU
 	bool "MMU"
 	select HAS_PMAP
 	select HAS_VMAP
+	select HAS_PASSTHROUGH
+	select IOMMU_FORCE_PT_SHARE
 	help
 	  Select it if you plan to run Xen on A-profile Armv7+
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Dec 06 22:11:11 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 06 Dec 2024 22:11:11 +0000
Received: from list by lists.xenproject.org with outflank-mailman.850528.1264937 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tJgXQ-0000FO-AO; Fri, 06 Dec 2024 22:11:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 850528.1264937; Fri, 06 Dec 2024 22: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 1tJgXQ-0000FG-7a; Fri, 06 Dec 2024 22:11:04 +0000
Received: by outflank-mailman (input) for mailman id 850528;
 Fri, 06 Dec 2024 22: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 1tJgXO-0000FA-9j
 for xen-changelog@lists.xenproject.org; Fri, 06 Dec 2024 22:11:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1tJgXN-007DX9-1o
 for xen-changelog@lists.xenproject.org;
 Fri, 06 Dec 2024 22:11:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1tJgXN-003I8W-2M
 for xen-changelog@lists.xenproject.org;
 Fri, 06 Dec 2024 22: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>
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] common/vmap: Fall back to simple allocator when !HAS_VMAP
Message-Id: <E1tJgXN-003I8W-2M@xenbits.xenproject.org>
Date: Fri, 06 Dec 2024 22:11:01 +0000

commit 57fe471f5646ac07330ede94a26c4db5a4da5fb0
Author:     Luca Fancellu <luca.fancellu@arm.com>
AuthorDate: Tue Dec 3 09:48:06 2024 +0000
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Fri Dec 6 19:24:25 2024 +0000

    common/vmap: Fall back to simple allocator when !HAS_VMAP
    
    When HAS_VMAP is disabled, the xv{malloc,zalloc,...} functions
    should fall back to the simple x{malloc,zalloc,...} variant,
    implement that because MPU systems won't have virtual memory.
    
    Additionally remove VMAP_VIRT_START from vmap.h guards since
    MPU systems won't have it defined.
    
    Signed-off-by: Luca Fancellu <luca.fancellu@arm.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/include/xen/vmap.h     |  2 +-
 xen/include/xen/xvmalloc.h | 21 ++++++++++++++++-----
 2 files changed, 17 insertions(+), 6 deletions(-)

diff --git a/xen/include/xen/vmap.h b/xen/include/xen/vmap.h
index c1dd7ac22f..26c831757a 100644
--- a/xen/include/xen/vmap.h
+++ b/xen/include/xen/vmap.h
@@ -5,7 +5,7 @@
  * purpose area (VMAP_DEFAULT) and a livepatch-specific area (VMAP_XEN). The
  * latter is used when loading livepatches and the former for everything else.
  */
-#if !defined(__XEN_VMAP_H__) && defined(VMAP_VIRT_START)
+#ifndef __XEN_VMAP_H__
 #define __XEN_VMAP_H__
 
 #include <xen/mm-frame.h>
diff --git a/xen/include/xen/xvmalloc.h b/xen/include/xen/xvmalloc.h
index 440d85a284..7686d49f81 100644
--- a/xen/include/xen/xvmalloc.h
+++ b/xen/include/xen/xvmalloc.h
@@ -40,20 +40,31 @@
     ((typeof(ptr))_xvrealloc(ptr, offsetof(typeof(*(ptr)), field[nr]), \
                              __alignof__(typeof(*(ptr)))))
 
+#ifdef CONFIG_HAS_VMAP
+
 /* Free any of the above. */
 void xvfree(void *va);
 
+/* Underlying functions */
+void *_xvmalloc(size_t size, unsigned int align);
+void *_xvzalloc(size_t size, unsigned int align);
+void *_xvrealloc(void *va, size_t size, unsigned int align);
+
+#else /* !CONFIG_HAS_VMAP */
+
+#define xvfree      xfree
+#define _xvmalloc   _xmalloc
+#define _xvzalloc   _xzalloc
+#define _xvrealloc  _xrealloc
+
+#endif /* CONFIG_HAS_VMAP */
+
 /* Free an allocation, and zero the pointer to it. */
 #define XVFREE(p) do { \
     xvfree(p);         \
     (p) = NULL;        \
 } while ( false )
 
-/* Underlying functions */
-void *_xvmalloc(size_t size, unsigned int align);
-void *_xvzalloc(size_t size, unsigned int align);
-void *_xvrealloc(void *va, size_t size, unsigned int align);
-
 static inline void *_xvmalloc_array(
     size_t size, unsigned int align, unsigned long num)
 {
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Dec 06 22:11:13 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 06 Dec 2024 22:11:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.850529.1264940 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tJgXZ-0000HK-CJ; Fri, 06 Dec 2024 22:11:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 850529.1264940; Fri, 06 Dec 2024 22: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 1tJgXZ-0000HB-98; Fri, 06 Dec 2024 22:11:13 +0000
Received: by outflank-mailman (input) for mailman id 850529;
 Fri, 06 Dec 2024 22: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 1tJgXY-0000Gu-1j
 for xen-changelog@lists.xenproject.org; Fri, 06 Dec 2024 22:11:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1tJgXX-007DXl-2F
 for xen-changelog@lists.xenproject.org;
 Fri, 06 Dec 2024 22:11:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1tJgXX-003I9x-2x
 for xen-changelog@lists.xenproject.org;
 Fri, 06 Dec 2024 22: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>
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] arm/setup: Move MMU specific extern declarations to mmu/setup.h
Message-Id: <E1tJgXX-003I9x-2x@xenbits.xenproject.org>
Date: Fri, 06 Dec 2024 22:11:11 +0000

commit b772a9f517a644c6e2dfe142373903f5ede4f24f
Author:     Luca Fancellu <luca.fancellu@arm.com>
AuthorDate: Tue Dec 3 09:48:07 2024 +0000
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Fri Dec 6 19:24:25 2024 +0000

    arm/setup: Move MMU specific extern declarations to mmu/setup.h
    
    Move some extern declarations related to MMU structures and define
    from asm/setup.h to asm/mmu/setup.h, in order to increase encapsulation
    and allow the MPU part to build, since it has no clue about them.
    
    Signed-off-by: Luca Fancellu <luca.fancellu@arm.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
---
 xen/arch/arm/include/asm/mmu/setup.h | 31 +++++++++++++++++++++++++++++++
 xen/arch/arm/include/asm/setup.h     | 20 ++++++--------------
 2 files changed, 37 insertions(+), 14 deletions(-)

diff --git a/xen/arch/arm/include/asm/mmu/setup.h b/xen/arch/arm/include/asm/mmu/setup.h
new file mode 100644
index 0000000000..3fe752b04c
--- /dev/null
+++ b/xen/arch/arm/include/asm/mmu/setup.h
@@ -0,0 +1,31 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
+#ifndef __ARM_MMU_SETUP_H__
+#define __ARM_MMU_SETUP_H__
+
+#include <asm/lpae.h>
+#include <asm/mmu/layout.h>
+
+extern lpae_t boot_pgtable[XEN_PT_LPAE_ENTRIES];
+
+#ifdef CONFIG_ARM_64
+extern lpae_t boot_first[XEN_PT_LPAE_ENTRIES];
+extern lpae_t boot_first_id[XEN_PT_LPAE_ENTRIES];
+#endif
+extern lpae_t boot_second[XEN_PT_LPAE_ENTRIES];
+extern lpae_t boot_second_id[XEN_PT_LPAE_ENTRIES];
+extern lpae_t boot_third[XEN_PT_LPAE_ENTRIES * XEN_NR_ENTRIES(2)];
+extern lpae_t boot_third_id[XEN_PT_LPAE_ENTRIES];
+
+/* Find where Xen will be residing at runtime and return a PT entry */
+lpae_t pte_of_xenaddr(vaddr_t va);
+
+#endif /* __ARM_MMU_SETUP_H__ */
+
+/*
+ * Local variables:
+ * mode: C
+ * c-file-style: "BSD"
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
diff --git a/xen/arch/arm/include/asm/setup.h b/xen/arch/arm/include/asm/setup.h
index 64c227d171..a5a80d9b47 100644
--- a/xen/arch/arm/include/asm/setup.h
+++ b/xen/arch/arm/include/asm/setup.h
@@ -6,6 +6,12 @@
 #include <xen/bootfdt.h>
 #include <xen/device_tree.h>
 
+#if defined(CONFIG_MMU)
+# include <asm/mmu/setup.h>
+#elif !defined(CONFIG_MPU)
+# error "Unknown memory management layout"
+#endif
+
 #define MAX_FDT_SIZE SZ_2M
 
 struct map_range_data
@@ -65,20 +71,6 @@ int map_irq_to_domain(struct domain *d, unsigned int irq,
 int map_range_to_domain(const struct dt_device_node *dev,
                         uint64_t addr, uint64_t len, void *data);
 
-extern lpae_t boot_pgtable[XEN_PT_LPAE_ENTRIES];
-
-#ifdef CONFIG_ARM_64
-extern lpae_t boot_first[XEN_PT_LPAE_ENTRIES];
-extern lpae_t boot_first_id[XEN_PT_LPAE_ENTRIES];
-#endif
-extern lpae_t boot_second[XEN_PT_LPAE_ENTRIES];
-extern lpae_t boot_second_id[XEN_PT_LPAE_ENTRIES];
-extern lpae_t boot_third[XEN_PT_LPAE_ENTRIES * XEN_NR_ENTRIES(2)];
-extern lpae_t boot_third_id[XEN_PT_LPAE_ENTRIES];
-
-/* Find where Xen will be residing at runtime and return a PT entry */
-lpae_t pte_of_xenaddr(vaddr_t va);
-
 extern const char __ro_after_init_start[], __ro_after_init_end[];
 
 struct init_info
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Dec 06 22:11:24 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 06 Dec 2024 22:11:24 +0000
Received: from list by lists.xenproject.org with outflank-mailman.850530.1264944 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tJgXj-0000KB-DS; Fri, 06 Dec 2024 22:11:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 850530.1264944; Fri, 06 Dec 2024 22: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 1tJgXj-0000K3-Ap; Fri, 06 Dec 2024 22:11:23 +0000
Received: by outflank-mailman (input) for mailman id 850530;
 Fri, 06 Dec 2024 22: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 1tJgXi-0000Jo-4U
 for xen-changelog@lists.xenproject.org; Fri, 06 Dec 2024 22:11:22 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1tJgXh-007DXq-2c
 for xen-changelog@lists.xenproject.org;
 Fri, 06 Dec 2024 22:11:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1tJgXi-003IBJ-0A
 for xen-changelog@lists.xenproject.org;
 Fri, 06 Dec 2024 22: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>
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/arm: Use vmap_contig instead of __vmap where it's possible
Message-Id: <E1tJgXi-003IBJ-0A@xenbits.xenproject.org>
Date: Fri, 06 Dec 2024 22:11:22 +0000

commit c8e59af7ad1e98479a91700334e5e1c1dbbe0781
Author:     Luca Fancellu <luca.fancellu@arm.com>
AuthorDate: Tue Dec 3 09:48:08 2024 +0000
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Fri Dec 6 19:24:25 2024 +0000

    xen/arm: Use vmap_contig instead of __vmap where it's possible
    
    Currently the arm code uses __vmap function in few parts to map
    physically contiguous pages, vmap_contig was introduced recently
    and does the same because it's a wrapper for __vmap, so use the
    latter instead of the direct __vmap function.
    
    Signed-off-by: Luca Fancellu <luca.fancellu@arm.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
    Acked-by: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/arch/arm/alternative.c | 3 +--
 xen/arch/arm/cpuerrata.c   | 5 ++---
 xen/arch/arm/kernel.c      | 2 +-
 xen/arch/arm/livepatch.c   | 3 +--
 4 files changed, 5 insertions(+), 8 deletions(-)

diff --git a/xen/arch/arm/alternative.c b/xen/arch/arm/alternative.c
index d99b507093..fec7dbd2cd 100644
--- a/xen/arch/arm/alternative.c
+++ b/xen/arch/arm/alternative.c
@@ -209,8 +209,7 @@ void __init apply_alternatives_all(void)
      * The text and inittext section are read-only. So re-map Xen to
      * be able to patch the code.
      */
-    xenmap = __vmap(&xen_mfn, 1U << xen_order, 1, 1, PAGE_HYPERVISOR,
-                    VMAP_DEFAULT);
+    xenmap = vmap_contig(xen_mfn, 1U << xen_order);
     /* Re-mapping Xen is not expected to fail during boot. */
     BUG_ON(!xenmap);
 
diff --git a/xen/arch/arm/cpuerrata.c b/xen/arch/arm/cpuerrata.c
index eef9c0ea0e..17cf134f1b 100644
--- a/xen/arch/arm/cpuerrata.c
+++ b/xen/arch/arm/cpuerrata.c
@@ -61,9 +61,8 @@ static bool copy_hyp_vect_bpi(unsigned int slot, const char *hyp_vec_start,
      * Vectors are part of the text that are mapped read-only. So re-map
      * the vector table to be able to update vectors.
      */
-    dst_remapped = __vmap(&dst_mfn,
-                          1UL << get_order_from_bytes(VECTOR_TABLE_SIZE),
-                          1, 1, PAGE_HYPERVISOR, VMAP_DEFAULT);
+    dst_remapped = vmap_contig(dst_mfn,
+                               1UL << get_order_from_bytes(VECTOR_TABLE_SIZE));
     if ( !dst_remapped )
         return false;
 
diff --git a/xen/arch/arm/kernel.c b/xen/arch/arm/kernel.c
index 669d143cee..293d7efaed 100644
--- a/xen/arch/arm/kernel.c
+++ b/xen/arch/arm/kernel.c
@@ -211,7 +211,7 @@ static __init int kernel_decompress(struct bootmodule *mod, uint32_t offset)
         return -ENOMEM;
     }
     mfn = page_to_mfn(pages);
-    output = __vmap(&mfn, 1 << kernel_order_out, 1, 1, PAGE_HYPERVISOR, VMAP_DEFAULT);
+    output = vmap_contig(mfn, 1 << kernel_order_out);
 
     rc = perform_gunzip(output, input, size);
     clean_dcache_va_range(output, output_size);
diff --git a/xen/arch/arm/livepatch.c b/xen/arch/arm/livepatch.c
index 037746d952..3805b29746 100644
--- a/xen/arch/arm/livepatch.c
+++ b/xen/arch/arm/livepatch.c
@@ -39,8 +39,7 @@ int arch_livepatch_quiesce(void)
      * The text section is read-only. So re-map Xen to be able to patch
      * the code.
      */
-    vmap_of_xen_text = __vmap(&text_mfn, 1U << text_order, 1, 1, PAGE_HYPERVISOR,
-                              VMAP_DEFAULT);
+    vmap_of_xen_text = vmap_contig(text_mfn, 1U << text_order);
 
     if ( !vmap_of_xen_text )
     {
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Dec 06 22:11:33 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 06 Dec 2024 22:11:33 +0000
Received: from list by lists.xenproject.org with outflank-mailman.850531.1264948 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tJgXt-0000N7-Ew; Fri, 06 Dec 2024 22:11:33 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 850531.1264948; Fri, 06 Dec 2024 22: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 1tJgXt-0000Mz-CG; Fri, 06 Dec 2024 22:11:33 +0000
Received: by outflank-mailman (input) for mailman id 850531;
 Fri, 06 Dec 2024 22: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 1tJgXs-0000Mh-7V
 for xen-changelog@lists.xenproject.org; Fri, 06 Dec 2024 22:11:32 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1tJgXr-007DXz-2w
 for xen-changelog@lists.xenproject.org;
 Fri, 06 Dec 2024 22:11:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1tJgXs-003IBz-0W
 for xen-changelog@lists.xenproject.org;
 Fri, 06 Dec 2024 22: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>
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/arm: Move setup_frametable_mappings to arm/mmu
Message-Id: <E1tJgXs-003IBz-0W@xenbits.xenproject.org>
Date: Fri, 06 Dec 2024 22:11:32 +0000

commit 1645bb7997cb1eccb45235ab350872733c74b305
Author:     Luca Fancellu <luca.fancellu@arm.com>
AuthorDate: Tue Dec 3 09:48:10 2024 +0000
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Fri Dec 6 19:24:25 2024 +0000

    xen/arm: Move setup_frametable_mappings to arm/mmu
    
    Move the current setup_frametable_mappings implementation to
    arm/mmu under a new file mm.c, this implementation depends on
    virtual memory and won't be used as it is for MPU systems.
    
    Take the occasion to fix code style issues related to the line
    length.
    
    Moved also frametable_virt_end since it is used only on MMU
    systems.
    
    Signed-off-by: Luca Fancellu <luca.fancellu@arm.com>
---
 xen/arch/arm/mm.c         | 40 -------------------------------
 xen/arch/arm/mmu/Makefile |  1 +
 xen/arch/arm/mmu/mm.c     | 61 +++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 62 insertions(+), 40 deletions(-)

diff --git a/xen/arch/arm/mm.c b/xen/arch/arm/mm.c
index def939172c..a56e20ba2b 100644
--- a/xen/arch/arm/mm.c
+++ b/xen/arch/arm/mm.c
@@ -22,7 +22,6 @@
 #define virt_to_mfn(va) _mfn(__virt_to_mfn(va))
 
 unsigned long frametable_base_pdx __read_mostly;
-unsigned long frametable_virt_end __read_mostly;
 
 void flush_page_to_ram(unsigned long mfn, bool sync_icache)
 {
@@ -43,45 +42,6 @@ void flush_page_to_ram(unsigned long mfn, bool sync_icache)
         invalidate_icache();
 }
 
-/* Map a frame table to cover physical addresses ps through pe */
-void __init setup_frametable_mappings(paddr_t ps, paddr_t pe)
-{
-    unsigned long nr_pdxs = mfn_to_pdx(mfn_add(maddr_to_mfn(pe), -1)) -
-                            mfn_to_pdx(maddr_to_mfn(ps)) + 1;
-    unsigned long frametable_size = nr_pdxs * sizeof(struct page_info);
-    mfn_t base_mfn;
-    const unsigned long mapping_size = frametable_size < MB(32) ? MB(2) : MB(32);
-    int rc;
-
-    /*
-     * The size of paddr_t should be sufficient for the complete range of
-     * physical address.
-     */
-    BUILD_BUG_ON((sizeof(paddr_t) * BITS_PER_BYTE) < PADDR_BITS);
-    BUILD_BUG_ON(sizeof(struct page_info) != PAGE_INFO_SIZE);
-
-    if ( frametable_size > FRAMETABLE_SIZE )
-        panic("The frametable cannot cover the physical region %#"PRIpaddr" - %#"PRIpaddr"\n",
-              ps, pe);
-
-    frametable_base_pdx = mfn_to_pdx(maddr_to_mfn(ps));
-    /* Round up to 2M or 32M boundary, as appropriate. */
-    frametable_size = ROUNDUP(frametable_size, mapping_size);
-    base_mfn = alloc_boot_pages(frametable_size >> PAGE_SHIFT, 32<<(20-12));
-
-    rc = map_pages_to_xen(FRAMETABLE_VIRT_START, base_mfn,
-                          frametable_size >> PAGE_SHIFT,
-                          PAGE_HYPERVISOR_RW | _PAGE_BLOCK);
-    if ( rc )
-        panic("Unable to setup the frametable mappings.\n");
-
-    memset(&frame_table[0], 0, nr_pdxs * sizeof(struct page_info));
-    memset(&frame_table[nr_pdxs], -1,
-           frametable_size - (nr_pdxs * sizeof(struct page_info)));
-
-    frametable_virt_end = FRAMETABLE_VIRT_START + (nr_pdxs * sizeof(struct page_info));
-}
-
 int steal_page(
     struct domain *d, struct page_info *page, unsigned int memflags)
 {
diff --git a/xen/arch/arm/mmu/Makefile b/xen/arch/arm/mmu/Makefile
index 2cb44b857d..1c89602947 100644
--- a/xen/arch/arm/mmu/Makefile
+++ b/xen/arch/arm/mmu/Makefile
@@ -1,3 +1,4 @@
+obj-y += mm.o
 obj-y += p2m.o
 obj-y += pt.o
 obj-y += setup.o
diff --git a/xen/arch/arm/mmu/mm.c b/xen/arch/arm/mmu/mm.c
new file mode 100644
index 0000000000..9c50479c63
--- /dev/null
+++ b/xen/arch/arm/mmu/mm.c
@@ -0,0 +1,61 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
+
+#include <xen/init.h>
+#include <xen/lib.h>
+#include <xen/macros.h>
+#include <xen/mm.h>
+#include <xen/mm-frame.h>
+#include <xen/pdx.h>
+#include <xen/string.h>
+
+unsigned long frametable_virt_end __read_mostly;
+
+/* Map a frame table to cover physical addresses ps through pe */
+void __init setup_frametable_mappings(paddr_t ps, paddr_t pe)
+{
+    unsigned long nr_pdxs = mfn_to_pdx(mfn_add(maddr_to_mfn(pe), -1)) -
+                            mfn_to_pdx(maddr_to_mfn(ps)) + 1;
+    unsigned long frametable_size = nr_pdxs * sizeof(struct page_info);
+    mfn_t base_mfn;
+    const unsigned long mapping_size = frametable_size < MB(32) ? MB(2)
+                                                                : MB(32);
+    int rc;
+
+    /*
+     * The size of paddr_t should be sufficient for the complete range of
+     * physical address.
+     */
+    BUILD_BUG_ON((sizeof(paddr_t) * BITS_PER_BYTE) < PADDR_BITS);
+    BUILD_BUG_ON(sizeof(struct page_info) != PAGE_INFO_SIZE);
+
+    if ( frametable_size > FRAMETABLE_SIZE )
+        panic("The frametable cannot cover the physical region %#"PRIpaddr" - %#"PRIpaddr"\n",
+              ps, pe);
+
+    frametable_base_pdx = mfn_to_pdx(maddr_to_mfn(ps));
+    /* Round up to 2M or 32M boundary, as appropriate. */
+    frametable_size = ROUNDUP(frametable_size, mapping_size);
+    base_mfn = alloc_boot_pages(frametable_size >> PAGE_SHIFT, 32<<(20-12));
+
+    rc = map_pages_to_xen(FRAMETABLE_VIRT_START, base_mfn,
+                          frametable_size >> PAGE_SHIFT,
+                          PAGE_HYPERVISOR_RW | _PAGE_BLOCK);
+    if ( rc )
+        panic("Unable to setup the frametable mappings.\n");
+
+    memset(&frame_table[0], 0, nr_pdxs * sizeof(struct page_info));
+    memset(&frame_table[nr_pdxs], -1,
+           frametable_size - (nr_pdxs * sizeof(struct page_info)));
+
+    frametable_virt_end = FRAMETABLE_VIRT_START + (nr_pdxs *
+                                                   sizeof(struct page_info));
+}
+
+/*
+ * Local variables:
+ * mode: C
+ * c-file-style: "BSD"
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Dec 10 17:11:15 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 10 Dec 2024 17:11:15 +0000
Received: from list by lists.xenproject.org with outflank-mailman.852933.1266587 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tL3lN-0000bp-A2; Tue, 10 Dec 2024 17:11:09 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 852933.1266587; Tue, 10 Dec 2024 17:11:09 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tL3lN-0000bh-7T; Tue, 10 Dec 2024 17:11:09 +0000
Received: by outflank-mailman (input) for mailman id 852933;
 Tue, 10 Dec 2024 17:11:08 +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 1tL3lM-0000Zk-8C
 for xen-changelog@lists.xenproject.org; Tue, 10 Dec 2024 17:11:08 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1tL3lL-00DrBZ-1z
 for xen-changelog@lists.xenproject.org;
 Tue, 10 Dec 2024 17:11:07 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1tL3lL-00CVbI-2l
 for xen-changelog@lists.xenproject.org;
 Tue, 10 Dec 2024 17:11:07 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/FPU: make vcpu_reset_fpu() build with old gcc
Message-Id: <E1tL3lL-00CVbI-2l@xenbits.xenproject.org>
Date: Tue, 10 Dec 2024 17:11:07 +0000

commit d636e0ed911234d7eca53777496203e83bb45505
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Dec 10 18:03:38 2024 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Dec 10 18:03:38 2024 +0100

    x86/FPU: make vcpu_reset_fpu() build with old gcc
    
    Fields of anonymous structs/unions may not be part of an initializer for
    rather old gcc (4.6 and earlier).
    
    Fixes: 49a068471d77 ("x86/fpu: Rework fpu_setup_fpu() uses to split it in two")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Alejandro Vallejo <alejandro.vallejo@cloud.com>
---
 xen/arch/x86/i387.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/xen/arch/x86/i387.c b/xen/arch/x86/i387.c
index 3add0025e4..8fba0aef42 100644
--- a/xen/arch/x86/i387.c
+++ b/xen/arch/x86/i387.c
@@ -306,13 +306,13 @@ void vcpu_reset_fpu(struct vcpu *v)
 {
     v->fpu_initialised = false;
     *v->arch.xsave_area = (struct xsave_struct) {
-        .fpu_sse = {
-            .mxcsr = MXCSR_DEFAULT,
-            .fcw = FCW_RESET,
-            .ftw = FXSAVE_FTW_RESET,
-        },
         .xsave_hdr.xstate_bv = X86_XCR0_X87,
     };
+
+    /* Old gcc doesn't permit these to be part of the initializer. */
+    v->arch.xsave_area->fpu_sse.mxcsr = MXCSR_DEFAULT;
+    v->arch.xsave_area->fpu_sse.fcw = FCW_RESET;
+    v->arch.xsave_area->fpu_sse.ftw = FXSAVE_FTW_RESET;
 }
 
 void vcpu_setup_fpu(struct vcpu *v, const void *data)
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Dec 10 17:11:19 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 10 Dec 2024 17:11:19 +0000
Received: from list by lists.xenproject.org with outflank-mailman.852935.1266592 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tL3lX-0000ia-C0; Tue, 10 Dec 2024 17:11:19 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 852935.1266592; Tue, 10 Dec 2024 17:11:19 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tL3lX-0000iP-8v; Tue, 10 Dec 2024 17:11:19 +0000
Received: by outflank-mailman (input) for mailman id 852935;
 Tue, 10 Dec 2024 17:11:18 +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 1tL3lW-0000gr-2H
 for xen-changelog@lists.xenproject.org; Tue, 10 Dec 2024 17:11:18 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1tL3lV-00DrBi-2M
 for xen-changelog@lists.xenproject.org;
 Tue, 10 Dec 2024 17:11:18 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1tL3lV-00CVdm-39
 for xen-changelog@lists.xenproject.org;
 Tue, 10 Dec 2024 17:11:17 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86: p2m-pod: address violation of MISRA C Rule 2.1
Message-Id: <E1tL3lV-00CVdm-39@xenbits.xenproject.org>
Date: Tue, 10 Dec 2024 17:11:17 +0000

commit bec5b2447c8622ada4619bf95d7e7b750754dc76
Author:     Nicola Vetrini <nicola.vetrini@bugseng.com>
AuthorDate: Tue Dec 10 18:04:20 2024 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Dec 10 18:04:20 2024 +0100

    x86: p2m-pod: address violation of MISRA C Rule 2.1
    
    Rule 2.1 states: "A project shall not contain unreachable code".
    
    The placement of the loop after "out_unmap" can be moved earlier
    in order to avoid the unconditional return to be marked as a cause of
    unreachability for the loop, as this is a consequence of
    "__builtin_unreachable" being configured in ECLAIR as being deliberately
    unreachable, and therefore not reported as causing the code after the
    "out_unmap" label to be unreachable.
    
    Replacing one instance of "goto out_unmap" with the loop avoids
    considering the unconditional return at the end of the function as a cause
    of unreachability, while preserving the semantics of the function.
    
    No functional change intended.
    
    Signed-off-by: Nicola Vetrini <nicola.vetrini@bugseng.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/mm/p2m-pod.c | 20 ++++++++------------
 1 file changed, 8 insertions(+), 12 deletions(-)

diff --git a/xen/arch/x86/mm/p2m-pod.c b/xen/arch/x86/mm/p2m-pod.c
index bd84fe9e27..df2a1cc074 100644
--- a/xen/arch/x86/mm/p2m-pod.c
+++ b/xen/arch/x86/mm/p2m-pod.c
@@ -1005,7 +1005,14 @@ p2m_pod_zero_check(struct p2m_domain *p2m, const gfn_t *gfns, unsigned int count
             {
                 ASSERT_UNREACHABLE();
                 domain_crash(d);
-                goto out_unmap;
+ out_unmap:
+                /*
+                 * Something went wrong, probably crashing the domain.  Unmap
+                 * everything and return.
+                 */
+                for ( i = 0; i < count; i++ )
+                    if ( map[i] )
+                        unmap_domain_page(map[i]);
             }
         }
         else
@@ -1032,17 +1039,6 @@ p2m_pod_zero_check(struct p2m_domain *p2m, const gfn_t *gfns, unsigned int count
             ioreq_request_mapcache_invalidate(d);
         }
     }
-
-    return;
-
-out_unmap:
-    /*
-     * Something went wrong, probably crashing the domain.  Unmap
-     * everything and return.
-     */
-    for ( i = 0; i < count; i++ )
-        if ( map[i] )
-            unmap_domain_page(map[i]);
 }
 
 static void
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Dec 10 17:11:29 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 10 Dec 2024 17:11:29 +0000
Received: from list by lists.xenproject.org with outflank-mailman.852939.1266597 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tL3lh-0000p7-Dr; Tue, 10 Dec 2024 17:11:29 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 852939.1266597; Tue, 10 Dec 2024 17:11:29 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tL3lh-0000ox-Am; Tue, 10 Dec 2024 17:11:29 +0000
Received: by outflank-mailman (input) for mailman id 852939;
 Tue, 10 Dec 2024 17:11:28 +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 1tL3lg-0000ob-4v
 for xen-changelog@lists.xenproject.org; Tue, 10 Dec 2024 17:11:28 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1tL3lf-00DrCB-2f
 for xen-changelog@lists.xenproject.org;
 Tue, 10 Dec 2024 17:11:28 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1tL3lg-00CVeM-0G
 for xen-changelog@lists.xenproject.org;
 Tue, 10 Dec 2024 17:11:28 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] CHANGELOG: Mention xl suspend/resume
Message-Id: <E1tL3lg-00CVeM-0G@xenbits.xenproject.org>
Date: Tue, 10 Dec 2024 17:11:28 +0000

commit 13df44f8a1c65613b5d14f2ae5c97e83ea33be32
Author:     Jason Andryuk <jason.andryuk@amd.com>
AuthorDate: Tue Dec 10 18:04:39 2024 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Dec 10 18:04:39 2024 +0100

    CHANGELOG: Mention xl suspend/resume
    
    The xl subcommands are generic, but only built when
    LIBXL_HAVE_NO_SUSPEND_RESUME is false.  Currently that is only x86, so
    list them there.
    
    Signed-off-by: Jason Andryuk <jason.andryuk@amd.com>
    Reviewed-by: Oleksii Kurochko<oleksii.kurochko@gmail.com>
---
 CHANGELOG.md | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 8553b2e451..15f681459f 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -16,6 +16,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
 ### Added
  - On Arm:
    - Experimental support for Armv8-R.
+ - On x86:
+   - xl suspend/resume subcommands.
 
 ### Removed
  - On x86:
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Dec 10 18:11:10 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 10 Dec 2024 18:11:10 +0000
Received: from list by lists.xenproject.org with outflank-mailman.852960.1266600 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tL4hL-0008AA-BY; Tue, 10 Dec 2024 18:11:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 852960.1266600; Tue, 10 Dec 2024 18:11:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tL4hL-0008A3-8q; Tue, 10 Dec 2024 18:11:03 +0000
Received: by outflank-mailman (input) for mailman id 852960;
 Tue, 10 Dec 2024 18: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 1tL4hJ-00089x-QD
 for xen-changelog@lists.xenproject.org; Tue, 10 Dec 2024 18:11:01 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1tL4hJ-00DsSS-12
 for xen-changelog@lists.xenproject.org;
 Tue, 10 Dec 2024 18:11:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1tL4hJ-00Cc94-1m
 for xen-changelog@lists.xenproject.org;
 Tue, 10 Dec 2024 18: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>
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/FPU: make vcpu_reset_fpu() build with old gcc
Message-Id: <E1tL4hJ-00Cc94-1m@xenbits.xenproject.org>
Date: Tue, 10 Dec 2024 18:11:01 +0000

commit d636e0ed911234d7eca53777496203e83bb45505
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Dec 10 18:03:38 2024 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Dec 10 18:03:38 2024 +0100

    x86/FPU: make vcpu_reset_fpu() build with old gcc
    
    Fields of anonymous structs/unions may not be part of an initializer for
    rather old gcc (4.6 and earlier).
    
    Fixes: 49a068471d77 ("x86/fpu: Rework fpu_setup_fpu() uses to split it in two")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Alejandro Vallejo <alejandro.vallejo@cloud.com>
---
 xen/arch/x86/i387.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/xen/arch/x86/i387.c b/xen/arch/x86/i387.c
index 3add0025e4..8fba0aef42 100644
--- a/xen/arch/x86/i387.c
+++ b/xen/arch/x86/i387.c
@@ -306,13 +306,13 @@ void vcpu_reset_fpu(struct vcpu *v)
 {
     v->fpu_initialised = false;
     *v->arch.xsave_area = (struct xsave_struct) {
-        .fpu_sse = {
-            .mxcsr = MXCSR_DEFAULT,
-            .fcw = FCW_RESET,
-            .ftw = FXSAVE_FTW_RESET,
-        },
         .xsave_hdr.xstate_bv = X86_XCR0_X87,
     };
+
+    /* Old gcc doesn't permit these to be part of the initializer. */
+    v->arch.xsave_area->fpu_sse.mxcsr = MXCSR_DEFAULT;
+    v->arch.xsave_area->fpu_sse.fcw = FCW_RESET;
+    v->arch.xsave_area->fpu_sse.ftw = FXSAVE_FTW_RESET;
 }
 
 void vcpu_setup_fpu(struct vcpu *v, const void *data)
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Dec 10 18:11:13 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 10 Dec 2024 18:11:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.852962.1266605 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tL4hV-0008Bz-DY; Tue, 10 Dec 2024 18:11:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 852962.1266605; Tue, 10 Dec 2024 18:11:13 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tL4hV-0008Br-AY; Tue, 10 Dec 2024 18:11:13 +0000
Received: by outflank-mailman (input) for mailman id 852962;
 Tue, 10 Dec 2024 18: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 1tL4hT-0008Bh-Qy
 for xen-changelog@lists.xenproject.org; Tue, 10 Dec 2024 18:11:11 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1tL4hT-00DsSo-1W
 for xen-changelog@lists.xenproject.org;
 Tue, 10 Dec 2024 18:11:11 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1tL4hT-00Cc9q-2B
 for xen-changelog@lists.xenproject.org;
 Tue, 10 Dec 2024 18: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>
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86: p2m-pod: address violation of MISRA C Rule 2.1
Message-Id: <E1tL4hT-00Cc9q-2B@xenbits.xenproject.org>
Date: Tue, 10 Dec 2024 18:11:11 +0000

commit bec5b2447c8622ada4619bf95d7e7b750754dc76
Author:     Nicola Vetrini <nicola.vetrini@bugseng.com>
AuthorDate: Tue Dec 10 18:04:20 2024 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Dec 10 18:04:20 2024 +0100

    x86: p2m-pod: address violation of MISRA C Rule 2.1
    
    Rule 2.1 states: "A project shall not contain unreachable code".
    
    The placement of the loop after "out_unmap" can be moved earlier
    in order to avoid the unconditional return to be marked as a cause of
    unreachability for the loop, as this is a consequence of
    "__builtin_unreachable" being configured in ECLAIR as being deliberately
    unreachable, and therefore not reported as causing the code after the
    "out_unmap" label to be unreachable.
    
    Replacing one instance of "goto out_unmap" with the loop avoids
    considering the unconditional return at the end of the function as a cause
    of unreachability, while preserving the semantics of the function.
    
    No functional change intended.
    
    Signed-off-by: Nicola Vetrini <nicola.vetrini@bugseng.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/mm/p2m-pod.c | 20 ++++++++------------
 1 file changed, 8 insertions(+), 12 deletions(-)

diff --git a/xen/arch/x86/mm/p2m-pod.c b/xen/arch/x86/mm/p2m-pod.c
index bd84fe9e27..df2a1cc074 100644
--- a/xen/arch/x86/mm/p2m-pod.c
+++ b/xen/arch/x86/mm/p2m-pod.c
@@ -1005,7 +1005,14 @@ p2m_pod_zero_check(struct p2m_domain *p2m, const gfn_t *gfns, unsigned int count
             {
                 ASSERT_UNREACHABLE();
                 domain_crash(d);
-                goto out_unmap;
+ out_unmap:
+                /*
+                 * Something went wrong, probably crashing the domain.  Unmap
+                 * everything and return.
+                 */
+                for ( i = 0; i < count; i++ )
+                    if ( map[i] )
+                        unmap_domain_page(map[i]);
             }
         }
         else
@@ -1032,17 +1039,6 @@ p2m_pod_zero_check(struct p2m_domain *p2m, const gfn_t *gfns, unsigned int count
             ioreq_request_mapcache_invalidate(d);
         }
     }
-
-    return;
-
-out_unmap:
-    /*
-     * Something went wrong, probably crashing the domain.  Unmap
-     * everything and return.
-     */
-    for ( i = 0; i < count; i++ )
-        if ( map[i] )
-            unmap_domain_page(map[i]);
 }
 
 static void
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Dec 10 18:11:24 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 10 Dec 2024 18:11:24 +0000
Received: from list by lists.xenproject.org with outflank-mailman.852963.1266609 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tL4hf-0008EU-F1; Tue, 10 Dec 2024 18:11:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 852963.1266609; Tue, 10 Dec 2024 18: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 1tL4hf-0008EK-Bw; Tue, 10 Dec 2024 18:11:23 +0000
Received: by outflank-mailman (input) for mailman id 852963;
 Tue, 10 Dec 2024 18:11: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 1tL4hd-0008E5-Tu
 for xen-changelog@lists.xenproject.org; Tue, 10 Dec 2024 18:11:21 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1tL4hd-00DsSv-1t
 for xen-changelog@lists.xenproject.org;
 Tue, 10 Dec 2024 18:11:21 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1tL4hd-00CcAc-2f
 for xen-changelog@lists.xenproject.org;
 Tue, 10 Dec 2024 18: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>
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] CHANGELOG: Mention xl suspend/resume
Message-Id: <E1tL4hd-00CcAc-2f@xenbits.xenproject.org>
Date: Tue, 10 Dec 2024 18:11:21 +0000

commit 13df44f8a1c65613b5d14f2ae5c97e83ea33be32
Author:     Jason Andryuk <jason.andryuk@amd.com>
AuthorDate: Tue Dec 10 18:04:39 2024 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Dec 10 18:04:39 2024 +0100

    CHANGELOG: Mention xl suspend/resume
    
    The xl subcommands are generic, but only built when
    LIBXL_HAVE_NO_SUSPEND_RESUME is false.  Currently that is only x86, so
    list them there.
    
    Signed-off-by: Jason Andryuk <jason.andryuk@amd.com>
    Reviewed-by: Oleksii Kurochko<oleksii.kurochko@gmail.com>
---
 CHANGELOG.md | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 8553b2e451..15f681459f 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -16,6 +16,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
 ### Added
  - On Arm:
    - Experimental support for Armv8-R.
+ - On x86:
+   - xl suspend/resume subcommands.
 
 ### Removed
  - On x86:
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Dec 11 10:55:17 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 11 Dec 2024 10:55:17 +0000
Received: from list by lists.xenproject.org with outflank-mailman.854545.1267715 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tLKN3-0007MC-VX; Wed, 11 Dec 2024 10:55:09 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 854545.1267715; Wed, 11 Dec 2024 10:55:09 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tLKN3-0007M4-T0; Wed, 11 Dec 2024 10:55:09 +0000
Received: by outflank-mailman (input) for mailman id 854545;
 Wed, 11 Dec 2024 10:55:08 +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 1tLKN2-0007Ly-HR
 for xen-changelog@lists.xenproject.org; Wed, 11 Dec 2024 10:55:08 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1tLKN1-00FQNp-3C
 for xen-changelog@lists.xenproject.org;
 Wed, 11 Dec 2024 10:55:08 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1tLKN2-00EJ8q-0a
 for xen-changelog@lists.xenproject.org;
 Wed, 11 Dec 2024 10:55:08 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] tools/ocaml: Specify rpath correctly for ocamlmklib
Message-Id: <E1tLKN2-00EJ8q-0a@xenbits.xenproject.org>
Date: Wed, 11 Dec 2024 10:55:08 +0000

commit bf8a209915804088c09ac6575bcca554450fa7e8
Author:     Andrii Sultanov <andrii.sultanov@cloud.com>
AuthorDate: Mon Dec 9 17:57:49 2024 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Wed Dec 11 10:45:08 2024 +0000

    tools/ocaml: Specify rpath correctly for ocamlmklib
    
    ocamlmklib has special handling for C-like '-Wl,-rpath' option, but does
    not know how to handle '-Wl,-rpath-link', as evidenced by warnings like:
    "Unknown option
    -Wl,-rpath-link=$HOME/xen/tools/ocaml/libs/eventchn/../../../../tools/libs/toollog"
    Pass this option directly to the compiler with -ccopt instead.
    
    Also pass -L directly to the linker with -ldopt. This prevents embedding absolute
    paths from buildtime into binary's RPATH.
    
    Fixes: f7b4e4558b42 ("tools/ocaml: Fix OCaml libs rules")
    Reported-by: Fernando Rodrigues <alpha@sigmasquadron.net>
    Tested-by: Fernando Rodrigues <alpha@sigmasquadron.net>
    Signed-off-by: Andrii Sultanov <andrii.sultanov@cloud.com>
    Acked-by: Christian Lindig <christian.lindig@cloud.com>
---
 tools/ocaml/Makefile.rules | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/ocaml/Makefile.rules b/tools/ocaml/Makefile.rules
index b9d4b51f0a..43f7add072 100644
--- a/tools/ocaml/Makefile.rules
+++ b/tools/ocaml/Makefile.rules
@@ -63,7 +63,7 @@ mk-caml-lib-bytecode = $(call quiet-command, $(OCAMLC) $(OCAMLCFLAGS) -a -o $1 $
 
 mk-caml-stubs = $(call quiet-command, $(OCAMLMKLIB) -o `basename $1 .a` $2,MKLIB,$1)
 mk-caml-lib-stubs = \
-	$(call quiet-command, $(OCAMLMKLIB) -o `basename $1 .a | sed -e 's/^lib//'` $2 $3,MKLIB,$1)
+	$(call quiet-command, $(OCAMLMKLIB) -o `basename $1 .a | sed -e 's/^lib//'` $2 `echo $3 | sed -e 's/-ccopt -l/-l/g' | sed -e 's/-ccopt -L/-ldopt -L/g'`,MKLIB,$1)
 
 # define a library target <name>.cmxa and <name>.cma
 define OCAML_LIBRARY_template
@@ -74,7 +74,7 @@ define OCAML_LIBRARY_template
  $(1)_stubs.a: $(foreach obj,$$($(1)_C_OBJS),$(obj).o)
 	$(call mk-caml-stubs,$$@, $$+)
  lib$(1)_stubs.a: $(foreach obj,$($(1)_C_OBJS),$(obj).o)
-	$(call mk-caml-lib-stubs,$$@, $$+, $(foreach lib,$(LIBS_$(1)),$(lib)))
+	$(call mk-caml-lib-stubs,$$@, $$+, $(foreach lib,$(LIBS_$(1)),-ccopt $(lib)))
 endef
 
 # Dynamically linked OCaml libraries ("plugins" in Dynlink parlance)
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Dec 11 10:55:20 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 11 Dec 2024 10:55:20 +0000
Received: from list by lists.xenproject.org with outflank-mailman.854546.1267720 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tLKNE-0007O8-0v; Wed, 11 Dec 2024 10:55:20 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 854546.1267720; Wed, 11 Dec 2024 10:55:20 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tLKND-0007O0-UV; Wed, 11 Dec 2024 10:55:19 +0000
Received: by outflank-mailman (input) for mailman id 854546;
 Wed, 11 Dec 2024 10:55:18 +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 1tLKNC-0007Nq-Dy
 for xen-changelog@lists.xenproject.org; Wed, 11 Dec 2024 10:55:18 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1tLKNC-00FQNt-0K
 for xen-changelog@lists.xenproject.org;
 Wed, 11 Dec 2024 10:55:18 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1tLKNC-00EJ9K-16
 for xen-changelog@lists.xenproject.org;
 Wed, 11 Dec 2024 10:55:18 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] MAINTAINERS: add Anthony, Michal, Roger to THE REST
Message-Id: <E1tLKNC-00EJ9K-16@xenbits.xenproject.org>
Date: Wed, 11 Dec 2024 10:55:18 +0000

commit a974366f7a1b650d39ea201972a336c175257fba
Author:     Stefano Stabellini <sstabellini@kernel.org>
AuthorDate: Tue Dec 10 15:58:04 2024 -0800
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Wed Dec 11 10:45:08 2024 +0000

    MAINTAINERS: add Anthony, Michal, Roger to THE REST
    
    In recognition of their outstanding work and years of service to the Xen
    Community, please join me in welcoming Anthony, Michal, and Roger as
    Committers and REST Maintainers.
    
    Signed-off-by: Stefano Stabellini <stefano.stabellini@amd.com>
    Acked-by: Anthony PERARD <anthony.perard@vates.tech>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Roger Pau Monné <roger.pau@citrix.com>
    Acked-by: Bertrand Marquis <bertrand.marquis@arm.com>
    Acked-by: Michal Orzel <michal.orzel@amd.com>
---
 MAINTAINERS | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/MAINTAINERS b/MAINTAINERS
index 026aa25a53..34ad49bc39 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -662,8 +662,11 @@ K:	\b(xsm|XSM)\b
 
 THE REST
 M:	Andrew Cooper <andrew.cooper3@citrix.com>
+M:	Anthony PERARD <anthony.perard@vates.tech>
+M:	Michal Orzel <michal.orzel@amd.com>
 M:	Jan Beulich <jbeulich@suse.com>
 M:	Julien Grall <julien@xen.org>
+M:	Roger Pau Monné <roger.pau@citrix.com>
 M:	Stefano Stabellini <sstabellini@kernel.org>
 L:	xen-devel@lists.xenproject.org
 S:	Supported
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Dec 11 11:44:07 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 11 Dec 2024 11:44:07 +0000
Received: from list by lists.xenproject.org with outflank-mailman.854661.1267816 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tLL8N-0003pJ-Hk; Wed, 11 Dec 2024 11:44:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 854661.1267816; Wed, 11 Dec 2024 11:44:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tLL8N-0003pB-D7; Wed, 11 Dec 2024 11:44:03 +0000
Received: by outflank-mailman (input) for mailman id 854661;
 Wed, 11 Dec 2024 11: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 1tLL8M-0003p3-J7
 for xen-changelog@lists.xenproject.org; Wed, 11 Dec 2024 11:44:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1tLL8M-00FRTA-0F
 for xen-changelog@lists.xenproject.org;
 Wed, 11 Dec 2024 11:44:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1tLL8M-00EOK3-12
 for xen-changelog@lists.xenproject.org;
 Wed, 11 Dec 2024 11:44:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools/ocaml: Specify rpath correctly for ocamlmklib
Message-Id: <E1tLL8M-00EOK3-12@xenbits.xenproject.org>
Date: Wed, 11 Dec 2024 11:44:02 +0000

commit bf8a209915804088c09ac6575bcca554450fa7e8
Author:     Andrii Sultanov <andrii.sultanov@cloud.com>
AuthorDate: Mon Dec 9 17:57:49 2024 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Wed Dec 11 10:45:08 2024 +0000

    tools/ocaml: Specify rpath correctly for ocamlmklib
    
    ocamlmklib has special handling for C-like '-Wl,-rpath' option, but does
    not know how to handle '-Wl,-rpath-link', as evidenced by warnings like:
    "Unknown option
    -Wl,-rpath-link=$HOME/xen/tools/ocaml/libs/eventchn/../../../../tools/libs/toollog"
    Pass this option directly to the compiler with -ccopt instead.
    
    Also pass -L directly to the linker with -ldopt. This prevents embedding absolute
    paths from buildtime into binary's RPATH.
    
    Fixes: f7b4e4558b42 ("tools/ocaml: Fix OCaml libs rules")
    Reported-by: Fernando Rodrigues <alpha@sigmasquadron.net>
    Tested-by: Fernando Rodrigues <alpha@sigmasquadron.net>
    Signed-off-by: Andrii Sultanov <andrii.sultanov@cloud.com>
    Acked-by: Christian Lindig <christian.lindig@cloud.com>
---
 tools/ocaml/Makefile.rules | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/ocaml/Makefile.rules b/tools/ocaml/Makefile.rules
index b9d4b51f0a..43f7add072 100644
--- a/tools/ocaml/Makefile.rules
+++ b/tools/ocaml/Makefile.rules
@@ -63,7 +63,7 @@ mk-caml-lib-bytecode = $(call quiet-command, $(OCAMLC) $(OCAMLCFLAGS) -a -o $1 $
 
 mk-caml-stubs = $(call quiet-command, $(OCAMLMKLIB) -o `basename $1 .a` $2,MKLIB,$1)
 mk-caml-lib-stubs = \
-	$(call quiet-command, $(OCAMLMKLIB) -o `basename $1 .a | sed -e 's/^lib//'` $2 $3,MKLIB,$1)
+	$(call quiet-command, $(OCAMLMKLIB) -o `basename $1 .a | sed -e 's/^lib//'` $2 `echo $3 | sed -e 's/-ccopt -l/-l/g' | sed -e 's/-ccopt -L/-ldopt -L/g'`,MKLIB,$1)
 
 # define a library target <name>.cmxa and <name>.cma
 define OCAML_LIBRARY_template
@@ -74,7 +74,7 @@ define OCAML_LIBRARY_template
  $(1)_stubs.a: $(foreach obj,$$($(1)_C_OBJS),$(obj).o)
 	$(call mk-caml-stubs,$$@, $$+)
  lib$(1)_stubs.a: $(foreach obj,$($(1)_C_OBJS),$(obj).o)
-	$(call mk-caml-lib-stubs,$$@, $$+, $(foreach lib,$(LIBS_$(1)),$(lib)))
+	$(call mk-caml-lib-stubs,$$@, $$+, $(foreach lib,$(LIBS_$(1)),-ccopt $(lib)))
 endef
 
 # Dynamically linked OCaml libraries ("plugins" in Dynlink parlance)
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Dec 11 11:44:13 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 11 Dec 2024 11:44:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.854662.1267817 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tLL8X-0003sC-J5; Wed, 11 Dec 2024 11:44:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 854662.1267817; Wed, 11 Dec 2024 11:44:13 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tLL8X-0003s5-GP; Wed, 11 Dec 2024 11:44:13 +0000
Received: by outflank-mailman (input) for mailman id 854662;
 Wed, 11 Dec 2024 11: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 1tLL8W-0003ro-HC
 for xen-changelog@lists.xenproject.org; Wed, 11 Dec 2024 11:44:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1tLL8W-00FRTG-0e
 for xen-changelog@lists.xenproject.org;
 Wed, 11 Dec 2024 11:44:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1tLL8W-00EOLL-1N
 for xen-changelog@lists.xenproject.org;
 Wed, 11 Dec 2024 11:44:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] MAINTAINERS: add Anthony, Michal, Roger to THE REST
Message-Id: <E1tLL8W-00EOLL-1N@xenbits.xenproject.org>
Date: Wed, 11 Dec 2024 11:44:12 +0000

commit a974366f7a1b650d39ea201972a336c175257fba
Author:     Stefano Stabellini <sstabellini@kernel.org>
AuthorDate: Tue Dec 10 15:58:04 2024 -0800
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Wed Dec 11 10:45:08 2024 +0000

    MAINTAINERS: add Anthony, Michal, Roger to THE REST
    
    In recognition of their outstanding work and years of service to the Xen
    Community, please join me in welcoming Anthony, Michal, and Roger as
    Committers and REST Maintainers.
    
    Signed-off-by: Stefano Stabellini <stefano.stabellini@amd.com>
    Acked-by: Anthony PERARD <anthony.perard@vates.tech>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Roger Pau Monné <roger.pau@citrix.com>
    Acked-by: Bertrand Marquis <bertrand.marquis@arm.com>
    Acked-by: Michal Orzel <michal.orzel@amd.com>
---
 MAINTAINERS | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/MAINTAINERS b/MAINTAINERS
index 026aa25a53..34ad49bc39 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -662,8 +662,11 @@ K:	\b(xsm|XSM)\b
 
 THE REST
 M:	Andrew Cooper <andrew.cooper3@citrix.com>
+M:	Anthony PERARD <anthony.perard@vates.tech>
+M:	Michal Orzel <michal.orzel@amd.com>
 M:	Jan Beulich <jbeulich@suse.com>
 M:	Julien Grall <julien@xen.org>
+M:	Roger Pau Monné <roger.pau@citrix.com>
 M:	Stefano Stabellini <sstabellini@kernel.org>
 L:	xen-devel@lists.xenproject.org
 S:	Supported
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Dec 12 08:55:17 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 12 Dec 2024 08:55:17 +0000
Received: from list by lists.xenproject.org with outflank-mailman.855572.1268428 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tLeyS-0006Rf-8l; Thu, 12 Dec 2024 08:55:08 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 855572.1268428; Thu, 12 Dec 2024 08:55:08 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tLeyS-0006RX-5r; Thu, 12 Dec 2024 08:55:08 +0000
Received: by outflank-mailman (input) for mailman id 855572;
 Thu, 12 Dec 2024 08:55:07 +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 1tLeyR-0006RR-Mg
 for xen-changelog@lists.xenproject.org; Thu, 12 Dec 2024 08:55:07 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1tLeyR-00H4qa-07
 for xen-changelog@lists.xenproject.org;
 Thu, 12 Dec 2024 08:55:07 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1tLeyR-00GXY4-0s
 for xen-changelog@lists.xenproject.org;
 Thu, 12 Dec 2024 08:55:07 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] arm/domain_build: Make find_unallocated_memory() more generic
Message-Id: <E1tLeyR-00GXY4-0s@xenbits.xenproject.org>
Date: Thu, 12 Dec 2024 08:55:07 +0000

commit 89dca886ac6be886f7a375612426f7661c80420b
Author:     Michal Orzel <michal.orzel@amd.com>
AuthorDate: Tue Dec 10 11:10:01 2024 +0100
Commit:     Michal Orzel <michal.orzel@amd.com>
CommitDate: Thu Dec 12 09:02:31 2024 +0100

    arm/domain_build: Make find_unallocated_memory() more generic
    
    At the moment, find_unallocated_memory() is only used to retrieve free
    memory ranges for direct mapped domains in order to find extended
    regions. It is not generic as it makes assumptions as for the place at
    which it's being called (domain memory already allocated, gnttab region
    already found) and hardcodes the memory banks to be excluded.
    
    Make the function more generic, so that it can be used for other
    purposes whenever there is a need to find free host memory regions (e.g.
    upcoming LLC coloring series). Allow passing array with memory banks as a
    parameter together with a callback to populate free regions structure,
    as the logic may differ depending on the needs.
    
    Add find_host_extended_regions() to be called from make_hypervisor_node()
    to contain the logic to find extended regions for domains using host
    memory layout that are not permitted to use IOMMU.
    
    Signed-off-by: Michal Orzel <michal.orzel@amd.com>
    Reviewed-by: Luca Fancellu <luca.fancellu@arm.com>
    Tested-by: Luca Fancellu <luca.fancellu@arm.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
---
 xen/arch/arm/domain_build.c | 96 +++++++++++++++++++++++++--------------------
 1 file changed, 54 insertions(+), 42 deletions(-)

diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c
index 2c30792de8..adf26f2778 100644
--- a/xen/arch/arm/domain_build.c
+++ b/xen/arch/arm/domain_build.c
@@ -901,31 +901,25 @@ int __init add_ext_regions(unsigned long s_gfn, unsigned long e_gfn,
 }
 
 /*
- * Find unused regions of Host address space which can be exposed to Dom0
- * as extended regions for the special memory mappings. In order to calculate
- * regions we exclude every region assigned to Dom0 from the Host RAM:
- * - domain RAM
- * - reserved-memory
- * - static shared memory
- * - grant table space
+ * Find unused regions of Host address space which can be exposed to domain
+ * using the host memory layout. In order to calculate regions we exclude every
+ * region passed in mem_banks from the Host RAM.
  */
 static int __init find_unallocated_memory(const struct kernel_info *kinfo,
-                                          struct membanks *ext_regions)
+                                          const struct membanks *mem_banks[],
+                                          unsigned int nr_mem_banks,
+                                          struct membanks *free_regions,
+                                          int (*cb)(unsigned long s_gfn,
+                                                    unsigned long e_gfn,
+                                                    void *data))
 {
     const struct membanks *mem = bootinfo_get_mem();
-    const struct membanks *mem_banks[] = {
-        kernel_info_get_mem_const(kinfo),
-        bootinfo_get_reserved_mem(),
-#ifdef CONFIG_STATIC_SHM
-        bootinfo_get_shmem(),
-#endif
-    };
     struct rangeset *unalloc_mem;
     paddr_t start, end;
     unsigned int i, j;
     int res;
 
-    dt_dprintk("Find unallocated memory for extended regions\n");
+    ASSERT(domain_use_host_layout(kinfo->d));
 
     unalloc_mem = rangeset_new(NULL, NULL, 0);
     if ( !unalloc_mem )
@@ -946,13 +940,8 @@ static int __init find_unallocated_memory(const struct kernel_info *kinfo,
         }
     }
 
-    /*
-     * Exclude the following regions:
-     * 1) Remove RAM assigned to Dom0
-     * 2) Remove reserved memory
-     * 3) Remove static shared memory (when the feature is enabled)
-     */
-    for ( i = 0; i < ARRAY_SIZE(mem_banks); i++ )
+    /* Remove all regions listed in mem_banks */
+    for ( i = 0; i < nr_mem_banks; i++ )
         for ( j = 0; j < mem_banks[i]->nr_banks; j++ )
         {
             start = mem_banks[i]->bank[j].start;
@@ -973,28 +962,13 @@ static int __init find_unallocated_memory(const struct kernel_info *kinfo,
             }
         }
 
-    /* Remove grant table region */
-    if ( kinfo->gnttab_size )
-    {
-        start = kinfo->gnttab_start;
-        end = kinfo->gnttab_start + kinfo->gnttab_size;
-        res = rangeset_remove_range(unalloc_mem, PFN_DOWN(start),
-                                    PFN_DOWN(end - 1));
-        if ( res )
-        {
-            printk(XENLOG_ERR "Failed to remove: %#"PRIpaddr"->%#"PRIpaddr"\n",
-                   start, end);
-            goto out;
-        }
-    }
-
     start = 0;
     end = (1ULL << p2m_ipa_bits) - 1;
     res = rangeset_report_ranges(unalloc_mem, PFN_DOWN(start), PFN_DOWN(end),
-                                 add_ext_regions, ext_regions);
+                                 cb, free_regions);
     if ( res )
-        ext_regions->nr_banks = 0;
-    else if ( !ext_regions->nr_banks )
+        free_regions->nr_banks = 0;
+    else if ( !free_regions->nr_banks )
         res = -ENOENT;
 
 out:
@@ -1170,6 +1144,44 @@ static int __init find_domU_holes(const struct kernel_info *kinfo,
     return remove_shm_holes_for_domU(kinfo, ext_regions);
 }
 
+static int __init find_host_extended_regions(const struct kernel_info *kinfo,
+                                             struct membanks *ext_regions)
+{
+    int res;
+    struct membanks *gnttab = xzalloc_flex_struct(struct membanks, bank, 1);
+
+    /*
+     * Exclude the following regions:
+     * 1) Remove RAM assigned to domain
+     * 2) Remove reserved memory
+     * 3) Grant table assigned to domain
+     * 4) Remove static shared memory (when the feature is enabled)
+     */
+    const struct membanks *mem_banks[] = {
+        kernel_info_get_mem_const(kinfo),
+        bootinfo_get_reserved_mem(),
+        gnttab,
+#ifdef CONFIG_STATIC_SHM
+        bootinfo_get_shmem(),
+#endif
+    };
+
+    dt_dprintk("Find unallocated memory for extended regions\n");
+
+    if ( !gnttab )
+        return -ENOMEM;
+
+    gnttab->nr_banks = 1;
+    gnttab->bank[0].start = kinfo->gnttab_start;
+    gnttab->bank[0].size = kinfo->gnttab_size;
+
+    res = find_unallocated_memory(kinfo, mem_banks, ARRAY_SIZE(mem_banks),
+                                  ext_regions, add_ext_regions);
+    xfree(gnttab);
+
+    return res;
+}
+
 int __init make_hypervisor_node(struct domain *d,
                                 const struct kernel_info *kinfo,
                                 int addrcells, int sizecells)
@@ -1226,7 +1238,7 @@ int __init make_hypervisor_node(struct domain *d,
         if ( is_domain_direct_mapped(d) )
         {
             if ( !is_iommu_enabled(d) )
-                res = find_unallocated_memory(kinfo, ext_regions);
+                res = find_host_extended_regions(kinfo, ext_regions);
             else
                 res = find_memory_holes(kinfo, ext_regions);
         }
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Dec 12 09:33:08 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 12 Dec 2024 09:33:08 +0000
Received: from list by lists.xenproject.org with outflank-mailman.855620.1268472 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tLfZ8-0008Fs-Or; Thu, 12 Dec 2024 09:33:02 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 855620.1268472; Thu, 12 Dec 2024 09:33:02 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tLfZ8-0008Fk-ML; Thu, 12 Dec 2024 09:33:02 +0000
Received: by outflank-mailman (input) for mailman id 855620;
 Thu, 12 Dec 2024 09: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 1tLfZ8-0008Fe-8v
 for xen-changelog@lists.xenproject.org; Thu, 12 Dec 2024 09:33:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1tLfZ7-00H5cl-2R
 for xen-changelog@lists.xenproject.org;
 Thu, 12 Dec 2024 09:33:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1tLfZ8-00Gc7n-00
 for xen-changelog@lists.xenproject.org;
 Thu, 12 Dec 2024 09:33:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] arm/domain_build: Make find_unallocated_memory() more generic
Message-Id: <E1tLfZ8-00Gc7n-00@xenbits.xenproject.org>
Date: Thu, 12 Dec 2024 09:33:02 +0000

commit 89dca886ac6be886f7a375612426f7661c80420b
Author:     Michal Orzel <michal.orzel@amd.com>
AuthorDate: Tue Dec 10 11:10:01 2024 +0100
Commit:     Michal Orzel <michal.orzel@amd.com>
CommitDate: Thu Dec 12 09:02:31 2024 +0100

    arm/domain_build: Make find_unallocated_memory() more generic
    
    At the moment, find_unallocated_memory() is only used to retrieve free
    memory ranges for direct mapped domains in order to find extended
    regions. It is not generic as it makes assumptions as for the place at
    which it's being called (domain memory already allocated, gnttab region
    already found) and hardcodes the memory banks to be excluded.
    
    Make the function more generic, so that it can be used for other
    purposes whenever there is a need to find free host memory regions (e.g.
    upcoming LLC coloring series). Allow passing array with memory banks as a
    parameter together with a callback to populate free regions structure,
    as the logic may differ depending on the needs.
    
    Add find_host_extended_regions() to be called from make_hypervisor_node()
    to contain the logic to find extended regions for domains using host
    memory layout that are not permitted to use IOMMU.
    
    Signed-off-by: Michal Orzel <michal.orzel@amd.com>
    Reviewed-by: Luca Fancellu <luca.fancellu@arm.com>
    Tested-by: Luca Fancellu <luca.fancellu@arm.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
---
 xen/arch/arm/domain_build.c | 96 +++++++++++++++++++++++++--------------------
 1 file changed, 54 insertions(+), 42 deletions(-)

diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c
index 2c30792de8..adf26f2778 100644
--- a/xen/arch/arm/domain_build.c
+++ b/xen/arch/arm/domain_build.c
@@ -901,31 +901,25 @@ int __init add_ext_regions(unsigned long s_gfn, unsigned long e_gfn,
 }
 
 /*
- * Find unused regions of Host address space which can be exposed to Dom0
- * as extended regions for the special memory mappings. In order to calculate
- * regions we exclude every region assigned to Dom0 from the Host RAM:
- * - domain RAM
- * - reserved-memory
- * - static shared memory
- * - grant table space
+ * Find unused regions of Host address space which can be exposed to domain
+ * using the host memory layout. In order to calculate regions we exclude every
+ * region passed in mem_banks from the Host RAM.
  */
 static int __init find_unallocated_memory(const struct kernel_info *kinfo,
-                                          struct membanks *ext_regions)
+                                          const struct membanks *mem_banks[],
+                                          unsigned int nr_mem_banks,
+                                          struct membanks *free_regions,
+                                          int (*cb)(unsigned long s_gfn,
+                                                    unsigned long e_gfn,
+                                                    void *data))
 {
     const struct membanks *mem = bootinfo_get_mem();
-    const struct membanks *mem_banks[] = {
-        kernel_info_get_mem_const(kinfo),
-        bootinfo_get_reserved_mem(),
-#ifdef CONFIG_STATIC_SHM
-        bootinfo_get_shmem(),
-#endif
-    };
     struct rangeset *unalloc_mem;
     paddr_t start, end;
     unsigned int i, j;
     int res;
 
-    dt_dprintk("Find unallocated memory for extended regions\n");
+    ASSERT(domain_use_host_layout(kinfo->d));
 
     unalloc_mem = rangeset_new(NULL, NULL, 0);
     if ( !unalloc_mem )
@@ -946,13 +940,8 @@ static int __init find_unallocated_memory(const struct kernel_info *kinfo,
         }
     }
 
-    /*
-     * Exclude the following regions:
-     * 1) Remove RAM assigned to Dom0
-     * 2) Remove reserved memory
-     * 3) Remove static shared memory (when the feature is enabled)
-     */
-    for ( i = 0; i < ARRAY_SIZE(mem_banks); i++ )
+    /* Remove all regions listed in mem_banks */
+    for ( i = 0; i < nr_mem_banks; i++ )
         for ( j = 0; j < mem_banks[i]->nr_banks; j++ )
         {
             start = mem_banks[i]->bank[j].start;
@@ -973,28 +962,13 @@ static int __init find_unallocated_memory(const struct kernel_info *kinfo,
             }
         }
 
-    /* Remove grant table region */
-    if ( kinfo->gnttab_size )
-    {
-        start = kinfo->gnttab_start;
-        end = kinfo->gnttab_start + kinfo->gnttab_size;
-        res = rangeset_remove_range(unalloc_mem, PFN_DOWN(start),
-                                    PFN_DOWN(end - 1));
-        if ( res )
-        {
-            printk(XENLOG_ERR "Failed to remove: %#"PRIpaddr"->%#"PRIpaddr"\n",
-                   start, end);
-            goto out;
-        }
-    }
-
     start = 0;
     end = (1ULL << p2m_ipa_bits) - 1;
     res = rangeset_report_ranges(unalloc_mem, PFN_DOWN(start), PFN_DOWN(end),
-                                 add_ext_regions, ext_regions);
+                                 cb, free_regions);
     if ( res )
-        ext_regions->nr_banks = 0;
-    else if ( !ext_regions->nr_banks )
+        free_regions->nr_banks = 0;
+    else if ( !free_regions->nr_banks )
         res = -ENOENT;
 
 out:
@@ -1170,6 +1144,44 @@ static int __init find_domU_holes(const struct kernel_info *kinfo,
     return remove_shm_holes_for_domU(kinfo, ext_regions);
 }
 
+static int __init find_host_extended_regions(const struct kernel_info *kinfo,
+                                             struct membanks *ext_regions)
+{
+    int res;
+    struct membanks *gnttab = xzalloc_flex_struct(struct membanks, bank, 1);
+
+    /*
+     * Exclude the following regions:
+     * 1) Remove RAM assigned to domain
+     * 2) Remove reserved memory
+     * 3) Grant table assigned to domain
+     * 4) Remove static shared memory (when the feature is enabled)
+     */
+    const struct membanks *mem_banks[] = {
+        kernel_info_get_mem_const(kinfo),
+        bootinfo_get_reserved_mem(),
+        gnttab,
+#ifdef CONFIG_STATIC_SHM
+        bootinfo_get_shmem(),
+#endif
+    };
+
+    dt_dprintk("Find unallocated memory for extended regions\n");
+
+    if ( !gnttab )
+        return -ENOMEM;
+
+    gnttab->nr_banks = 1;
+    gnttab->bank[0].start = kinfo->gnttab_start;
+    gnttab->bank[0].size = kinfo->gnttab_size;
+
+    res = find_unallocated_memory(kinfo, mem_banks, ARRAY_SIZE(mem_banks),
+                                  ext_regions, add_ext_regions);
+    xfree(gnttab);
+
+    return res;
+}
+
 int __init make_hypervisor_node(struct domain *d,
                                 const struct kernel_info *kinfo,
                                 int addrcells, int sizecells)
@@ -1226,7 +1238,7 @@ int __init make_hypervisor_node(struct domain *d,
         if ( is_domain_direct_mapped(d) )
         {
             if ( !is_iommu_enabled(d) )
-                res = find_unallocated_memory(kinfo, ext_regions);
+                res = find_host_extended_regions(kinfo, ext_regions);
             else
                 res = find_memory_holes(kinfo, ext_regions);
         }
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Mon Dec 16 12:11:14 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 16 Dec 2024 12:11:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.857924.1270122 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tN9wL-0008CM-8c; Mon, 16 Dec 2024 12:11:09 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 857924.1270122; Mon, 16 Dec 2024 12:11:09 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tN9wL-0008CE-5j; Mon, 16 Dec 2024 12:11:09 +0000
Received: by outflank-mailman (input) for mailman id 857924;
 Mon, 16 Dec 2024 12:11:07 +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 1tN9wJ-0008C5-Qg
 for xen-changelog@lists.xenproject.org; Mon, 16 Dec 2024 12:11:07 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1tN9wJ-006J8r-17
 for xen-changelog@lists.xenproject.org;
 Mon, 16 Dec 2024 12:11:07 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1tN9wJ-00ABYK-1p
 for xen-changelog@lists.xenproject.org;
 Mon, 16 Dec 2024 12:11:07 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/riscv: add destroy_xen_mappings() to remove mappings in Xen page tables
Message-Id: <E1tN9wJ-00ABYK-1p@xenbits.xenproject.org>
Date: Mon, 16 Dec 2024 12:11:07 +0000

commit 0eb8b7160444121226318a8301fe9496acb2f0d0
Author:     Oleksii Kurochko <oleksii.kurochko@gmail.com>
AuthorDate: Mon Dec 16 13:05:05 2024 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Dec 16 13:05:05 2024 +0100

    xen/riscv: add destroy_xen_mappings() to remove mappings in Xen page tables
    
    Introduce the destroy_xen_mappings() function, which removes page
    mappings in Xen's page tables between a start address s and an end
    address e.
    The function ensures that both s and e are page-aligned
    and verifies that the start address is less than or equal to the end
    address before calling pt_update() to invalidate the mappings.
    The pt_update() function is called with INVALID_MFN and PTE_VALID=0
    in the flags, which tell pt_update() to remove mapping. No additional
    ASSERT() is required to check these arguments, as they are hardcoded in
    the call to pt_update() within destroy_xen_mappings().
    
    Signed-off-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/riscv/mm.c | 6 ------
 xen/arch/riscv/pt.c | 8 ++++++++
 2 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/xen/arch/riscv/mm.c b/xen/arch/riscv/mm.c
index 9359dc7f33..f2bf279bac 100644
--- a/xen/arch/riscv/mm.c
+++ b/xen/arch/riscv/mm.c
@@ -360,12 +360,6 @@ int xenmem_add_to_physmap_one(struct domain *d, unsigned int space,
     return 0;
 }
 
-int destroy_xen_mappings(unsigned long s, unsigned long e)
-{
-    BUG_ON("unimplemented");
-    return -1;
-}
-
 void share_xen_page_with_guest(struct page_info *page, struct domain *d,
                                enum XENSHARE_flags flags)
 {
diff --git a/xen/arch/riscv/pt.c b/xen/arch/riscv/pt.c
index d62aceb36c..798483aa3b 100644
--- a/xen/arch/riscv/pt.c
+++ b/xen/arch/riscv/pt.c
@@ -421,6 +421,14 @@ int map_pages_to_xen(unsigned long virt,
     return pt_update(virt, mfn, nr_mfns, flags);
 }
 
+int destroy_xen_mappings(unsigned long s, unsigned long e)
+{
+    ASSERT(IS_ALIGNED(s, PAGE_SIZE));
+    ASSERT(IS_ALIGNED(e, PAGE_SIZE));
+
+    return s < e ? pt_update(s, INVALID_MFN, PFN_DOWN(e - s), 0) : -EINVAL;
+}
+
 int __init populate_pt_range(unsigned long virt, unsigned long nr_mfns)
 {
     return pt_update(virt, INVALID_MFN, nr_mfns, PTE_POPULATE);
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Dec 16 12:11:19 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 16 Dec 2024 12:11:19 +0000
Received: from list by lists.xenproject.org with outflank-mailman.857927.1270126 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tN9wV-0008HN-9k; Mon, 16 Dec 2024 12:11:19 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 857927.1270126; Mon, 16 Dec 2024 12:11:19 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tN9wV-0008HF-7B; Mon, 16 Dec 2024 12:11:19 +0000
Received: by outflank-mailman (input) for mailman id 857927;
 Mon, 16 Dec 2024 12:11:17 +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 1tN9wT-0008H2-PL
 for xen-changelog@lists.xenproject.org; Mon, 16 Dec 2024 12:11:17 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1tN9wT-006J8z-1U
 for xen-changelog@lists.xenproject.org;
 Mon, 16 Dec 2024 12:11:17 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1tN9wT-00ABab-2G
 for xen-changelog@lists.xenproject.org;
 Mon, 16 Dec 2024 12:11:17 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/riscv: reorder includes in asm/page.h alphabetically
Message-Id: <E1tN9wT-00ABab-2G@xenbits.xenproject.org>
Date: Mon, 16 Dec 2024 12:11:17 +0000

commit f5bf0d100bc80c882b9923ff0151c33ebd4941c9
Author:     Oleksii Kurochko <oleksii.kurochko@gmail.com>
AuthorDate: Mon Dec 16 13:05:27 2024 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Dec 16 13:05:27 2024 +0100

    xen/riscv: reorder includes in asm/page.h alphabetically
    
    Signed-off-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/riscv/include/asm/page.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/arch/riscv/include/asm/page.h b/xen/arch/riscv/include/asm/page.h
index 91b1194b55..bf3f75e85d 100644
--- a/xen/arch/riscv/include/asm/page.h
+++ b/xen/arch/riscv/include/asm/page.h
@@ -5,8 +5,8 @@
 
 #ifndef __ASSEMBLY__
 
-#include <xen/const.h>
 #include <xen/bug.h>
+#include <xen/const.h>
 #include <xen/types.h>
 
 #include <asm/atomic.h>
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Dec 16 12:11:29 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 16 Dec 2024 12:11:29 +0000
Received: from list by lists.xenproject.org with outflank-mailman.857928.1270130 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tN9wf-0008PC-B9; Mon, 16 Dec 2024 12:11:29 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 857928.1270130; Mon, 16 Dec 2024 12:11:29 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tN9wf-0008P6-8X; Mon, 16 Dec 2024 12:11:29 +0000
Received: by outflank-mailman (input) for mailman id 857928;
 Mon, 16 Dec 2024 12:11:27 +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 1tN9wd-0008Op-TO
 for xen-changelog@lists.xenproject.org; Mon, 16 Dec 2024 12:11:27 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1tN9wd-006J9M-1t
 for xen-changelog@lists.xenproject.org;
 Mon, 16 Dec 2024 12:11:27 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1tN9wd-00ABiI-2c
 for xen-changelog@lists.xenproject.org;
 Mon, 16 Dec 2024 12:11:27 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/riscv: add {set,clear}_fixmap() functions for managing fixmap entries
Message-Id: <E1tN9wd-00ABiI-2c@xenbits.xenproject.org>
Date: Mon, 16 Dec 2024 12:11:27 +0000

commit df98c0386426a5fc0d840f7615f223ced181fc52
Author:     Oleksii Kurochko <oleksii.kurochko@gmail.com>
AuthorDate: Mon Dec 16 13:05:46 2024 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Dec 16 13:05:46 2024 +0100

    xen/riscv: add {set,clear}_fixmap() functions for managing fixmap entries
    
    Introduce set_fixmap() and clear_fixmap() functions to manage mappings
    in the fixmap region. The set_fixmap() function maps a 4k page ( as only L0
    is expected to be updated; look at setup_fixmap_mappings() ) at a specified
    fixmap entry using map_pages_to_xen(), while clear_fixmap() removes the
    mapping from a fixmap entry by calling destroy_xen_mappings().
    
    Both functions ensure that the operations succeed by asserting that their
    respective calls (map_pages_to_xen() and destroy_xen_mappings()) return 0.
    `BUG()` is added to trigger a failure if any issues occur during
    the mapping or unmapping process.
    
    Signed-off-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/riscv/include/asm/fixmap.h |  5 +++++
 xen/arch/riscv/pt.c                 | 16 ++++++++++++++++
 2 files changed, 21 insertions(+)

diff --git a/xen/arch/riscv/include/asm/fixmap.h b/xen/arch/riscv/include/asm/fixmap.h
index 818c8ce07b..e399a15f53 100644
--- a/xen/arch/riscv/include/asm/fixmap.h
+++ b/xen/arch/riscv/include/asm/fixmap.h
@@ -32,6 +32,11 @@
  */
 extern pte_t xen_fixmap[];
 
+/* Map a page in a fixmap entry */
+void set_fixmap(unsigned int map, mfn_t mfn, unsigned int flags);
+/* Remove a mapping from a fixmap entry */
+void clear_fixmap(unsigned int map);
+
 #define fix_to_virt(slot) ((void *)FIXMAP_ADDR(slot))
 
 static inline unsigned int virt_to_fix(vaddr_t vaddr)
diff --git a/xen/arch/riscv/pt.c b/xen/arch/riscv/pt.c
index 798483aa3b..a703e0f1bd 100644
--- a/xen/arch/riscv/pt.c
+++ b/xen/arch/riscv/pt.c
@@ -8,6 +8,7 @@
 #include <xen/pmap.h>
 #include <xen/spinlock.h>
 
+#include <asm/fixmap.h>
 #include <asm/flushtlb.h>
 #include <asm/page.h>
 
@@ -433,3 +434,18 @@ int __init populate_pt_range(unsigned long virt, unsigned long nr_mfns)
 {
     return pt_update(virt, INVALID_MFN, nr_mfns, PTE_POPULATE);
 }
+
+/* Map a 4k page in a fixmap entry */
+void set_fixmap(unsigned int map, mfn_t mfn, unsigned int flags)
+{
+    if ( map_pages_to_xen(FIXMAP_ADDR(map), mfn, 1, flags | PTE_SMALL) != 0 )
+        BUG();
+}
+
+/* Remove a mapping from a fixmap entry */
+void clear_fixmap(unsigned int map)
+{
+    if ( destroy_xen_mappings(FIXMAP_ADDR(map),
+                              FIXMAP_ADDR(map) + PAGE_SIZE) != 0 )
+        BUG();
+}
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Dec 16 12:11:39 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 16 Dec 2024 12:11:39 +0000
Received: from list by lists.xenproject.org with outflank-mailman.857933.1270134 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tN9wp-0008WB-Ca; Mon, 16 Dec 2024 12:11:39 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 857933.1270134; Mon, 16 Dec 2024 12:11:39 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tN9wp-0008W3-9y; Mon, 16 Dec 2024 12:11:39 +0000
Received: by outflank-mailman (input) for mailman id 857933;
 Mon, 16 Dec 2024 12:11:38 +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 1tN9wo-0008Vl-0Y
 for xen-changelog@lists.xenproject.org; Mon, 16 Dec 2024 12:11:38 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1tN9wn-006J9U-2D
 for xen-changelog@lists.xenproject.org;
 Mon, 16 Dec 2024 12:11:37 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1tN9wn-00ABms-31
 for xen-changelog@lists.xenproject.org;
 Mon, 16 Dec 2024 12:11:37 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/xsm: make getdomaininfo xsm dummy checks more stringent
Message-Id: <E1tN9wn-00ABms-31@xenbits.xenproject.org>
Date: Mon, 16 Dec 2024 12:11:37 +0000

commit 5793b84c5e8fb268f94e7fde7816799e66945a73
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Mon Dec 16 13:06:55 2024 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Dec 16 13:06:55 2024 +0100

    xen/xsm: make getdomaininfo xsm dummy checks more stringent
    
    Today the dummy XSM privilege checks for getdomaininfo are less
    stringent than possible: they basically rely on the general
    sysctl/domctl entry check to do all tests and then do the test with
    the XSM_HOOK privilege, which is an "allow all" default.
    
    Instead of XSM_HOOK use XSM_XS_PRIV, which is the privilege really
    wanted. Note that this test is still wider than the sysctl entry test,
    but there is no easy way to make both domctl and sysctl happy at the
    same time.
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Acked-by: Daniel P. Smith <dpsmith@apertussolutions.com>
---
 xen/common/domctl.c     | 2 +-
 xen/common/sysctl.c     | 2 +-
 xen/include/xsm/dummy.h | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/xen/common/domctl.c b/xen/common/domctl.c
index ea16b75910..444e072fdc 100644
--- a/xen/common/domctl.c
+++ b/xen/common/domctl.c
@@ -539,7 +539,7 @@ long do_domctl(XEN_GUEST_HANDLE_PARAM(xen_domctl_t) u_domctl)
         break;
 
     case XEN_DOMCTL_getdomaininfo:
-        ret = xsm_getdomaininfo(XSM_HOOK, d);
+        ret = xsm_getdomaininfo(XSM_XS_PRIV, d);
         if ( ret )
             break;
 
diff --git a/xen/common/sysctl.c b/xen/common/sysctl.c
index d02f44fe3a..c2d99ae12e 100644
--- a/xen/common/sysctl.c
+++ b/xen/common/sysctl.c
@@ -89,7 +89,7 @@ long do_sysctl(XEN_GUEST_HANDLE_PARAM(xen_sysctl_t) u_sysctl)
             if ( num_domains == op->u.getdomaininfolist.max_domains )
                 break;
 
-            if ( xsm_getdomaininfo(XSM_HOOK, d) )
+            if ( xsm_getdomaininfo(XSM_XS_PRIV, d) )
                 continue;
 
             getdomaininfo(d, &info);
diff --git a/xen/include/xsm/dummy.h b/xen/include/xsm/dummy.h
index 7956f27a29..f8a3c4b81e 100644
--- a/xen/include/xsm/dummy.h
+++ b/xen/include/xsm/dummy.h
@@ -137,7 +137,7 @@ static XSM_INLINE int cf_check xsm_domain_create(
 static XSM_INLINE int cf_check xsm_getdomaininfo(
     XSM_DEFAULT_ARG struct domain *d)
 {
-    XSM_ASSERT_ACTION(XSM_HOOK);
+    XSM_ASSERT_ACTION(XSM_XS_PRIV);
     return xsm_default_action(action, current->domain, d);
 }
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Dec 16 12:11:49 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 16 Dec 2024 12:11:49 +0000
Received: from list by lists.xenproject.org with outflank-mailman.857934.1270137 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tN9wz-0000B4-E4; Mon, 16 Dec 2024 12:11:49 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 857934.1270137; Mon, 16 Dec 2024 12:11:49 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tN9wz-0000Aw-BK; Mon, 16 Dec 2024 12:11:49 +0000
Received: by outflank-mailman (input) for mailman id 857934;
 Mon, 16 Dec 2024 12:11:48 +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 1tN9wy-0000Ao-4Z
 for xen-changelog@lists.xenproject.org; Mon, 16 Dec 2024 12:11:48 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1tN9wx-006J9Y-2a
 for xen-changelog@lists.xenproject.org;
 Mon, 16 Dec 2024 12:11:48 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1tN9wy-00ABrm-08
 for xen-changelog@lists.xenproject.org;
 Mon, 16 Dec 2024 12:11:48 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen: add a domain unique id to each domain
Message-Id: <E1tN9wy-00ABrm-08@xenbits.xenproject.org>
Date: Mon, 16 Dec 2024 12:11:48 +0000

commit 58ba55959ae1bca0651396d0752c2076a45b5ee6
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Mon Dec 16 13:07:19 2024 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Dec 16 13:07:19 2024 +0100

    xen: add a domain unique id to each domain
    
    Xenstore is referencing domains by their domid, but reuse of a domid
    can lead to the situation that Xenstore can't tell whether a domain
    with that domid has been deleted and created again without Xenstore
    noticing the domain is a new one now.
    
    Add a global domain creation unique id which is updated when creating
    a new domain, and store that value in struct domain of the new domain.
    The global unique id is initialized with the system time and updates
    are done via the xorshift algorithm which is used for pseudo random
    number generation, too (see https://en.wikipedia.org/wiki/Xorshift).
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Alejandro Vallejo <alejandro.vallejo@cloud.com>
---
 xen/common/domain.c     | 27 +++++++++++++++++++++++++++
 xen/include/xen/sched.h |  3 +++
 2 files changed, 30 insertions(+)

diff --git a/xen/common/domain.c b/xen/common/domain.c
index 92263a4fbd..e33a0a5a21 100644
--- a/xen/common/domain.c
+++ b/xen/common/domain.c
@@ -562,6 +562,32 @@ static void _domain_destroy(struct domain *d)
     free_domain_struct(d);
 }
 
+static uint64_t get_unique_id(void)
+{
+    static uint64_t unique_id;
+    static DEFINE_SPINLOCK(lock);
+    uint64_t x;
+
+    spin_lock(&lock);
+
+    x = unique_id ? : NOW();
+
+    /*
+     * Pseudo-randomize id in order to avoid consumers relying on sequence.
+     * Randomization algorithm has a period of 2^64 - 1.
+     * Unique id is not repeatable between resets and each id has the same
+     * lifetime as the domain it is associated with.
+     */
+    x ^= x << 13;
+    x ^= x >> 7;
+    x ^= x << 17;
+    unique_id = x;
+
+    spin_unlock(&lock);
+
+    return x;
+}
+
 static int sanitise_domain_config(struct xen_domctl_createdomain *config)
 {
     bool hvm = config->flags & XEN_DOMCTL_CDF_hvm;
@@ -654,6 +680,7 @@ struct domain *domain_create(domid_t domid,
 
     /* Sort out our idea of is_system_domain(). */
     d->domain_id = domid;
+    d->unique_id = get_unique_id();
 
     /* Holding CDF_* internal flags. */
     d->cdf = flags;
diff --git a/xen/include/xen/sched.h b/xen/include/xen/sched.h
index 76e39378b3..711668e028 100644
--- a/xen/include/xen/sched.h
+++ b/xen/include/xen/sched.h
@@ -370,6 +370,9 @@ struct domain
     domid_t          domain_id;
 
     unsigned int     max_vcpus;
+
+    uint64_t         unique_id;       /* Unique domain identifier */
+
     struct vcpu    **vcpu;
 
     shared_info_t   *shared_info;     /* shared data area */
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Dec 16 12:44:17 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 16 Dec 2024 12:44:17 +0000
Received: from list by lists.xenproject.org with outflank-mailman.857986.1270191 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tNASH-0007wV-RU; Mon, 16 Dec 2024 12:44:09 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 857986.1270191; Mon, 16 Dec 2024 12:44:09 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tNASH-0007wN-Om; Mon, 16 Dec 2024 12:44:09 +0000
Received: by outflank-mailman (input) for mailman id 857986;
 Mon, 16 Dec 2024 12:44:08 +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 1tNASG-0007wH-8j
 for xen-changelog@lists.xenproject.org; Mon, 16 Dec 2024 12:44:08 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1tNASF-006Jpm-2c
 for xen-changelog@lists.xenproject.org;
 Mon, 16 Dec 2024 12:44:08 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1tNASG-00AICI-06
 for xen-changelog@lists.xenproject.org;
 Mon, 16 Dec 2024 12:44:08 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.19] xen/device-tree: Allow region overlapping with /memreserve/ ranges
Message-Id: <E1tNASG-00AICI-06@xenbits.xenproject.org>
Date: Mon, 16 Dec 2024 12:44:08 +0000

commit 6f7af8383f51f6e4f0588a12ff945d22d7375ae6
Author:     Luca Fancellu <luca.fancellu@arm.com>
AuthorDate: Mon Dec 16 13:31:23 2024 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Dec 16 13:31:23 2024 +0100

    xen/device-tree: Allow region overlapping with /memreserve/ ranges
    
    There are some cases where the device tree exposes a memory range
    in both /memreserve/ and reserved-memory node, in this case the
    current code will stop Xen to boot since it will find that the
    latter range is clashing with the already recorded /memreserve/
    ranges.
    
    Furthermore, u-boot lists boot modules ranges, such as ramdisk,
    in the /memreserve/ part and even in this case this will prevent
    Xen to boot since it will see that the module memory range that
    it is going to add in 'add_boot_module' clashes with a /memreserve/
    range.
    
    When Xen populate the data structure that tracks the memory ranges,
    it also adds a memory type described in 'enum membank_type', so
    in order to fix this behavior, allow overlapping with the /memreserve/
    ranges in the 'check_reserved_regions_overlap' function when a flag
    is set.
    
    In order to implement this solution, there is a distinction between
    the 'struct membanks *' handled by meminfo_overlap_check(...) that
    needs to be done, because the static shared memory banks doesn't have
    a usable bank[].type field and so it can't be accessed, hence now
    the 'struct membanks_hdr' have a 'enum region_type type' field in order
    to be able to identify static shared memory banks in meminfo_overlap_check(...).
    
    While there, set a type for the memory recorded using meminfo_add_bank()
    from efi-boot.h.
    
    Fixes: 53dc37829c31 ("xen/arm: Add DT reserve map regions to bootinfo.reserved_mem")
    Reported-by: Shawn Anastasio <sanastasio@raptorengineering.com>
    Reported-by: Grygorii Strashko <grygorii_strashko@epam.com>
    Signed-off-by: Luca Fancellu <luca.fancellu@arm.com>
    Tested-by: Grygorii Strashko <grygorii_strashko@epam.com>
    Reviewed-by: Julien Grall <jgrall@amazon.com>
    
    bootfdt: Add missing trailing commas in BOOTINFO_{ACPI,SHMEM}_INIT
    
    Commit a14593e3995a extended BOOTINFO_{ACPI,SHMEM}_INIT initializers
    list with a new 'type' member but forgot to add trailing commas (they
    were present before). This results in a build failure when building
    with CONFIG_ACPI=y and CONFIG_STATIC_SHM=y:
    ./include/xen/bootfdt.h:155:5: error: request for member 'shmem' in something not a structure or union
      155 |     .shmem.common.max_banks = NR_SHMEM_BANKS,       \
          |     ^
    ./include/xen/bootfdt.h:168:5: note: in expansion of macro 'BOOTINFO_SHMEM_INIT'
      168 |     BOOTINFO_SHMEM_INIT                             \
          |     ^~~~~~~~~~~~~~~~~~~
    common/device-tree/bootinfo.c:22:39: note: in expansion of macro 'BOOTINFO_INIT'
       22 | struct bootinfo __initdata bootinfo = BOOTINFO_INIT;
    
    Fixes: a14593e3995a ("xen/device-tree: Allow region overlapping with /memreserve/ ranges")
    Signed-off-by: Michal Orzel <michal.orzel@amd.com>
    Reviewed-by: Bertrand Marquis <bertrand.marquis@arm.com>
    Reviewed-by: Luca Fancellu <luca.fancellu@arm.com>
    master commit: a14593e3995afc74bf4efe91116e34894e0ea49a
    master date: 2024-11-28 18:57:21 +0000
    master commit: 5a455a52eae1420619df14c8e55fd17ced70538e
    master date: 2024-12-03 12:20:41 +0000
---
 xen/arch/arm/bootfdt.c           |  9 ++++++++-
 xen/arch/arm/efi/efi-boot.h      |  3 ++-
 xen/arch/arm/include/asm/setup.h | 20 +++++++++++++++++---
 xen/arch/arm/setup.c             | 39 +++++++++++++++++++++++++++++----------
 xen/arch/arm/static-shmem.c      |  2 +-
 5 files changed, 57 insertions(+), 16 deletions(-)

diff --git a/xen/arch/arm/bootfdt.c b/xen/arch/arm/bootfdt.c
index 6e060111d9..1a766a2c4b 100644
--- a/xen/arch/arm/bootfdt.c
+++ b/xen/arch/arm/bootfdt.c
@@ -148,8 +148,15 @@ static int __init device_tree_get_meminfo(const void *fdt, int node,
     for ( i = 0; i < banks && mem->nr_banks < mem->max_banks; i++ )
     {
         device_tree_get_reg(&cell, address_cells, size_cells, &start, &size);
+        /*
+         * Some valid device trees, such as those generated by OpenPOWER
+         * skiboot firmware, expose all reserved memory regions in the
+         * FDT memory reservation block AND in the reserved-memory node which
+         * has already been parsed. Thus, any matching overlaps in the
+         * reserved_mem banks should be ignored.
+         */
         if ( mem == bootinfo_get_reserved_mem() &&
-             check_reserved_regions_overlap(start, size) )
+             check_reserved_regions_overlap(start, size, true) )
             return -EINVAL;
         /* Some DT may describe empty bank, ignore them */
         if ( !size )
diff --git a/xen/arch/arm/efi/efi-boot.h b/xen/arch/arm/efi/efi-boot.h
index 199f526022..a80a5a7ab3 100644
--- a/xen/arch/arm/efi/efi-boot.h
+++ b/xen/arch/arm/efi/efi-boot.h
@@ -167,13 +167,14 @@ static bool __init meminfo_add_bank(struct membanks *mem,
     if ( mem->nr_banks >= mem->max_banks )
         return false;
 #ifdef CONFIG_ACPI
-    if ( check_reserved_regions_overlap(start, size) )
+    if ( check_reserved_regions_overlap(start, size, false) )
         return false;
 #endif
 
     bank = &mem->bank[mem->nr_banks];
     bank->start = start;
     bank->size = size;
+    bank->type = MEMBANK_DEFAULT;
 
     mem->nr_banks++;
 
diff --git a/xen/arch/arm/include/asm/setup.h b/xen/arch/arm/include/asm/setup.h
index c34179da93..ea2e8503dc 100644
--- a/xen/arch/arm/include/asm/setup.h
+++ b/xen/arch/arm/include/asm/setup.h
@@ -49,6 +49,12 @@ enum membank_type {
     MEMBANK_FDT_RESVMEM,
 };
 
+enum region_type {
+    MEMORY,
+    RESERVED_MEMORY,
+    STATIC_SHARED_MEMORY
+};
+
 /* Indicates the maximum number of characters(\0 included) for shm_id */
 #define MAX_SHM_ID_LENGTH 16
 
@@ -72,6 +78,7 @@ struct membanks {
     __struct_group(membanks_hdr, common, ,
         unsigned int nr_banks;
         unsigned int max_banks;
+        enum region_type type;
     );
     struct membank bank[];
 };
@@ -137,13 +144,17 @@ struct bootinfo {
 };
 
 #ifdef CONFIG_ACPI
-#define BOOTINFO_ACPI_INIT .acpi.common.max_banks = NR_MEM_BANKS,
+#define BOOTINFO_ACPI_INIT                          \
+    .acpi.common.max_banks = NR_MEM_BANKS,          \
+    .acpi.common.type = MEMORY,
 #else
 #define BOOTINFO_ACPI_INIT
 #endif
 
 #ifdef CONFIG_STATIC_SHM
-#define BOOTINFO_SHMEM_INIT .shmem.common.max_banks = NR_SHMEM_BANKS,
+#define BOOTINFO_SHMEM_INIT                         \
+    .shmem.common.max_banks = NR_SHMEM_BANKS,       \
+    .shmem.common.type = STATIC_SHARED_MEMORY,
 #else
 #define BOOTINFO_SHMEM_INIT
 #endif
@@ -151,7 +162,9 @@ struct bootinfo {
 #define BOOTINFO_INIT                               \
 {                                                   \
     .mem.common.max_banks = NR_MEM_BANKS,           \
+    .mem.common.type = MEMORY,                      \
     .reserved_mem.common.max_banks = NR_MEM_BANKS,  \
+    .reserved_mem.common.type = RESERVED_MEMORY,    \
     BOOTINFO_ACPI_INIT                              \
     BOOTINFO_SHMEM_INIT                             \
 }
@@ -223,7 +236,8 @@ void fw_unreserved_regions(paddr_t s, paddr_t e,
 size_t boot_fdt_info(const void *fdt, paddr_t paddr);
 const char *boot_fdt_cmdline(const void *fdt);
 
-bool check_reserved_regions_overlap(paddr_t region_start, paddr_t region_size);
+bool check_reserved_regions_overlap(paddr_t region_start, paddr_t region_size,
+                                    bool allow_memreserve_overlap);
 
 struct bootmodule *add_boot_module(bootmodule_kind kind,
                                    paddr_t start, paddr_t size, bool domU);
diff --git a/xen/arch/arm/setup.c b/xen/arch/arm/setup.c
index 0c2fdaceaf..d0533cb715 100644
--- a/xen/arch/arm/setup.c
+++ b/xen/arch/arm/setup.c
@@ -268,7 +268,8 @@ static void __init dt_unreserved_regions(paddr_t s, paddr_t e,
  */
 static bool __init meminfo_overlap_check(const struct membanks *mem,
                                          paddr_t region_start,
-                                         paddr_t region_size)
+                                         paddr_t region_size,
+                                         bool allow_memreserve_overlap)
 {
     paddr_t bank_start = INVALID_PADDR, bank_end = 0;
     paddr_t region_end = region_start + region_size;
@@ -282,12 +283,23 @@ static bool __init meminfo_overlap_check(const struct membanks *mem,
         if ( INVALID_PADDR == bank_start || region_end <= bank_start ||
              region_start >= bank_end )
             continue;
-        else
-        {
-            printk("Region: [%#"PRIpaddr", %#"PRIpaddr") overlapping with bank[%u]: [%#"PRIpaddr", %#"PRIpaddr")\n",
-                   region_start, region_end, i, bank_start, bank_end);
-            return true;
-        }
+
+        /*
+         * If allow_memreserve_overlap is set, this check allows a region to be
+         * included in a MEMBANK_FDT_RESVMEM bank, but struct membanks *mem of
+         * type STATIC_SHARED_MEMORY don't set the bank[].type field because
+         * that is declared in a union with a field that is instead used,
+         * in any case this restriction is ok since STATIC_SHARED_MEMORY banks
+         * are not meant to clash with FDT /memreserve/ ranges.
+         */
+        if ( allow_memreserve_overlap && mem->type != STATIC_SHARED_MEMORY &&
+             region_start >= bank_start && region_end <= bank_end &&
+             mem->bank[i].type == MEMBANK_FDT_RESVMEM )
+            continue;
+
+        printk("Region: [%#"PRIpaddr", %#"PRIpaddr") overlapping with bank[%u]: [%#"PRIpaddr", %#"PRIpaddr")\n",
+                region_start, region_end, i, bank_start, bank_end);
+        return true;
     }
 
     return false;
@@ -340,7 +352,8 @@ void __init fw_unreserved_regions(paddr_t s, paddr_t e,
  * existing reserved memory regions, otherwise false.
  */
 bool __init check_reserved_regions_overlap(paddr_t region_start,
-                                           paddr_t region_size)
+                                           paddr_t region_size,
+                                           bool allow_memreserve_overlap)
 {
     const struct membanks *mem_banks[] = {
         bootinfo_get_reserved_mem(),
@@ -359,7 +372,8 @@ bool __init check_reserved_regions_overlap(paddr_t region_start,
      * shared memory banks (when static shared memory feature is enabled)
      */
     for ( i = 0; i < ARRAY_SIZE(mem_banks); i++ )
-        if ( meminfo_overlap_check(mem_banks[i], region_start, region_size) )
+        if ( meminfo_overlap_check(mem_banks[i], region_start, region_size,
+                                   allow_memreserve_overlap) )
             return true;
 
     /* Check if input region is overlapping with bootmodules */
@@ -385,7 +399,12 @@ struct bootmodule __init *add_boot_module(bootmodule_kind kind,
         return NULL;
     }
 
-    if ( check_reserved_regions_overlap(start, size) )
+    /*
+     * u-boot adds boot module such as ramdisk to the /memreserve/, since these
+     * ranges are saved in reserved_mem at this stage, allow an eventual exact
+     * match with MEMBANK_FDT_RESVMEM banks.
+     */
+    if ( check_reserved_regions_overlap(start, size, true) )
         return NULL;
 
     for ( i = 0 ; i < mods->nr_mods ; i++ )
diff --git a/xen/arch/arm/static-shmem.c b/xen/arch/arm/static-shmem.c
index aa80756c3c..66088a4267 100644
--- a/xen/arch/arm/static-shmem.c
+++ b/xen/arch/arm/static-shmem.c
@@ -696,7 +696,7 @@ int __init process_shm_node(const void *fdt, int node, uint32_t address_cells,
         if (i < mem->max_banks)
         {
             if ( (paddr != INVALID_PADDR) &&
-                 check_reserved_regions_overlap(paddr, size) )
+                 check_reserved_regions_overlap(paddr, size, false) )
                 return -EINVAL;
 
             /* Static shared memory shall be reserved from any other use. */
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.19


From xen-changelog-bounces@lists.xenproject.org Mon Dec 16 12:44:19 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 16 Dec 2024 12:44:19 +0000
Received: from list by lists.xenproject.org with outflank-mailman.857987.1270197 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tNASR-0007yj-V6; Mon, 16 Dec 2024 12:44:19 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 857987.1270197; Mon, 16 Dec 2024 12:44:19 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tNASR-0007yb-RV; Mon, 16 Dec 2024 12:44:19 +0000
Received: by outflank-mailman (input) for mailman id 857987;
 Mon, 16 Dec 2024 12:44:18 +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 1tNASQ-0007yQ-8F
 for xen-changelog@lists.xenproject.org; Mon, 16 Dec 2024 12:44:18 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1tNASP-006Jpq-2z
 for xen-changelog@lists.xenproject.org;
 Mon, 16 Dec 2024 12:44:18 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1tNASQ-00AIDd-0W
 for xen-changelog@lists.xenproject.org;
 Mon, 16 Dec 2024 12:44:18 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.19] update Xen version to 4.19.2-pre
Message-Id: <E1tNASQ-00AIDd-0W@xenbits.xenproject.org>
Date: Mon, 16 Dec 2024 12:44:18 +0000

commit 5d61bc05850c05a32c2b4192adc1d33bcc19d1f7
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Mon Dec 16 13:31:51 2024 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Dec 16 13:31:51 2024 +0100

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

diff --git a/xen/Makefile b/xen/Makefile
index 0a942894dd..968971694c 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    = 19
-export XEN_EXTRAVERSION ?= .1$(XEN_VENDORVERSION)
+export XEN_EXTRAVERSION ?= .2-pre$(XEN_VENDORVERSION)
 export XEN_FULLVERSION   = $(XEN_VERSION).$(XEN_SUBVERSION)$(XEN_EXTRAVERSION)
 -include xen-version
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.19


From xen-changelog-bounces@lists.xenproject.org Mon Dec 16 12:44:30 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 16 Dec 2024 12:44:30 +0000
Received: from list by lists.xenproject.org with outflank-mailman.857988.1270200 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tNASb-00081L-VX; Mon, 16 Dec 2024 12:44:29 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 857988.1270200; Mon, 16 Dec 2024 12:44:29 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tNASb-00081D-Sy; Mon, 16 Dec 2024 12:44:29 +0000
Received: by outflank-mailman (input) for mailman id 857988;
 Mon, 16 Dec 2024 12:44:28 +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 1tNASa-000813-BZ
 for xen-changelog@lists.xenproject.org; Mon, 16 Dec 2024 12:44:28 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1tNASa-006JqM-04
 for xen-changelog@lists.xenproject.org;
 Mon, 16 Dec 2024 12:44:28 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1tNASa-00AIEO-0u
 for xen-changelog@lists.xenproject.org;
 Mon, 16 Dec 2024 12:44:28 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.19] x86emul: MOVBE requires a memory operand
Message-Id: <E1tNASa-00AIEO-0u@xenbits.xenproject.org>
Date: Mon, 16 Dec 2024 12:44:28 +0000

commit 3a9e5a93e6ed5300f25612963c0fe521156951a1
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Mon Dec 16 13:32:19 2024 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Dec 16 13:32:19 2024 +0100

    x86emul: MOVBE requires a memory operand
    
    The reg-reg forms should cause #UD; they come into existence only with
    APX, where MOVBE also extends BSWAP (for the latter not being "eligible"
    to a REX2 prefix).
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
    master commit: 4c5d9a01f8fa81417a9c431e9624fb71361ec4f9
    master date: 2024-12-02 09:50:14 +0100
---
 xen/arch/x86/x86_emulate/x86_emulate.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/xen/arch/x86/x86_emulate/x86_emulate.c b/xen/arch/x86/x86_emulate/x86_emulate.c
index 905c6abf42..09ab75d035 100644
--- a/xen/arch/x86/x86_emulate/x86_emulate.c
+++ b/xen/arch/x86/x86_emulate/x86_emulate.c
@@ -6944,6 +6944,7 @@ x86_emulate(
 
     case X86EMUL_OPC(0x0f38, 0xf0): /* movbe m,r */
     case X86EMUL_OPC(0x0f38, 0xf1): /* movbe r,m */
+        generate_exception_if(ea.type != OP_MEM, X86_EXC_UD);
         vcpu_must_have(movbe);
         switch ( op_bytes )
         {
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.19


From xen-changelog-bounces@lists.xenproject.org Mon Dec 16 12:44:40 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 16 Dec 2024 12:44:40 +0000
Received: from list by lists.xenproject.org with outflank-mailman.857989.1270203 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tNASm-000843-0e; Mon, 16 Dec 2024 12:44:40 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 857989.1270203; Mon, 16 Dec 2024 12:44:39 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tNASl-00083u-UL; Mon, 16 Dec 2024 12:44:39 +0000
Received: by outflank-mailman (input) for mailman id 857989;
 Mon, 16 Dec 2024 12:44:38 +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 1tNASk-00083k-EQ
 for xen-changelog@lists.xenproject.org; Mon, 16 Dec 2024 12:44:38 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1tNASk-006JqS-0O
 for xen-changelog@lists.xenproject.org;
 Mon, 16 Dec 2024 12:44:38 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1tNASk-00AIFF-1B
 for xen-changelog@lists.xenproject.org;
 Mon, 16 Dec 2024 12:44:38 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.19] xen/Kconfig: livepatch-build-tools requires debug information
Message-Id: <E1tNASk-00AIFF-1B@xenbits.xenproject.org>
Date: Mon, 16 Dec 2024 12:44:38 +0000

commit 475511a467e8296f7d11f35cb4b5838c2b465937
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Mon Dec 16 13:32:43 2024 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Dec 16 13:32:43 2024 +0100

    xen/Kconfig: livepatch-build-tools requires debug information
    
    The tools infrastructure used to build livepatches for Xen
    (livepatch-build-tools) consumes some DWARF debug information present in
    xen-syms to generate a livepatch (see livepatch-build script usage of readelf
    -wi).
    
    The current Kconfig defaults however will enable LIVEPATCH without DEBUG_INFO
    on release builds, thus providing a default Kconfig selection that's not
    suitable for livepatch-build-tools even when LIVEPATCH support is enabled,
    because it's missing the DWARF debug section.
    
    Fix by defaulting DEBUG_INFO to enabled when LIVEPATCH is.
    
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 126b0a6e537ce1d486a29e35cfeec1f222a74d11
    master date: 2024-12-02 15:22:05 +0100
---
 xen/Kconfig.debug | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/Kconfig.debug b/xen/Kconfig.debug
index 78b5a7c603..778db6f4e9 100644
--- a/xen/Kconfig.debug
+++ b/xen/Kconfig.debug
@@ -133,7 +133,7 @@ endif # DEBUG || EXPERT
 
 config DEBUG_INFO
 	bool "Compile Xen with debug info"
-	default DEBUG
+	default DEBUG || LIVEPATCH
 	help
 	  Say Y here if you want to build Xen with debug information. This
 	  information is needed e.g. for doing crash dump analysis of the
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.19


From xen-changelog-bounces@lists.xenproject.org Mon Dec 16 12:44:50 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 16 Dec 2024 12:44:50 +0000
Received: from list by lists.xenproject.org with outflank-mailman.857991.1270208 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tNASw-000870-2A; Mon, 16 Dec 2024 12:44:50 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 857991.1270208; Mon, 16 Dec 2024 12:44:50 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tNASv-00086s-Vl; Mon, 16 Dec 2024 12:44:49 +0000
Received: by outflank-mailman (input) for mailman id 857991;
 Mon, 16 Dec 2024 12:44:48 +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 1tNASu-00086k-HZ
 for xen-changelog@lists.xenproject.org; Mon, 16 Dec 2024 12:44:48 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1tNASu-006JqW-0h
 for xen-changelog@lists.xenproject.org;
 Mon, 16 Dec 2024 12:44:48 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1tNASu-00AIH6-1W
 for xen-changelog@lists.xenproject.org;
 Mon, 16 Dec 2024 12:44:48 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.19] libs/guest: Fix migration compatibility with a security-patched Xen 4.13
Message-Id: <E1tNASu-00AIH6-1W@xenbits.xenproject.org>
Date: Mon, 16 Dec 2024 12:44:48 +0000

commit 60573721c5f85d79d1ed04de6534248e504df0da
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Mon Dec 16 13:33:07 2024 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Dec 16 13:33:07 2024 +0100

    libs/guest: Fix migration compatibility with a security-patched Xen 4.13
    
    xc_cpuid_apply_policy() provides compatibility for migration of a pre-4.14 VM
    where no CPUID data was provided in the stream.
    
    It guesses the various max-leaf limits, based on what was true at the time of
    writing, but this was not correctly adapted when speculative security issues
    forced the advertisement of new feature bits.  Of note are:
    
     * LFENCE-DISPATCH, in leaf 0x80000021.eax
     * BHI-CTRL, in leaf 0x7[2].edx
    
    In both cases, a VM booted on a security-patched Xen 4.13, and then migrated
    on to any newer version of Xen on the same or compatible hardware would have
    these features stripped back because Xen is still editing the cpu-policy for
    sanity behind the back of the toolstack.
    
    For VMs using BHI_DIS_S to mitigate Native-BHI, this resulted in a failure to
    restore the guests MSR_SPEC_CTRL setting:
    
      (XEN) HVM d7v0 load MSR 0x48 with value 0x401 failed
      (XEN) HVM7 restore: failed to load entry 20/0 rc -6
    
    Fixes: e9b4fe263649 ("x86/cpuid: support LFENCE always serialising CPUID bit")
    Fixes: f3709b15fc86 ("x86/cpuid: Infrastructure for cpuid word 7:2.edx")
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 28301682f492c1df2ff9c3e01a0aab6262bd925a
    master date: 2024-12-03 12:20:41 +0000
---
 tools/libs/guest/xg_cpuid_x86.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/tools/libs/guest/xg_cpuid_x86.c b/tools/libs/guest/xg_cpuid_x86.c
index 4453178100..263a9d4787 100644
--- a/tools/libs/guest/xg_cpuid_x86.c
+++ b/tools/libs/guest/xg_cpuid_x86.c
@@ -640,7 +640,8 @@ int xc_cpuid_apply_policy(xc_interface *xch, uint32_t domid, bool restore,
          *
          * This restore path is used for incoming VMs with no CPUID data
          * i.e. originated on Xen 4.13 or earlier.  We must invent a policy
-         * compatible with what Xen 4.13 would have done on the same hardware.
+         * compatible with what a security-patched Xen 4.13 would have done on
+         * the same hardware.
          *
          * Specifically:
          * - Clamp max leaves.
@@ -657,8 +658,8 @@ int xc_cpuid_apply_policy(xc_interface *xch, uint32_t domid, bool restore,
         }
 
         p->policy.basic.max_leaf = min(p->policy.basic.max_leaf, 0xdu);
-        p->policy.feat.max_subleaf = 0;
-        p->policy.extd.max_leaf = min(p->policy.extd.max_leaf, 0x8000001c);
+        p->policy.feat.max_subleaf = min(p->policy.feat.max_subleaf, 0x2u);
+        p->policy.extd.max_leaf = min(p->policy.extd.max_leaf, 0x80000021);
     }
 
     if ( featureset )
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.19


From xen-changelog-bounces@lists.xenproject.org Mon Dec 16 12:45:00 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 16 Dec 2024 12:45:00 +0000
Received: from list by lists.xenproject.org with outflank-mailman.857992.1270212 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tNAT6-00089S-3Z; Mon, 16 Dec 2024 12:45:00 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 857992.1270212; Mon, 16 Dec 2024 12:45:00 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tNAT6-00089K-0t; Mon, 16 Dec 2024 12:45:00 +0000
Received: by outflank-mailman (input) for mailman id 857992;
 Mon, 16 Dec 2024 12:44:58 +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 1tNAT4-00089C-Kl
 for xen-changelog@lists.xenproject.org; Mon, 16 Dec 2024 12:44:58 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1tNAT4-006Jqg-0x
 for xen-changelog@lists.xenproject.org;
 Mon, 16 Dec 2024 12:44:58 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1tNAT4-00AIJs-1p
 for xen-changelog@lists.xenproject.org;
 Mon, 16 Dec 2024 12:44:58 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.19] tools/ocaml: Specify rpath correctly for ocamlmklib
Message-Id: <E1tNAT4-00AIJs-1p@xenbits.xenproject.org>
Date: Mon, 16 Dec 2024 12:44:58 +0000

commit fbe3ec72dc0d6ecf4007fdb6eff821cc7570e9ca
Author:     Andrii Sultanov <andrii.sultanov@cloud.com>
AuthorDate: Mon Dec 16 13:33:17 2024 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Dec 16 13:33:17 2024 +0100

    tools/ocaml: Specify rpath correctly for ocamlmklib
    
    ocamlmklib has special handling for C-like '-Wl,-rpath' option, but does
    not know how to handle '-Wl,-rpath-link', as evidenced by warnings like:
    "Unknown option
    -Wl,-rpath-link=$HOME/xen/tools/ocaml/libs/eventchn/../../../../tools/libs/toollog"
    Pass this option directly to the compiler with -ccopt instead.
    
    Also pass -L directly to the linker with -ldopt. This prevents embedding absolute
    paths from buildtime into binary's RPATH.
    
    Fixes: f7b4e4558b42 ("tools/ocaml: Fix OCaml libs rules")
    Reported-by: Fernando Rodrigues <alpha@sigmasquadron.net>
    Tested-by: Fernando Rodrigues <alpha@sigmasquadron.net>
    Signed-off-by: Andrii Sultanov <andrii.sultanov@cloud.com>
    Acked-by: Christian Lindig <christian.lindig@cloud.com>
    master commit: bf8a209915804088c09ac6575bcca554450fa7e8
    master date: 2024-12-11 10:45:08 +0000
---
 tools/ocaml/Makefile.rules | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/ocaml/Makefile.rules b/tools/ocaml/Makefile.rules
index 5638193edf..678bbc046f 100644
--- a/tools/ocaml/Makefile.rules
+++ b/tools/ocaml/Makefile.rules
@@ -61,7 +61,7 @@ mk-caml-lib-bytecode = $(call quiet-command, $(OCAMLC) $(OCAMLCFLAGS) -a -o $1 $
 
 mk-caml-stubs = $(call quiet-command, $(OCAMLMKLIB) -o `basename $1 .a` $2,MKLIB,$1)
 mk-caml-lib-stubs = \
-	$(call quiet-command, $(OCAMLMKLIB) -o `basename $1 .a | sed -e 's/^lib//'` $2 $3,MKLIB,$1)
+	$(call quiet-command, $(OCAMLMKLIB) -o `basename $1 .a | sed -e 's/^lib//'` $2 `echo $3 | sed -e 's/-ccopt -l/-l/g' | sed -e 's/-ccopt -L/-ldopt -L/g'`,MKLIB,$1)
 
 # define a library target <name>.cmxa and <name>.cma
 define OCAML_LIBRARY_template
@@ -72,7 +72,7 @@ define OCAML_LIBRARY_template
  $(1)_stubs.a: $(foreach obj,$$($(1)_C_OBJS),$(obj).o)
 	$(call mk-caml-stubs,$$@, $$+)
  lib$(1)_stubs.a: $(foreach obj,$($(1)_C_OBJS),$(obj).o)
-	$(call mk-caml-lib-stubs,$$@, $$+, $(foreach lib,$(LIBS_$(1)),$(lib)))
+	$(call mk-caml-lib-stubs,$$@, $$+, $(foreach lib,$(LIBS_$(1)),-ccopt $(lib)))
 endef
 
 define OCAML_NOC_LIBRARY_template
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.19


From xen-changelog-bounces@lists.xenproject.org Mon Dec 16 12:45:11 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 16 Dec 2024 12:45:11 +0000
Received: from list by lists.xenproject.org with outflank-mailman.857993.1270216 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tNATH-0008C7-4u; Mon, 16 Dec 2024 12:45:11 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 857993.1270216; Mon, 16 Dec 2024 12:45:11 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tNATH-0008C0-2T; Mon, 16 Dec 2024 12:45:11 +0000
Received: by outflank-mailman (input) for mailman id 857993;
 Mon, 16 Dec 2024 12:45:09 +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 1tNATF-0008Bj-2p
 for xen-changelog@lists.xenproject.org; Mon, 16 Dec 2024 12:45:09 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1tNATE-006JrF-2S
 for xen-changelog@lists.xenproject.org;
 Mon, 16 Dec 2024 12:45:09 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1tNATE-00AIQJ-3C
 for xen-changelog@lists.xenproject.org;
 Mon, 16 Dec 2024 12:45:08 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.18] x86emul: MOVBE requires a memory operand
Message-Id: <E1tNATE-00AIQJ-3C@xenbits.xenproject.org>
Date: Mon, 16 Dec 2024 12:45:08 +0000

commit 37b069fc3bb97cfcf5ae769a163bd02e460d9675
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Mon Dec 16 13:34:19 2024 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Dec 16 13:34:19 2024 +0100

    x86emul: MOVBE requires a memory operand
    
    The reg-reg forms should cause #UD; they come into existence only with
    APX, where MOVBE also extends BSWAP (for the latter not being "eligible"
    to a REX2 prefix).
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
    master commit: 4c5d9a01f8fa81417a9c431e9624fb71361ec4f9
    master date: 2024-12-02 09:50:14 +0100
---
 xen/arch/x86/x86_emulate/x86_emulate.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/xen/arch/x86/x86_emulate/x86_emulate.c b/xen/arch/x86/x86_emulate/x86_emulate.c
index 0245d23ca7..2c6bc8df2c 100644
--- a/xen/arch/x86/x86_emulate/x86_emulate.c
+++ b/xen/arch/x86/x86_emulate/x86_emulate.c
@@ -6912,6 +6912,7 @@ x86_emulate(
 
     case X86EMUL_OPC(0x0f38, 0xf0): /* movbe m,r */
     case X86EMUL_OPC(0x0f38, 0xf1): /* movbe r,m */
+        generate_exception_if(ea.type != OP_MEM, X86_EXC_UD);
         vcpu_must_have(movbe);
         switch ( op_bytes )
         {
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.18


From xen-changelog-bounces@lists.xenproject.org Mon Dec 16 12:45:21 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 16 Dec 2024 12:45:21 +0000
Received: from list by lists.xenproject.org with outflank-mailman.857994.1270220 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tNATR-0008Em-6s; Mon, 16 Dec 2024 12:45:21 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 857994.1270220; Mon, 16 Dec 2024 12:45:21 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tNATR-0008Ed-3v; Mon, 16 Dec 2024 12:45:21 +0000
Received: by outflank-mailman (input) for mailman id 857994;
 Mon, 16 Dec 2024 12:45:19 +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 1tNATP-0008EK-5W
 for xen-changelog@lists.xenproject.org; Mon, 16 Dec 2024 12:45:19 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1tNATO-006JrJ-2j
 for xen-changelog@lists.xenproject.org;
 Mon, 16 Dec 2024 12:45:19 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1tNATP-00AISF-0M
 for xen-changelog@lists.xenproject.org;
 Mon, 16 Dec 2024 12:45:19 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.18] xen/Kconfig: livepatch-build-tools requires debug information
Message-Id: <E1tNATP-00AISF-0M@xenbits.xenproject.org>
Date: Mon, 16 Dec 2024 12:45:19 +0000

commit abf8f900c6d9010f273c16f92777213ecad92bc4
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Mon Dec 16 13:34:43 2024 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Dec 16 13:34:43 2024 +0100

    xen/Kconfig: livepatch-build-tools requires debug information
    
    The tools infrastructure used to build livepatches for Xen
    (livepatch-build-tools) consumes some DWARF debug information present in
    xen-syms to generate a livepatch (see livepatch-build script usage of readelf
    -wi).
    
    The current Kconfig defaults however will enable LIVEPATCH without DEBUG_INFO
    on release builds, thus providing a default Kconfig selection that's not
    suitable for livepatch-build-tools even when LIVEPATCH support is enabled,
    because it's missing the DWARF debug section.
    
    Fix by defaulting DEBUG_INFO to enabled when LIVEPATCH is.
    
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 126b0a6e537ce1d486a29e35cfeec1f222a74d11
    master date: 2024-12-02 15:22:05 +0100
---
 xen/Kconfig.debug | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/Kconfig.debug b/xen/Kconfig.debug
index c533ddf75f..a2df359273 100644
--- a/xen/Kconfig.debug
+++ b/xen/Kconfig.debug
@@ -127,7 +127,7 @@ endif # DEBUG || EXPERT
 
 config DEBUG_INFO
 	bool "Compile Xen with debug info"
-	default DEBUG
+	default DEBUG || LIVEPATCH
 	help
 	  Say Y here if you want to build Xen with debug information. This
 	  information is needed e.g. for doing crash dump analysis of the
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.18


From xen-changelog-bounces@lists.xenproject.org Mon Dec 16 12:45:30 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 16 Dec 2024 12:45:30 +0000
Received: from list by lists.xenproject.org with outflank-mailman.857996.1270224 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tNATa-0008HK-87; Mon, 16 Dec 2024 12:45:30 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 857996.1270224; Mon, 16 Dec 2024 12:45:30 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tNATa-0008HC-5O; Mon, 16 Dec 2024 12:45:30 +0000
Received: by outflank-mailman (input) for mailman id 857996;
 Mon, 16 Dec 2024 12:45:29 +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 1tNATZ-0008H6-8B
 for xen-changelog@lists.xenproject.org; Mon, 16 Dec 2024 12:45:29 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1tNATY-006Jrf-30
 for xen-changelog@lists.xenproject.org;
 Mon, 16 Dec 2024 12:45:29 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1tNATZ-00AITK-0d
 for xen-changelog@lists.xenproject.org;
 Mon, 16 Dec 2024 12:45:29 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.18] libs/guest: Fix migration compatibility with a security-patched Xen 4.13
Message-Id: <E1tNATZ-00AITK-0d@xenbits.xenproject.org>
Date: Mon, 16 Dec 2024 12:45:29 +0000

commit 4306bf6a7558e033356554fa32859eeba9a4471e
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Mon Dec 16 13:35:02 2024 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Dec 16 13:35:02 2024 +0100

    libs/guest: Fix migration compatibility with a security-patched Xen 4.13
    
    xc_cpuid_apply_policy() provides compatibility for migration of a pre-4.14 VM
    where no CPUID data was provided in the stream.
    
    It guesses the various max-leaf limits, based on what was true at the time of
    writing, but this was not correctly adapted when speculative security issues
    forced the advertisement of new feature bits.  Of note are:
    
     * LFENCE-DISPATCH, in leaf 0x80000021.eax
     * BHI-CTRL, in leaf 0x7[2].edx
    
    In both cases, a VM booted on a security-patched Xen 4.13, and then migrated
    on to any newer version of Xen on the same or compatible hardware would have
    these features stripped back because Xen is still editing the cpu-policy for
    sanity behind the back of the toolstack.
    
    For VMs using BHI_DIS_S to mitigate Native-BHI, this resulted in a failure to
    restore the guests MSR_SPEC_CTRL setting:
    
      (XEN) HVM d7v0 load MSR 0x48 with value 0x401 failed
      (XEN) HVM7 restore: failed to load entry 20/0 rc -6
    
    Fixes: e9b4fe263649 ("x86/cpuid: support LFENCE always serialising CPUID bit")
    Fixes: f3709b15fc86 ("x86/cpuid: Infrastructure for cpuid word 7:2.edx")
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 28301682f492c1df2ff9c3e01a0aab6262bd925a
    master date: 2024-12-03 12:20:41 +0000
---
 tools/libs/guest/xg_cpuid_x86.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/tools/libs/guest/xg_cpuid_x86.c b/tools/libs/guest/xg_cpuid_x86.c
index 3a74bb2b37..4cef7ab72b 100644
--- a/tools/libs/guest/xg_cpuid_x86.c
+++ b/tools/libs/guest/xg_cpuid_x86.c
@@ -652,7 +652,8 @@ int xc_cpuid_apply_policy(xc_interface *xch, uint32_t domid, bool restore,
          *
          * This restore path is used for incoming VMs with no CPUID data
          * i.e. originated on Xen 4.13 or earlier.  We must invent a policy
-         * compatible with what Xen 4.13 would have done on the same hardware.
+         * compatible with what a security-patched Xen 4.13 would have done on
+         * the same hardware.
          *
          * Specifically:
          * - Clamp max leaves.
@@ -669,8 +670,8 @@ int xc_cpuid_apply_policy(xc_interface *xch, uint32_t domid, bool restore,
         }
 
         p->basic.max_leaf = min(p->basic.max_leaf, 0xdu);
-        p->feat.max_subleaf = 0;
-        p->extd.max_leaf = min(p->extd.max_leaf, 0x8000001c);
+        p->feat.max_subleaf = min(p->feat.max_subleaf, 0x2u);
+        p->extd.max_leaf = min(p->extd.max_leaf, 0x80000021);
     }
 
     if ( featureset )
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.18


From xen-changelog-bounces@lists.xenproject.org Mon Dec 16 12:45:40 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 16 Dec 2024 12:45:40 +0000
Received: from list by lists.xenproject.org with outflank-mailman.857997.1270229 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tNATk-0008K9-9x; Mon, 16 Dec 2024 12:45:40 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 857997.1270229; Mon, 16 Dec 2024 12:45:40 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tNATk-0008K1-6n; Mon, 16 Dec 2024 12:45:40 +0000
Received: by outflank-mailman (input) for mailman id 857997;
 Mon, 16 Dec 2024 12:45:39 +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 1tNATj-0008Jv-BV
 for xen-changelog@lists.xenproject.org; Mon, 16 Dec 2024 12:45:39 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1tNATj-006Jrp-06
 for xen-changelog@lists.xenproject.org;
 Mon, 16 Dec 2024 12:45:39 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1tNATj-00AIVk-0u
 for xen-changelog@lists.xenproject.org;
 Mon, 16 Dec 2024 12:45:39 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.18] tools/ocaml: Specify rpath correctly for ocamlmklib
Message-Id: <E1tNATj-00AIVk-0u@xenbits.xenproject.org>
Date: Mon, 16 Dec 2024 12:45:39 +0000

commit e5865e7804635a6cf863968a9eee395cd39bc6f3
Author:     Andrii Sultanov <andrii.sultanov@cloud.com>
AuthorDate: Mon Dec 16 13:35:10 2024 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Dec 16 13:35:10 2024 +0100

    tools/ocaml: Specify rpath correctly for ocamlmklib
    
    ocamlmklib has special handling for C-like '-Wl,-rpath' option, but does
    not know how to handle '-Wl,-rpath-link', as evidenced by warnings like:
    "Unknown option
    -Wl,-rpath-link=$HOME/xen/tools/ocaml/libs/eventchn/../../../../tools/libs/toollog"
    Pass this option directly to the compiler with -ccopt instead.
    
    Also pass -L directly to the linker with -ldopt. This prevents embedding absolute
    paths from buildtime into binary's RPATH.
    
    Fixes: f7b4e4558b42 ("tools/ocaml: Fix OCaml libs rules")
    Reported-by: Fernando Rodrigues <alpha@sigmasquadron.net>
    Tested-by: Fernando Rodrigues <alpha@sigmasquadron.net>
    Signed-off-by: Andrii Sultanov <andrii.sultanov@cloud.com>
    Acked-by: Christian Lindig <christian.lindig@cloud.com>
    master commit: bf8a209915804088c09ac6575bcca554450fa7e8
    master date: 2024-12-11 10:45:08 +0000
---
 tools/ocaml/Makefile.rules | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/ocaml/Makefile.rules b/tools/ocaml/Makefile.rules
index 5638193edf..678bbc046f 100644
--- a/tools/ocaml/Makefile.rules
+++ b/tools/ocaml/Makefile.rules
@@ -61,7 +61,7 @@ mk-caml-lib-bytecode = $(call quiet-command, $(OCAMLC) $(OCAMLCFLAGS) -a -o $1 $
 
 mk-caml-stubs = $(call quiet-command, $(OCAMLMKLIB) -o `basename $1 .a` $2,MKLIB,$1)
 mk-caml-lib-stubs = \
-	$(call quiet-command, $(OCAMLMKLIB) -o `basename $1 .a | sed -e 's/^lib//'` $2 $3,MKLIB,$1)
+	$(call quiet-command, $(OCAMLMKLIB) -o `basename $1 .a | sed -e 's/^lib//'` $2 `echo $3 | sed -e 's/-ccopt -l/-l/g' | sed -e 's/-ccopt -L/-ldopt -L/g'`,MKLIB,$1)
 
 # define a library target <name>.cmxa and <name>.cma
 define OCAML_LIBRARY_template
@@ -72,7 +72,7 @@ define OCAML_LIBRARY_template
  $(1)_stubs.a: $(foreach obj,$$($(1)_C_OBJS),$(obj).o)
 	$(call mk-caml-stubs,$$@, $$+)
  lib$(1)_stubs.a: $(foreach obj,$($(1)_C_OBJS),$(obj).o)
-	$(call mk-caml-lib-stubs,$$@, $$+, $(foreach lib,$(LIBS_$(1)),$(lib)))
+	$(call mk-caml-lib-stubs,$$@, $$+, $(foreach lib,$(LIBS_$(1)),-ccopt $(lib)))
 endef
 
 define OCAML_NOC_LIBRARY_template
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.18


From xen-changelog-bounces@lists.xenproject.org Mon Dec 16 12:55:05 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 16 Dec 2024 12:55:05 +0000
Received: from list by lists.xenproject.org with outflank-mailman.858001.1270232 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tNAco-0001Ol-VK; Mon, 16 Dec 2024 12:55:02 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 858001.1270232; Mon, 16 Dec 2024 12: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 1tNAco-0001Od-So; Mon, 16 Dec 2024 12:55:02 +0000
Received: by outflank-mailman (input) for mailman id 858001;
 Mon, 16 Dec 2024 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 1tNAco-0001OX-4X
 for xen-changelog@lists.xenproject.org; Mon, 16 Dec 2024 12:55:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1tNAcn-006K3g-1Y
 for xen-changelog@lists.xenproject.org;
 Mon, 16 Dec 2024 12:55:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1tNAcn-00AK2e-2Q
 for xen-changelog@lists.xenproject.org;
 Mon, 16 Dec 2024 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>
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/riscv: add destroy_xen_mappings() to remove mappings in Xen page tables
Message-Id: <E1tNAcn-00AK2e-2Q@xenbits.xenproject.org>
Date: Mon, 16 Dec 2024 12:55:01 +0000

commit 0eb8b7160444121226318a8301fe9496acb2f0d0
Author:     Oleksii Kurochko <oleksii.kurochko@gmail.com>
AuthorDate: Mon Dec 16 13:05:05 2024 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Dec 16 13:05:05 2024 +0100

    xen/riscv: add destroy_xen_mappings() to remove mappings in Xen page tables
    
    Introduce the destroy_xen_mappings() function, which removes page
    mappings in Xen's page tables between a start address s and an end
    address e.
    The function ensures that both s and e are page-aligned
    and verifies that the start address is less than or equal to the end
    address before calling pt_update() to invalidate the mappings.
    The pt_update() function is called with INVALID_MFN and PTE_VALID=0
    in the flags, which tell pt_update() to remove mapping. No additional
    ASSERT() is required to check these arguments, as they are hardcoded in
    the call to pt_update() within destroy_xen_mappings().
    
    Signed-off-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/riscv/mm.c | 6 ------
 xen/arch/riscv/pt.c | 8 ++++++++
 2 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/xen/arch/riscv/mm.c b/xen/arch/riscv/mm.c
index 9359dc7f33..f2bf279bac 100644
--- a/xen/arch/riscv/mm.c
+++ b/xen/arch/riscv/mm.c
@@ -360,12 +360,6 @@ int xenmem_add_to_physmap_one(struct domain *d, unsigned int space,
     return 0;
 }
 
-int destroy_xen_mappings(unsigned long s, unsigned long e)
-{
-    BUG_ON("unimplemented");
-    return -1;
-}
-
 void share_xen_page_with_guest(struct page_info *page, struct domain *d,
                                enum XENSHARE_flags flags)
 {
diff --git a/xen/arch/riscv/pt.c b/xen/arch/riscv/pt.c
index d62aceb36c..798483aa3b 100644
--- a/xen/arch/riscv/pt.c
+++ b/xen/arch/riscv/pt.c
@@ -421,6 +421,14 @@ int map_pages_to_xen(unsigned long virt,
     return pt_update(virt, mfn, nr_mfns, flags);
 }
 
+int destroy_xen_mappings(unsigned long s, unsigned long e)
+{
+    ASSERT(IS_ALIGNED(s, PAGE_SIZE));
+    ASSERT(IS_ALIGNED(e, PAGE_SIZE));
+
+    return s < e ? pt_update(s, INVALID_MFN, PFN_DOWN(e - s), 0) : -EINVAL;
+}
+
 int __init populate_pt_range(unsigned long virt, unsigned long nr_mfns)
 {
     return pt_update(virt, INVALID_MFN, nr_mfns, PTE_POPULATE);
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Mon Dec 16 12:55:13 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 16 Dec 2024 12:55:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.858002.1270236 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tNAcz-0001Qw-0N; Mon, 16 Dec 2024 12:55:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 858002.1270236; Mon, 16 Dec 2024 12: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 1tNAcy-0001Qo-UA; Mon, 16 Dec 2024 12:55:12 +0000
Received: by outflank-mailman (input) for mailman id 858002;
 Mon, 16 Dec 2024 12: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 1tNAcx-0001Qb-Sx
 for xen-changelog@lists.xenproject.org; Mon, 16 Dec 2024 12:55:11 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1tNAcx-006K3o-1p
 for xen-changelog@lists.xenproject.org;
 Mon, 16 Dec 2024 12:55:11 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1tNAcx-00AK4t-2h
 for xen-changelog@lists.xenproject.org;
 Mon, 16 Dec 2024 12: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>
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/riscv: reorder includes in asm/page.h alphabetically
Message-Id: <E1tNAcx-00AK4t-2h@xenbits.xenproject.org>
Date: Mon, 16 Dec 2024 12:55:11 +0000

commit f5bf0d100bc80c882b9923ff0151c33ebd4941c9
Author:     Oleksii Kurochko <oleksii.kurochko@gmail.com>
AuthorDate: Mon Dec 16 13:05:27 2024 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Dec 16 13:05:27 2024 +0100

    xen/riscv: reorder includes in asm/page.h alphabetically
    
    Signed-off-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/riscv/include/asm/page.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/arch/riscv/include/asm/page.h b/xen/arch/riscv/include/asm/page.h
index 91b1194b55..bf3f75e85d 100644
--- a/xen/arch/riscv/include/asm/page.h
+++ b/xen/arch/riscv/include/asm/page.h
@@ -5,8 +5,8 @@
 
 #ifndef __ASSEMBLY__
 
-#include <xen/const.h>
 #include <xen/bug.h>
+#include <xen/const.h>
 #include <xen/types.h>
 
 #include <asm/atomic.h>
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Mon Dec 16 12:55:23 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 16 Dec 2024 12:55:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.858003.1270241 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tNAd9-0001Te-3G; Mon, 16 Dec 2024 12:55:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 858003.1270241; Mon, 16 Dec 2024 12:55:23 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tNAd8-0001TW-VX; Mon, 16 Dec 2024 12:55:22 +0000
Received: by outflank-mailman (input) for mailman id 858003;
 Mon, 16 Dec 2024 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 1tNAd8-0001TM-04
 for xen-changelog@lists.xenproject.org; Mon, 16 Dec 2024 12:55:22 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1tNAd7-006K3x-26
 for xen-changelog@lists.xenproject.org;
 Mon, 16 Dec 2024 12:55:21 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1tNAd7-00AKB4-2x
 for xen-changelog@lists.xenproject.org;
 Mon, 16 Dec 2024 12: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>
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/riscv: add {set,clear}_fixmap() functions for managing fixmap entries
Message-Id: <E1tNAd7-00AKB4-2x@xenbits.xenproject.org>
Date: Mon, 16 Dec 2024 12:55:21 +0000

commit df98c0386426a5fc0d840f7615f223ced181fc52
Author:     Oleksii Kurochko <oleksii.kurochko@gmail.com>
AuthorDate: Mon Dec 16 13:05:46 2024 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Dec 16 13:05:46 2024 +0100

    xen/riscv: add {set,clear}_fixmap() functions for managing fixmap entries
    
    Introduce set_fixmap() and clear_fixmap() functions to manage mappings
    in the fixmap region. The set_fixmap() function maps a 4k page ( as only L0
    is expected to be updated; look at setup_fixmap_mappings() ) at a specified
    fixmap entry using map_pages_to_xen(), while clear_fixmap() removes the
    mapping from a fixmap entry by calling destroy_xen_mappings().
    
    Both functions ensure that the operations succeed by asserting that their
    respective calls (map_pages_to_xen() and destroy_xen_mappings()) return 0.
    `BUG()` is added to trigger a failure if any issues occur during
    the mapping or unmapping process.
    
    Signed-off-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/riscv/include/asm/fixmap.h |  5 +++++
 xen/arch/riscv/pt.c                 | 16 ++++++++++++++++
 2 files changed, 21 insertions(+)

diff --git a/xen/arch/riscv/include/asm/fixmap.h b/xen/arch/riscv/include/asm/fixmap.h
index 818c8ce07b..e399a15f53 100644
--- a/xen/arch/riscv/include/asm/fixmap.h
+++ b/xen/arch/riscv/include/asm/fixmap.h
@@ -32,6 +32,11 @@
  */
 extern pte_t xen_fixmap[];
 
+/* Map a page in a fixmap entry */
+void set_fixmap(unsigned int map, mfn_t mfn, unsigned int flags);
+/* Remove a mapping from a fixmap entry */
+void clear_fixmap(unsigned int map);
+
 #define fix_to_virt(slot) ((void *)FIXMAP_ADDR(slot))
 
 static inline unsigned int virt_to_fix(vaddr_t vaddr)
diff --git a/xen/arch/riscv/pt.c b/xen/arch/riscv/pt.c
index 798483aa3b..a703e0f1bd 100644
--- a/xen/arch/riscv/pt.c
+++ b/xen/arch/riscv/pt.c
@@ -8,6 +8,7 @@
 #include <xen/pmap.h>
 #include <xen/spinlock.h>
 
+#include <asm/fixmap.h>
 #include <asm/flushtlb.h>
 #include <asm/page.h>
 
@@ -433,3 +434,18 @@ int __init populate_pt_range(unsigned long virt, unsigned long nr_mfns)
 {
     return pt_update(virt, INVALID_MFN, nr_mfns, PTE_POPULATE);
 }
+
+/* Map a 4k page in a fixmap entry */
+void set_fixmap(unsigned int map, mfn_t mfn, unsigned int flags)
+{
+    if ( map_pages_to_xen(FIXMAP_ADDR(map), mfn, 1, flags | PTE_SMALL) != 0 )
+        BUG();
+}
+
+/* Remove a mapping from a fixmap entry */
+void clear_fixmap(unsigned int map)
+{
+    if ( destroy_xen_mappings(FIXMAP_ADDR(map),
+                              FIXMAP_ADDR(map) + PAGE_SIZE) != 0 )
+        BUG();
+}
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Mon Dec 16 12:55:33 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 16 Dec 2024 12:55:33 +0000
Received: from list by lists.xenproject.org with outflank-mailman.858004.1270243 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tNAdJ-0001WV-3G; Mon, 16 Dec 2024 12:55:33 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 858004.1270243; Mon, 16 Dec 2024 12:55:33 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tNAdJ-0001WN-0k; Mon, 16 Dec 2024 12:55:33 +0000
Received: by outflank-mailman (input) for mailman id 858004;
 Mon, 16 Dec 2024 12: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 1tNAdI-0001WD-3k
 for xen-changelog@lists.xenproject.org; Mon, 16 Dec 2024 12:55:32 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1tNAdH-006K4K-2M
 for xen-changelog@lists.xenproject.org;
 Mon, 16 Dec 2024 12:55:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1tNAdI-00AKDO-00
 for xen-changelog@lists.xenproject.org;
 Mon, 16 Dec 2024 12:55:32 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/xsm: make getdomaininfo xsm dummy checks more stringent
Message-Id: <E1tNAdI-00AKDO-00@xenbits.xenproject.org>
Date: Mon, 16 Dec 2024 12:55:32 +0000

commit 5793b84c5e8fb268f94e7fde7816799e66945a73
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Mon Dec 16 13:06:55 2024 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Dec 16 13:06:55 2024 +0100

    xen/xsm: make getdomaininfo xsm dummy checks more stringent
    
    Today the dummy XSM privilege checks for getdomaininfo are less
    stringent than possible: they basically rely on the general
    sysctl/domctl entry check to do all tests and then do the test with
    the XSM_HOOK privilege, which is an "allow all" default.
    
    Instead of XSM_HOOK use XSM_XS_PRIV, which is the privilege really
    wanted. Note that this test is still wider than the sysctl entry test,
    but there is no easy way to make both domctl and sysctl happy at the
    same time.
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Acked-by: Daniel P. Smith <dpsmith@apertussolutions.com>
---
 xen/common/domctl.c     | 2 +-
 xen/common/sysctl.c     | 2 +-
 xen/include/xsm/dummy.h | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/xen/common/domctl.c b/xen/common/domctl.c
index ea16b75910..444e072fdc 100644
--- a/xen/common/domctl.c
+++ b/xen/common/domctl.c
@@ -539,7 +539,7 @@ long do_domctl(XEN_GUEST_HANDLE_PARAM(xen_domctl_t) u_domctl)
         break;
 
     case XEN_DOMCTL_getdomaininfo:
-        ret = xsm_getdomaininfo(XSM_HOOK, d);
+        ret = xsm_getdomaininfo(XSM_XS_PRIV, d);
         if ( ret )
             break;
 
diff --git a/xen/common/sysctl.c b/xen/common/sysctl.c
index d02f44fe3a..c2d99ae12e 100644
--- a/xen/common/sysctl.c
+++ b/xen/common/sysctl.c
@@ -89,7 +89,7 @@ long do_sysctl(XEN_GUEST_HANDLE_PARAM(xen_sysctl_t) u_sysctl)
             if ( num_domains == op->u.getdomaininfolist.max_domains )
                 break;
 
-            if ( xsm_getdomaininfo(XSM_HOOK, d) )
+            if ( xsm_getdomaininfo(XSM_XS_PRIV, d) )
                 continue;
 
             getdomaininfo(d, &info);
diff --git a/xen/include/xsm/dummy.h b/xen/include/xsm/dummy.h
index 7956f27a29..f8a3c4b81e 100644
--- a/xen/include/xsm/dummy.h
+++ b/xen/include/xsm/dummy.h
@@ -137,7 +137,7 @@ static XSM_INLINE int cf_check xsm_domain_create(
 static XSM_INLINE int cf_check xsm_getdomaininfo(
     XSM_DEFAULT_ARG struct domain *d)
 {
-    XSM_ASSERT_ACTION(XSM_HOOK);
+    XSM_ASSERT_ACTION(XSM_XS_PRIV);
     return xsm_default_action(action, current->domain, d);
 }
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Mon Dec 16 12:55:43 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 16 Dec 2024 12:55:43 +0000
Received: from list by lists.xenproject.org with outflank-mailman.858006.1270253 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tNAdT-0001ea-7a; Mon, 16 Dec 2024 12:55:43 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 858006.1270253; Mon, 16 Dec 2024 12:55:43 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tNAdT-0001eL-4m; Mon, 16 Dec 2024 12:55:43 +0000
Received: by outflank-mailman (input) for mailman id 858006;
 Mon, 16 Dec 2024 12: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 1tNAdS-0001e4-4l
 for xen-changelog@lists.xenproject.org; Mon, 16 Dec 2024 12:55:42 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1tNAdR-006K4W-2e
 for xen-changelog@lists.xenproject.org;
 Mon, 16 Dec 2024 12:55:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1tNAdS-00AKId-0H
 for xen-changelog@lists.xenproject.org;
 Mon, 16 Dec 2024 12:55:42 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen: add a domain unique id to each domain
Message-Id: <E1tNAdS-00AKId-0H@xenbits.xenproject.org>
Date: Mon, 16 Dec 2024 12:55:42 +0000

commit 58ba55959ae1bca0651396d0752c2076a45b5ee6
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Mon Dec 16 13:07:19 2024 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Dec 16 13:07:19 2024 +0100

    xen: add a domain unique id to each domain
    
    Xenstore is referencing domains by their domid, but reuse of a domid
    can lead to the situation that Xenstore can't tell whether a domain
    with that domid has been deleted and created again without Xenstore
    noticing the domain is a new one now.
    
    Add a global domain creation unique id which is updated when creating
    a new domain, and store that value in struct domain of the new domain.
    The global unique id is initialized with the system time and updates
    are done via the xorshift algorithm which is used for pseudo random
    number generation, too (see https://en.wikipedia.org/wiki/Xorshift).
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Alejandro Vallejo <alejandro.vallejo@cloud.com>
---
 xen/common/domain.c     | 27 +++++++++++++++++++++++++++
 xen/include/xen/sched.h |  3 +++
 2 files changed, 30 insertions(+)

diff --git a/xen/common/domain.c b/xen/common/domain.c
index 92263a4fbd..e33a0a5a21 100644
--- a/xen/common/domain.c
+++ b/xen/common/domain.c
@@ -562,6 +562,32 @@ static void _domain_destroy(struct domain *d)
     free_domain_struct(d);
 }
 
+static uint64_t get_unique_id(void)
+{
+    static uint64_t unique_id;
+    static DEFINE_SPINLOCK(lock);
+    uint64_t x;
+
+    spin_lock(&lock);
+
+    x = unique_id ? : NOW();
+
+    /*
+     * Pseudo-randomize id in order to avoid consumers relying on sequence.
+     * Randomization algorithm has a period of 2^64 - 1.
+     * Unique id is not repeatable between resets and each id has the same
+     * lifetime as the domain it is associated with.
+     */
+    x ^= x << 13;
+    x ^= x >> 7;
+    x ^= x << 17;
+    unique_id = x;
+
+    spin_unlock(&lock);
+
+    return x;
+}
+
 static int sanitise_domain_config(struct xen_domctl_createdomain *config)
 {
     bool hvm = config->flags & XEN_DOMCTL_CDF_hvm;
@@ -654,6 +680,7 @@ struct domain *domain_create(domid_t domid,
 
     /* Sort out our idea of is_system_domain(). */
     d->domain_id = domid;
+    d->unique_id = get_unique_id();
 
     /* Holding CDF_* internal flags. */
     d->cdf = flags;
diff --git a/xen/include/xen/sched.h b/xen/include/xen/sched.h
index 76e39378b3..711668e028 100644
--- a/xen/include/xen/sched.h
+++ b/xen/include/xen/sched.h
@@ -370,6 +370,9 @@ struct domain
     domid_t          domain_id;
 
     unsigned int     max_vcpus;
+
+    uint64_t         unique_id;       /* Unique domain identifier */
+
     struct vcpu    **vcpu;
 
     shared_info_t   *shared_info;     /* shared data area */
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Mon Dec 16 13:55:11 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 16 Dec 2024 13:55:11 +0000
Received: from list by lists.xenproject.org with outflank-mailman.858051.1270287 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tNBYu-00030Y-17; Mon, 16 Dec 2024 13:55:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 858051.1270287; Mon, 16 Dec 2024 13:55:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tNBYt-00030R-UT; Mon, 16 Dec 2024 13:55:03 +0000
Received: by outflank-mailman (input) for mailman id 858051;
 Mon, 16 Dec 2024 13: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 1tNBYs-00030L-6a
 for xen-changelog@lists.xenproject.org; Mon, 16 Dec 2024 13:55:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1tNBYr-006Laa-1o
 for xen-changelog@lists.xenproject.org;
 Mon, 16 Dec 2024 13:55:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1tNBYr-00AVNk-2U
 for xen-changelog@lists.xenproject.org;
 Mon, 16 Dec 2024 13:55:01 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.18] x86emul: MOVBE requires a memory operand
Message-Id: <E1tNBYr-00AVNk-2U@xenbits.xenproject.org>
Date: Mon, 16 Dec 2024 13:55:01 +0000

commit 37b069fc3bb97cfcf5ae769a163bd02e460d9675
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Mon Dec 16 13:34:19 2024 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Dec 16 13:34:19 2024 +0100

    x86emul: MOVBE requires a memory operand
    
    The reg-reg forms should cause #UD; they come into existence only with
    APX, where MOVBE also extends BSWAP (for the latter not being "eligible"
    to a REX2 prefix).
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
    master commit: 4c5d9a01f8fa81417a9c431e9624fb71361ec4f9
    master date: 2024-12-02 09:50:14 +0100
---
 xen/arch/x86/x86_emulate/x86_emulate.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/xen/arch/x86/x86_emulate/x86_emulate.c b/xen/arch/x86/x86_emulate/x86_emulate.c
index 0245d23ca7..2c6bc8df2c 100644
--- a/xen/arch/x86/x86_emulate/x86_emulate.c
+++ b/xen/arch/x86/x86_emulate/x86_emulate.c
@@ -6912,6 +6912,7 @@ x86_emulate(
 
     case X86EMUL_OPC(0x0f38, 0xf0): /* movbe m,r */
     case X86EMUL_OPC(0x0f38, 0xf1): /* movbe r,m */
+        generate_exception_if(ea.type != OP_MEM, X86_EXC_UD);
         vcpu_must_have(movbe);
         switch ( op_bytes )
         {
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.18


From xen-changelog-bounces@lists.xenproject.org Mon Dec 16 13:55:13 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 16 Dec 2024 13:55:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.858053.1270290 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tNBZ3-00032E-2P; Mon, 16 Dec 2024 13:55:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 858053.1270290; Mon, 16 Dec 2024 13:55:13 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tNBZ2-000327-W3; Mon, 16 Dec 2024 13:55:12 +0000
Received: by outflank-mailman (input) for mailman id 858053;
 Mon, 16 Dec 2024 13: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 1tNBZ2-00031z-1M
 for xen-changelog@lists.xenproject.org; Mon, 16 Dec 2024 13:55:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1tNBZ1-006Lae-2E
 for xen-changelog@lists.xenproject.org;
 Mon, 16 Dec 2024 13:55:11 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1tNBZ1-00AVOa-2x
 for xen-changelog@lists.xenproject.org;
 Mon, 16 Dec 2024 13: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>
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.18] xen/Kconfig: livepatch-build-tools requires debug information
Message-Id: <E1tNBZ1-00AVOa-2x@xenbits.xenproject.org>
Date: Mon, 16 Dec 2024 13:55:11 +0000

commit abf8f900c6d9010f273c16f92777213ecad92bc4
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Mon Dec 16 13:34:43 2024 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Dec 16 13:34:43 2024 +0100

    xen/Kconfig: livepatch-build-tools requires debug information
    
    The tools infrastructure used to build livepatches for Xen
    (livepatch-build-tools) consumes some DWARF debug information present in
    xen-syms to generate a livepatch (see livepatch-build script usage of readelf
    -wi).
    
    The current Kconfig defaults however will enable LIVEPATCH without DEBUG_INFO
    on release builds, thus providing a default Kconfig selection that's not
    suitable for livepatch-build-tools even when LIVEPATCH support is enabled,
    because it's missing the DWARF debug section.
    
    Fix by defaulting DEBUG_INFO to enabled when LIVEPATCH is.
    
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 126b0a6e537ce1d486a29e35cfeec1f222a74d11
    master date: 2024-12-02 15:22:05 +0100
---
 xen/Kconfig.debug | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/Kconfig.debug b/xen/Kconfig.debug
index c533ddf75f..a2df359273 100644
--- a/xen/Kconfig.debug
+++ b/xen/Kconfig.debug
@@ -127,7 +127,7 @@ endif # DEBUG || EXPERT
 
 config DEBUG_INFO
 	bool "Compile Xen with debug info"
-	default DEBUG
+	default DEBUG || LIVEPATCH
 	help
 	  Say Y here if you want to build Xen with debug information. This
 	  information is needed e.g. for doing crash dump analysis of the
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.18


From xen-changelog-bounces@lists.xenproject.org Mon Dec 16 13:55:23 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 16 Dec 2024 13:55:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.858055.1270299 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tNBZD-0003AW-6U; Mon, 16 Dec 2024 13:55:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 858055.1270299; Mon, 16 Dec 2024 13:55:23 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tNBZD-0003AO-3q; Mon, 16 Dec 2024 13:55:23 +0000
Received: by outflank-mailman (input) for mailman id 858055;
 Mon, 16 Dec 2024 13: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 1tNBZC-0003A3-3P
 for xen-changelog@lists.xenproject.org; Mon, 16 Dec 2024 13:55:22 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1tNBZB-006Lal-2V
 for xen-changelog@lists.xenproject.org;
 Mon, 16 Dec 2024 13:55:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1tNBZC-00AVPR-08
 for xen-changelog@lists.xenproject.org;
 Mon, 16 Dec 2024 13:55:22 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.18] libs/guest: Fix migration compatibility with a security-patched Xen 4.13
Message-Id: <E1tNBZC-00AVPR-08@xenbits.xenproject.org>
Date: Mon, 16 Dec 2024 13:55:22 +0000

commit 4306bf6a7558e033356554fa32859eeba9a4471e
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Mon Dec 16 13:35:02 2024 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Dec 16 13:35:02 2024 +0100

    libs/guest: Fix migration compatibility with a security-patched Xen 4.13
    
    xc_cpuid_apply_policy() provides compatibility for migration of a pre-4.14 VM
    where no CPUID data was provided in the stream.
    
    It guesses the various max-leaf limits, based on what was true at the time of
    writing, but this was not correctly adapted when speculative security issues
    forced the advertisement of new feature bits.  Of note are:
    
     * LFENCE-DISPATCH, in leaf 0x80000021.eax
     * BHI-CTRL, in leaf 0x7[2].edx
    
    In both cases, a VM booted on a security-patched Xen 4.13, and then migrated
    on to any newer version of Xen on the same or compatible hardware would have
    these features stripped back because Xen is still editing the cpu-policy for
    sanity behind the back of the toolstack.
    
    For VMs using BHI_DIS_S to mitigate Native-BHI, this resulted in a failure to
    restore the guests MSR_SPEC_CTRL setting:
    
      (XEN) HVM d7v0 load MSR 0x48 with value 0x401 failed
      (XEN) HVM7 restore: failed to load entry 20/0 rc -6
    
    Fixes: e9b4fe263649 ("x86/cpuid: support LFENCE always serialising CPUID bit")
    Fixes: f3709b15fc86 ("x86/cpuid: Infrastructure for cpuid word 7:2.edx")
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 28301682f492c1df2ff9c3e01a0aab6262bd925a
    master date: 2024-12-03 12:20:41 +0000
---
 tools/libs/guest/xg_cpuid_x86.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/tools/libs/guest/xg_cpuid_x86.c b/tools/libs/guest/xg_cpuid_x86.c
index 3a74bb2b37..4cef7ab72b 100644
--- a/tools/libs/guest/xg_cpuid_x86.c
+++ b/tools/libs/guest/xg_cpuid_x86.c
@@ -652,7 +652,8 @@ int xc_cpuid_apply_policy(xc_interface *xch, uint32_t domid, bool restore,
          *
          * This restore path is used for incoming VMs with no CPUID data
          * i.e. originated on Xen 4.13 or earlier.  We must invent a policy
-         * compatible with what Xen 4.13 would have done on the same hardware.
+         * compatible with what a security-patched Xen 4.13 would have done on
+         * the same hardware.
          *
          * Specifically:
          * - Clamp max leaves.
@@ -669,8 +670,8 @@ int xc_cpuid_apply_policy(xc_interface *xch, uint32_t domid, bool restore,
         }
 
         p->basic.max_leaf = min(p->basic.max_leaf, 0xdu);
-        p->feat.max_subleaf = 0;
-        p->extd.max_leaf = min(p->extd.max_leaf, 0x8000001c);
+        p->feat.max_subleaf = min(p->feat.max_subleaf, 0x2u);
+        p->extd.max_leaf = min(p->extd.max_leaf, 0x80000021);
     }
 
     if ( featureset )
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.18


From xen-changelog-bounces@lists.xenproject.org Mon Dec 16 13:55:33 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 16 Dec 2024 13:55:33 +0000
Received: from list by lists.xenproject.org with outflank-mailman.858056.1270304 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tNBZN-0003G2-9Y; Mon, 16 Dec 2024 13:55:33 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 858056.1270304; Mon, 16 Dec 2024 13:55:33 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tNBZN-0003Fu-6U; Mon, 16 Dec 2024 13:55:33 +0000
Received: by outflank-mailman (input) for mailman id 858056;
 Mon, 16 Dec 2024 13: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 1tNBZM-0003Ej-8X
 for xen-changelog@lists.xenproject.org; Mon, 16 Dec 2024 13:55:32 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1tNBZL-006Lb6-2t
 for xen-changelog@lists.xenproject.org;
 Mon, 16 Dec 2024 13:55:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1tNBZM-00AVQ1-0P
 for xen-changelog@lists.xenproject.org;
 Mon, 16 Dec 2024 13:55:32 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.18] tools/ocaml: Specify rpath correctly for ocamlmklib
Message-Id: <E1tNBZM-00AVQ1-0P@xenbits.xenproject.org>
Date: Mon, 16 Dec 2024 13:55:32 +0000

commit e5865e7804635a6cf863968a9eee395cd39bc6f3
Author:     Andrii Sultanov <andrii.sultanov@cloud.com>
AuthorDate: Mon Dec 16 13:35:10 2024 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Dec 16 13:35:10 2024 +0100

    tools/ocaml: Specify rpath correctly for ocamlmklib
    
    ocamlmklib has special handling for C-like '-Wl,-rpath' option, but does
    not know how to handle '-Wl,-rpath-link', as evidenced by warnings like:
    "Unknown option
    -Wl,-rpath-link=$HOME/xen/tools/ocaml/libs/eventchn/../../../../tools/libs/toollog"
    Pass this option directly to the compiler with -ccopt instead.
    
    Also pass -L directly to the linker with -ldopt. This prevents embedding absolute
    paths from buildtime into binary's RPATH.
    
    Fixes: f7b4e4558b42 ("tools/ocaml: Fix OCaml libs rules")
    Reported-by: Fernando Rodrigues <alpha@sigmasquadron.net>
    Tested-by: Fernando Rodrigues <alpha@sigmasquadron.net>
    Signed-off-by: Andrii Sultanov <andrii.sultanov@cloud.com>
    Acked-by: Christian Lindig <christian.lindig@cloud.com>
    master commit: bf8a209915804088c09ac6575bcca554450fa7e8
    master date: 2024-12-11 10:45:08 +0000
---
 tools/ocaml/Makefile.rules | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/ocaml/Makefile.rules b/tools/ocaml/Makefile.rules
index 5638193edf..678bbc046f 100644
--- a/tools/ocaml/Makefile.rules
+++ b/tools/ocaml/Makefile.rules
@@ -61,7 +61,7 @@ mk-caml-lib-bytecode = $(call quiet-command, $(OCAMLC) $(OCAMLCFLAGS) -a -o $1 $
 
 mk-caml-stubs = $(call quiet-command, $(OCAMLMKLIB) -o `basename $1 .a` $2,MKLIB,$1)
 mk-caml-lib-stubs = \
-	$(call quiet-command, $(OCAMLMKLIB) -o `basename $1 .a | sed -e 's/^lib//'` $2 $3,MKLIB,$1)
+	$(call quiet-command, $(OCAMLMKLIB) -o `basename $1 .a | sed -e 's/^lib//'` $2 `echo $3 | sed -e 's/-ccopt -l/-l/g' | sed -e 's/-ccopt -L/-ldopt -L/g'`,MKLIB,$1)
 
 # define a library target <name>.cmxa and <name>.cma
 define OCAML_LIBRARY_template
@@ -72,7 +72,7 @@ define OCAML_LIBRARY_template
  $(1)_stubs.a: $(foreach obj,$$($(1)_C_OBJS),$(obj).o)
 	$(call mk-caml-stubs,$$@, $$+)
  lib$(1)_stubs.a: $(foreach obj,$($(1)_C_OBJS),$(obj).o)
-	$(call mk-caml-lib-stubs,$$@, $$+, $(foreach lib,$(LIBS_$(1)),$(lib)))
+	$(call mk-caml-lib-stubs,$$@, $$+, $(foreach lib,$(LIBS_$(1)),-ccopt $(lib)))
 endef
 
 define OCAML_NOC_LIBRARY_template
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.18


From xen-changelog-bounces@lists.xenproject.org Mon Dec 16 14:11:08 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 16 Dec 2024 14:11:08 +0000
Received: from list by lists.xenproject.org with outflank-mailman.858107.1270353 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tNBoN-0008Ob-DE; Mon, 16 Dec 2024 14:11:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 858107.1270353; Mon, 16 Dec 2024 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 1tNBoN-0008OU-Ac; Mon, 16 Dec 2024 14:11:03 +0000
Received: by outflank-mailman (input) for mailman id 858107;
 Mon, 16 Dec 2024 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 1tNBoM-0008OC-4w
 for xen-changelog@lists.xenproject.org; Mon, 16 Dec 2024 14:11:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1tNBoL-006Lzi-22
 for xen-changelog@lists.xenproject.org;
 Mon, 16 Dec 2024 14:11:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1tNBoL-00AY3g-2j
 for xen-changelog@lists.xenproject.org;
 Mon, 16 Dec 2024 14: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>
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.19] xen/device-tree: Allow region overlapping with /memreserve/ ranges
Message-Id: <E1tNBoL-00AY3g-2j@xenbits.xenproject.org>
Date: Mon, 16 Dec 2024 14:11:01 +0000

commit 6f7af8383f51f6e4f0588a12ff945d22d7375ae6
Author:     Luca Fancellu <luca.fancellu@arm.com>
AuthorDate: Mon Dec 16 13:31:23 2024 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Dec 16 13:31:23 2024 +0100

    xen/device-tree: Allow region overlapping with /memreserve/ ranges
    
    There are some cases where the device tree exposes a memory range
    in both /memreserve/ and reserved-memory node, in this case the
    current code will stop Xen to boot since it will find that the
    latter range is clashing with the already recorded /memreserve/
    ranges.
    
    Furthermore, u-boot lists boot modules ranges, such as ramdisk,
    in the /memreserve/ part and even in this case this will prevent
    Xen to boot since it will see that the module memory range that
    it is going to add in 'add_boot_module' clashes with a /memreserve/
    range.
    
    When Xen populate the data structure that tracks the memory ranges,
    it also adds a memory type described in 'enum membank_type', so
    in order to fix this behavior, allow overlapping with the /memreserve/
    ranges in the 'check_reserved_regions_overlap' function when a flag
    is set.
    
    In order to implement this solution, there is a distinction between
    the 'struct membanks *' handled by meminfo_overlap_check(...) that
    needs to be done, because the static shared memory banks doesn't have
    a usable bank[].type field and so it can't be accessed, hence now
    the 'struct membanks_hdr' have a 'enum region_type type' field in order
    to be able to identify static shared memory banks in meminfo_overlap_check(...).
    
    While there, set a type for the memory recorded using meminfo_add_bank()
    from efi-boot.h.
    
    Fixes: 53dc37829c31 ("xen/arm: Add DT reserve map regions to bootinfo.reserved_mem")
    Reported-by: Shawn Anastasio <sanastasio@raptorengineering.com>
    Reported-by: Grygorii Strashko <grygorii_strashko@epam.com>
    Signed-off-by: Luca Fancellu <luca.fancellu@arm.com>
    Tested-by: Grygorii Strashko <grygorii_strashko@epam.com>
    Reviewed-by: Julien Grall <jgrall@amazon.com>
    
    bootfdt: Add missing trailing commas in BOOTINFO_{ACPI,SHMEM}_INIT
    
    Commit a14593e3995a extended BOOTINFO_{ACPI,SHMEM}_INIT initializers
    list with a new 'type' member but forgot to add trailing commas (they
    were present before). This results in a build failure when building
    with CONFIG_ACPI=y and CONFIG_STATIC_SHM=y:
    ./include/xen/bootfdt.h:155:5: error: request for member 'shmem' in something not a structure or union
      155 |     .shmem.common.max_banks = NR_SHMEM_BANKS,       \
          |     ^
    ./include/xen/bootfdt.h:168:5: note: in expansion of macro 'BOOTINFO_SHMEM_INIT'
      168 |     BOOTINFO_SHMEM_INIT                             \
          |     ^~~~~~~~~~~~~~~~~~~
    common/device-tree/bootinfo.c:22:39: note: in expansion of macro 'BOOTINFO_INIT'
       22 | struct bootinfo __initdata bootinfo = BOOTINFO_INIT;
    
    Fixes: a14593e3995a ("xen/device-tree: Allow region overlapping with /memreserve/ ranges")
    Signed-off-by: Michal Orzel <michal.orzel@amd.com>
    Reviewed-by: Bertrand Marquis <bertrand.marquis@arm.com>
    Reviewed-by: Luca Fancellu <luca.fancellu@arm.com>
    master commit: a14593e3995afc74bf4efe91116e34894e0ea49a
    master date: 2024-11-28 18:57:21 +0000
    master commit: 5a455a52eae1420619df14c8e55fd17ced70538e
    master date: 2024-12-03 12:20:41 +0000
---
 xen/arch/arm/bootfdt.c           |  9 ++++++++-
 xen/arch/arm/efi/efi-boot.h      |  3 ++-
 xen/arch/arm/include/asm/setup.h | 20 +++++++++++++++++---
 xen/arch/arm/setup.c             | 39 +++++++++++++++++++++++++++++----------
 xen/arch/arm/static-shmem.c      |  2 +-
 5 files changed, 57 insertions(+), 16 deletions(-)

diff --git a/xen/arch/arm/bootfdt.c b/xen/arch/arm/bootfdt.c
index 6e060111d9..1a766a2c4b 100644
--- a/xen/arch/arm/bootfdt.c
+++ b/xen/arch/arm/bootfdt.c
@@ -148,8 +148,15 @@ static int __init device_tree_get_meminfo(const void *fdt, int node,
     for ( i = 0; i < banks && mem->nr_banks < mem->max_banks; i++ )
     {
         device_tree_get_reg(&cell, address_cells, size_cells, &start, &size);
+        /*
+         * Some valid device trees, such as those generated by OpenPOWER
+         * skiboot firmware, expose all reserved memory regions in the
+         * FDT memory reservation block AND in the reserved-memory node which
+         * has already been parsed. Thus, any matching overlaps in the
+         * reserved_mem banks should be ignored.
+         */
         if ( mem == bootinfo_get_reserved_mem() &&
-             check_reserved_regions_overlap(start, size) )
+             check_reserved_regions_overlap(start, size, true) )
             return -EINVAL;
         /* Some DT may describe empty bank, ignore them */
         if ( !size )
diff --git a/xen/arch/arm/efi/efi-boot.h b/xen/arch/arm/efi/efi-boot.h
index 199f526022..a80a5a7ab3 100644
--- a/xen/arch/arm/efi/efi-boot.h
+++ b/xen/arch/arm/efi/efi-boot.h
@@ -167,13 +167,14 @@ static bool __init meminfo_add_bank(struct membanks *mem,
     if ( mem->nr_banks >= mem->max_banks )
         return false;
 #ifdef CONFIG_ACPI
-    if ( check_reserved_regions_overlap(start, size) )
+    if ( check_reserved_regions_overlap(start, size, false) )
         return false;
 #endif
 
     bank = &mem->bank[mem->nr_banks];
     bank->start = start;
     bank->size = size;
+    bank->type = MEMBANK_DEFAULT;
 
     mem->nr_banks++;
 
diff --git a/xen/arch/arm/include/asm/setup.h b/xen/arch/arm/include/asm/setup.h
index c34179da93..ea2e8503dc 100644
--- a/xen/arch/arm/include/asm/setup.h
+++ b/xen/arch/arm/include/asm/setup.h
@@ -49,6 +49,12 @@ enum membank_type {
     MEMBANK_FDT_RESVMEM,
 };
 
+enum region_type {
+    MEMORY,
+    RESERVED_MEMORY,
+    STATIC_SHARED_MEMORY
+};
+
 /* Indicates the maximum number of characters(\0 included) for shm_id */
 #define MAX_SHM_ID_LENGTH 16
 
@@ -72,6 +78,7 @@ struct membanks {
     __struct_group(membanks_hdr, common, ,
         unsigned int nr_banks;
         unsigned int max_banks;
+        enum region_type type;
     );
     struct membank bank[];
 };
@@ -137,13 +144,17 @@ struct bootinfo {
 };
 
 #ifdef CONFIG_ACPI
-#define BOOTINFO_ACPI_INIT .acpi.common.max_banks = NR_MEM_BANKS,
+#define BOOTINFO_ACPI_INIT                          \
+    .acpi.common.max_banks = NR_MEM_BANKS,          \
+    .acpi.common.type = MEMORY,
 #else
 #define BOOTINFO_ACPI_INIT
 #endif
 
 #ifdef CONFIG_STATIC_SHM
-#define BOOTINFO_SHMEM_INIT .shmem.common.max_banks = NR_SHMEM_BANKS,
+#define BOOTINFO_SHMEM_INIT                         \
+    .shmem.common.max_banks = NR_SHMEM_BANKS,       \
+    .shmem.common.type = STATIC_SHARED_MEMORY,
 #else
 #define BOOTINFO_SHMEM_INIT
 #endif
@@ -151,7 +162,9 @@ struct bootinfo {
 #define BOOTINFO_INIT                               \
 {                                                   \
     .mem.common.max_banks = NR_MEM_BANKS,           \
+    .mem.common.type = MEMORY,                      \
     .reserved_mem.common.max_banks = NR_MEM_BANKS,  \
+    .reserved_mem.common.type = RESERVED_MEMORY,    \
     BOOTINFO_ACPI_INIT                              \
     BOOTINFO_SHMEM_INIT                             \
 }
@@ -223,7 +236,8 @@ void fw_unreserved_regions(paddr_t s, paddr_t e,
 size_t boot_fdt_info(const void *fdt, paddr_t paddr);
 const char *boot_fdt_cmdline(const void *fdt);
 
-bool check_reserved_regions_overlap(paddr_t region_start, paddr_t region_size);
+bool check_reserved_regions_overlap(paddr_t region_start, paddr_t region_size,
+                                    bool allow_memreserve_overlap);
 
 struct bootmodule *add_boot_module(bootmodule_kind kind,
                                    paddr_t start, paddr_t size, bool domU);
diff --git a/xen/arch/arm/setup.c b/xen/arch/arm/setup.c
index 0c2fdaceaf..d0533cb715 100644
--- a/xen/arch/arm/setup.c
+++ b/xen/arch/arm/setup.c
@@ -268,7 +268,8 @@ static void __init dt_unreserved_regions(paddr_t s, paddr_t e,
  */
 static bool __init meminfo_overlap_check(const struct membanks *mem,
                                          paddr_t region_start,
-                                         paddr_t region_size)
+                                         paddr_t region_size,
+                                         bool allow_memreserve_overlap)
 {
     paddr_t bank_start = INVALID_PADDR, bank_end = 0;
     paddr_t region_end = region_start + region_size;
@@ -282,12 +283,23 @@ static bool __init meminfo_overlap_check(const struct membanks *mem,
         if ( INVALID_PADDR == bank_start || region_end <= bank_start ||
              region_start >= bank_end )
             continue;
-        else
-        {
-            printk("Region: [%#"PRIpaddr", %#"PRIpaddr") overlapping with bank[%u]: [%#"PRIpaddr", %#"PRIpaddr")\n",
-                   region_start, region_end, i, bank_start, bank_end);
-            return true;
-        }
+
+        /*
+         * If allow_memreserve_overlap is set, this check allows a region to be
+         * included in a MEMBANK_FDT_RESVMEM bank, but struct membanks *mem of
+         * type STATIC_SHARED_MEMORY don't set the bank[].type field because
+         * that is declared in a union with a field that is instead used,
+         * in any case this restriction is ok since STATIC_SHARED_MEMORY banks
+         * are not meant to clash with FDT /memreserve/ ranges.
+         */
+        if ( allow_memreserve_overlap && mem->type != STATIC_SHARED_MEMORY &&
+             region_start >= bank_start && region_end <= bank_end &&
+             mem->bank[i].type == MEMBANK_FDT_RESVMEM )
+            continue;
+
+        printk("Region: [%#"PRIpaddr", %#"PRIpaddr") overlapping with bank[%u]: [%#"PRIpaddr", %#"PRIpaddr")\n",
+                region_start, region_end, i, bank_start, bank_end);
+        return true;
     }
 
     return false;
@@ -340,7 +352,8 @@ void __init fw_unreserved_regions(paddr_t s, paddr_t e,
  * existing reserved memory regions, otherwise false.
  */
 bool __init check_reserved_regions_overlap(paddr_t region_start,
-                                           paddr_t region_size)
+                                           paddr_t region_size,
+                                           bool allow_memreserve_overlap)
 {
     const struct membanks *mem_banks[] = {
         bootinfo_get_reserved_mem(),
@@ -359,7 +372,8 @@ bool __init check_reserved_regions_overlap(paddr_t region_start,
      * shared memory banks (when static shared memory feature is enabled)
      */
     for ( i = 0; i < ARRAY_SIZE(mem_banks); i++ )
-        if ( meminfo_overlap_check(mem_banks[i], region_start, region_size) )
+        if ( meminfo_overlap_check(mem_banks[i], region_start, region_size,
+                                   allow_memreserve_overlap) )
             return true;
 
     /* Check if input region is overlapping with bootmodules */
@@ -385,7 +399,12 @@ struct bootmodule __init *add_boot_module(bootmodule_kind kind,
         return NULL;
     }
 
-    if ( check_reserved_regions_overlap(start, size) )
+    /*
+     * u-boot adds boot module such as ramdisk to the /memreserve/, since these
+     * ranges are saved in reserved_mem at this stage, allow an eventual exact
+     * match with MEMBANK_FDT_RESVMEM banks.
+     */
+    if ( check_reserved_regions_overlap(start, size, true) )
         return NULL;
 
     for ( i = 0 ; i < mods->nr_mods ; i++ )
diff --git a/xen/arch/arm/static-shmem.c b/xen/arch/arm/static-shmem.c
index aa80756c3c..66088a4267 100644
--- a/xen/arch/arm/static-shmem.c
+++ b/xen/arch/arm/static-shmem.c
@@ -696,7 +696,7 @@ int __init process_shm_node(const void *fdt, int node, uint32_t address_cells,
         if (i < mem->max_banks)
         {
             if ( (paddr != INVALID_PADDR) &&
-                 check_reserved_regions_overlap(paddr, size) )
+                 check_reserved_regions_overlap(paddr, size, false) )
                 return -EINVAL;
 
             /* Static shared memory shall be reserved from any other use. */
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.19


From xen-changelog-bounces@lists.xenproject.org Mon Dec 16 14:11:12 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 16 Dec 2024 14:11:12 +0000
Received: from list by lists.xenproject.org with outflank-mailman.858109.1270356 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tNBoW-0008U1-Eo; Mon, 16 Dec 2024 14:11:12 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 858109.1270356; Mon, 16 Dec 2024 14:11:12 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tNBoW-0008Tt-CF; Mon, 16 Dec 2024 14:11:12 +0000
Received: by outflank-mailman (input) for mailman id 858109;
 Mon, 16 Dec 2024 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 1tNBoW-0008Tk-2P
 for xen-changelog@lists.xenproject.org; Mon, 16 Dec 2024 14:11:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1tNBoV-006Lzp-2P
 for xen-changelog@lists.xenproject.org;
 Mon, 16 Dec 2024 14:11:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1tNBoV-00AYAt-3C
 for xen-changelog@lists.xenproject.org;
 Mon, 16 Dec 2024 14: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>
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.19] update Xen version to 4.19.2-pre
Message-Id: <E1tNBoV-00AYAt-3C@xenbits.xenproject.org>
Date: Mon, 16 Dec 2024 14:11:11 +0000

commit 5d61bc05850c05a32c2b4192adc1d33bcc19d1f7
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Mon Dec 16 13:31:51 2024 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Dec 16 13:31:51 2024 +0100

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

diff --git a/xen/Makefile b/xen/Makefile
index 0a942894dd..968971694c 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    = 19
-export XEN_EXTRAVERSION ?= .1$(XEN_VENDORVERSION)
+export XEN_EXTRAVERSION ?= .2-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.19


From xen-changelog-bounces@lists.xenproject.org Mon Dec 16 14:11:23 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 16 Dec 2024 14:11:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.858110.1270361 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tNBoh-0000Cw-GR; Mon, 16 Dec 2024 14:11:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 858110.1270361; Mon, 16 Dec 2024 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 1tNBoh-0000Cm-Dk; Mon, 16 Dec 2024 14:11:23 +0000
Received: by outflank-mailman (input) for mailman id 858110;
 Mon, 16 Dec 2024 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 1tNBog-0000Cc-6k
 for xen-changelog@lists.xenproject.org; Mon, 16 Dec 2024 14:11:22 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1tNBof-006Lzx-2l
 for xen-changelog@lists.xenproject.org;
 Mon, 16 Dec 2024 14:11:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1tNBog-00AYCS-0L
 for xen-changelog@lists.xenproject.org;
 Mon, 16 Dec 2024 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>
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.19] x86emul: MOVBE requires a memory operand
Message-Id: <E1tNBog-00AYCS-0L@xenbits.xenproject.org>
Date: Mon, 16 Dec 2024 14:11:22 +0000

commit 3a9e5a93e6ed5300f25612963c0fe521156951a1
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Mon Dec 16 13:32:19 2024 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Dec 16 13:32:19 2024 +0100

    x86emul: MOVBE requires a memory operand
    
    The reg-reg forms should cause #UD; they come into existence only with
    APX, where MOVBE also extends BSWAP (for the latter not being "eligible"
    to a REX2 prefix).
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
    master commit: 4c5d9a01f8fa81417a9c431e9624fb71361ec4f9
    master date: 2024-12-02 09:50:14 +0100
---
 xen/arch/x86/x86_emulate/x86_emulate.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/xen/arch/x86/x86_emulate/x86_emulate.c b/xen/arch/x86/x86_emulate/x86_emulate.c
index 905c6abf42..09ab75d035 100644
--- a/xen/arch/x86/x86_emulate/x86_emulate.c
+++ b/xen/arch/x86/x86_emulate/x86_emulate.c
@@ -6944,6 +6944,7 @@ x86_emulate(
 
     case X86EMUL_OPC(0x0f38, 0xf0): /* movbe m,r */
     case X86EMUL_OPC(0x0f38, 0xf1): /* movbe r,m */
+        generate_exception_if(ea.type != OP_MEM, X86_EXC_UD);
         vcpu_must_have(movbe);
         switch ( op_bytes )
         {
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.19


From xen-changelog-bounces@lists.xenproject.org Mon Dec 16 14:11:33 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 16 Dec 2024 14:11:33 +0000
Received: from list by lists.xenproject.org with outflank-mailman.858113.1270364 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tNBor-0000G1-Hh; Mon, 16 Dec 2024 14:11:33 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 858113.1270364; Mon, 16 Dec 2024 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 1tNBor-0000Ft-F9; Mon, 16 Dec 2024 14:11:33 +0000
Received: by outflank-mailman (input) for mailman id 858113;
 Mon, 16 Dec 2024 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 1tNBoq-0000Fb-9Q
 for xen-changelog@lists.xenproject.org; Mon, 16 Dec 2024 14:11:32 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1tNBop-006M0N-36
 for xen-changelog@lists.xenproject.org;
 Mon, 16 Dec 2024 14:11:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1tNBoq-00AYDu-0g
 for xen-changelog@lists.xenproject.org;
 Mon, 16 Dec 2024 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>
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.19] xen/Kconfig: livepatch-build-tools requires debug information
Message-Id: <E1tNBoq-00AYDu-0g@xenbits.xenproject.org>
Date: Mon, 16 Dec 2024 14:11:32 +0000

commit 475511a467e8296f7d11f35cb4b5838c2b465937
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Mon Dec 16 13:32:43 2024 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Dec 16 13:32:43 2024 +0100

    xen/Kconfig: livepatch-build-tools requires debug information
    
    The tools infrastructure used to build livepatches for Xen
    (livepatch-build-tools) consumes some DWARF debug information present in
    xen-syms to generate a livepatch (see livepatch-build script usage of readelf
    -wi).
    
    The current Kconfig defaults however will enable LIVEPATCH without DEBUG_INFO
    on release builds, thus providing a default Kconfig selection that's not
    suitable for livepatch-build-tools even when LIVEPATCH support is enabled,
    because it's missing the DWARF debug section.
    
    Fix by defaulting DEBUG_INFO to enabled when LIVEPATCH is.
    
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 126b0a6e537ce1d486a29e35cfeec1f222a74d11
    master date: 2024-12-02 15:22:05 +0100
---
 xen/Kconfig.debug | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/Kconfig.debug b/xen/Kconfig.debug
index 78b5a7c603..778db6f4e9 100644
--- a/xen/Kconfig.debug
+++ b/xen/Kconfig.debug
@@ -133,7 +133,7 @@ endif # DEBUG || EXPERT
 
 config DEBUG_INFO
 	bool "Compile Xen with debug info"
-	default DEBUG
+	default DEBUG || LIVEPATCH
 	help
 	  Say Y here if you want to build Xen with debug information. This
 	  information is needed e.g. for doing crash dump analysis of the
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.19


From xen-changelog-bounces@lists.xenproject.org Mon Dec 16 14:11:43 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 16 Dec 2024 14:11:43 +0000
Received: from list by lists.xenproject.org with outflank-mailman.858114.1270369 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tNBp1-0000Im-JA; Mon, 16 Dec 2024 14:11:43 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 858114.1270369; Mon, 16 Dec 2024 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 1tNBp1-0000Ie-GY; Mon, 16 Dec 2024 14:11:43 +0000
Received: by outflank-mailman (input) for mailman id 858114;
 Mon, 16 Dec 2024 14: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 1tNBp0-0000IW-DT
 for xen-changelog@lists.xenproject.org; Mon, 16 Dec 2024 14:11:42 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1tNBp0-006M0R-0H
 for xen-changelog@lists.xenproject.org;
 Mon, 16 Dec 2024 14:11:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1tNBp0-00AYEu-11
 for xen-changelog@lists.xenproject.org;
 Mon, 16 Dec 2024 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>
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.19] libs/guest: Fix migration compatibility with a security-patched Xen 4.13
Message-Id: <E1tNBp0-00AYEu-11@xenbits.xenproject.org>
Date: Mon, 16 Dec 2024 14:11:42 +0000

commit 60573721c5f85d79d1ed04de6534248e504df0da
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Mon Dec 16 13:33:07 2024 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Dec 16 13:33:07 2024 +0100

    libs/guest: Fix migration compatibility with a security-patched Xen 4.13
    
    xc_cpuid_apply_policy() provides compatibility for migration of a pre-4.14 VM
    where no CPUID data was provided in the stream.
    
    It guesses the various max-leaf limits, based on what was true at the time of
    writing, but this was not correctly adapted when speculative security issues
    forced the advertisement of new feature bits.  Of note are:
    
     * LFENCE-DISPATCH, in leaf 0x80000021.eax
     * BHI-CTRL, in leaf 0x7[2].edx
    
    In both cases, a VM booted on a security-patched Xen 4.13, and then migrated
    on to any newer version of Xen on the same or compatible hardware would have
    these features stripped back because Xen is still editing the cpu-policy for
    sanity behind the back of the toolstack.
    
    For VMs using BHI_DIS_S to mitigate Native-BHI, this resulted in a failure to
    restore the guests MSR_SPEC_CTRL setting:
    
      (XEN) HVM d7v0 load MSR 0x48 with value 0x401 failed
      (XEN) HVM7 restore: failed to load entry 20/0 rc -6
    
    Fixes: e9b4fe263649 ("x86/cpuid: support LFENCE always serialising CPUID bit")
    Fixes: f3709b15fc86 ("x86/cpuid: Infrastructure for cpuid word 7:2.edx")
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 28301682f492c1df2ff9c3e01a0aab6262bd925a
    master date: 2024-12-03 12:20:41 +0000
---
 tools/libs/guest/xg_cpuid_x86.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/tools/libs/guest/xg_cpuid_x86.c b/tools/libs/guest/xg_cpuid_x86.c
index 4453178100..263a9d4787 100644
--- a/tools/libs/guest/xg_cpuid_x86.c
+++ b/tools/libs/guest/xg_cpuid_x86.c
@@ -640,7 +640,8 @@ int xc_cpuid_apply_policy(xc_interface *xch, uint32_t domid, bool restore,
          *
          * This restore path is used for incoming VMs with no CPUID data
          * i.e. originated on Xen 4.13 or earlier.  We must invent a policy
-         * compatible with what Xen 4.13 would have done on the same hardware.
+         * compatible with what a security-patched Xen 4.13 would have done on
+         * the same hardware.
          *
          * Specifically:
          * - Clamp max leaves.
@@ -657,8 +658,8 @@ int xc_cpuid_apply_policy(xc_interface *xch, uint32_t domid, bool restore,
         }
 
         p->policy.basic.max_leaf = min(p->policy.basic.max_leaf, 0xdu);
-        p->policy.feat.max_subleaf = 0;
-        p->policy.extd.max_leaf = min(p->policy.extd.max_leaf, 0x8000001c);
+        p->policy.feat.max_subleaf = min(p->policy.feat.max_subleaf, 0x2u);
+        p->policy.extd.max_leaf = min(p->policy.extd.max_leaf, 0x80000021);
     }
 
     if ( featureset )
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.19


From xen-changelog-bounces@lists.xenproject.org Mon Dec 16 14:11:53 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 16 Dec 2024 14:11:53 +0000
Received: from list by lists.xenproject.org with outflank-mailman.858115.1270373 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tNBpB-0000Lx-Lx; Mon, 16 Dec 2024 14:11:53 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 858115.1270373; Mon, 16 Dec 2024 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 1tNBpB-0000Lp-JO; Mon, 16 Dec 2024 14:11:53 +0000
Received: by outflank-mailman (input) for mailman id 858115;
 Mon, 16 Dec 2024 14:11: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 1tNBpA-0000Lb-G4
 for xen-changelog@lists.xenproject.org; Mon, 16 Dec 2024 14:11:52 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1tNBpA-006M0W-0Y
 for xen-changelog@lists.xenproject.org;
 Mon, 16 Dec 2024 14:11:52 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1tNBpA-00AYIO-1Q
 for xen-changelog@lists.xenproject.org;
 Mon, 16 Dec 2024 14:11:52 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.19] tools/ocaml: Specify rpath correctly for ocamlmklib
Message-Id: <E1tNBpA-00AYIO-1Q@xenbits.xenproject.org>
Date: Mon, 16 Dec 2024 14:11:52 +0000

commit fbe3ec72dc0d6ecf4007fdb6eff821cc7570e9ca
Author:     Andrii Sultanov <andrii.sultanov@cloud.com>
AuthorDate: Mon Dec 16 13:33:17 2024 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Dec 16 13:33:17 2024 +0100

    tools/ocaml: Specify rpath correctly for ocamlmklib
    
    ocamlmklib has special handling for C-like '-Wl,-rpath' option, but does
    not know how to handle '-Wl,-rpath-link', as evidenced by warnings like:
    "Unknown option
    -Wl,-rpath-link=$HOME/xen/tools/ocaml/libs/eventchn/../../../../tools/libs/toollog"
    Pass this option directly to the compiler with -ccopt instead.
    
    Also pass -L directly to the linker with -ldopt. This prevents embedding absolute
    paths from buildtime into binary's RPATH.
    
    Fixes: f7b4e4558b42 ("tools/ocaml: Fix OCaml libs rules")
    Reported-by: Fernando Rodrigues <alpha@sigmasquadron.net>
    Tested-by: Fernando Rodrigues <alpha@sigmasquadron.net>
    Signed-off-by: Andrii Sultanov <andrii.sultanov@cloud.com>
    Acked-by: Christian Lindig <christian.lindig@cloud.com>
    master commit: bf8a209915804088c09ac6575bcca554450fa7e8
    master date: 2024-12-11 10:45:08 +0000
---
 tools/ocaml/Makefile.rules | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/ocaml/Makefile.rules b/tools/ocaml/Makefile.rules
index 5638193edf..678bbc046f 100644
--- a/tools/ocaml/Makefile.rules
+++ b/tools/ocaml/Makefile.rules
@@ -61,7 +61,7 @@ mk-caml-lib-bytecode = $(call quiet-command, $(OCAMLC) $(OCAMLCFLAGS) -a -o $1 $
 
 mk-caml-stubs = $(call quiet-command, $(OCAMLMKLIB) -o `basename $1 .a` $2,MKLIB,$1)
 mk-caml-lib-stubs = \
-	$(call quiet-command, $(OCAMLMKLIB) -o `basename $1 .a | sed -e 's/^lib//'` $2 $3,MKLIB,$1)
+	$(call quiet-command, $(OCAMLMKLIB) -o `basename $1 .a | sed -e 's/^lib//'` $2 `echo $3 | sed -e 's/-ccopt -l/-l/g' | sed -e 's/-ccopt -L/-ldopt -L/g'`,MKLIB,$1)
 
 # define a library target <name>.cmxa and <name>.cma
 define OCAML_LIBRARY_template
@@ -72,7 +72,7 @@ define OCAML_LIBRARY_template
  $(1)_stubs.a: $(foreach obj,$$($(1)_C_OBJS),$(obj).o)
 	$(call mk-caml-stubs,$$@, $$+)
  lib$(1)_stubs.a: $(foreach obj,$($(1)_C_OBJS),$(obj).o)
-	$(call mk-caml-lib-stubs,$$@, $$+, $(foreach lib,$(LIBS_$(1)),$(lib)))
+	$(call mk-caml-lib-stubs,$$@, $$+, $(foreach lib,$(LIBS_$(1)),-ccopt $(lib)))
 endef
 
 define OCAML_NOC_LIBRARY_template
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.19


From xen-changelog-bounces@lists.xenproject.org Mon Dec 16 16:44:15 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 16 Dec 2024 16:44:15 +0000
Received: from list by lists.xenproject.org with outflank-mailman.858384.1270602 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tNECW-00022W-OO; Mon, 16 Dec 2024 16:44:08 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 858384.1270602; Mon, 16 Dec 2024 16:44:08 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tNECW-00022O-LO; Mon, 16 Dec 2024 16:44:08 +0000
Received: by outflank-mailman (input) for mailman id 858384;
 Mon, 16 Dec 2024 16:44:08 +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 1tNECW-00022I-4F
 for xen-changelog@lists.xenproject.org; Mon, 16 Dec 2024 16:44:08 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1tNECV-006PkC-2G
 for xen-changelog@lists.xenproject.org;
 Mon, 16 Dec 2024 16:44:08 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1tNECV-00AzOC-2s
 for xen-changelog@lists.xenproject.org;
 Mon, 16 Dec 2024 16:44:07 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] tools/misc: Drop xensymoops
Message-Id: <E1tNECV-00AzOC-2s@xenbits.xenproject.org>
Date: Mon, 16 Dec 2024 16:44:07 +0000

commit 2e955d25544c86667d7ddecb0a0827749a2d7455
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Mon Dec 16 11:56:03 2024 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Mon Dec 16 16:33:42 2024 +0000

    tools/misc: Drop xensymoops
    
    This script is not referenced by the build system, and has escaped all Python
    compatibility work; it's still using print statements.
    
    Also, the regex it uses ties it to a 32bit build of Xen, which was dropped in
    Xen 4.3, 11 years ago.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 tools/misc/xensymoops | 118 --------------------------------------------------
 1 file changed, 118 deletions(-)

diff --git a/tools/misc/xensymoops b/tools/misc/xensymoops
deleted file mode 100755
index 835d187e90..0000000000
--- a/tools/misc/xensymoops
+++ /dev/null
@@ -1,118 +0,0 @@
-#!/usr/bin/env python
-
-# An oops analyser for Xen
-# Usage: xensymoops path-to-xen.s < oops-message
-
-# There's probably some more features that could go in here but this
-# is sufficient to analyse most errors in my code ;-)
-
-# by Mark Williamson (C) 2004 Intel Research Cambridge
-
-import re, sys
-
-def read_oops():
-    """Process an oops message on stdin and return (eip_addr, stack_addrs)
-
-    eip_addr is the location of EIP at the point of the crash.
-    stack_addrs is a dictionary mapping potential code addresses in the stack
-      to their order in the stack trace.
-    """
-    stackaddr_ptn = "\[([a-z,0-9]*)\]"
-    stackaddr_re  = re.compile(stackaddr_ptn)
-
-    eip_ptn = ".*EIP:.*<([a-z,0-9]*)>.*"
-    eip_re  = re.compile(eip_ptn)
-
-    matches = 0
-    stack_addresses = {}
-    eip_addr = "Not known"
-
-    while True:
-        line = sys.stdin.readline()
-        if not line: break
-
-        m = eip_re.match(line)
-        if m: eip_addr = m.group(1)
-        
-        m = stackaddr_re.findall(line)
-    
-        for i in m:
-            stack_addresses[i] = matches
-            matches += 1
-
-    return (eip_addr, stack_addresses)
-
-def usage():
-    print >> sys.stderr, """Usage: %s path-to-asm < oops-msg
-    The oops message should be fed to the standard input.  The
-    command-line argument specifies the path to the Xen assembly dump
-    produced by \"make debug\".  The location of EIP and the backtrace
-    will be output to standard output.
-    """ % sys.argv[0]
-    sys.exit()
-
-##### main
-
-if len(sys.argv) != 2:
-    usage()
-
-# get address of EIP and the potential code addresses from the stack
-(eip_addr, stk_addrs) = read_oops()
-
-# open Xen disassembly
-asm_file = open(sys.argv[1])
-
-# regexp to match addresses of code lines in the objdump
-addr_ptn = "([a-z,0-9]*):"
-addr_re  = re.compile(addr_ptn)
-
-# regexp to match the start of functions in the objdump
-func_ptn = "(.*<[\S]*>):"
-func_re  = re.compile(func_ptn)
-
-func = "<No function>" # holds the name of the current function being scanned
-
-eip_func = "<No function>" # name of the function EIP was in
-
-# list of (position in original backtrace, code address, function) tuples
-# describing all the potential code addresses we identified in the backtrace
-# whose addresses we also located in the objdump output
-backtrace = []
-
-while True:
-    line = asm_file.readline()
-    if not line: break
-
-    # if we've read the start of the function, record the name and address
-    fm = func_re.match(line)
-    if fm:
-        func = fm.group(1)
-        continue
-
-    # try match the address at the start of the line
-    m = addr_re.match(line)
-    if not m: continue
-
-    # we're on a code line...
-
-    address = m.group(1)
-
-    # if this address was seen as a potential code address in the backtrace then
-    # record it in the backtrace list
-    if stk_addrs.has_key(address):
-        backtrace.append((stk_addrs[address], address, func))
-
-    # if this was the address that EIP...
-    if address == eip_addr:
-        eip_func = func
-
-
-print "EIP %s in function %s" % (eip_addr, eip_func)
-print "Backtrace:"
-
-# sorting will order primarily by the first element of each tuple,
-# i.e. the order in the original oops
-backtrace.sort()
-
-for (i, a, f) in backtrace:
-    print "%s in function %s" % ( a, f )
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Dec 16 18:11:09 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 16 Dec 2024 18:11:09 +0000
Received: from list by lists.xenproject.org with outflank-mailman.858436.1270656 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tNFYc-0006xo-Gg; Mon, 16 Dec 2024 18:11:02 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 858436.1270656; Mon, 16 Dec 2024 18:11:02 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tNFYc-0006xg-Dw; Mon, 16 Dec 2024 18:11:02 +0000
Received: by outflank-mailman (input) for mailman id 858436;
 Mon, 16 Dec 2024 18: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 1tNFYb-0006xY-V2
 for xen-changelog@lists.xenproject.org; Mon, 16 Dec 2024 18:11:01 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1tNFYb-006Rkq-1X
 for xen-changelog@lists.xenproject.org;
 Mon, 16 Dec 2024 18:11:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1tNFYb-00BKTw-26
 for xen-changelog@lists.xenproject.org;
 Mon, 16 Dec 2024 18: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>
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools/misc: Drop xensymoops
Message-Id: <E1tNFYb-00BKTw-26@xenbits.xenproject.org>
Date: Mon, 16 Dec 2024 18:11:01 +0000

commit 2e955d25544c86667d7ddecb0a0827749a2d7455
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Mon Dec 16 11:56:03 2024 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Mon Dec 16 16:33:42 2024 +0000

    tools/misc: Drop xensymoops
    
    This script is not referenced by the build system, and has escaped all Python
    compatibility work; it's still using print statements.
    
    Also, the regex it uses ties it to a 32bit build of Xen, which was dropped in
    Xen 4.3, 11 years ago.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 tools/misc/xensymoops | 118 --------------------------------------------------
 1 file changed, 118 deletions(-)

diff --git a/tools/misc/xensymoops b/tools/misc/xensymoops
deleted file mode 100755
index 835d187e90..0000000000
--- a/tools/misc/xensymoops
+++ /dev/null
@@ -1,118 +0,0 @@
-#!/usr/bin/env python
-
-# An oops analyser for Xen
-# Usage: xensymoops path-to-xen.s < oops-message
-
-# There's probably some more features that could go in here but this
-# is sufficient to analyse most errors in my code ;-)
-
-# by Mark Williamson (C) 2004 Intel Research Cambridge
-
-import re, sys
-
-def read_oops():
-    """Process an oops message on stdin and return (eip_addr, stack_addrs)
-
-    eip_addr is the location of EIP at the point of the crash.
-    stack_addrs is a dictionary mapping potential code addresses in the stack
-      to their order in the stack trace.
-    """
-    stackaddr_ptn = "\[([a-z,0-9]*)\]"
-    stackaddr_re  = re.compile(stackaddr_ptn)
-
-    eip_ptn = ".*EIP:.*<([a-z,0-9]*)>.*"
-    eip_re  = re.compile(eip_ptn)
-
-    matches = 0
-    stack_addresses = {}
-    eip_addr = "Not known"
-
-    while True:
-        line = sys.stdin.readline()
-        if not line: break
-
-        m = eip_re.match(line)
-        if m: eip_addr = m.group(1)
-        
-        m = stackaddr_re.findall(line)
-    
-        for i in m:
-            stack_addresses[i] = matches
-            matches += 1
-
-    return (eip_addr, stack_addresses)
-
-def usage():
-    print >> sys.stderr, """Usage: %s path-to-asm < oops-msg
-    The oops message should be fed to the standard input.  The
-    command-line argument specifies the path to the Xen assembly dump
-    produced by \"make debug\".  The location of EIP and the backtrace
-    will be output to standard output.
-    """ % sys.argv[0]
-    sys.exit()
-
-##### main
-
-if len(sys.argv) != 2:
-    usage()
-
-# get address of EIP and the potential code addresses from the stack
-(eip_addr, stk_addrs) = read_oops()
-
-# open Xen disassembly
-asm_file = open(sys.argv[1])
-
-# regexp to match addresses of code lines in the objdump
-addr_ptn = "([a-z,0-9]*):"
-addr_re  = re.compile(addr_ptn)
-
-# regexp to match the start of functions in the objdump
-func_ptn = "(.*<[\S]*>):"
-func_re  = re.compile(func_ptn)
-
-func = "<No function>" # holds the name of the current function being scanned
-
-eip_func = "<No function>" # name of the function EIP was in
-
-# list of (position in original backtrace, code address, function) tuples
-# describing all the potential code addresses we identified in the backtrace
-# whose addresses we also located in the objdump output
-backtrace = []
-
-while True:
-    line = asm_file.readline()
-    if not line: break
-
-    # if we've read the start of the function, record the name and address
-    fm = func_re.match(line)
-    if fm:
-        func = fm.group(1)
-        continue
-
-    # try match the address at the start of the line
-    m = addr_re.match(line)
-    if not m: continue
-
-    # we're on a code line...
-
-    address = m.group(1)
-
-    # if this address was seen as a potential code address in the backtrace then
-    # record it in the backtrace list
-    if stk_addrs.has_key(address):
-        backtrace.append((stk_addrs[address], address, func))
-
-    # if this was the address that EIP...
-    if address == eip_addr:
-        eip_func = func
-
-
-print "EIP %s in function %s" % (eip_addr, eip_func)
-print "Backtrace:"
-
-# sorting will order primarily by the first element of each tuple,
-# i.e. the order in the original oops
-backtrace.sort()
-
-for (i, a, f) in backtrace:
-    print "%s in function %s" % ( a, f )
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Mon Dec 16 20:11:16 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 16 Dec 2024 20:11:16 +0000
Received: from list by lists.xenproject.org with outflank-mailman.858471.1270683 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tNHQs-00051P-0Y; Mon, 16 Dec 2024 20:11:10 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 858471.1270683; Mon, 16 Dec 2024 20:11:09 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tNHQr-00051H-U4; Mon, 16 Dec 2024 20:11:09 +0000
Received: by outflank-mailman (input) for mailman id 858471;
 Mon, 16 Dec 2024 20:11:08 +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 1tNHQq-000518-1v
 for xen-changelog@lists.xenproject.org; Mon, 16 Dec 2024 20:11:08 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1tNHQp-006URE-25
 for xen-changelog@lists.xenproject.org;
 Mon, 16 Dec 2024 20:11:07 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1tNHQp-00BgEu-2s
 for xen-changelog@lists.xenproject.org;
 Mon, 16 Dec 2024 20:11:07 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/arm: ffa: Rework firmware discovery
Message-Id: <E1tNHQp-00BgEu-2s@xenbits.xenproject.org>
Date: Mon, 16 Dec 2024 20:11:07 +0000

commit cf15d857072e4265dd7af57404ca14cc2225e9f7
Author:     Bertrand Marquis <bertrand.marquis@arm.com>
AuthorDate: Wed Nov 27 17:07:33 2024 +0100
Commit:     Julien Grall <julien@xen.org>
CommitDate: Mon Dec 16 21:00:25 2024 +0100

    xen/arm: ffa: Rework firmware discovery
    
    Rework firmware discovery during probe:
    - move prints into the probe
    - rename ffa_version to ffa_fw_version as the variable identifies the
      version of the firmware and not the one we support
    - add error prints when allocation fail during probe
    
    No functional changes.
    
    Signed-off-by: Bertrand Marquis <bertrand.marquis@arm.com>
    Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
---
 xen/arch/arm/tee/ffa.c      | 41 +++++++++++++++++++++++++----------------
 xen/arch/arm/tee/ffa_rxtx.c |  4 +---
 2 files changed, 26 insertions(+), 19 deletions(-)

diff --git a/xen/arch/arm/tee/ffa.c b/xen/arch/arm/tee/ffa.c
index 022089278e..5a7f297ca5 100644
--- a/xen/arch/arm/tee/ffa.c
+++ b/xen/arch/arm/tee/ffa.c
@@ -71,8 +71,8 @@
 
 #include "ffa_private.h"
 
-/* Negotiated FF-A version to use with the SPMC */
-static uint32_t __ro_after_init ffa_version;
+/* Negotiated FF-A version to use with the SPMC, 0 if not there or supported */
+static uint32_t __ro_after_init ffa_fw_version;
 
 
 /*
@@ -105,10 +105,7 @@ static bool ffa_get_version(uint32_t *vers)
 
     arm_smccc_1_2_smc(&arg, &resp);
     if ( resp.a0 == FFA_RET_NOT_SUPPORTED )
-    {
-        gprintk(XENLOG_ERR, "ffa: FFA_VERSION returned not supported\n");
         return false;
-    }
 
     *vers = resp.a0;
 
@@ -372,7 +369,7 @@ static int ffa_domain_init(struct domain *d)
     struct ffa_ctx *ctx;
     int ret;
 
-    if ( !ffa_version )
+    if ( !ffa_fw_version )
         return -ENODEV;
      /*
       * We can't use that last possible domain ID or ffa_get_vm_id() would
@@ -505,6 +502,9 @@ static bool ffa_probe(void)
      */
     BUILD_BUG_ON(PAGE_SIZE != FFA_PAGE_SIZE);
 
+    printk(XENLOG_INFO "ARM FF-A Mediator version %u.%u\n",
+           FFA_MY_VERSION_MAJOR, FFA_MY_VERSION_MINOR);
+
     /*
      * psci_init_smccc() updates this value with what's reported by EL-3
      * or secure world.
@@ -514,22 +514,23 @@ static bool ffa_probe(void)
         printk(XENLOG_ERR
                "ffa: unsupported SMCCC version %#x (need at least %#x)\n",
                smccc_ver, ARM_SMCCC_VERSION_1_2);
-        return false;
+        goto err_no_fw;
     }
 
     if ( !ffa_get_version(&vers) )
-        return false;
+    {
+        gprintk(XENLOG_ERR, "Cannot retrieve the FFA version\n");
+        goto err_no_fw;
+    }
 
     if ( vers < FFA_MIN_SPMC_VERSION || vers > FFA_MY_VERSION )
     {
         printk(XENLOG_ERR "ffa: Incompatible version %#x found\n", vers);
-        return false;
+        goto err_no_fw;
     }
 
     major_vers = (vers >> FFA_VERSION_MAJOR_SHIFT) & FFA_VERSION_MAJOR_MASK;
     minor_vers = vers & FFA_VERSION_MINOR_MASK;
-    printk(XENLOG_INFO "ARM FF-A Mediator version %u.%u\n",
-           FFA_MY_VERSION_MAJOR, FFA_MY_VERSION_MINOR);
     printk(XENLOG_INFO "ARM FF-A Firmware version %u.%u\n",
            major_vers, minor_vers);
 
@@ -546,12 +547,18 @@ static bool ffa_probe(void)
          !check_mandatory_feature(FFA_MEM_SHARE_32) ||
          !check_mandatory_feature(FFA_MEM_RECLAIM) ||
          !check_mandatory_feature(FFA_MSG_SEND_DIRECT_REQ_32) )
-        return false;
+    {
+        printk(XENLOG_ERR "ffa: Mandatory feature not supported by fw\n");
+        goto err_no_fw;
+    }
 
-    if ( !ffa_rxtx_init() )
-        return false;
+    ffa_fw_version = vers;
 
-    ffa_version = vers;
+    if ( !ffa_rxtx_init() )
+    {
+        printk(XENLOG_ERR "ffa: Error during RXTX buffer init\n");
+        goto err_no_fw;
+    }
 
     if ( !ffa_partinfo_init() )
         goto err_rxtx_destroy;
@@ -564,7 +571,9 @@ static bool ffa_probe(void)
 
 err_rxtx_destroy:
     ffa_rxtx_destroy();
-    ffa_version = 0;
+err_no_fw:
+    ffa_fw_version = 0;
+    printk(XENLOG_WARNING "ARM FF-A No firmware support\n");
 
     return false;
 }
diff --git a/xen/arch/arm/tee/ffa_rxtx.c b/xen/arch/arm/tee/ffa_rxtx.c
index 661764052e..c8bc516a19 100644
--- a/xen/arch/arm/tee/ffa_rxtx.c
+++ b/xen/arch/arm/tee/ffa_rxtx.c
@@ -203,10 +203,8 @@ bool ffa_rxtx_init(void)
 
     e = ffa_rxtx_map(__pa(ffa_tx), __pa(ffa_rx), FFA_RXTX_PAGE_COUNT);
     if ( e )
-    {
-        printk(XENLOG_ERR "ffa: Failed to map rxtx: error %d\n", e);
         goto err;
-    }
+
     return true;
 
 err:
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Dec 16 20:11:20 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 16 Dec 2024 20:11:20 +0000
Received: from list by lists.xenproject.org with outflank-mailman.858472.1270686 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tNHR2-00053G-1f; Mon, 16 Dec 2024 20:11:20 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 858472.1270686; Mon, 16 Dec 2024 20:11:20 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tNHR1-000539-VV; Mon, 16 Dec 2024 20:11:19 +0000
Received: by outflank-mailman (input) for mailman id 858472;
 Mon, 16 Dec 2024 20:11:18 +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 1tNHR0-00052s-2g
 for xen-changelog@lists.xenproject.org; Mon, 16 Dec 2024 20:11:18 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1tNHQz-006URM-2R
 for xen-changelog@lists.xenproject.org;
 Mon, 16 Dec 2024 20:11:18 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1tNHR0-00BgFl-01
 for xen-changelog@lists.xenproject.org;
 Mon, 16 Dec 2024 20:11:18 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/arm: ffa: Rework feature discovery
Message-Id: <E1tNHR0-00BgFl-01@xenbits.xenproject.org>
Date: Mon, 16 Dec 2024 20:11:18 +0000

commit 1a20f862f365876f2b0f9e7c804d86dc1038b66b
Author:     Bertrand Marquis <bertrand.marquis@arm.com>
AuthorDate: Wed Nov 27 17:07:34 2024 +0100
Commit:     Julien Grall <julien@xen.org>
CommitDate: Mon Dec 16 21:00:25 2024 +0100

    xen/arm: ffa: Rework feature discovery
    
    Store the list of ABI we need in a list and go through the list instead
    of having a list of conditions inside the code.
    
    No functional change.
    
    Signed-off-by: Bertrand Marquis <bertrand.marquis@arm.com>
    Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
---
 xen/arch/arm/tee/ffa.c | 57 ++++++++++++++++++++++++++++++--------------------
 1 file changed, 34 insertions(+), 23 deletions(-)

diff --git a/xen/arch/arm/tee/ffa.c b/xen/arch/arm/tee/ffa.c
index 5a7f297ca5..ade6aaa6fd 100644
--- a/xen/arch/arm/tee/ffa.c
+++ b/xen/arch/arm/tee/ffa.c
@@ -74,6 +74,31 @@
 /* Negotiated FF-A version to use with the SPMC, 0 if not there or supported */
 static uint32_t __ro_after_init ffa_fw_version;
 
+struct ffa_fw_abi {
+    uint32_t id;
+    const char *name;
+};
+
+#define FW_ABI(abi) {abi,#abi}
+
+/* List of ABI we use from the firmware */
+static const struct ffa_fw_abi ffa_fw_abi_needed[] = {
+    FW_ABI(FFA_VERSION),
+    FW_ABI(FFA_FEATURES),
+    FW_ABI(FFA_NOTIFICATION_BITMAP_CREATE),
+    FW_ABI(FFA_NOTIFICATION_BITMAP_DESTROY),
+    FW_ABI(FFA_PARTITION_INFO_GET),
+    FW_ABI(FFA_NOTIFICATION_INFO_GET_64),
+    FW_ABI(FFA_NOTIFICATION_GET),
+    FW_ABI(FFA_RX_RELEASE),
+    FW_ABI(FFA_RXTX_MAP_64),
+    FW_ABI(FFA_RXTX_UNMAP),
+    FW_ABI(FFA_MEM_SHARE_32),
+    FW_ABI(FFA_MEM_SHARE_64),
+    FW_ABI(FFA_MEM_RECLAIM),
+    FW_ABI(FFA_MSG_SEND_DIRECT_REQ_32),
+    FW_ABI(FFA_MSG_SEND_DIRECT_REQ_64),
+};
 
 /*
  * Our rx/tx buffers shared with the SPMC. FFA_RXTX_PAGE_COUNT is the
@@ -112,20 +137,9 @@ static bool ffa_get_version(uint32_t *vers)
     return true;
 }
 
-static int32_t ffa_features(uint32_t id)
-{
-    return ffa_simple_call(FFA_FEATURES, id, 0, 0, 0);
-}
-
-static bool check_mandatory_feature(uint32_t id)
+static bool ffa_abi_supported(uint32_t id)
 {
-    int32_t ret = ffa_features(id);
-
-    if ( ret )
-        printk(XENLOG_ERR "ffa: mandatory feature id %#x missing: error %d\n",
-               id, ret);
-
-    return !ret;
+    return !ffa_simple_call(FFA_FEATURES, id, 0, 0, 0);
 }
 
 static void handle_version(struct cpu_user_regs *regs)
@@ -539,17 +553,14 @@ static bool ffa_probe(void)
      * TODO: Rework the code to allow domain to use a subset of the
      * features supported.
      */
-    if ( !check_mandatory_feature(FFA_PARTITION_INFO_GET) ||
-         !check_mandatory_feature(FFA_RX_RELEASE) ||
-         !check_mandatory_feature(FFA_RXTX_MAP_64) ||
-         !check_mandatory_feature(FFA_MEM_SHARE_64) ||
-         !check_mandatory_feature(FFA_RXTX_UNMAP) ||
-         !check_mandatory_feature(FFA_MEM_SHARE_32) ||
-         !check_mandatory_feature(FFA_MEM_RECLAIM) ||
-         !check_mandatory_feature(FFA_MSG_SEND_DIRECT_REQ_32) )
+    for ( unsigned int i = 0; i < ARRAY_SIZE(ffa_fw_abi_needed); i++ )
     {
-        printk(XENLOG_ERR "ffa: Mandatory feature not supported by fw\n");
-        goto err_no_fw;
+        if ( !ffa_abi_supported(ffa_fw_abi_needed[i].id) )
+        {
+            printk(XENLOG_INFO "ARM FF-A Firmware does not support %s\n",
+                   ffa_fw_abi_needed[i].name);
+            goto err_no_fw;
+        }
     }
 
     ffa_fw_version = vers;
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Dec 16 20:11:30 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 16 Dec 2024 20:11:30 +0000
Received: from list by lists.xenproject.org with outflank-mailman.858473.1270691 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tNHRC-000567-3q; Mon, 16 Dec 2024 20:11:30 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 858473.1270691; Mon, 16 Dec 2024 20:11:30 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tNHRC-00055z-0d; Mon, 16 Dec 2024 20:11:30 +0000
Received: by outflank-mailman (input) for mailman id 858473;
 Mon, 16 Dec 2024 20:11:28 +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 1tNHRA-00055f-6j
 for xen-changelog@lists.xenproject.org; Mon, 16 Dec 2024 20:11:28 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1tNHR9-006URX-2q
 for xen-changelog@lists.xenproject.org;
 Mon, 16 Dec 2024 20:11:28 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1tNHRA-00BgGg-0L
 for xen-changelog@lists.xenproject.org;
 Mon, 16 Dec 2024 20:11:28 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/arm: ffa: Fix version negotiation
Message-Id: <E1tNHRA-00BgGg-0L@xenbits.xenproject.org>
Date: Mon, 16 Dec 2024 20:11:28 +0000

commit da07df55580368ad696f39d58a8c100a37f6cd13
Author:     Bertrand Marquis <bertrand.marquis@arm.com>
AuthorDate: Wed Nov 27 17:07:35 2024 +0100
Commit:     Julien Grall <julien@xen.org>
CommitDate: Mon Dec 16 21:00:25 2024 +0100

    xen/arm: ffa: Fix version negotiation
    
    Fix FFA version negotiation with the firmware to follow the
    specification guidance more closely (see FF-A Specification Version 1.1
    in chapter 13.2.1).
    When the firmware returns OK we can have several cases:
    - the version requested is accepted but the firmware supports a greater
      one in the same major.
    - the firmware supports a greater major version. It could still return
      OK even if the version requested is not accepted. Reject it.
    - the firmware supports a lower version. It will return OK and give that
      version. Check if we support it and use it or reject it if we do not.
    
    Adapt the code to:
    - reject any version lower than the one we support or not with the same
      major version
    - use the version returned if in our supported range (currently 1.1
      only)
    - use 1.1 if the version returned is greater.
    
    Also adapt the handling of version requests from VM:
    - use our version if same major but greater minor is requested
    - use requested version if same major but lower minor is requested
    - do not use if incompatible major is requested
    - always return our version without error to the requester
    
    [1] https://developer.arm.com/documentation/den0077/e/
    
    Signed-off-by: Bertrand Marquis <bertrand.marquis@arm.com>
    Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
---
 xen/arch/arm/tee/ffa.c         | 53 +++++++++++++++++++++++++++++++-----------
 xen/arch/arm/tee/ffa_private.h |  3 +++
 2 files changed, 43 insertions(+), 13 deletions(-)

diff --git a/xen/arch/arm/tee/ffa.c b/xen/arch/arm/tee/ffa.c
index ade6aaa6fd..c5dcb4fe24 100644
--- a/xen/arch/arm/tee/ffa.c
+++ b/xen/arch/arm/tee/ffa.c
@@ -148,13 +148,20 @@ static void handle_version(struct cpu_user_regs *regs)
     struct ffa_ctx *ctx = d->arch.tee;
     uint32_t vers = get_user_reg(regs, 1);
 
-    if ( vers < FFA_VERSION_1_1 )
-        vers = FFA_VERSION_1_0;
-    else
-        vers = FFA_VERSION_1_1;
-
-    ctx->guest_vers = vers;
-    ffa_set_regs(regs, vers, 0, 0, 0, 0, 0, 0, 0);
+    /*
+     * Guest will use the version it requested if it is our major and minor
+     * lower or equals to ours. If the minor is greater, our version will be
+     * used.
+     * In any case return our version to the caller.
+     */
+    if ( FFA_VERSION_MAJOR(vers) == FFA_MY_VERSION_MAJOR )
+    {
+        if ( FFA_VERSION_MINOR(vers) > FFA_MY_VERSION_MINOR )
+            ctx->guest_vers = FFA_MY_VERSION;
+        else
+            ctx->guest_vers = vers;
+    }
+    ffa_set_regs(regs, FFA_MY_VERSION, 0, 0, 0, 0, 0, 0, 0);
 }
 
 static void handle_msg_send_direct_req(struct cpu_user_regs *regs, uint32_t fid)
@@ -537,17 +544,39 @@ static bool ffa_probe(void)
         goto err_no_fw;
     }
 
-    if ( vers < FFA_MIN_SPMC_VERSION || vers > FFA_MY_VERSION )
+    /* Some sanity check in case we update the version we support */
+    BUILD_BUG_ON(FFA_MIN_SPMC_VERSION > FFA_MY_VERSION);
+    BUILD_BUG_ON(FFA_VERSION_MAJOR(FFA_MIN_SPMC_VERSION) !=
+                                   FFA_MY_VERSION_MAJOR);
+
+    major_vers = FFA_VERSION_MAJOR(vers);
+    minor_vers = FFA_VERSION_MINOR(vers);
+
+    if ( major_vers != FFA_MY_VERSION_MAJOR ||
+         minor_vers < FFA_VERSION_MINOR(FFA_MIN_SPMC_VERSION) )
     {
-        printk(XENLOG_ERR "ffa: Incompatible version %#x found\n", vers);
+        printk(XENLOG_ERR "ffa: Incompatible firmware version %u.%u\n",
+               major_vers, minor_vers);
         goto err_no_fw;
     }
 
-    major_vers = (vers >> FFA_VERSION_MAJOR_SHIFT) & FFA_VERSION_MAJOR_MASK;
-    minor_vers = vers & FFA_VERSION_MINOR_MASK;
     printk(XENLOG_INFO "ARM FF-A Firmware version %u.%u\n",
            major_vers, minor_vers);
 
+    /*
+     * If the call succeed and the version returned is higher or equal to
+     * the one Xen requested, the version requested by Xen will be the one
+     * used. If the version returned is lower but compatible with Xen, Xen
+     * will use that version instead.
+     * A version with a different major or lower than the minimum version
+     * we support is rejected before.
+     * See https://developer.arm.com/documentation/den0077/e/ chapter 13.2.1
+     */
+    if ( minor_vers > FFA_MY_VERSION_MINOR )
+        ffa_fw_version = FFA_MY_VERSION;
+    else
+        ffa_fw_version = vers;
+
     /*
      * At the moment domains must support the same features used by Xen.
      * TODO: Rework the code to allow domain to use a subset of the
@@ -563,8 +592,6 @@ static bool ffa_probe(void)
         }
     }
 
-    ffa_fw_version = vers;
-
     if ( !ffa_rxtx_init() )
     {
         printk(XENLOG_ERR "ffa: Error during RXTX buffer init\n");
diff --git a/xen/arch/arm/tee/ffa_private.h b/xen/arch/arm/tee/ffa_private.h
index 7c6b06f686..045d9c4a0b 100644
--- a/xen/arch/arm/tee/ffa_private.h
+++ b/xen/arch/arm/tee/ffa_private.h
@@ -35,6 +35,9 @@
 #define MAKE_FFA_VERSION(major, minor)  \
         ((((major) & FFA_VERSION_MAJOR_MASK) << FFA_VERSION_MAJOR_SHIFT) | \
          ((minor) & FFA_VERSION_MINOR_MASK))
+#define FFA_VERSION_MAJOR(vers) (((vers) >> FFA_VERSION_MAJOR_SHIFT) & \
+                                 FFA_VERSION_MAJOR_MASK)
+#define FFA_VERSION_MINOR(vers) ((vers) & FFA_VERSION_MINOR_MASK)
 
 #define FFA_VERSION_1_0         MAKE_FFA_VERSION(1, 0)
 #define FFA_VERSION_1_1         MAKE_FFA_VERSION(1, 1)
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Dec 16 20:11:40 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 16 Dec 2024 20:11:40 +0000
Received: from list by lists.xenproject.org with outflank-mailman.858475.1270695 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tNHRM-00059i-6M; Mon, 16 Dec 2024 20:11:40 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 858475.1270695; Mon, 16 Dec 2024 20:11:40 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tNHRM-00059Z-3j; Mon, 16 Dec 2024 20:11:40 +0000
Received: by outflank-mailman (input) for mailman id 858475;
 Mon, 16 Dec 2024 20:11:38 +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 1tNHRK-00059G-CI
 for xen-changelog@lists.xenproject.org; Mon, 16 Dec 2024 20:11:38 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1tNHRK-006URr-0A
 for xen-changelog@lists.xenproject.org;
 Mon, 16 Dec 2024 20:11:38 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1tNHRK-00BgHh-0m
 for xen-changelog@lists.xenproject.org;
 Mon, 16 Dec 2024 20:11:38 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/arm: ffa: Fine granular call support
Message-Id: <E1tNHRK-00BgHh-0m@xenbits.xenproject.org>
Date: Mon, 16 Dec 2024 20:11:38 +0000

commit 2f9f240a5e875e75f7f69c589bbea7a210d9e2d6
Author:     Bertrand Marquis <bertrand.marquis@arm.com>
AuthorDate: Wed Nov 27 17:07:36 2024 +0100
Commit:     Julien Grall <julien@xen.org>
CommitDate: Mon Dec 16 21:01:11 2024 +0100

    xen/arm: ffa: Fine granular call support
    
    Create a bitmap to store which feature is supported or not by the
    firmware and use it to filter which calls are done to the firmware.
    
    While there reorder ABI definition by numbers to easily find the min and
    max ones.
    
    Signed-off-by: Bertrand Marquis <bertrand.marquis@arm.com>
    Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
---
 xen/arch/arm/tee/ffa.c          | 28 ++++++++++++++++++----------
 xen/arch/arm/tee/ffa_notif.c    |  7 +++++++
 xen/arch/arm/tee/ffa_partinfo.c | 30 +++++++++++++++++++++++++++++-
 xen/arch/arm/tee/ffa_private.h  | 38 +++++++++++++++++++++++++++++++++-----
 xen/arch/arm/tee/ffa_rxtx.c     |  4 ++++
 xen/arch/arm/tee/ffa_shm.c      | 12 ++++++++++++
 6 files changed, 103 insertions(+), 16 deletions(-)

diff --git a/xen/arch/arm/tee/ffa.c b/xen/arch/arm/tee/ffa.c
index c5dcb4fe24..1b0919041d 100644
--- a/xen/arch/arm/tee/ffa.c
+++ b/xen/arch/arm/tee/ffa.c
@@ -72,7 +72,10 @@
 #include "ffa_private.h"
 
 /* Negotiated FF-A version to use with the SPMC, 0 if not there or supported */
-static uint32_t __ro_after_init ffa_fw_version;
+uint32_t __ro_after_init ffa_fw_version;
+
+/* Features supported by the SPMC or secure world when present */
+DECLARE_BITMAP(ffa_fw_abi_supported, FFA_ABI_BITMAP_SIZE);
 
 struct ffa_fw_abi {
     uint32_t id;
@@ -177,6 +180,13 @@ static void handle_msg_send_direct_req(struct cpu_user_regs *regs, uint32_t fid)
     else
         mask = GENMASK_ULL(31, 0);
 
+    if ( !ffa_fw_supports_fid(fid) )
+    {
+        resp.a0 = FFA_ERROR;
+        resp.a2 = FFA_RET_NOT_SUPPORTED;
+        goto out;
+    }
+
     src_dst = get_user_reg(regs, 1);
     if ( (src_dst >> 16) != ffa_get_vm_id(d) )
     {
@@ -577,19 +587,16 @@ static bool ffa_probe(void)
     else
         ffa_fw_version = vers;
 
-    /*
-     * At the moment domains must support the same features used by Xen.
-     * TODO: Rework the code to allow domain to use a subset of the
-     * features supported.
-     */
     for ( unsigned int i = 0; i < ARRAY_SIZE(ffa_fw_abi_needed); i++ )
     {
-        if ( !ffa_abi_supported(ffa_fw_abi_needed[i].id) )
-        {
+        ASSERT(FFA_ABI_BITNUM(ffa_fw_abi_needed[i].id) < FFA_ABI_BITMAP_SIZE);
+
+        if ( ffa_abi_supported(ffa_fw_abi_needed[i].id) )
+            set_bit(FFA_ABI_BITNUM(ffa_fw_abi_needed[i].id),
+                    ffa_fw_abi_supported);
+        else
             printk(XENLOG_INFO "ARM FF-A Firmware does not support %s\n",
                    ffa_fw_abi_needed[i].name);
-            goto err_no_fw;
-        }
     }
 
     if ( !ffa_rxtx_init() )
@@ -611,6 +618,7 @@ err_rxtx_destroy:
     ffa_rxtx_destroy();
 err_no_fw:
     ffa_fw_version = 0;
+    bitmap_zero(ffa_fw_abi_supported, FFA_ABI_BITMAP_SIZE);
     printk(XENLOG_WARNING "ARM FF-A No firmware support\n");
 
     return false;
diff --git a/xen/arch/arm/tee/ffa_notif.c b/xen/arch/arm/tee/ffa_notif.c
index 541e61d2f6..4b3e46318f 100644
--- a/xen/arch/arm/tee/ffa_notif.c
+++ b/xen/arch/arm/tee/ffa_notif.c
@@ -377,6 +377,13 @@ void ffa_notif_init(void)
     unsigned int irq;
     int ret;
 
+    /* Only enable fw notification if all ABIs we need are supported */
+    if ( !(ffa_fw_supports_fid(FFA_NOTIFICATION_BITMAP_CREATE) &&
+           ffa_fw_supports_fid(FFA_NOTIFICATION_BITMAP_DESTROY) &&
+           ffa_fw_supports_fid(FFA_NOTIFICATION_GET) &&
+           ffa_fw_supports_fid(FFA_NOTIFICATION_INFO_GET_64)) )
+        return;
+
     arm_smccc_1_2_smc(&arg, &resp);
     if ( resp.a0 != FFA_SUCCESS_32 )
         return;
diff --git a/xen/arch/arm/tee/ffa_partinfo.c b/xen/arch/arm/tee/ffa_partinfo.c
index 93a03c6bc6..99c48f0e5c 100644
--- a/xen/arch/arm/tee/ffa_partinfo.c
+++ b/xen/arch/arm/tee/ffa_partinfo.c
@@ -77,7 +77,15 @@ int32_t ffa_handle_partition_info_get(uint32_t w1, uint32_t w2, uint32_t w3,
      */
     if ( w5 == FFA_PARTITION_INFO_GET_COUNT_FLAG &&
          ctx->guest_vers == FFA_VERSION_1_1 )
-        return ffa_partition_info_get(w1, w2, w3, w4, w5, count, fpi_size);
+    {
+        if ( ffa_fw_supports_fid(FFA_PARTITION_INFO_GET) )
+            return ffa_partition_info_get(w1, w2, w3, w4, w5, count, fpi_size);
+        else
+        {
+            *count = 0;
+            return FFA_RET_OK;
+        }
+    }
     if ( w5 )
         return FFA_RET_INVALID_PARAMETERS;
 
@@ -87,6 +95,18 @@ int32_t ffa_handle_partition_info_get(uint32_t w1, uint32_t w2, uint32_t w3,
     if ( !spin_trylock(&ctx->rx_lock) )
         return FFA_RET_BUSY;
 
+    if ( !ffa_fw_supports_fid(FFA_PARTITION_INFO_GET) )
+    {
+        if ( ctx->guest_vers == FFA_VERSION_1_0 )
+            *fpi_size = sizeof(struct ffa_partition_info_1_0);
+        else
+            *fpi_size = sizeof(struct ffa_partition_info_1_1);
+
+        *count = 0;
+        ret = FFA_RET_OK;
+        goto out;
+    }
+
     if ( !ctx->page_count || !ctx->rx_is_free )
         goto out;
     spin_lock(&ffa_rx_buffer_lock);
@@ -250,6 +270,11 @@ bool ffa_partinfo_init(void)
     uint32_t count;
     int e;
 
+    if ( !ffa_fw_supports_fid(FFA_PARTITION_INFO_GET) ||
+         !ffa_fw_supports_fid(FFA_MSG_SEND_DIRECT_REQ_32) ||
+         !ffa_rx || !ffa_tx )
+        return false;
+
     e = ffa_partition_info_get(0, 0, 0, 0, 0, &count, &fpi_size);
     if ( e )
     {
@@ -313,6 +338,9 @@ int ffa_partinfo_domain_init(struct domain *d)
     unsigned int n;
     int32_t res;
 
+    if ( !ffa_fw_supports_fid(FFA_MSG_SEND_DIRECT_REQ_32) )
+        return 0;
+
     ctx->vm_destroy_bitmap = xzalloc_array(unsigned long, count);
     if ( !ctx->vm_destroy_bitmap )
         return -ENOMEM;
diff --git a/xen/arch/arm/tee/ffa_private.h b/xen/arch/arm/tee/ffa_private.h
index 045d9c4a0b..85eb61c134 100644
--- a/xen/arch/arm/tee/ffa_private.h
+++ b/xen/arch/arm/tee/ffa_private.h
@@ -14,6 +14,7 @@
 #include <xen/spinlock.h>
 #include <xen/sched.h>
 #include <xen/time.h>
+#include <xen/bitmap.h>
 
 /* Error codes */
 #define FFA_RET_OK                      0
@@ -201,18 +202,17 @@
 #define FFA_INTERRUPT                   0x84000062U
 #define FFA_VERSION                     0x84000063U
 #define FFA_FEATURES                    0x84000064U
-#define FFA_RX_ACQUIRE                  0x84000084U
 #define FFA_RX_RELEASE                  0x84000065U
 #define FFA_RXTX_MAP_32                 0x84000066U
 #define FFA_RXTX_MAP_64                 0xC4000066U
 #define FFA_RXTX_UNMAP                  0x84000067U
 #define FFA_PARTITION_INFO_GET          0x84000068U
 #define FFA_ID_GET                      0x84000069U
-#define FFA_SPM_ID_GET                  0x84000085U
+#define FFA_MSG_POLL                    0x8400006AU
 #define FFA_MSG_WAIT                    0x8400006BU
 #define FFA_MSG_YIELD                   0x8400006CU
 #define FFA_RUN                         0x8400006DU
-#define FFA_MSG_SEND2                   0x84000086U
+#define FFA_MSG_SEND                    0x8400006EU
 #define FFA_MSG_SEND_DIRECT_REQ_32      0x8400006FU
 #define FFA_MSG_SEND_DIRECT_REQ_64      0xC400006FU
 #define FFA_MSG_SEND_DIRECT_RESP_32     0x84000070U
@@ -230,8 +230,6 @@
 #define FFA_MEM_RECLAIM                 0x84000077U
 #define FFA_MEM_FRAG_RX                 0x8400007AU
 #define FFA_MEM_FRAG_TX                 0x8400007BU
-#define FFA_MSG_SEND                    0x8400006EU
-#define FFA_MSG_POLL                    0x8400006AU
 #define FFA_NOTIFICATION_BITMAP_CREATE  0x8400007DU
 #define FFA_NOTIFICATION_BITMAP_DESTROY 0x8400007EU
 #define FFA_NOTIFICATION_BIND           0x8400007FU
@@ -240,6 +238,25 @@
 #define FFA_NOTIFICATION_GET            0x84000082U
 #define FFA_NOTIFICATION_INFO_GET_32    0x84000083U
 #define FFA_NOTIFICATION_INFO_GET_64    0xC4000083U
+#define FFA_RX_ACQUIRE                  0x84000084U
+#define FFA_SPM_ID_GET                  0x84000085U
+#define FFA_MSG_SEND2                   0x84000086U
+
+/**
+ * Encoding of features supported or not by the fw in a bitmap:
+ * - Function IDs are going from 0x60 to 0xFF
+ * - A function can be supported in 32 and/or 64bit
+ * The bitmap has one bit for each function in 32 and 64 bit.
+ */
+#define FFA_ABI_ID(id)        ((id) & ARM_SMCCC_FUNC_MASK)
+#define FFA_ABI_CONV(id)      (((id) >> ARM_SMCCC_CONV_SHIFT) & BIT(0,U))
+
+#define FFA_ABI_MIN           FFA_ABI_ID(FFA_ERROR)
+#define FFA_ABI_MAX           FFA_ABI_ID(FFA_MSG_SEND2)
+
+#define FFA_ABI_BITMAP_SIZE   (2 * (FFA_ABI_MAX - FFA_ABI_MIN + 1))
+#define FFA_ABI_BITNUM(id)    ((FFA_ABI_ID(id) - FFA_ABI_MIN) << 1 | \
+                               FFA_ABI_CONV(id))
 
 struct ffa_ctx_notif {
     bool enabled;
@@ -289,6 +306,8 @@ extern void *ffa_rx;
 extern void *ffa_tx;
 extern spinlock_t ffa_rx_buffer_lock;
 extern spinlock_t ffa_tx_buffer_lock;
+extern uint32_t __ro_after_init ffa_fw_version;
+extern DECLARE_BITMAP(ffa_fw_abi_supported, FFA_ABI_BITMAP_SIZE);
 
 bool ffa_shm_domain_destroy(struct domain *d);
 void ffa_handle_mem_share(struct cpu_user_regs *regs);
@@ -401,4 +420,13 @@ static inline int32_t ffa_rx_release(void)
     return ffa_simple_call(FFA_RX_RELEASE, 0, 0, 0, 0);
 }
 
+static inline bool ffa_fw_supports_fid(uint32_t fid)
+{
+    BUILD_BUG_ON(FFA_ABI_MIN > FFA_ABI_MAX);
+
+    if ( FFA_ABI_BITNUM(fid) > FFA_ABI_BITMAP_SIZE)
+        return false;
+    return test_bit(FFA_ABI_BITNUM(fid), ffa_fw_abi_supported);
+}
+
 #endif /*__FFA_PRIVATE_H__*/
diff --git a/xen/arch/arm/tee/ffa_rxtx.c b/xen/arch/arm/tee/ffa_rxtx.c
index c8bc516a19..132a798240 100644
--- a/xen/arch/arm/tee/ffa_rxtx.c
+++ b/xen/arch/arm/tee/ffa_rxtx.c
@@ -193,6 +193,10 @@ bool ffa_rxtx_init(void)
 {
     int e;
 
+    /* Firmware not there or not supporting */
+    if ( !ffa_fw_supports_fid(FFA_RXTX_MAP_64) )
+        return false;
+
     ffa_rx = alloc_xenheap_pages(get_order_from_pages(FFA_RXTX_PAGE_COUNT), 0);
     if ( !ffa_rx )
         return false;
diff --git a/xen/arch/arm/tee/ffa_shm.c b/xen/arch/arm/tee/ffa_shm.c
index 370d83ec5c..efa5b67db8 100644
--- a/xen/arch/arm/tee/ffa_shm.c
+++ b/xen/arch/arm/tee/ffa_shm.c
@@ -149,6 +149,9 @@ static int32_t ffa_mem_share(uint32_t tot_len, uint32_t frag_len,
 static int32_t ffa_mem_reclaim(uint32_t handle_lo, uint32_t handle_hi,
                                uint32_t flags)
 {
+    if ( !ffa_fw_supports_fid(FFA_MEM_RECLAIM) )
+        return FFA_RET_NOT_SUPPORTED;
+
     return ffa_simple_call(FFA_MEM_RECLAIM, handle_lo, handle_hi, flags, 0);
 }
 
@@ -467,6 +470,12 @@ void ffa_handle_mem_share(struct cpu_user_regs *regs)
     uint32_t range_count;
     uint32_t region_offs;
 
+    if ( !ffa_fw_supports_fid(FFA_MEM_SHARE_64) )
+    {
+        ret = FFA_RET_NOT_SUPPORTED;
+        goto out_set_ret;
+    }
+
     /*
      * We're only accepting memory transaction descriptors via the rx/tx
      * buffer.
@@ -621,6 +630,9 @@ int ffa_handle_mem_reclaim(uint64_t handle, uint32_t flags)
     register_t handle_lo;
     int ret;
 
+    if ( !ffa_fw_supports_fid(FFA_MEM_RECLAIM) )
+        return FFA_RET_NOT_SUPPORTED;
+
     spin_lock(&ctx->lock);
     shm = find_shm_mem(ctx, handle);
     if ( shm )
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Dec 16 20:11:50 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 16 Dec 2024 20:11:50 +0000
Received: from list by lists.xenproject.org with outflank-mailman.858476.1270699 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tNHRW-0005CM-81; Mon, 16 Dec 2024 20:11:50 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 858476.1270699; Mon, 16 Dec 2024 20:11:50 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tNHRW-0005CF-5E; Mon, 16 Dec 2024 20:11:50 +0000
Received: by outflank-mailman (input) for mailman id 858476;
 Mon, 16 Dec 2024 20:11:48 +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 1tNHRU-0005C2-Fd
 for xen-changelog@lists.xenproject.org; Mon, 16 Dec 2024 20:11:48 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1tNHRU-006URz-0V
 for xen-changelog@lists.xenproject.org;
 Mon, 16 Dec 2024 20:11:48 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1tNHRU-00BgKQ-1J
 for xen-changelog@lists.xenproject.org;
 Mon, 16 Dec 2024 20:11:48 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/arm: ffa: Rework partition info get
Message-Id: <E1tNHRU-00BgKQ-1J@xenbits.xenproject.org>
Date: Mon, 16 Dec 2024 20:11:48 +0000

commit 8a932b91aa635a64ebaa24a616f951ff0c2c9735
Author:     Bertrand Marquis <bertrand.marquis@arm.com>
AuthorDate: Wed Nov 27 17:07:37 2024 +0100
Commit:     Julien Grall <julien@xen.org>
CommitDate: Mon Dec 16 21:01:16 2024 +0100

    xen/arm: ffa: Rework partition info get
    
    Rework the partition info get implementation to use the correct size of
    structure depending on the version of the protocol and simplifies the
    structure copy to use only memcpy and prevent recreating the structure
    each time.
    The goal here is to have an implementation that will be easier to
    maintain in the long term as the specification is only adding fields to
    structure with versions to simplify support of several protocol
    versions and as such an SPMC implementation in the future could use this
    and return a size higher than the one we expect.
    The patch is fixing the part_info_get function for this and the
    subscriber discovery on probe.
    
    No functional changes expected.
    
    Signed-off-by: Bertrand Marquis <bertrand.marquis@arm.com>
    Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
---
 xen/arch/arm/tee/ffa.c          |  13 +--
 xen/arch/arm/tee/ffa_partinfo.c | 185 +++++++++++++++++++++++++---------------
 xen/arch/arm/tee/ffa_private.h  |   4 +-
 3 files changed, 118 insertions(+), 84 deletions(-)

diff --git a/xen/arch/arm/tee/ffa.c b/xen/arch/arm/tee/ffa.c
index 1b0919041d..4b283a4de5 100644
--- a/xen/arch/arm/tee/ffa.c
+++ b/xen/arch/arm/tee/ffa.c
@@ -311,8 +311,6 @@ static bool ffa_handle_call(struct cpu_user_regs *regs)
     uint32_t fid = get_user_reg(regs, 0);
     struct domain *d = current->domain;
     struct ffa_ctx *ctx = d->arch.tee;
-    uint32_t fpi_size;
-    uint32_t count;
     int e;
 
     if ( !ctx )
@@ -338,16 +336,7 @@ static bool ffa_handle_call(struct cpu_user_regs *regs)
         e = ffa_handle_rxtx_unmap();
         break;
     case FFA_PARTITION_INFO_GET:
-        e = ffa_handle_partition_info_get(get_user_reg(regs, 1),
-                                          get_user_reg(regs, 2),
-                                          get_user_reg(regs, 3),
-                                          get_user_reg(regs, 4),
-                                          get_user_reg(regs, 5), &count,
-                                          &fpi_size);
-        if ( e )
-            ffa_set_regs_error(regs, e);
-        else
-            ffa_set_regs_success(regs, count, fpi_size);
+        ffa_handle_partition_info_get(regs);
         return true;
     case FFA_RX_RELEASE:
         e = ffa_handle_rx_release();
diff --git a/xen/arch/arm/tee/ffa_partinfo.c b/xen/arch/arm/tee/ffa_partinfo.c
index 99c48f0e5c..75a073d090 100644
--- a/xen/arch/arm/tee/ffa_partinfo.c
+++ b/xen/arch/arm/tee/ffa_partinfo.c
@@ -33,21 +33,24 @@ static uint16_t subscr_vm_created_count __read_mostly;
 static uint16_t *subscr_vm_destroyed __read_mostly;
 static uint16_t subscr_vm_destroyed_count __read_mostly;
 
-static int32_t ffa_partition_info_get(uint32_t w1, uint32_t w2, uint32_t w3,
-                                      uint32_t w4, uint32_t w5, uint32_t *count,
-                                      uint32_t *fpi_size)
+static int32_t ffa_partition_info_get(uint32_t *uuid, uint32_t flags,
+                                      uint32_t *count, uint32_t *fpi_size)
 {
-    const struct arm_smccc_1_2_regs arg = {
+    struct arm_smccc_1_2_regs arg = {
         .a0 = FFA_PARTITION_INFO_GET,
-        .a1 = w1,
-        .a2 = w2,
-        .a3 = w3,
-        .a4 = w4,
-        .a5 = w5,
+        .a5 = flags,
     };
     struct arm_smccc_1_2_regs resp;
     uint32_t ret;
 
+    if ( uuid )
+    {
+        arg.a1 = uuid[0];
+        arg.a2 = uuid[1];
+        arg.a3 = uuid[2];
+        arg.a4 = uuid[3];
+    }
+
     arm_smccc_1_2_smc(&arg, &resp);
 
     ret = ffa_get_ret_code(&resp);
@@ -60,13 +63,31 @@ static int32_t ffa_partition_info_get(uint32_t w1, uint32_t w2, uint32_t w3,
     return ret;
 }
 
-int32_t ffa_handle_partition_info_get(uint32_t w1, uint32_t w2, uint32_t w3,
-                                      uint32_t w4, uint32_t w5, uint32_t *count,
-                                      uint32_t *fpi_size)
+void ffa_handle_partition_info_get(struct cpu_user_regs *regs)
 {
-    int32_t ret = FFA_RET_DENIED;
+    int32_t ret;
     struct domain *d = current->domain;
     struct ffa_ctx *ctx = d->arch.tee;
+    uint32_t flags = get_user_reg(regs, 5);
+    uint32_t uuid[4] = {
+        get_user_reg(regs, 1),
+        get_user_reg(regs, 2),
+        get_user_reg(regs, 3),
+        get_user_reg(regs, 4),
+    };
+    uint32_t src_size, dst_size;
+    void *dst_buf;
+    uint32_t ffa_sp_count = 0;
+
+    /*
+     * If the guest is v1.0, he does not get back the entry size so we must
+     * use the v1.0 structure size in the destination buffer.
+     * Otherwise use the size of the highest version we support, here 1.1.
+     */
+    if ( ctx->guest_vers == FFA_VERSION_1_0 )
+        dst_size = sizeof(struct ffa_partition_info_1_0);
+    else
+        dst_size = sizeof(struct ffa_partition_info_1_1);
 
     /*
      * FF-A v1.0 has w5 MBZ while v1.1 allows
@@ -75,90 +96,105 @@ int32_t ffa_handle_partition_info_get(uint32_t w1, uint32_t w2, uint32_t w3,
      * FFA_PARTITION_INFO_GET_COUNT is only using registers and not the
      * rxtx buffer so do the partition_info_get directly.
      */
-    if ( w5 == FFA_PARTITION_INFO_GET_COUNT_FLAG &&
+    if ( flags == FFA_PARTITION_INFO_GET_COUNT_FLAG &&
          ctx->guest_vers == FFA_VERSION_1_1 )
     {
         if ( ffa_fw_supports_fid(FFA_PARTITION_INFO_GET) )
-            return ffa_partition_info_get(w1, w2, w3, w4, w5, count, fpi_size);
+            ret = ffa_partition_info_get(uuid, flags, &ffa_sp_count,
+                                        &src_size);
         else
-        {
-            *count = 0;
-            return FFA_RET_OK;
-        }
-    }
-    if ( w5 )
-        return FFA_RET_INVALID_PARAMETERS;
+            ret = FFA_RET_OK;
 
-    if ( !ffa_rx )
-        return FFA_RET_DENIED;
+        goto out;
+    }
 
-    if ( !spin_trylock(&ctx->rx_lock) )
-        return FFA_RET_BUSY;
+    if ( flags )
+    {
+        ret = FFA_RET_INVALID_PARAMETERS;
+        goto out;
+    }
 
     if ( !ffa_fw_supports_fid(FFA_PARTITION_INFO_GET) )
     {
-        if ( ctx->guest_vers == FFA_VERSION_1_0 )
-            *fpi_size = sizeof(struct ffa_partition_info_1_0);
-        else
-            *fpi_size = sizeof(struct ffa_partition_info_1_1);
-
-        *count = 0;
+        /* Just give an empty partition list to the caller */
         ret = FFA_RET_OK;
         goto out;
     }
 
-    if ( !ctx->page_count || !ctx->rx_is_free )
+    if ( !spin_trylock(&ctx->rx_lock) )
+    {
+        ret = FFA_RET_BUSY;
         goto out;
+    }
+
+    dst_buf = ctx->rx;
+
+    if ( !ffa_rx )
+    {
+        ret = FFA_RET_DENIED;
+        goto out_rx_release;
+    }
+
+    if ( !ctx->page_count || !ctx->rx_is_free )
+    {
+        ret = FFA_RET_DENIED;
+        goto out_rx_release;
+    }
+
     spin_lock(&ffa_rx_buffer_lock);
-    ret = ffa_partition_info_get(w1, w2, w3, w4, w5, count, fpi_size);
+
+    ret = ffa_partition_info_get(uuid, 0, &ffa_sp_count, &src_size);
+
     if ( ret )
         goto out_rx_buf_unlock;
+
     /*
      * ffa_partition_info_get() succeeded so we now own the RX buffer we
      * share with the SPMC. We must give it back using ffa_rx_release()
      * once we've copied the content.
      */
 
-    if ( ctx->guest_vers == FFA_VERSION_1_0 )
+    /* we cannot have a size smaller than 1.0 structure */
+    if ( src_size < sizeof(struct ffa_partition_info_1_0) )
     {
-        size_t n;
-        struct ffa_partition_info_1_1 *src = ffa_rx;
-        struct ffa_partition_info_1_0 *dst = ctx->rx;
-
-        if ( ctx->page_count * FFA_PAGE_SIZE < *count * sizeof(*dst) )
-        {
-            ret = FFA_RET_NO_MEMORY;
-            goto out_rx_release;
-        }
+        ret = FFA_RET_NOT_SUPPORTED;
+        goto out_rx_hyp_release;
+    }
 
-        for ( n = 0; n < *count; n++ )
-        {
-            dst[n].id = src[n].id;
-            dst[n].execution_context = src[n].execution_context;
-            dst[n].partition_properties = src[n].partition_properties;
-        }
+    if ( ctx->page_count * FFA_PAGE_SIZE < ffa_sp_count * dst_size )
+    {
+        ret = FFA_RET_NO_MEMORY;
+        goto out_rx_hyp_release;
     }
-    else
+
+    if ( ffa_sp_count > 0 )
     {
-        size_t sz = *count * *fpi_size;
+        uint32_t n;
+        void *src_buf = ffa_rx;
 
-        if ( ctx->page_count * FFA_PAGE_SIZE < sz )
+        /* copy the secure partitions info */
+        for ( n = 0; n < ffa_sp_count; n++ )
         {
-            ret = FFA_RET_NO_MEMORY;
-            goto out_rx_release;
+            memcpy(dst_buf, src_buf, dst_size);
+            dst_buf += dst_size;
+            src_buf += src_size;
         }
-
-        memcpy(ctx->rx, ffa_rx, sz);
     }
+
     ctx->rx_is_free = false;
-out_rx_release:
+
+out_rx_hyp_release:
     ffa_rx_release();
 out_rx_buf_unlock:
     spin_unlock(&ffa_rx_buffer_lock);
-out:
+out_rx_release:
     spin_unlock(&ctx->rx_lock);
 
-    return ret;
+out:
+    if ( ret )
+        ffa_set_regs_error(regs, ret);
+    else
+        ffa_set_regs_success(regs, ffa_sp_count, dst_size);
 }
 
 static int32_t ffa_direct_req_send_vm(uint16_t sp_id, uint16_t vm_id,
@@ -221,19 +257,28 @@ static void uninit_subscribers(void)
         XFREE(subscr_vm_destroyed);
 }
 
-static bool init_subscribers(struct ffa_partition_info_1_1 *fpi, uint16_t count)
+static bool init_subscribers(uint16_t count, uint32_t fpi_size)
 {
     uint16_t n;
     uint16_t c_pos;
     uint16_t d_pos;
+    struct ffa_partition_info_1_1 *fpi;
+
+    if ( fpi_size < sizeof(struct ffa_partition_info_1_1) )
+    {
+        printk(XENLOG_ERR "ffa: partition info size invalid: %u\n", fpi_size);
+        return false;
+    }
 
     subscr_vm_created_count = 0;
     subscr_vm_destroyed_count = 0;
     for ( n = 0; n < count; n++ )
     {
-        if ( fpi[n].partition_properties & FFA_PART_PROP_NOTIF_CREATED )
+        fpi = ffa_rx + n * fpi_size;
+
+        if ( fpi->partition_properties & FFA_PART_PROP_NOTIF_CREATED )
             subscr_vm_created_count++;
-        if ( fpi[n].partition_properties & FFA_PART_PROP_NOTIF_DESTROYED )
+        if ( fpi->partition_properties & FFA_PART_PROP_NOTIF_DESTROYED )
             subscr_vm_destroyed_count++;
     }
 
@@ -252,10 +297,12 @@ static bool init_subscribers(struct ffa_partition_info_1_1 *fpi, uint16_t count)
 
     for ( c_pos = 0, d_pos = 0, n = 0; n < count; n++ )
     {
-        if ( fpi[n].partition_properties & FFA_PART_PROP_NOTIF_CREATED )
-            subscr_vm_created[c_pos++] = fpi[n].id;
-        if ( fpi[n].partition_properties & FFA_PART_PROP_NOTIF_DESTROYED )
-            subscr_vm_destroyed[d_pos++] = fpi[n].id;
+        fpi = ffa_rx + n * fpi_size;
+
+        if ( fpi->partition_properties & FFA_PART_PROP_NOTIF_CREATED )
+            subscr_vm_created[c_pos++] = fpi->id;
+        if ( fpi->partition_properties & FFA_PART_PROP_NOTIF_DESTROYED )
+            subscr_vm_destroyed[d_pos++] = fpi->id;
     }
 
     return true;
@@ -275,7 +322,7 @@ bool ffa_partinfo_init(void)
          !ffa_rx || !ffa_tx )
         return false;
 
-    e = ffa_partition_info_get(0, 0, 0, 0, 0, &count, &fpi_size);
+    e = ffa_partition_info_get(NULL, 0, &count, &fpi_size);
     if ( e )
     {
         printk(XENLOG_ERR "ffa: Failed to get list of SPs: %d\n", e);
@@ -288,7 +335,7 @@ bool ffa_partinfo_init(void)
         goto out;
     }
 
-    ret = init_subscribers(ffa_rx, count);
+    ret = init_subscribers(count, fpi_size);
 
 out:
     ffa_rx_release();
diff --git a/xen/arch/arm/tee/ffa_private.h b/xen/arch/arm/tee/ffa_private.h
index 85eb61c134..e5bc73f903 100644
--- a/xen/arch/arm/tee/ffa_private.h
+++ b/xen/arch/arm/tee/ffa_private.h
@@ -316,9 +316,7 @@ int ffa_handle_mem_reclaim(uint64_t handle, uint32_t flags);
 bool ffa_partinfo_init(void);
 int ffa_partinfo_domain_init(struct domain *d);
 bool ffa_partinfo_domain_destroy(struct domain *d);
-int32_t ffa_handle_partition_info_get(uint32_t w1, uint32_t w2, uint32_t w3,
-                                      uint32_t w4, uint32_t w5, uint32_t *count,
-                                      uint32_t *fpi_size);
+void ffa_handle_partition_info_get(struct cpu_user_regs *regs);
 
 bool ffa_rxtx_init(void);
 void ffa_rxtx_destroy(void);
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Dec 16 20:12:00 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 16 Dec 2024 20:12:00 +0000
Received: from list by lists.xenproject.org with outflank-mailman.858477.1270703 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tNHRg-0005F0-9j; Mon, 16 Dec 2024 20:12:00 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 858477.1270703; Mon, 16 Dec 2024 20:12:00 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tNHRg-0005Es-6r; Mon, 16 Dec 2024 20:12:00 +0000
Received: by outflank-mailman (input) for mailman id 858477;
 Mon, 16 Dec 2024 20:11:58 +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 1tNHRe-0005EZ-IX
 for xen-changelog@lists.xenproject.org; Mon, 16 Dec 2024 20:11:58 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1tNHRe-006US6-0o
 for xen-changelog@lists.xenproject.org;
 Mon, 16 Dec 2024 20:11:58 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1tNHRe-00BgLm-1f
 for xen-changelog@lists.xenproject.org;
 Mon, 16 Dec 2024 20:11:58 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/arm: ffa: Use bit 15 convention for SPs
Message-Id: <E1tNHRe-00BgLm-1f@xenbits.xenproject.org>
Date: Mon, 16 Dec 2024 20:11:58 +0000

commit 2833aa172fdabeb77a7e0cbb36a1dcb05ab1af13
Author:     Bertrand Marquis <bertrand.marquis@arm.com>
AuthorDate: Wed Nov 27 17:07:38 2024 +0100
Commit:     Julien Grall <julien@xen.org>
CommitDate: Mon Dec 16 21:01:16 2024 +0100

    xen/arm: ffa: Use bit 15 convention for SPs
    
    Make use and required to have bit 15 convention respected by secure
    world (having bit 15 of IDs set for secure endpoints and non-set for
    non-secure ones).
    If any secure partition has an ID with bit 15 not set, it will not be
    possible to contact or detect them.
    Print an error log during probe for each secure endpoint detected with
    bit 15 not set.
    
    We are switching to this convention because Xen is currently not using
    VMIDs with bit 15 set so we are sure that no VM will have it set (this
    is ensured by BUILD_BUG_ON in case this becomes false in the future).
    It is allowing to easily distinguish between secure and non-secure
    endpoints, preventing the need to store a list of secure endpoint IDs in
    Xen.
    
    Signed-off-by: Bertrand Marquis <bertrand.marquis@arm.com>
    Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
---
 xen/arch/arm/tee/ffa.c          | 22 ++++++++++++++----
 xen/arch/arm/tee/ffa_partinfo.c | 51 +++++++++++++++++++++++++++++++----------
 xen/arch/arm/tee/ffa_private.h  |  7 ++++++
 xen/arch/arm/tee/ffa_shm.c      | 12 +++++++++-
 4 files changed, 74 insertions(+), 18 deletions(-)

diff --git a/xen/arch/arm/tee/ffa.c b/xen/arch/arm/tee/ffa.c
index 4b283a4de5..0026ac9134 100644
--- a/xen/arch/arm/tee/ffa.c
+++ b/xen/arch/arm/tee/ffa.c
@@ -195,6 +195,14 @@ static void handle_msg_send_direct_req(struct cpu_user_regs *regs, uint32_t fid)
         goto out;
     }
 
+    /* we do not support direct messages to VMs */
+    if ( !FFA_ID_IS_SECURE(src_dst & GENMASK(15,0)) )
+    {
+        resp.a0 = FFA_ERROR;
+        resp.a2 = FFA_RET_NOT_SUPPORTED;
+        goto out;
+    }
+
     arg.a1 = src_dst;
     arg.a2 = get_user_reg(regs, 2) & mask;
     arg.a3 = get_user_reg(regs, 3) & mask;
@@ -391,11 +399,15 @@ static int ffa_domain_init(struct domain *d)
 
     if ( !ffa_fw_version )
         return -ENODEV;
-     /*
-      * We can't use that last possible domain ID or ffa_get_vm_id() would
-      * cause an overflow.
-      */
-    if ( d->domain_id >= UINT16_MAX)
+    /*
+     * We are using the domain_id + 1 as the FF-A ID for VMs as FF-A ID 0 is
+     * reserved for the hypervisor and we only support secure endpoints using
+     * FF-A IDs with BIT 15 set to 1 so make sure those are not used by Xen.
+     */
+    BUILD_BUG_ON(DOMID_FIRST_RESERVED >= UINT16_MAX);
+    BUILD_BUG_ON((DOMID_MASK & BIT(15, U)) != 0);
+
+    if ( d->domain_id >= DOMID_FIRST_RESERVED )
         return -ERANGE;
 
     ctx = xzalloc(struct ffa_ctx);
diff --git a/xen/arch/arm/tee/ffa_partinfo.c b/xen/arch/arm/tee/ffa_partinfo.c
index 75a073d090..74324e1d9d 100644
--- a/xen/arch/arm/tee/ffa_partinfo.c
+++ b/xen/arch/arm/tee/ffa_partinfo.c
@@ -169,14 +169,23 @@ void ffa_handle_partition_info_get(struct cpu_user_regs *regs)
 
     if ( ffa_sp_count > 0 )
     {
-        uint32_t n;
+        uint32_t n, n_limit = ffa_sp_count;
         void *src_buf = ffa_rx;
 
         /* copy the secure partitions info */
-        for ( n = 0; n < ffa_sp_count; n++ )
+        for ( n = 0; n < n_limit; n++ )
         {
-            memcpy(dst_buf, src_buf, dst_size);
-            dst_buf += dst_size;
+            struct ffa_partition_info_1_1 *fpi = src_buf;
+
+            /* filter out SP not following bit 15 convention if any */
+            if ( FFA_ID_IS_SECURE(fpi->id) )
+            {
+                memcpy(dst_buf, src_buf, dst_size);
+                dst_buf += dst_size;
+            }
+            else
+                ffa_sp_count--;
+
             src_buf += src_size;
         }
     }
@@ -276,10 +285,25 @@ static bool init_subscribers(uint16_t count, uint32_t fpi_size)
     {
         fpi = ffa_rx + n * fpi_size;
 
-        if ( fpi->partition_properties & FFA_PART_PROP_NOTIF_CREATED )
-            subscr_vm_created_count++;
-        if ( fpi->partition_properties & FFA_PART_PROP_NOTIF_DESTROYED )
-            subscr_vm_destroyed_count++;
+        /*
+         * We need to have secure partitions using bit 15 set convention for
+         * secure partition IDs.
+         * Inform the user with a log and discard giving created or destroy
+         * event to those IDs.
+         */
+        if ( !FFA_ID_IS_SECURE(fpi->id) )
+        {
+            printk(XENLOG_ERR "ffa: Firmware is not using bit 15 convention for IDs !!\n"
+                              "ffa: Secure partition with id 0x%04x cannot be used\n",
+                              fpi->id);
+        }
+        else
+        {
+            if ( fpi->partition_properties & FFA_PART_PROP_NOTIF_CREATED )
+                subscr_vm_created_count++;
+            if ( fpi->partition_properties & FFA_PART_PROP_NOTIF_DESTROYED )
+                subscr_vm_destroyed_count++;
+        }
     }
 
     if ( subscr_vm_created_count )
@@ -299,10 +323,13 @@ static bool init_subscribers(uint16_t count, uint32_t fpi_size)
     {
         fpi = ffa_rx + n * fpi_size;
 
-        if ( fpi->partition_properties & FFA_PART_PROP_NOTIF_CREATED )
-            subscr_vm_created[c_pos++] = fpi->id;
-        if ( fpi->partition_properties & FFA_PART_PROP_NOTIF_DESTROYED )
-            subscr_vm_destroyed[d_pos++] = fpi->id;
+        if ( FFA_ID_IS_SECURE(fpi->id) )
+        {
+            if ( fpi->partition_properties & FFA_PART_PROP_NOTIF_CREATED )
+                subscr_vm_created[c_pos++] = fpi->id;
+            if ( fpi->partition_properties & FFA_PART_PROP_NOTIF_DESTROYED )
+                subscr_vm_destroyed[d_pos++] = fpi->id;
+        }
     }
 
     return true;
diff --git a/xen/arch/arm/tee/ffa_private.h b/xen/arch/arm/tee/ffa_private.h
index e5bc73f903..afe69b43db 100644
--- a/xen/arch/arm/tee/ffa_private.h
+++ b/xen/arch/arm/tee/ffa_private.h
@@ -108,6 +108,13 @@
  */
 #define FFA_CTX_TEARDOWN_DELAY          SECONDS(1)
 
+/*
+ * We rely on the convention suggested but not mandated by the FF-A
+ * specification that secure world endpoint identifiers have the bit 15
+ * set and normal world have it set to 0.
+ */
+#define FFA_ID_IS_SECURE(id)    ((id) & BIT(15, U))
+
 /* FF-A-1.1-REL0 section 10.9.2 Memory region handle, page 167 */
 #define FFA_HANDLE_HYP_FLAG             BIT(63, ULL)
 #define FFA_HANDLE_INVALID              0xffffffffffffffffULL
diff --git a/xen/arch/arm/tee/ffa_shm.c b/xen/arch/arm/tee/ffa_shm.c
index efa5b67db8..29675f9ba3 100644
--- a/xen/arch/arm/tee/ffa_shm.c
+++ b/xen/arch/arm/tee/ffa_shm.c
@@ -469,6 +469,7 @@ void ffa_handle_mem_share(struct cpu_user_regs *regs)
     int ret = FFA_RET_DENIED;
     uint32_t range_count;
     uint32_t region_offs;
+    uint16_t dst_id;
 
     if ( !ffa_fw_supports_fid(FFA_MEM_SHARE_64) )
     {
@@ -537,6 +538,15 @@ void ffa_handle_mem_share(struct cpu_user_regs *regs)
         goto out_unlock;
 
     mem_access = ctx->tx + trans.mem_access_offs;
+
+    dst_id = ACCESS_ONCE(mem_access->access_perm.endpoint_id);
+    if ( !FFA_ID_IS_SECURE(dst_id) )
+    {
+        /* we do not support sharing with VMs */
+        ret = FFA_RET_NOT_SUPPORTED;
+        goto out_unlock;
+    }
+
     if ( ACCESS_ONCE(mem_access->access_perm.perm) != FFA_MEM_ACC_RW )
     {
         ret = FFA_RET_NOT_SUPPORTED;
@@ -567,7 +577,7 @@ void ffa_handle_mem_share(struct cpu_user_regs *regs)
         goto out_unlock;
     }
     shm->sender_id = trans.sender_id;
-    shm->ep_id = ACCESS_ONCE(mem_access->access_perm.endpoint_id);
+    shm->ep_id = dst_id;
 
     /*
      * Check that the Composite memory region descriptor fits.
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Dec 16 20:12:10 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 16 Dec 2024 20:12:10 +0000
Received: from list by lists.xenproject.org with outflank-mailman.858478.1270708 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tNHRq-0005I7-DZ; Mon, 16 Dec 2024 20:12:10 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 858478.1270708; Mon, 16 Dec 2024 20:12:10 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tNHRq-0005Hx-AN; Mon, 16 Dec 2024 20:12:10 +0000
Received: by outflank-mailman (input) for mailman id 858478;
 Mon, 16 Dec 2024 20:12:08 +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 1tNHRo-0005Hk-MJ
 for xen-changelog@lists.xenproject.org; Mon, 16 Dec 2024 20:12:08 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1tNHRo-006USP-1A
 for xen-changelog@lists.xenproject.org;
 Mon, 16 Dec 2024 20:12:08 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1tNHRo-00BgNg-1x
 for xen-changelog@lists.xenproject.org;
 Mon, 16 Dec 2024 20:12:08 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/arm: ffa: Transmit RXTX buffers to the SPMC
Message-Id: <E1tNHRo-00BgNg-1x@xenbits.xenproject.org>
Date: Mon, 16 Dec 2024 20:12:08 +0000

commit 6dceb1378d740bd45f237bcc41bf1dfe7a862d64
Author:     Bertrand Marquis <bertrand.marquis@arm.com>
AuthorDate: Wed Nov 27 17:07:39 2024 +0100
Commit:     Julien Grall <julien@xen.org>
CommitDate: Mon Dec 16 21:04:15 2024 +0100

    xen/arm: ffa: Transmit RXTX buffers to the SPMC
    
    When an RXTX buffer is mapped by a VM transmit it to the SPMC when it
    supports RX_ACQUIRE.
    As a consequence of that, we must acquire the RX buffer of a VM from the
    SPMC when we want to use it:
    - create a generic acquire and release function to get the rx buffer of
      a VM which gets it from the SPMC when supported
    - rename the rx_acquire to hyp_rx_acquire to remove confusion
    - rework the rx_lock to only lock access to rx_is_free and only allow
      usage of the rx buffer to one who managed to acquire it, thus removing
      the trylock and returning busy if rx_is_free is false
    
    As part of this change move some structure definition to ffa_private
    from ffa_shm as those are need for the MAP call with the SPMC.
    
    While there also fix ffa_handle_rxtx_map which was testing the wrong
    variable after getting the page for the rx buffer, testing tx_pg
    instead of rx_pg.
    
    Fixes: be75f686eb03 ("xen/arm: ffa: separate rxtx buffer routines")
    
    Signed-off-by: Bertrand Marquis <bertrand.marquis@arm.com>
    Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
---
 xen/arch/arm/tee/ffa.c          |   2 +-
 xen/arch/arm/tee/ffa_partinfo.c |  36 ++++-----
 xen/arch/arm/tee/ffa_private.h  |  22 +++++-
 xen/arch/arm/tee/ffa_rxtx.c     | 161 +++++++++++++++++++++++++++++++++-------
 xen/arch/arm/tee/ffa_shm.c      |  15 ----
 5 files changed, 170 insertions(+), 66 deletions(-)

diff --git a/xen/arch/arm/tee/ffa.c b/xen/arch/arm/tee/ffa.c
index 0026ac9134..bc2722d53f 100644
--- a/xen/arch/arm/tee/ffa.c
+++ b/xen/arch/arm/tee/ffa.c
@@ -347,7 +347,7 @@ static bool ffa_handle_call(struct cpu_user_regs *regs)
         ffa_handle_partition_info_get(regs);
         return true;
     case FFA_RX_RELEASE:
-        e = ffa_handle_rx_release();
+        e = ffa_rx_release(d);
         break;
     case FFA_MSG_SEND_DIRECT_REQ_32:
     case FFA_MSG_SEND_DIRECT_REQ_64:
diff --git a/xen/arch/arm/tee/ffa_partinfo.c b/xen/arch/arm/tee/ffa_partinfo.c
index 74324e1d9d..c0510ceb83 100644
--- a/xen/arch/arm/tee/ffa_partinfo.c
+++ b/xen/arch/arm/tee/ffa_partinfo.c
@@ -121,11 +121,9 @@ void ffa_handle_partition_info_get(struct cpu_user_regs *regs)
         goto out;
     }
 
-    if ( !spin_trylock(&ctx->rx_lock) )
-    {
-        ret = FFA_RET_BUSY;
+    ret = ffa_rx_acquire(d);
+    if ( ret != FFA_RET_OK )
         goto out;
-    }
 
     dst_buf = ctx->rx;
 
@@ -135,22 +133,16 @@ void ffa_handle_partition_info_get(struct cpu_user_regs *regs)
         goto out_rx_release;
     }
 
-    if ( !ctx->page_count || !ctx->rx_is_free )
-    {
-        ret = FFA_RET_DENIED;
-        goto out_rx_release;
-    }
-
     spin_lock(&ffa_rx_buffer_lock);
 
     ret = ffa_partition_info_get(uuid, 0, &ffa_sp_count, &src_size);
 
     if ( ret )
-        goto out_rx_buf_unlock;
+        goto out_rx_hyp_unlock;
 
     /*
      * ffa_partition_info_get() succeeded so we now own the RX buffer we
-     * share with the SPMC. We must give it back using ffa_rx_release()
+     * share with the SPMC. We must give it back using ffa_hyp_rx_release()
      * once we've copied the content.
      */
 
@@ -190,15 +182,20 @@ void ffa_handle_partition_info_get(struct cpu_user_regs *regs)
         }
     }
 
-    ctx->rx_is_free = false;
-
 out_rx_hyp_release:
-    ffa_rx_release();
-out_rx_buf_unlock:
+    ffa_hyp_rx_release();
+out_rx_hyp_unlock:
     spin_unlock(&ffa_rx_buffer_lock);
 out_rx_release:
-    spin_unlock(&ctx->rx_lock);
-
+    /*
+     * The calling VM RX buffer only contains data to be used by the VM if the
+     * call was successful, in which case the VM has to release the buffer
+     * once it has used the data.
+     * If something went wrong during the call, we have to release the RX
+     * buffer back to the SPMC as the VM will not do it.
+     */
+    if ( ret != FFA_RET_OK )
+        ffa_rx_release(d);
 out:
     if ( ret )
         ffa_set_regs_error(regs, ret);
@@ -365,8 +362,7 @@ bool ffa_partinfo_init(void)
     ret = init_subscribers(count, fpi_size);
 
 out:
-    ffa_rx_release();
-
+    ffa_hyp_rx_release();
     return ret;
 }
 
diff --git a/xen/arch/arm/tee/ffa_private.h b/xen/arch/arm/tee/ffa_private.h
index afe69b43db..9adfe687c3 100644
--- a/xen/arch/arm/tee/ffa_private.h
+++ b/xen/arch/arm/tee/ffa_private.h
@@ -265,6 +265,21 @@
 #define FFA_ABI_BITNUM(id)    ((FFA_ABI_ID(id) - FFA_ABI_MIN) << 1 | \
                                FFA_ABI_CONV(id))
 
+/* Constituent memory region descriptor */
+struct ffa_address_range {
+    uint64_t address;
+    uint32_t page_count;
+    uint32_t reserved;
+};
+
+/* Composite memory region descriptor */
+struct ffa_mem_region {
+    uint32_t total_page_count;
+    uint32_t address_range_count;
+    uint64_t reserved;
+    struct ffa_address_range address_range_array[];
+};
+
 struct ffa_ctx_notif {
     bool enabled;
 
@@ -292,7 +307,7 @@ struct ffa_ctx {
     struct ffa_ctx_notif notif;
     /*
      * tx_lock is used to serialize access to tx
-     * rx_lock is used to serialize access to rx
+     * rx_lock is used to serialize access to rx_is_free
      * lock is used for the rest in this struct
      */
     spinlock_t tx_lock;
@@ -331,7 +346,8 @@ void ffa_rxtx_domain_destroy(struct domain *d);
 uint32_t ffa_handle_rxtx_map(uint32_t fid, register_t tx_addr,
 			     register_t rx_addr, uint32_t page_count);
 uint32_t ffa_handle_rxtx_unmap(void);
-int32_t ffa_handle_rx_release(void);
+int32_t ffa_rx_acquire(struct domain *d);
+int32_t ffa_rx_release(struct domain *d);
 
 void ffa_notif_init(void);
 void ffa_notif_init_interrupt(void);
@@ -420,7 +436,7 @@ static inline int32_t ffa_simple_call(uint32_t fid, register_t a1,
     return ffa_get_ret_code(&resp);
 }
 
-static inline int32_t ffa_rx_release(void)
+static inline int32_t ffa_hyp_rx_release(void)
 {
     return ffa_simple_call(FFA_RX_RELEASE, 0, 0, 0, 0);
 }
diff --git a/xen/arch/arm/tee/ffa_rxtx.c b/xen/arch/arm/tee/ffa_rxtx.c
index 132a798240..a40e5b32e3 100644
--- a/xen/arch/arm/tee/ffa_rxtx.c
+++ b/xen/arch/arm/tee/ffa_rxtx.c
@@ -30,6 +30,17 @@ struct ffa_endpoint_rxtx_descriptor_1_1 {
     uint32_t tx_region_offs;
 };
 
+static int32_t ffa_rxtx_map(paddr_t tx_addr, paddr_t rx_addr,
+                            uint32_t page_count)
+{
+    return ffa_simple_call(FFA_RXTX_MAP_64, tx_addr, rx_addr, page_count, 0);
+}
+
+static int32_t ffa_rxtx_unmap(uint16_t id)
+{
+    return ffa_simple_call(FFA_RXTX_UNMAP, ((uint64_t)id) << 16, 0, 0, 0);
+}
+
 uint32_t ffa_handle_rxtx_map(uint32_t fid, register_t tx_addr,
 			     register_t rx_addr, uint32_t page_count)
 {
@@ -42,6 +53,9 @@ uint32_t ffa_handle_rxtx_map(uint32_t fid, register_t tx_addr,
     void *rx;
     void *tx;
 
+    /* The code is considering that we only get one page for now */
+    BUILD_BUG_ON(FFA_MAX_RXTX_PAGE_COUNT != 1);
+
     if ( !smccc_is_conv_64(fid) )
     {
         /*
@@ -72,7 +86,7 @@ uint32_t ffa_handle_rxtx_map(uint32_t fid, register_t tx_addr,
         goto err_put_tx_pg;
 
     rx_pg = get_page_from_gfn(d, gfn_x(gaddr_to_gfn(rx_addr)), &t, P2M_ALLOC);
-    if ( !tx_pg )
+    if ( !rx_pg )
         goto err_put_tx_pg;
 
     /* Only normal RW RAM for now */
@@ -87,6 +101,66 @@ uint32_t ffa_handle_rxtx_map(uint32_t fid, register_t tx_addr,
     if ( !rx )
         goto err_unmap_tx;
 
+    /*
+     * Transmit the RX/TX buffer information to the SPM if acquire is supported
+     * as the spec says that if not there is not need to acquire/release/map
+     * rxtx buffers from the SPMC
+     */
+    if ( ffa_fw_supports_fid(FFA_RX_ACQUIRE) )
+    {
+        struct ffa_endpoint_rxtx_descriptor_1_1 *rxtx_desc;
+        struct ffa_mem_region *mem_reg;
+
+        /* All must fit in our TX buffer */
+        BUILD_BUG_ON(sizeof(*rxtx_desc) + sizeof(*mem_reg) * 2 +
+                     sizeof(struct ffa_address_range) * 2 >
+                     FFA_MAX_RXTX_PAGE_COUNT * FFA_PAGE_SIZE);
+
+        spin_lock(&ffa_tx_buffer_lock);
+        rxtx_desc = ffa_tx;
+
+        /*
+         * We have only one page for each so we pack everything:
+         * - rx region descriptor
+         * - rx region range
+         * - tx region descriptor
+         * - tx region range
+         */
+        rxtx_desc->sender_id = ffa_get_vm_id(d);
+        rxtx_desc->reserved = 0;
+        rxtx_desc->rx_region_offs = sizeof(*rxtx_desc);
+        rxtx_desc->tx_region_offs = sizeof(*rxtx_desc) +
+                                    offsetof(struct ffa_mem_region,
+                                             address_range_array[1]);
+
+        /* rx buffer */
+        mem_reg = ffa_tx + sizeof(*rxtx_desc);
+        mem_reg->total_page_count = 1;
+        mem_reg->address_range_count = 1;
+        mem_reg->reserved = 0;
+
+        mem_reg->address_range_array[0].address = page_to_maddr(rx_pg);
+        mem_reg->address_range_array[0].page_count = 1;
+        mem_reg->address_range_array[0].reserved = 0;
+
+        /* tx buffer */
+        mem_reg = ffa_tx + rxtx_desc->tx_region_offs;
+        mem_reg->total_page_count = 1;
+        mem_reg->address_range_count = 1;
+        mem_reg->reserved = 0;
+
+        mem_reg->address_range_array[0].address = page_to_maddr(tx_pg);
+        mem_reg->address_range_array[0].page_count = 1;
+        mem_reg->address_range_array[0].reserved = 0;
+
+        ret = ffa_rxtx_map(0, 0, 0);
+
+        spin_unlock(&ffa_tx_buffer_lock);
+
+        if ( ret != FFA_RET_OK )
+            goto err_unmap_rx;
+    }
+
     ctx->rx = rx;
     ctx->tx = tx;
     ctx->rx_pg = rx_pg;
@@ -95,6 +169,8 @@ uint32_t ffa_handle_rxtx_map(uint32_t fid, register_t tx_addr,
     ctx->rx_is_free = true;
     return FFA_RET_OK;
 
+err_unmap_rx:
+    unmap_domain_page_global(rx);
 err_unmap_tx:
     unmap_domain_page_global(tx);
 err_put_rx_pg:
@@ -105,8 +181,22 @@ err_put_tx_pg:
     return ret;
 }
 
-static void rxtx_unmap(struct ffa_ctx *ctx)
+static uint32_t  rxtx_unmap(struct domain *d)
 {
+    struct ffa_ctx *ctx = d->arch.tee;
+
+    if ( !ctx->page_count )
+        return FFA_RET_INVALID_PARAMETERS;
+
+    if ( ffa_fw_supports_fid(FFA_RX_ACQUIRE) )
+    {
+        uint32_t ret;
+
+        ret = ffa_rxtx_unmap(ffa_get_vm_id(d));
+        if ( ret != FFA_RET_OK )
+            return ret;
+    }
+
     unmap_domain_page_global(ctx->rx);
     unmap_domain_page_global(ctx->tx);
     put_page(ctx->rx_pg);
@@ -117,32 +207,63 @@ static void rxtx_unmap(struct ffa_ctx *ctx)
     ctx->tx_pg = NULL;
     ctx->page_count = 0;
     ctx->rx_is_free = false;
+
+    return FFA_RET_OK;
 }
 
 uint32_t ffa_handle_rxtx_unmap(void)
 {
-    struct domain *d = current->domain;
+    return rxtx_unmap(current->domain);
+}
+
+int32_t ffa_rx_acquire(struct domain *d)
+{
+    int32_t ret = FFA_RET_OK;
     struct ffa_ctx *ctx = d->arch.tee;
 
-    if ( !ctx->rx )
-        return FFA_RET_INVALID_PARAMETERS;
+    spin_lock(&ctx->rx_lock);
 
-    rxtx_unmap(ctx);
+    if ( !ctx->page_count )
+    {
+        ret = FFA_RET_DENIED;
+        goto out;
+    }
 
-    return FFA_RET_OK;
+    if ( !ctx->rx_is_free )
+    {
+        ret = FFA_RET_BUSY;
+        goto out;
+    }
+
+    if ( ffa_fw_supports_fid(FFA_RX_ACQUIRE) )
+    {
+        ret = ffa_simple_call(FFA_RX_ACQUIRE, ffa_get_vm_id(d), 0, 0, 0);
+        if ( ret != FFA_RET_OK )
+            goto out;
+    }
+    ctx->rx_is_free = false;
+out:
+    spin_unlock(&ctx->rx_lock);
+
+    return ret;
 }
 
-int32_t ffa_handle_rx_release(void)
+int32_t ffa_rx_release(struct domain *d)
 {
     int32_t ret = FFA_RET_DENIED;
-    struct domain *d = current->domain;
     struct ffa_ctx *ctx = d->arch.tee;
 
-    if ( !spin_trylock(&ctx->rx_lock) )
-        return FFA_RET_BUSY;
+    spin_lock(&ctx->rx_lock);
 
     if ( !ctx->page_count || ctx->rx_is_free )
         goto out;
+
+    if ( ffa_fw_supports_fid(FFA_RX_ACQUIRE) )
+    {
+        ret = ffa_simple_call(FFA_RX_RELEASE, ffa_get_vm_id(d), 0, 0, 0);
+        if ( ret != FFA_RET_OK )
+            goto out;
+    }
     ret = FFA_RET_OK;
     ctx->rx_is_free = true;
 out:
@@ -151,23 +272,9 @@ out:
     return ret;
 }
 
-static int32_t ffa_rxtx_map(paddr_t tx_addr, paddr_t rx_addr,
-                            uint32_t page_count)
-{
-    return ffa_simple_call(FFA_RXTX_MAP_64, tx_addr, rx_addr, page_count, 0);
-}
-
-static int32_t ffa_rxtx_unmap(void)
-{
-    return ffa_simple_call(FFA_RXTX_UNMAP, 0, 0, 0, 0);
-}
-
 void ffa_rxtx_domain_destroy(struct domain *d)
 {
-    struct ffa_ctx *ctx = d->arch.tee;
-
-    if ( ctx->rx )
-        rxtx_unmap(ctx);
+    rxtx_unmap(d);
 }
 
 void ffa_rxtx_destroy(void)
@@ -186,7 +293,7 @@ void ffa_rxtx_destroy(void)
     }
 
     if ( need_unmap )
-        ffa_rxtx_unmap();
+        ffa_rxtx_unmap(0);
 }
 
 bool ffa_rxtx_init(void)
diff --git a/xen/arch/arm/tee/ffa_shm.c b/xen/arch/arm/tee/ffa_shm.c
index 29675f9ba3..d628c1b706 100644
--- a/xen/arch/arm/tee/ffa_shm.c
+++ b/xen/arch/arm/tee/ffa_shm.c
@@ -16,21 +16,6 @@
 
 #include "ffa_private.h"
 
-/* Constituent memory region descriptor */
-struct ffa_address_range {
-    uint64_t address;
-    uint32_t page_count;
-    uint32_t reserved;
-};
-
-/* Composite memory region descriptor */
-struct ffa_mem_region {
-    uint32_t total_page_count;
-    uint32_t address_range_count;
-    uint64_t reserved;
-    struct ffa_address_range address_range_array[];
-};
-
 /* Memory access permissions descriptor */
 struct ffa_mem_access_perm {
     uint16_t endpoint_id;
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Dec 16 20:12:19 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 16 Dec 2024 20:12:19 +0000
Received: from list by lists.xenproject.org with outflank-mailman.858479.1270710 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tNHRz-0005KX-Ek; Mon, 16 Dec 2024 20:12:19 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 858479.1270710; Mon, 16 Dec 2024 20:12:19 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tNHRz-0005KP-CD; Mon, 16 Dec 2024 20:12:19 +0000
Received: by outflank-mailman (input) for mailman id 858479;
 Mon, 16 Dec 2024 20:12:18 +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 1tNHRy-0005KA-Oy
 for xen-changelog@lists.xenproject.org; Mon, 16 Dec 2024 20:12:18 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1tNHRy-006UST-1R
 for xen-changelog@lists.xenproject.org;
 Mon, 16 Dec 2024 20:12:18 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1tNHRy-00BgOr-2J
 for xen-changelog@lists.xenproject.org;
 Mon, 16 Dec 2024 20:12:18 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/arm: ffa: move message function into ffa_msg.c
Message-Id: <E1tNHRy-00BgOr-2J@xenbits.xenproject.org>
Date: Mon, 16 Dec 2024 20:12:18 +0000

commit 42b6f47132474d1bf4aae8c9ab31c1a8f1df9e45
Author:     Bertrand Marquis <bertrand.marquis@arm.com>
AuthorDate: Wed Nov 27 17:07:40 2024 +0100
Commit:     Julien Grall <julien@xen.org>
CommitDate: Mon Dec 16 21:04:17 2024 +0100

    xen/arm: ffa: move message function into ffa_msg.c
    
    Move the direct message handling function in its own source file and
    rename it to have a ffa_ prefix.
    This is a preparation to add support for indirect messages which will
    go into this newly created source file.
    
    Signed-off-by: Bertrand Marquis <bertrand.marquis@arm.com>
    Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
---
 xen/arch/arm/tee/Makefile      |  1 +
 xen/arch/arm/tee/ffa.c         | 69 +-----------------------------------
 xen/arch/arm/tee/ffa_msg.c     | 80 ++++++++++++++++++++++++++++++++++++++++++
 xen/arch/arm/tee/ffa_private.h |  2 ++
 4 files changed, 84 insertions(+), 68 deletions(-)

diff --git a/xen/arch/arm/tee/Makefile b/xen/arch/arm/tee/Makefile
index 7c0f46f7f4..0848c833fe 100644
--- a/xen/arch/arm/tee/Makefile
+++ b/xen/arch/arm/tee/Makefile
@@ -3,5 +3,6 @@ obj-$(CONFIG_FFA) += ffa_shm.o
 obj-$(CONFIG_FFA) += ffa_partinfo.o
 obj-$(CONFIG_FFA) += ffa_rxtx.o
 obj-$(CONFIG_FFA) += ffa_notif.o
+obj-$(CONFIG_FFA) += ffa_msg.o
 obj-y += tee.o
 obj-$(CONFIG_OPTEE) += optee.o
diff --git a/xen/arch/arm/tee/ffa.c b/xen/arch/arm/tee/ffa.c
index bc2722d53f..8488fe6af9 100644
--- a/xen/arch/arm/tee/ffa.c
+++ b/xen/arch/arm/tee/ffa.c
@@ -167,73 +167,6 @@ static void handle_version(struct cpu_user_regs *regs)
     ffa_set_regs(regs, FFA_MY_VERSION, 0, 0, 0, 0, 0, 0, 0);
 }
 
-static void handle_msg_send_direct_req(struct cpu_user_regs *regs, uint32_t fid)
-{
-    struct arm_smccc_1_2_regs arg = { .a0 = fid, };
-    struct arm_smccc_1_2_regs resp = { };
-    struct domain *d = current->domain;
-    uint32_t src_dst;
-    uint64_t mask;
-
-    if ( smccc_is_conv_64(fid) )
-        mask = GENMASK_ULL(63, 0);
-    else
-        mask = GENMASK_ULL(31, 0);
-
-    if ( !ffa_fw_supports_fid(fid) )
-    {
-        resp.a0 = FFA_ERROR;
-        resp.a2 = FFA_RET_NOT_SUPPORTED;
-        goto out;
-    }
-
-    src_dst = get_user_reg(regs, 1);
-    if ( (src_dst >> 16) != ffa_get_vm_id(d) )
-    {
-        resp.a0 = FFA_ERROR;
-        resp.a2 = FFA_RET_INVALID_PARAMETERS;
-        goto out;
-    }
-
-    /* we do not support direct messages to VMs */
-    if ( !FFA_ID_IS_SECURE(src_dst & GENMASK(15,0)) )
-    {
-        resp.a0 = FFA_ERROR;
-        resp.a2 = FFA_RET_NOT_SUPPORTED;
-        goto out;
-    }
-
-    arg.a1 = src_dst;
-    arg.a2 = get_user_reg(regs, 2) & mask;
-    arg.a3 = get_user_reg(regs, 3) & mask;
-    arg.a4 = get_user_reg(regs, 4) & mask;
-    arg.a5 = get_user_reg(regs, 5) & mask;
-    arg.a6 = get_user_reg(regs, 6) & mask;
-    arg.a7 = get_user_reg(regs, 7) & mask;
-
-    arm_smccc_1_2_smc(&arg, &resp);
-    switch ( resp.a0 )
-    {
-    case FFA_ERROR:
-    case FFA_SUCCESS_32:
-    case FFA_SUCCESS_64:
-    case FFA_MSG_SEND_DIRECT_RESP_32:
-    case FFA_MSG_SEND_DIRECT_RESP_64:
-        break;
-    default:
-        /* Bad fid, report back to the caller. */
-        memset(&resp, 0, sizeof(resp));
-        resp.a0 = FFA_ERROR;
-        resp.a1 = src_dst;
-        resp.a2 = FFA_RET_ABORTED;
-    }
-
-out:
-    ffa_set_regs(regs, resp.a0, resp.a1 & mask, resp.a2 & mask, resp.a3 & mask,
-                 resp.a4 & mask, resp.a5 & mask, resp.a6 & mask,
-                 resp.a7 & mask);
-}
-
 static void handle_features(struct cpu_user_regs *regs)
 {
     struct domain *d = current->domain;
@@ -351,7 +284,7 @@ static bool ffa_handle_call(struct cpu_user_regs *regs)
         break;
     case FFA_MSG_SEND_DIRECT_REQ_32:
     case FFA_MSG_SEND_DIRECT_REQ_64:
-        handle_msg_send_direct_req(regs, fid);
+        ffa_handle_msg_send_direct_req(regs, fid);
         return true;
     case FFA_MEM_SHARE_32:
     case FFA_MEM_SHARE_64:
diff --git a/xen/arch/arm/tee/ffa_msg.c b/xen/arch/arm/tee/ffa_msg.c
new file mode 100644
index 0000000000..ae263e5489
--- /dev/null
+++ b/xen/arch/arm/tee/ffa_msg.c
@@ -0,0 +1,80 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+/*
+ * Copyright (C) 2024  Linaro Limited
+ */
+
+#include <xen/const.h>
+#include <xen/sizes.h>
+#include <xen/types.h>
+
+#include <asm/smccc.h>
+#include <asm/regs.h>
+
+#include "ffa_private.h"
+
+void ffa_handle_msg_send_direct_req(struct cpu_user_regs *regs, uint32_t fid)
+{
+    struct arm_smccc_1_2_regs arg = { .a0 = fid, };
+    struct arm_smccc_1_2_regs resp = { };
+    struct domain *d = current->domain;
+    uint32_t src_dst;
+    uint64_t mask;
+
+    if ( smccc_is_conv_64(fid) )
+        mask = GENMASK_ULL(63, 0);
+    else
+        mask = GENMASK_ULL(31, 0);
+
+    if ( !ffa_fw_supports_fid(fid) )
+    {
+        resp.a0 = FFA_ERROR;
+        resp.a2 = FFA_RET_NOT_SUPPORTED;
+        goto out;
+    }
+
+    src_dst = get_user_reg(regs, 1);
+    if ( (src_dst >> 16) != ffa_get_vm_id(d) )
+    {
+        resp.a0 = FFA_ERROR;
+        resp.a2 = FFA_RET_INVALID_PARAMETERS;
+        goto out;
+    }
+
+    /* we do not support direct messages to VMs */
+    if ( !FFA_ID_IS_SECURE(src_dst & GENMASK(15,0)) )
+    {
+        resp.a0 = FFA_ERROR;
+        resp.a2 = FFA_RET_NOT_SUPPORTED;
+        goto out;
+    }
+
+    arg.a1 = src_dst;
+    arg.a2 = get_user_reg(regs, 2) & mask;
+    arg.a3 = get_user_reg(regs, 3) & mask;
+    arg.a4 = get_user_reg(regs, 4) & mask;
+    arg.a5 = get_user_reg(regs, 5) & mask;
+    arg.a6 = get_user_reg(regs, 6) & mask;
+    arg.a7 = get_user_reg(regs, 7) & mask;
+
+    arm_smccc_1_2_smc(&arg, &resp);
+    switch ( resp.a0 )
+    {
+    case FFA_ERROR:
+    case FFA_SUCCESS_32:
+    case FFA_SUCCESS_64:
+    case FFA_MSG_SEND_DIRECT_RESP_32:
+    case FFA_MSG_SEND_DIRECT_RESP_64:
+        break;
+    default:
+        /* Bad fid, report back to the caller. */
+        memset(&resp, 0, sizeof(resp));
+        resp.a0 = FFA_ERROR;
+        resp.a1 = src_dst;
+        resp.a2 = FFA_RET_ABORTED;
+    }
+
+out:
+    ffa_set_regs(regs, resp.a0, resp.a1 & mask, resp.a2 & mask, resp.a3 & mask,
+                 resp.a4 & mask, resp.a5 & mask, resp.a6 & mask,
+                 resp.a7 & mask);
+}
diff --git a/xen/arch/arm/tee/ffa_private.h b/xen/arch/arm/tee/ffa_private.h
index 9adfe687c3..02162e0ee4 100644
--- a/xen/arch/arm/tee/ffa_private.h
+++ b/xen/arch/arm/tee/ffa_private.h
@@ -360,6 +360,8 @@ void ffa_handle_notification_info_get(struct cpu_user_regs *regs);
 void ffa_handle_notification_get(struct cpu_user_regs *regs);
 int ffa_handle_notification_set(struct cpu_user_regs *regs);
 
+void ffa_handle_msg_send_direct_req(struct cpu_user_regs *regs, uint32_t fid);
+
 static inline uint16_t ffa_get_vm_id(const struct domain *d)
 {
     /* +1 since 0 is reserved for the hypervisor in FF-A */
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Dec 16 20:12:29 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 16 Dec 2024 20:12:29 +0000
Received: from list by lists.xenproject.org with outflank-mailman.858480.1270715 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tNHS9-0005N4-GJ; Mon, 16 Dec 2024 20:12:29 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 858480.1270715; Mon, 16 Dec 2024 20:12:29 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tNHS9-0005Mw-Df; Mon, 16 Dec 2024 20:12:29 +0000
Received: by outflank-mailman (input) for mailman id 858480;
 Mon, 16 Dec 2024 20:12:28 +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 1tNHS8-0005Mq-S1
 for xen-changelog@lists.xenproject.org; Mon, 16 Dec 2024 20:12:28 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1tNHS8-006USY-1k
 for xen-changelog@lists.xenproject.org;
 Mon, 16 Dec 2024 20:12:28 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1tNHS8-00BgR7-2Z
 for xen-changelog@lists.xenproject.org;
 Mon, 16 Dec 2024 20:12:28 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/arm: ffa: Remove per VM notif_enabled
Message-Id: <E1tNHS8-00BgR7-2Z@xenbits.xenproject.org>
Date: Mon, 16 Dec 2024 20:12:28 +0000

commit e6794b683b817463a8a3f8670dd720f33ed11f1f
Author:     Bertrand Marquis <bertrand.marquis@arm.com>
AuthorDate: Wed Nov 27 17:07:41 2024 +0100
Commit:     Julien Grall <julien@xen.org>
CommitDate: Mon Dec 16 21:04:17 2024 +0100

    xen/arm: ffa: Remove per VM notif_enabled
    
    Remove the per VM flag to store if notifications are enabled or not as
    the only case where they are not, if notifications are enabled globally,
    will make the VM creation fail.
    Also use the opportunity to always give the notifications interrupts IDs
    to VM. If the firmware does not support notifications, there won't be
    any generated and setting one will give back a NOT_SUPPORTED.
    
    Signed-off-by: Bertrand Marquis <bertrand.marquis@arm.com>
    Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
---
 xen/arch/arm/tee/ffa.c         | 17 +++--------------
 xen/arch/arm/tee/ffa_notif.c   | 14 +++++---------
 xen/arch/arm/tee/ffa_private.h |  2 --
 3 files changed, 8 insertions(+), 25 deletions(-)

diff --git a/xen/arch/arm/tee/ffa.c b/xen/arch/arm/tee/ffa.c
index 8488fe6af9..04d2403415 100644
--- a/xen/arch/arm/tee/ffa.c
+++ b/xen/arch/arm/tee/ffa.c
@@ -169,8 +169,6 @@ static void handle_version(struct cpu_user_regs *regs)
 
 static void handle_features(struct cpu_user_regs *regs)
 {
-    struct domain *d = current->domain;
-    struct ffa_ctx *ctx = d->arch.tee;
     uint32_t a1 = get_user_reg(regs, 1);
     unsigned int n;
 
@@ -218,16 +216,10 @@ static void handle_features(struct cpu_user_regs *regs)
         ffa_set_regs_success(regs, 0, 0);
         break;
     case FFA_FEATURE_NOTIF_PEND_INTR:
-        if ( ctx->notif.enabled )
-            ffa_set_regs_success(regs, GUEST_FFA_NOTIF_PEND_INTR_ID, 0);
-        else
-            ffa_set_regs_error(regs, FFA_RET_NOT_SUPPORTED);
+        ffa_set_regs_success(regs, GUEST_FFA_NOTIF_PEND_INTR_ID, 0);
         break;
     case FFA_FEATURE_SCHEDULE_RECV_INTR:
-        if ( ctx->notif.enabled )
-            ffa_set_regs_success(regs, GUEST_FFA_SCHEDULE_RECV_INTR_ID, 0);
-        else
-            ffa_set_regs_error(regs, FFA_RET_NOT_SUPPORTED);
+        ffa_set_regs_success(regs, GUEST_FFA_SCHEDULE_RECV_INTR_ID, 0);
         break;
 
     case FFA_NOTIFICATION_BIND:
@@ -236,10 +228,7 @@ static void handle_features(struct cpu_user_regs *regs)
     case FFA_NOTIFICATION_SET:
     case FFA_NOTIFICATION_INFO_GET_32:
     case FFA_NOTIFICATION_INFO_GET_64:
-        if ( ctx->notif.enabled )
-            ffa_set_regs_success(regs, 0, 0);
-        else
-            ffa_set_regs_error(regs, FFA_RET_NOT_SUPPORTED);
+        ffa_set_regs_success(regs, 0, 0);
         break;
     default:
         ffa_set_regs_error(regs, FFA_RET_NOT_SUPPORTED);
diff --git a/xen/arch/arm/tee/ffa_notif.c b/xen/arch/arm/tee/ffa_notif.c
index 4b3e46318f..21b9e78f63 100644
--- a/xen/arch/arm/tee/ffa_notif.c
+++ b/xen/arch/arm/tee/ffa_notif.c
@@ -405,7 +405,6 @@ void ffa_notif_init(void)
 
 int ffa_notif_domain_init(struct domain *d)
 {
-    struct ffa_ctx *ctx = d->arch.tee;
     int32_t res;
 
     if ( !notif_enabled )
@@ -415,18 +414,15 @@ int ffa_notif_domain_init(struct domain *d)
     if ( res )
         return -ENOMEM;
 
-    ctx->notif.enabled = true;
-
     return 0;
 }
 
 void ffa_notif_domain_destroy(struct domain *d)
 {
-    struct ffa_ctx *ctx = d->arch.tee;
-
-    if ( ctx->notif.enabled )
-    {
+    /*
+     * Call bitmap_destroy even if bitmap create failed as the SPMC will
+     * return a DENIED error that we will ignore.
+     */
+    if ( notif_enabled )
         ffa_notification_bitmap_destroy(ffa_get_vm_id(d));
-        ctx->notif.enabled = false;
-    }
 }
diff --git a/xen/arch/arm/tee/ffa_private.h b/xen/arch/arm/tee/ffa_private.h
index 02162e0ee4..973ee55be0 100644
--- a/xen/arch/arm/tee/ffa_private.h
+++ b/xen/arch/arm/tee/ffa_private.h
@@ -281,8 +281,6 @@ struct ffa_mem_region {
 };
 
 struct ffa_ctx_notif {
-    bool enabled;
-
     /*
      * True if domain is reported by FFA_NOTIFICATION_INFO_GET to have
      * pending global notifications.
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Dec 16 20:12:39 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 16 Dec 2024 20:12:39 +0000
Received: from list by lists.xenproject.org with outflank-mailman.858481.1270718 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tNHSJ-0005Pw-Hc; Mon, 16 Dec 2024 20:12:39 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 858481.1270718; Mon, 16 Dec 2024 20:12:39 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tNHSJ-0005Po-F5; Mon, 16 Dec 2024 20:12:39 +0000
Received: by outflank-mailman (input) for mailman id 858481;
 Mon, 16 Dec 2024 20:12:39 +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 1tNHSI-0005Pg-Ue
 for xen-changelog@lists.xenproject.org; Mon, 16 Dec 2024 20:12:38 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1tNHSI-006USw-21
 for xen-changelog@lists.xenproject.org;
 Mon, 16 Dec 2024 20:12:38 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1tNHSI-00BgTH-2t
 for xen-changelog@lists.xenproject.org;
 Mon, 16 Dec 2024 20:12:38 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/arm: ffa: Add indirect message support
Message-Id: <E1tNHSI-00BgTH-2t@xenbits.xenproject.org>
Date: Mon, 16 Dec 2024 20:12:38 +0000

commit df8a0eec1c66fac9a74a3fb62f4d9713999392c3
Author:     Bertrand Marquis <bertrand.marquis@arm.com>
AuthorDate: Wed Nov 27 17:07:42 2024 +0100
Commit:     Julien Grall <julien@xen.org>
CommitDate: Mon Dec 16 21:04:17 2024 +0100

    xen/arm: ffa: Add indirect message support
    
    Add support for FFA_MSG_SEND2 to send indirect messages from a VM to a
    secure partition.
    
    Signed-off-by: Bertrand Marquis <bertrand.marquis@arm.com>
    Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
---
 xen/arch/arm/tee/ffa.c         |  5 +++++
 xen/arch/arm/tee/ffa_msg.c     | 50 ++++++++++++++++++++++++++++++++++++++++++
 xen/arch/arm/tee/ffa_private.h |  1 +
 3 files changed, 56 insertions(+)

diff --git a/xen/arch/arm/tee/ffa.c b/xen/arch/arm/tee/ffa.c
index 04d2403415..87775ed88f 100644
--- a/xen/arch/arm/tee/ffa.c
+++ b/xen/arch/arm/tee/ffa.c
@@ -101,6 +101,7 @@ static const struct ffa_fw_abi ffa_fw_abi_needed[] = {
     FW_ABI(FFA_MEM_RECLAIM),
     FW_ABI(FFA_MSG_SEND_DIRECT_REQ_32),
     FW_ABI(FFA_MSG_SEND_DIRECT_REQ_64),
+    FW_ABI(FFA_MSG_SEND2),
 };
 
 /*
@@ -195,6 +196,7 @@ static void handle_features(struct cpu_user_regs *regs)
     case FFA_PARTITION_INFO_GET:
     case FFA_MSG_SEND_DIRECT_REQ_32:
     case FFA_MSG_SEND_DIRECT_REQ_64:
+    case FFA_MSG_SEND2:
         ffa_set_regs_success(regs, 0, 0);
         break;
     case FFA_MEM_SHARE_64:
@@ -275,6 +277,9 @@ static bool ffa_handle_call(struct cpu_user_regs *regs)
     case FFA_MSG_SEND_DIRECT_REQ_64:
         ffa_handle_msg_send_direct_req(regs, fid);
         return true;
+    case FFA_MSG_SEND2:
+        e = ffa_handle_msg_send2(regs);
+        break;
     case FFA_MEM_SHARE_32:
     case FFA_MEM_SHARE_64:
         ffa_handle_mem_share(regs);
diff --git a/xen/arch/arm/tee/ffa_msg.c b/xen/arch/arm/tee/ffa_msg.c
index ae263e5489..ee594e737f 100644
--- a/xen/arch/arm/tee/ffa_msg.c
+++ b/xen/arch/arm/tee/ffa_msg.c
@@ -12,6 +12,15 @@
 
 #include "ffa_private.h"
 
+/* Encoding of partition message in RX/TX buffer */
+struct ffa_part_msg_rxtx {
+    uint32_t flags;
+    uint32_t reserved;
+    uint32_t msg_offset;
+    uint32_t send_recv_id;
+    uint32_t msg_size;
+};
+
 void ffa_handle_msg_send_direct_req(struct cpu_user_regs *regs, uint32_t fid)
 {
     struct arm_smccc_1_2_regs arg = { .a0 = fid, };
@@ -78,3 +87,44 @@ out:
                  resp.a4 & mask, resp.a5 & mask, resp.a6 & mask,
                  resp.a7 & mask);
 }
+
+int32_t ffa_handle_msg_send2(struct cpu_user_regs *regs)
+{
+    struct domain *src_d = current->domain;
+    struct ffa_ctx *src_ctx = src_d->arch.tee;
+    const struct ffa_part_msg_rxtx *src_msg;
+    uint16_t dst_id, src_id;
+    int32_t ret;
+
+    if ( !ffa_fw_supports_fid(FFA_MSG_SEND2) )
+        return FFA_RET_NOT_SUPPORTED;
+
+    if ( !spin_trylock(&src_ctx->tx_lock) )
+        return FFA_RET_BUSY;
+
+    src_msg = src_ctx->tx;
+    src_id = src_msg->send_recv_id >> 16;
+    dst_id = src_msg->send_recv_id & GENMASK(15,0);
+
+    if ( src_id != ffa_get_vm_id(src_d) || !FFA_ID_IS_SECURE(dst_id) )
+    {
+        ret = FFA_RET_INVALID_PARAMETERS;
+        goto out_unlock_tx;
+    }
+
+    /* check source message fits in buffer */
+    if ( src_ctx->page_count * FFA_PAGE_SIZE <
+         src_msg->msg_offset + src_msg->msg_size ||
+         src_msg->msg_offset < sizeof(struct ffa_part_msg_rxtx) )
+    {
+        ret = FFA_RET_INVALID_PARAMETERS;
+        goto out_unlock_tx;
+    }
+
+    ret = ffa_simple_call(FFA_MSG_SEND2,
+                          ((uint32_t)ffa_get_vm_id(src_d)) << 16, 0, 0, 0);
+
+out_unlock_tx:
+    spin_unlock(&src_ctx->tx_lock);
+    return ret;
+}
diff --git a/xen/arch/arm/tee/ffa_private.h b/xen/arch/arm/tee/ffa_private.h
index 973ee55be0..d441c0ca55 100644
--- a/xen/arch/arm/tee/ffa_private.h
+++ b/xen/arch/arm/tee/ffa_private.h
@@ -359,6 +359,7 @@ void ffa_handle_notification_get(struct cpu_user_regs *regs);
 int ffa_handle_notification_set(struct cpu_user_regs *regs);
 
 void ffa_handle_msg_send_direct_req(struct cpu_user_regs *regs, uint32_t fid);
+int32_t ffa_handle_msg_send2(struct cpu_user_regs *regs);
 
 static inline uint16_t ffa_get_vm_id(const struct domain *d)
 {
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Dec 17 08:00:14 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 17 Dec 2024 08:00:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.858543.1270773 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tNSUt-0000ZQ-JE; Tue, 17 Dec 2024 08:00:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 858543.1270773; Tue, 17 Dec 2024 08: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 1tNSUt-0000ZD-Fo; Tue, 17 Dec 2024 08:00:03 +0000
Received: by outflank-mailman (input) for mailman id 858543;
 Tue, 17 Dec 2024 08: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 1tNSUr-0008J9-Rm
 for xen-changelog@lists.xenproject.org; Tue, 17 Dec 2024 08:00:01 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1tNSUr-007vMw-1M
 for xen-changelog@lists.xenproject.org;
 Tue, 17 Dec 2024 08:00:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1tNSUr-00DYwP-20
 for xen-changelog@lists.xenproject.org;
 Tue, 17 Dec 2024 08: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>
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/arm: ffa: Rework firmware discovery
Message-Id: <E1tNSUr-00DYwP-20@xenbits.xenproject.org>
Date: Tue, 17 Dec 2024 08:00:01 +0000

commit cf15d857072e4265dd7af57404ca14cc2225e9f7
Author:     Bertrand Marquis <bertrand.marquis@arm.com>
AuthorDate: Wed Nov 27 17:07:33 2024 +0100
Commit:     Julien Grall <julien@xen.org>
CommitDate: Mon Dec 16 21:00:25 2024 +0100

    xen/arm: ffa: Rework firmware discovery
    
    Rework firmware discovery during probe:
    - move prints into the probe
    - rename ffa_version to ffa_fw_version as the variable identifies the
      version of the firmware and not the one we support
    - add error prints when allocation fail during probe
    
    No functional changes.
    
    Signed-off-by: Bertrand Marquis <bertrand.marquis@arm.com>
    Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
---
 xen/arch/arm/tee/ffa.c      | 41 +++++++++++++++++++++++++----------------
 xen/arch/arm/tee/ffa_rxtx.c |  4 +---
 2 files changed, 26 insertions(+), 19 deletions(-)

diff --git a/xen/arch/arm/tee/ffa.c b/xen/arch/arm/tee/ffa.c
index 022089278e..5a7f297ca5 100644
--- a/xen/arch/arm/tee/ffa.c
+++ b/xen/arch/arm/tee/ffa.c
@@ -71,8 +71,8 @@
 
 #include "ffa_private.h"
 
-/* Negotiated FF-A version to use with the SPMC */
-static uint32_t __ro_after_init ffa_version;
+/* Negotiated FF-A version to use with the SPMC, 0 if not there or supported */
+static uint32_t __ro_after_init ffa_fw_version;
 
 
 /*
@@ -105,10 +105,7 @@ static bool ffa_get_version(uint32_t *vers)
 
     arm_smccc_1_2_smc(&arg, &resp);
     if ( resp.a0 == FFA_RET_NOT_SUPPORTED )
-    {
-        gprintk(XENLOG_ERR, "ffa: FFA_VERSION returned not supported\n");
         return false;
-    }
 
     *vers = resp.a0;
 
@@ -372,7 +369,7 @@ static int ffa_domain_init(struct domain *d)
     struct ffa_ctx *ctx;
     int ret;
 
-    if ( !ffa_version )
+    if ( !ffa_fw_version )
         return -ENODEV;
      /*
       * We can't use that last possible domain ID or ffa_get_vm_id() would
@@ -505,6 +502,9 @@ static bool ffa_probe(void)
      */
     BUILD_BUG_ON(PAGE_SIZE != FFA_PAGE_SIZE);
 
+    printk(XENLOG_INFO "ARM FF-A Mediator version %u.%u\n",
+           FFA_MY_VERSION_MAJOR, FFA_MY_VERSION_MINOR);
+
     /*
      * psci_init_smccc() updates this value with what's reported by EL-3
      * or secure world.
@@ -514,22 +514,23 @@ static bool ffa_probe(void)
         printk(XENLOG_ERR
                "ffa: unsupported SMCCC version %#x (need at least %#x)\n",
                smccc_ver, ARM_SMCCC_VERSION_1_2);
-        return false;
+        goto err_no_fw;
     }
 
     if ( !ffa_get_version(&vers) )
-        return false;
+    {
+        gprintk(XENLOG_ERR, "Cannot retrieve the FFA version\n");
+        goto err_no_fw;
+    }
 
     if ( vers < FFA_MIN_SPMC_VERSION || vers > FFA_MY_VERSION )
     {
         printk(XENLOG_ERR "ffa: Incompatible version %#x found\n", vers);
-        return false;
+        goto err_no_fw;
     }
 
     major_vers = (vers >> FFA_VERSION_MAJOR_SHIFT) & FFA_VERSION_MAJOR_MASK;
     minor_vers = vers & FFA_VERSION_MINOR_MASK;
-    printk(XENLOG_INFO "ARM FF-A Mediator version %u.%u\n",
-           FFA_MY_VERSION_MAJOR, FFA_MY_VERSION_MINOR);
     printk(XENLOG_INFO "ARM FF-A Firmware version %u.%u\n",
            major_vers, minor_vers);
 
@@ -546,12 +547,18 @@ static bool ffa_probe(void)
          !check_mandatory_feature(FFA_MEM_SHARE_32) ||
          !check_mandatory_feature(FFA_MEM_RECLAIM) ||
          !check_mandatory_feature(FFA_MSG_SEND_DIRECT_REQ_32) )
-        return false;
+    {
+        printk(XENLOG_ERR "ffa: Mandatory feature not supported by fw\n");
+        goto err_no_fw;
+    }
 
-    if ( !ffa_rxtx_init() )
-        return false;
+    ffa_fw_version = vers;
 
-    ffa_version = vers;
+    if ( !ffa_rxtx_init() )
+    {
+        printk(XENLOG_ERR "ffa: Error during RXTX buffer init\n");
+        goto err_no_fw;
+    }
 
     if ( !ffa_partinfo_init() )
         goto err_rxtx_destroy;
@@ -564,7 +571,9 @@ static bool ffa_probe(void)
 
 err_rxtx_destroy:
     ffa_rxtx_destroy();
-    ffa_version = 0;
+err_no_fw:
+    ffa_fw_version = 0;
+    printk(XENLOG_WARNING "ARM FF-A No firmware support\n");
 
     return false;
 }
diff --git a/xen/arch/arm/tee/ffa_rxtx.c b/xen/arch/arm/tee/ffa_rxtx.c
index 661764052e..c8bc516a19 100644
--- a/xen/arch/arm/tee/ffa_rxtx.c
+++ b/xen/arch/arm/tee/ffa_rxtx.c
@@ -203,10 +203,8 @@ bool ffa_rxtx_init(void)
 
     e = ffa_rxtx_map(__pa(ffa_tx), __pa(ffa_rx), FFA_RXTX_PAGE_COUNT);
     if ( e )
-    {
-        printk(XENLOG_ERR "ffa: Failed to map rxtx: error %d\n", e);
         goto err;
-    }
+
     return true;
 
 err:
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Dec 17 08:00:14 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 17 Dec 2024 08:00:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.858546.1270777 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tNSV3-0001Ep-Lw; Tue, 17 Dec 2024 08:00:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 858546.1270777; Tue, 17 Dec 2024 08: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 1tNSV3-0001EZ-J3; Tue, 17 Dec 2024 08:00:13 +0000
Received: by outflank-mailman (input) for mailman id 858546;
 Tue, 17 Dec 2024 08: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 1tNSV1-0001E8-Ro
 for xen-changelog@lists.xenproject.org; Tue, 17 Dec 2024 08:00:11 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1tNSV1-007vpU-1i
 for xen-changelog@lists.xenproject.org;
 Tue, 17 Dec 2024 08:00:11 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1tNSV1-00DYyA-2V
 for xen-changelog@lists.xenproject.org;
 Tue, 17 Dec 2024 08: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>
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/arm: ffa: Rework feature discovery
Message-Id: <E1tNSV1-00DYyA-2V@xenbits.xenproject.org>
Date: Tue, 17 Dec 2024 08:00:11 +0000

commit 1a20f862f365876f2b0f9e7c804d86dc1038b66b
Author:     Bertrand Marquis <bertrand.marquis@arm.com>
AuthorDate: Wed Nov 27 17:07:34 2024 +0100
Commit:     Julien Grall <julien@xen.org>
CommitDate: Mon Dec 16 21:00:25 2024 +0100

    xen/arm: ffa: Rework feature discovery
    
    Store the list of ABI we need in a list and go through the list instead
    of having a list of conditions inside the code.
    
    No functional change.
    
    Signed-off-by: Bertrand Marquis <bertrand.marquis@arm.com>
    Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
---
 xen/arch/arm/tee/ffa.c | 57 ++++++++++++++++++++++++++++++--------------------
 1 file changed, 34 insertions(+), 23 deletions(-)

diff --git a/xen/arch/arm/tee/ffa.c b/xen/arch/arm/tee/ffa.c
index 5a7f297ca5..ade6aaa6fd 100644
--- a/xen/arch/arm/tee/ffa.c
+++ b/xen/arch/arm/tee/ffa.c
@@ -74,6 +74,31 @@
 /* Negotiated FF-A version to use with the SPMC, 0 if not there or supported */
 static uint32_t __ro_after_init ffa_fw_version;
 
+struct ffa_fw_abi {
+    uint32_t id;
+    const char *name;
+};
+
+#define FW_ABI(abi) {abi,#abi}
+
+/* List of ABI we use from the firmware */
+static const struct ffa_fw_abi ffa_fw_abi_needed[] = {
+    FW_ABI(FFA_VERSION),
+    FW_ABI(FFA_FEATURES),
+    FW_ABI(FFA_NOTIFICATION_BITMAP_CREATE),
+    FW_ABI(FFA_NOTIFICATION_BITMAP_DESTROY),
+    FW_ABI(FFA_PARTITION_INFO_GET),
+    FW_ABI(FFA_NOTIFICATION_INFO_GET_64),
+    FW_ABI(FFA_NOTIFICATION_GET),
+    FW_ABI(FFA_RX_RELEASE),
+    FW_ABI(FFA_RXTX_MAP_64),
+    FW_ABI(FFA_RXTX_UNMAP),
+    FW_ABI(FFA_MEM_SHARE_32),
+    FW_ABI(FFA_MEM_SHARE_64),
+    FW_ABI(FFA_MEM_RECLAIM),
+    FW_ABI(FFA_MSG_SEND_DIRECT_REQ_32),
+    FW_ABI(FFA_MSG_SEND_DIRECT_REQ_64),
+};
 
 /*
  * Our rx/tx buffers shared with the SPMC. FFA_RXTX_PAGE_COUNT is the
@@ -112,20 +137,9 @@ static bool ffa_get_version(uint32_t *vers)
     return true;
 }
 
-static int32_t ffa_features(uint32_t id)
-{
-    return ffa_simple_call(FFA_FEATURES, id, 0, 0, 0);
-}
-
-static bool check_mandatory_feature(uint32_t id)
+static bool ffa_abi_supported(uint32_t id)
 {
-    int32_t ret = ffa_features(id);
-
-    if ( ret )
-        printk(XENLOG_ERR "ffa: mandatory feature id %#x missing: error %d\n",
-               id, ret);
-
-    return !ret;
+    return !ffa_simple_call(FFA_FEATURES, id, 0, 0, 0);
 }
 
 static void handle_version(struct cpu_user_regs *regs)
@@ -539,17 +553,14 @@ static bool ffa_probe(void)
      * TODO: Rework the code to allow domain to use a subset of the
      * features supported.
      */
-    if ( !check_mandatory_feature(FFA_PARTITION_INFO_GET) ||
-         !check_mandatory_feature(FFA_RX_RELEASE) ||
-         !check_mandatory_feature(FFA_RXTX_MAP_64) ||
-         !check_mandatory_feature(FFA_MEM_SHARE_64) ||
-         !check_mandatory_feature(FFA_RXTX_UNMAP) ||
-         !check_mandatory_feature(FFA_MEM_SHARE_32) ||
-         !check_mandatory_feature(FFA_MEM_RECLAIM) ||
-         !check_mandatory_feature(FFA_MSG_SEND_DIRECT_REQ_32) )
+    for ( unsigned int i = 0; i < ARRAY_SIZE(ffa_fw_abi_needed); i++ )
     {
-        printk(XENLOG_ERR "ffa: Mandatory feature not supported by fw\n");
-        goto err_no_fw;
+        if ( !ffa_abi_supported(ffa_fw_abi_needed[i].id) )
+        {
+            printk(XENLOG_INFO "ARM FF-A Firmware does not support %s\n",
+                   ffa_fw_abi_needed[i].name);
+            goto err_no_fw;
+        }
     }
 
     ffa_fw_version = vers;
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Dec 17 08:00:22 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 17 Dec 2024 08:00:22 +0000
Received: from list by lists.xenproject.org with outflank-mailman.858547.1270781 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tNSVC-0001Od-Nh; Tue, 17 Dec 2024 08:00:22 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 858547.1270781; Tue, 17 Dec 2024 08: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 1tNSVC-0001OV-Kv; Tue, 17 Dec 2024 08:00:22 +0000
Received: by outflank-mailman (input) for mailman id 858547;
 Tue, 17 Dec 2024 08: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 1tNSVC-0001OL-0I
 for xen-changelog@lists.xenproject.org; Tue, 17 Dec 2024 08:00:22 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1tNSVB-007vum-27
 for xen-changelog@lists.xenproject.org;
 Tue, 17 Dec 2024 08:00:21 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1tNSVB-00DZ0M-2r
 for xen-changelog@lists.xenproject.org;
 Tue, 17 Dec 2024 08: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>
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/arm: ffa: Fix version negotiation
Message-Id: <E1tNSVB-00DZ0M-2r@xenbits.xenproject.org>
Date: Tue, 17 Dec 2024 08:00:21 +0000

commit da07df55580368ad696f39d58a8c100a37f6cd13
Author:     Bertrand Marquis <bertrand.marquis@arm.com>
AuthorDate: Wed Nov 27 17:07:35 2024 +0100
Commit:     Julien Grall <julien@xen.org>
CommitDate: Mon Dec 16 21:00:25 2024 +0100

    xen/arm: ffa: Fix version negotiation
    
    Fix FFA version negotiation with the firmware to follow the
    specification guidance more closely (see FF-A Specification Version 1.1
    in chapter 13.2.1).
    When the firmware returns OK we can have several cases:
    - the version requested is accepted but the firmware supports a greater
      one in the same major.
    - the firmware supports a greater major version. It could still return
      OK even if the version requested is not accepted. Reject it.
    - the firmware supports a lower version. It will return OK and give that
      version. Check if we support it and use it or reject it if we do not.
    
    Adapt the code to:
    - reject any version lower than the one we support or not with the same
      major version
    - use the version returned if in our supported range (currently 1.1
      only)
    - use 1.1 if the version returned is greater.
    
    Also adapt the handling of version requests from VM:
    - use our version if same major but greater minor is requested
    - use requested version if same major but lower minor is requested
    - do not use if incompatible major is requested
    - always return our version without error to the requester
    
    [1] https://developer.arm.com/documentation/den0077/e/
    
    Signed-off-by: Bertrand Marquis <bertrand.marquis@arm.com>
    Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
---
 xen/arch/arm/tee/ffa.c         | 53 +++++++++++++++++++++++++++++++-----------
 xen/arch/arm/tee/ffa_private.h |  3 +++
 2 files changed, 43 insertions(+), 13 deletions(-)

diff --git a/xen/arch/arm/tee/ffa.c b/xen/arch/arm/tee/ffa.c
index ade6aaa6fd..c5dcb4fe24 100644
--- a/xen/arch/arm/tee/ffa.c
+++ b/xen/arch/arm/tee/ffa.c
@@ -148,13 +148,20 @@ static void handle_version(struct cpu_user_regs *regs)
     struct ffa_ctx *ctx = d->arch.tee;
     uint32_t vers = get_user_reg(regs, 1);
 
-    if ( vers < FFA_VERSION_1_1 )
-        vers = FFA_VERSION_1_0;
-    else
-        vers = FFA_VERSION_1_1;
-
-    ctx->guest_vers = vers;
-    ffa_set_regs(regs, vers, 0, 0, 0, 0, 0, 0, 0);
+    /*
+     * Guest will use the version it requested if it is our major and minor
+     * lower or equals to ours. If the minor is greater, our version will be
+     * used.
+     * In any case return our version to the caller.
+     */
+    if ( FFA_VERSION_MAJOR(vers) == FFA_MY_VERSION_MAJOR )
+    {
+        if ( FFA_VERSION_MINOR(vers) > FFA_MY_VERSION_MINOR )
+            ctx->guest_vers = FFA_MY_VERSION;
+        else
+            ctx->guest_vers = vers;
+    }
+    ffa_set_regs(regs, FFA_MY_VERSION, 0, 0, 0, 0, 0, 0, 0);
 }
 
 static void handle_msg_send_direct_req(struct cpu_user_regs *regs, uint32_t fid)
@@ -537,17 +544,39 @@ static bool ffa_probe(void)
         goto err_no_fw;
     }
 
-    if ( vers < FFA_MIN_SPMC_VERSION || vers > FFA_MY_VERSION )
+    /* Some sanity check in case we update the version we support */
+    BUILD_BUG_ON(FFA_MIN_SPMC_VERSION > FFA_MY_VERSION);
+    BUILD_BUG_ON(FFA_VERSION_MAJOR(FFA_MIN_SPMC_VERSION) !=
+                                   FFA_MY_VERSION_MAJOR);
+
+    major_vers = FFA_VERSION_MAJOR(vers);
+    minor_vers = FFA_VERSION_MINOR(vers);
+
+    if ( major_vers != FFA_MY_VERSION_MAJOR ||
+         minor_vers < FFA_VERSION_MINOR(FFA_MIN_SPMC_VERSION) )
     {
-        printk(XENLOG_ERR "ffa: Incompatible version %#x found\n", vers);
+        printk(XENLOG_ERR "ffa: Incompatible firmware version %u.%u\n",
+               major_vers, minor_vers);
         goto err_no_fw;
     }
 
-    major_vers = (vers >> FFA_VERSION_MAJOR_SHIFT) & FFA_VERSION_MAJOR_MASK;
-    minor_vers = vers & FFA_VERSION_MINOR_MASK;
     printk(XENLOG_INFO "ARM FF-A Firmware version %u.%u\n",
            major_vers, minor_vers);
 
+    /*
+     * If the call succeed and the version returned is higher or equal to
+     * the one Xen requested, the version requested by Xen will be the one
+     * used. If the version returned is lower but compatible with Xen, Xen
+     * will use that version instead.
+     * A version with a different major or lower than the minimum version
+     * we support is rejected before.
+     * See https://developer.arm.com/documentation/den0077/e/ chapter 13.2.1
+     */
+    if ( minor_vers > FFA_MY_VERSION_MINOR )
+        ffa_fw_version = FFA_MY_VERSION;
+    else
+        ffa_fw_version = vers;
+
     /*
      * At the moment domains must support the same features used by Xen.
      * TODO: Rework the code to allow domain to use a subset of the
@@ -563,8 +592,6 @@ static bool ffa_probe(void)
         }
     }
 
-    ffa_fw_version = vers;
-
     if ( !ffa_rxtx_init() )
     {
         printk(XENLOG_ERR "ffa: Error during RXTX buffer init\n");
diff --git a/xen/arch/arm/tee/ffa_private.h b/xen/arch/arm/tee/ffa_private.h
index 7c6b06f686..045d9c4a0b 100644
--- a/xen/arch/arm/tee/ffa_private.h
+++ b/xen/arch/arm/tee/ffa_private.h
@@ -35,6 +35,9 @@
 #define MAKE_FFA_VERSION(major, minor)  \
         ((((major) & FFA_VERSION_MAJOR_MASK) << FFA_VERSION_MAJOR_SHIFT) | \
          ((minor) & FFA_VERSION_MINOR_MASK))
+#define FFA_VERSION_MAJOR(vers) (((vers) >> FFA_VERSION_MAJOR_SHIFT) & \
+                                 FFA_VERSION_MAJOR_MASK)
+#define FFA_VERSION_MINOR(vers) ((vers) & FFA_VERSION_MINOR_MASK)
 
 #define FFA_VERSION_1_0         MAKE_FFA_VERSION(1, 0)
 #define FFA_VERSION_1_1         MAKE_FFA_VERSION(1, 1)
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Dec 17 08:00:32 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 17 Dec 2024 08:00:32 +0000
Received: from list by lists.xenproject.org with outflank-mailman.858548.1270785 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tNSVM-0001T5-PD; Tue, 17 Dec 2024 08:00:32 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 858548.1270785; Tue, 17 Dec 2024 08: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 1tNSVM-0001Sy-MW; Tue, 17 Dec 2024 08:00:32 +0000
Received: by outflank-mailman (input) for mailman id 858548;
 Tue, 17 Dec 2024 08: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 1tNSVM-0001So-2T
 for xen-changelog@lists.xenproject.org; Tue, 17 Dec 2024 08:00:32 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1tNSVL-007vur-2P
 for xen-changelog@lists.xenproject.org;
 Tue, 17 Dec 2024 08:00:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1tNSVM-00DZ1c-03
 for xen-changelog@lists.xenproject.org;
 Tue, 17 Dec 2024 08: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>
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/arm: ffa: Fine granular call support
Message-Id: <E1tNSVM-00DZ1c-03@xenbits.xenproject.org>
Date: Tue, 17 Dec 2024 08:00:32 +0000

commit 2f9f240a5e875e75f7f69c589bbea7a210d9e2d6
Author:     Bertrand Marquis <bertrand.marquis@arm.com>
AuthorDate: Wed Nov 27 17:07:36 2024 +0100
Commit:     Julien Grall <julien@xen.org>
CommitDate: Mon Dec 16 21:01:11 2024 +0100

    xen/arm: ffa: Fine granular call support
    
    Create a bitmap to store which feature is supported or not by the
    firmware and use it to filter which calls are done to the firmware.
    
    While there reorder ABI definition by numbers to easily find the min and
    max ones.
    
    Signed-off-by: Bertrand Marquis <bertrand.marquis@arm.com>
    Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
---
 xen/arch/arm/tee/ffa.c          | 28 ++++++++++++++++++----------
 xen/arch/arm/tee/ffa_notif.c    |  7 +++++++
 xen/arch/arm/tee/ffa_partinfo.c | 30 +++++++++++++++++++++++++++++-
 xen/arch/arm/tee/ffa_private.h  | 38 +++++++++++++++++++++++++++++++++-----
 xen/arch/arm/tee/ffa_rxtx.c     |  4 ++++
 xen/arch/arm/tee/ffa_shm.c      | 12 ++++++++++++
 6 files changed, 103 insertions(+), 16 deletions(-)

diff --git a/xen/arch/arm/tee/ffa.c b/xen/arch/arm/tee/ffa.c
index c5dcb4fe24..1b0919041d 100644
--- a/xen/arch/arm/tee/ffa.c
+++ b/xen/arch/arm/tee/ffa.c
@@ -72,7 +72,10 @@
 #include "ffa_private.h"
 
 /* Negotiated FF-A version to use with the SPMC, 0 if not there or supported */
-static uint32_t __ro_after_init ffa_fw_version;
+uint32_t __ro_after_init ffa_fw_version;
+
+/* Features supported by the SPMC or secure world when present */
+DECLARE_BITMAP(ffa_fw_abi_supported, FFA_ABI_BITMAP_SIZE);
 
 struct ffa_fw_abi {
     uint32_t id;
@@ -177,6 +180,13 @@ static void handle_msg_send_direct_req(struct cpu_user_regs *regs, uint32_t fid)
     else
         mask = GENMASK_ULL(31, 0);
 
+    if ( !ffa_fw_supports_fid(fid) )
+    {
+        resp.a0 = FFA_ERROR;
+        resp.a2 = FFA_RET_NOT_SUPPORTED;
+        goto out;
+    }
+
     src_dst = get_user_reg(regs, 1);
     if ( (src_dst >> 16) != ffa_get_vm_id(d) )
     {
@@ -577,19 +587,16 @@ static bool ffa_probe(void)
     else
         ffa_fw_version = vers;
 
-    /*
-     * At the moment domains must support the same features used by Xen.
-     * TODO: Rework the code to allow domain to use a subset of the
-     * features supported.
-     */
     for ( unsigned int i = 0; i < ARRAY_SIZE(ffa_fw_abi_needed); i++ )
     {
-        if ( !ffa_abi_supported(ffa_fw_abi_needed[i].id) )
-        {
+        ASSERT(FFA_ABI_BITNUM(ffa_fw_abi_needed[i].id) < FFA_ABI_BITMAP_SIZE);
+
+        if ( ffa_abi_supported(ffa_fw_abi_needed[i].id) )
+            set_bit(FFA_ABI_BITNUM(ffa_fw_abi_needed[i].id),
+                    ffa_fw_abi_supported);
+        else
             printk(XENLOG_INFO "ARM FF-A Firmware does not support %s\n",
                    ffa_fw_abi_needed[i].name);
-            goto err_no_fw;
-        }
     }
 
     if ( !ffa_rxtx_init() )
@@ -611,6 +618,7 @@ err_rxtx_destroy:
     ffa_rxtx_destroy();
 err_no_fw:
     ffa_fw_version = 0;
+    bitmap_zero(ffa_fw_abi_supported, FFA_ABI_BITMAP_SIZE);
     printk(XENLOG_WARNING "ARM FF-A No firmware support\n");
 
     return false;
diff --git a/xen/arch/arm/tee/ffa_notif.c b/xen/arch/arm/tee/ffa_notif.c
index 541e61d2f6..4b3e46318f 100644
--- a/xen/arch/arm/tee/ffa_notif.c
+++ b/xen/arch/arm/tee/ffa_notif.c
@@ -377,6 +377,13 @@ void ffa_notif_init(void)
     unsigned int irq;
     int ret;
 
+    /* Only enable fw notification if all ABIs we need are supported */
+    if ( !(ffa_fw_supports_fid(FFA_NOTIFICATION_BITMAP_CREATE) &&
+           ffa_fw_supports_fid(FFA_NOTIFICATION_BITMAP_DESTROY) &&
+           ffa_fw_supports_fid(FFA_NOTIFICATION_GET) &&
+           ffa_fw_supports_fid(FFA_NOTIFICATION_INFO_GET_64)) )
+        return;
+
     arm_smccc_1_2_smc(&arg, &resp);
     if ( resp.a0 != FFA_SUCCESS_32 )
         return;
diff --git a/xen/arch/arm/tee/ffa_partinfo.c b/xen/arch/arm/tee/ffa_partinfo.c
index 93a03c6bc6..99c48f0e5c 100644
--- a/xen/arch/arm/tee/ffa_partinfo.c
+++ b/xen/arch/arm/tee/ffa_partinfo.c
@@ -77,7 +77,15 @@ int32_t ffa_handle_partition_info_get(uint32_t w1, uint32_t w2, uint32_t w3,
      */
     if ( w5 == FFA_PARTITION_INFO_GET_COUNT_FLAG &&
          ctx->guest_vers == FFA_VERSION_1_1 )
-        return ffa_partition_info_get(w1, w2, w3, w4, w5, count, fpi_size);
+    {
+        if ( ffa_fw_supports_fid(FFA_PARTITION_INFO_GET) )
+            return ffa_partition_info_get(w1, w2, w3, w4, w5, count, fpi_size);
+        else
+        {
+            *count = 0;
+            return FFA_RET_OK;
+        }
+    }
     if ( w5 )
         return FFA_RET_INVALID_PARAMETERS;
 
@@ -87,6 +95,18 @@ int32_t ffa_handle_partition_info_get(uint32_t w1, uint32_t w2, uint32_t w3,
     if ( !spin_trylock(&ctx->rx_lock) )
         return FFA_RET_BUSY;
 
+    if ( !ffa_fw_supports_fid(FFA_PARTITION_INFO_GET) )
+    {
+        if ( ctx->guest_vers == FFA_VERSION_1_0 )
+            *fpi_size = sizeof(struct ffa_partition_info_1_0);
+        else
+            *fpi_size = sizeof(struct ffa_partition_info_1_1);
+
+        *count = 0;
+        ret = FFA_RET_OK;
+        goto out;
+    }
+
     if ( !ctx->page_count || !ctx->rx_is_free )
         goto out;
     spin_lock(&ffa_rx_buffer_lock);
@@ -250,6 +270,11 @@ bool ffa_partinfo_init(void)
     uint32_t count;
     int e;
 
+    if ( !ffa_fw_supports_fid(FFA_PARTITION_INFO_GET) ||
+         !ffa_fw_supports_fid(FFA_MSG_SEND_DIRECT_REQ_32) ||
+         !ffa_rx || !ffa_tx )
+        return false;
+
     e = ffa_partition_info_get(0, 0, 0, 0, 0, &count, &fpi_size);
     if ( e )
     {
@@ -313,6 +338,9 @@ int ffa_partinfo_domain_init(struct domain *d)
     unsigned int n;
     int32_t res;
 
+    if ( !ffa_fw_supports_fid(FFA_MSG_SEND_DIRECT_REQ_32) )
+        return 0;
+
     ctx->vm_destroy_bitmap = xzalloc_array(unsigned long, count);
     if ( !ctx->vm_destroy_bitmap )
         return -ENOMEM;
diff --git a/xen/arch/arm/tee/ffa_private.h b/xen/arch/arm/tee/ffa_private.h
index 045d9c4a0b..85eb61c134 100644
--- a/xen/arch/arm/tee/ffa_private.h
+++ b/xen/arch/arm/tee/ffa_private.h
@@ -14,6 +14,7 @@
 #include <xen/spinlock.h>
 #include <xen/sched.h>
 #include <xen/time.h>
+#include <xen/bitmap.h>
 
 /* Error codes */
 #define FFA_RET_OK                      0
@@ -201,18 +202,17 @@
 #define FFA_INTERRUPT                   0x84000062U
 #define FFA_VERSION                     0x84000063U
 #define FFA_FEATURES                    0x84000064U
-#define FFA_RX_ACQUIRE                  0x84000084U
 #define FFA_RX_RELEASE                  0x84000065U
 #define FFA_RXTX_MAP_32                 0x84000066U
 #define FFA_RXTX_MAP_64                 0xC4000066U
 #define FFA_RXTX_UNMAP                  0x84000067U
 #define FFA_PARTITION_INFO_GET          0x84000068U
 #define FFA_ID_GET                      0x84000069U
-#define FFA_SPM_ID_GET                  0x84000085U
+#define FFA_MSG_POLL                    0x8400006AU
 #define FFA_MSG_WAIT                    0x8400006BU
 #define FFA_MSG_YIELD                   0x8400006CU
 #define FFA_RUN                         0x8400006DU
-#define FFA_MSG_SEND2                   0x84000086U
+#define FFA_MSG_SEND                    0x8400006EU
 #define FFA_MSG_SEND_DIRECT_REQ_32      0x8400006FU
 #define FFA_MSG_SEND_DIRECT_REQ_64      0xC400006FU
 #define FFA_MSG_SEND_DIRECT_RESP_32     0x84000070U
@@ -230,8 +230,6 @@
 #define FFA_MEM_RECLAIM                 0x84000077U
 #define FFA_MEM_FRAG_RX                 0x8400007AU
 #define FFA_MEM_FRAG_TX                 0x8400007BU
-#define FFA_MSG_SEND                    0x8400006EU
-#define FFA_MSG_POLL                    0x8400006AU
 #define FFA_NOTIFICATION_BITMAP_CREATE  0x8400007DU
 #define FFA_NOTIFICATION_BITMAP_DESTROY 0x8400007EU
 #define FFA_NOTIFICATION_BIND           0x8400007FU
@@ -240,6 +238,25 @@
 #define FFA_NOTIFICATION_GET            0x84000082U
 #define FFA_NOTIFICATION_INFO_GET_32    0x84000083U
 #define FFA_NOTIFICATION_INFO_GET_64    0xC4000083U
+#define FFA_RX_ACQUIRE                  0x84000084U
+#define FFA_SPM_ID_GET                  0x84000085U
+#define FFA_MSG_SEND2                   0x84000086U
+
+/**
+ * Encoding of features supported or not by the fw in a bitmap:
+ * - Function IDs are going from 0x60 to 0xFF
+ * - A function can be supported in 32 and/or 64bit
+ * The bitmap has one bit for each function in 32 and 64 bit.
+ */
+#define FFA_ABI_ID(id)        ((id) & ARM_SMCCC_FUNC_MASK)
+#define FFA_ABI_CONV(id)      (((id) >> ARM_SMCCC_CONV_SHIFT) & BIT(0,U))
+
+#define FFA_ABI_MIN           FFA_ABI_ID(FFA_ERROR)
+#define FFA_ABI_MAX           FFA_ABI_ID(FFA_MSG_SEND2)
+
+#define FFA_ABI_BITMAP_SIZE   (2 * (FFA_ABI_MAX - FFA_ABI_MIN + 1))
+#define FFA_ABI_BITNUM(id)    ((FFA_ABI_ID(id) - FFA_ABI_MIN) << 1 | \
+                               FFA_ABI_CONV(id))
 
 struct ffa_ctx_notif {
     bool enabled;
@@ -289,6 +306,8 @@ extern void *ffa_rx;
 extern void *ffa_tx;
 extern spinlock_t ffa_rx_buffer_lock;
 extern spinlock_t ffa_tx_buffer_lock;
+extern uint32_t __ro_after_init ffa_fw_version;
+extern DECLARE_BITMAP(ffa_fw_abi_supported, FFA_ABI_BITMAP_SIZE);
 
 bool ffa_shm_domain_destroy(struct domain *d);
 void ffa_handle_mem_share(struct cpu_user_regs *regs);
@@ -401,4 +420,13 @@ static inline int32_t ffa_rx_release(void)
     return ffa_simple_call(FFA_RX_RELEASE, 0, 0, 0, 0);
 }
 
+static inline bool ffa_fw_supports_fid(uint32_t fid)
+{
+    BUILD_BUG_ON(FFA_ABI_MIN > FFA_ABI_MAX);
+
+    if ( FFA_ABI_BITNUM(fid) > FFA_ABI_BITMAP_SIZE)
+        return false;
+    return test_bit(FFA_ABI_BITNUM(fid), ffa_fw_abi_supported);
+}
+
 #endif /*__FFA_PRIVATE_H__*/
diff --git a/xen/arch/arm/tee/ffa_rxtx.c b/xen/arch/arm/tee/ffa_rxtx.c
index c8bc516a19..132a798240 100644
--- a/xen/arch/arm/tee/ffa_rxtx.c
+++ b/xen/arch/arm/tee/ffa_rxtx.c
@@ -193,6 +193,10 @@ bool ffa_rxtx_init(void)
 {
     int e;
 
+    /* Firmware not there or not supporting */
+    if ( !ffa_fw_supports_fid(FFA_RXTX_MAP_64) )
+        return false;
+
     ffa_rx = alloc_xenheap_pages(get_order_from_pages(FFA_RXTX_PAGE_COUNT), 0);
     if ( !ffa_rx )
         return false;
diff --git a/xen/arch/arm/tee/ffa_shm.c b/xen/arch/arm/tee/ffa_shm.c
index 370d83ec5c..efa5b67db8 100644
--- a/xen/arch/arm/tee/ffa_shm.c
+++ b/xen/arch/arm/tee/ffa_shm.c
@@ -149,6 +149,9 @@ static int32_t ffa_mem_share(uint32_t tot_len, uint32_t frag_len,
 static int32_t ffa_mem_reclaim(uint32_t handle_lo, uint32_t handle_hi,
                                uint32_t flags)
 {
+    if ( !ffa_fw_supports_fid(FFA_MEM_RECLAIM) )
+        return FFA_RET_NOT_SUPPORTED;
+
     return ffa_simple_call(FFA_MEM_RECLAIM, handle_lo, handle_hi, flags, 0);
 }
 
@@ -467,6 +470,12 @@ void ffa_handle_mem_share(struct cpu_user_regs *regs)
     uint32_t range_count;
     uint32_t region_offs;
 
+    if ( !ffa_fw_supports_fid(FFA_MEM_SHARE_64) )
+    {
+        ret = FFA_RET_NOT_SUPPORTED;
+        goto out_set_ret;
+    }
+
     /*
      * We're only accepting memory transaction descriptors via the rx/tx
      * buffer.
@@ -621,6 +630,9 @@ int ffa_handle_mem_reclaim(uint64_t handle, uint32_t flags)
     register_t handle_lo;
     int ret;
 
+    if ( !ffa_fw_supports_fid(FFA_MEM_RECLAIM) )
+        return FFA_RET_NOT_SUPPORTED;
+
     spin_lock(&ctx->lock);
     shm = find_shm_mem(ctx, handle);
     if ( shm )
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Dec 17 08:00:43 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 17 Dec 2024 08:00:43 +0000
Received: from list by lists.xenproject.org with outflank-mailman.858549.1270789 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tNSVW-0001WE-SK; Tue, 17 Dec 2024 08:00:42 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 858549.1270789; Tue, 17 Dec 2024 08:00:42 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tNSVW-0001W6-PY; Tue, 17 Dec 2024 08:00:42 +0000
Received: by outflank-mailman (input) for mailman id 858549;
 Tue, 17 Dec 2024 08: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 1tNSVW-0001Vy-77
 for xen-changelog@lists.xenproject.org; Tue, 17 Dec 2024 08:00:42 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1tNSVV-007vv5-2p
 for xen-changelog@lists.xenproject.org;
 Tue, 17 Dec 2024 08:00:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1tNSVW-00DZ4C-0K
 for xen-changelog@lists.xenproject.org;
 Tue, 17 Dec 2024 08: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>
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/arm: ffa: Rework partition info get
Message-Id: <E1tNSVW-00DZ4C-0K@xenbits.xenproject.org>
Date: Tue, 17 Dec 2024 08:00:42 +0000

commit 8a932b91aa635a64ebaa24a616f951ff0c2c9735
Author:     Bertrand Marquis <bertrand.marquis@arm.com>
AuthorDate: Wed Nov 27 17:07:37 2024 +0100
Commit:     Julien Grall <julien@xen.org>
CommitDate: Mon Dec 16 21:01:16 2024 +0100

    xen/arm: ffa: Rework partition info get
    
    Rework the partition info get implementation to use the correct size of
    structure depending on the version of the protocol and simplifies the
    structure copy to use only memcpy and prevent recreating the structure
    each time.
    The goal here is to have an implementation that will be easier to
    maintain in the long term as the specification is only adding fields to
    structure with versions to simplify support of several protocol
    versions and as such an SPMC implementation in the future could use this
    and return a size higher than the one we expect.
    The patch is fixing the part_info_get function for this and the
    subscriber discovery on probe.
    
    No functional changes expected.
    
    Signed-off-by: Bertrand Marquis <bertrand.marquis@arm.com>
    Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
---
 xen/arch/arm/tee/ffa.c          |  13 +--
 xen/arch/arm/tee/ffa_partinfo.c | 185 +++++++++++++++++++++++++---------------
 xen/arch/arm/tee/ffa_private.h  |   4 +-
 3 files changed, 118 insertions(+), 84 deletions(-)

diff --git a/xen/arch/arm/tee/ffa.c b/xen/arch/arm/tee/ffa.c
index 1b0919041d..4b283a4de5 100644
--- a/xen/arch/arm/tee/ffa.c
+++ b/xen/arch/arm/tee/ffa.c
@@ -311,8 +311,6 @@ static bool ffa_handle_call(struct cpu_user_regs *regs)
     uint32_t fid = get_user_reg(regs, 0);
     struct domain *d = current->domain;
     struct ffa_ctx *ctx = d->arch.tee;
-    uint32_t fpi_size;
-    uint32_t count;
     int e;
 
     if ( !ctx )
@@ -338,16 +336,7 @@ static bool ffa_handle_call(struct cpu_user_regs *regs)
         e = ffa_handle_rxtx_unmap();
         break;
     case FFA_PARTITION_INFO_GET:
-        e = ffa_handle_partition_info_get(get_user_reg(regs, 1),
-                                          get_user_reg(regs, 2),
-                                          get_user_reg(regs, 3),
-                                          get_user_reg(regs, 4),
-                                          get_user_reg(regs, 5), &count,
-                                          &fpi_size);
-        if ( e )
-            ffa_set_regs_error(regs, e);
-        else
-            ffa_set_regs_success(regs, count, fpi_size);
+        ffa_handle_partition_info_get(regs);
         return true;
     case FFA_RX_RELEASE:
         e = ffa_handle_rx_release();
diff --git a/xen/arch/arm/tee/ffa_partinfo.c b/xen/arch/arm/tee/ffa_partinfo.c
index 99c48f0e5c..75a073d090 100644
--- a/xen/arch/arm/tee/ffa_partinfo.c
+++ b/xen/arch/arm/tee/ffa_partinfo.c
@@ -33,21 +33,24 @@ static uint16_t subscr_vm_created_count __read_mostly;
 static uint16_t *subscr_vm_destroyed __read_mostly;
 static uint16_t subscr_vm_destroyed_count __read_mostly;
 
-static int32_t ffa_partition_info_get(uint32_t w1, uint32_t w2, uint32_t w3,
-                                      uint32_t w4, uint32_t w5, uint32_t *count,
-                                      uint32_t *fpi_size)
+static int32_t ffa_partition_info_get(uint32_t *uuid, uint32_t flags,
+                                      uint32_t *count, uint32_t *fpi_size)
 {
-    const struct arm_smccc_1_2_regs arg = {
+    struct arm_smccc_1_2_regs arg = {
         .a0 = FFA_PARTITION_INFO_GET,
-        .a1 = w1,
-        .a2 = w2,
-        .a3 = w3,
-        .a4 = w4,
-        .a5 = w5,
+        .a5 = flags,
     };
     struct arm_smccc_1_2_regs resp;
     uint32_t ret;
 
+    if ( uuid )
+    {
+        arg.a1 = uuid[0];
+        arg.a2 = uuid[1];
+        arg.a3 = uuid[2];
+        arg.a4 = uuid[3];
+    }
+
     arm_smccc_1_2_smc(&arg, &resp);
 
     ret = ffa_get_ret_code(&resp);
@@ -60,13 +63,31 @@ static int32_t ffa_partition_info_get(uint32_t w1, uint32_t w2, uint32_t w3,
     return ret;
 }
 
-int32_t ffa_handle_partition_info_get(uint32_t w1, uint32_t w2, uint32_t w3,
-                                      uint32_t w4, uint32_t w5, uint32_t *count,
-                                      uint32_t *fpi_size)
+void ffa_handle_partition_info_get(struct cpu_user_regs *regs)
 {
-    int32_t ret = FFA_RET_DENIED;
+    int32_t ret;
     struct domain *d = current->domain;
     struct ffa_ctx *ctx = d->arch.tee;
+    uint32_t flags = get_user_reg(regs, 5);
+    uint32_t uuid[4] = {
+        get_user_reg(regs, 1),
+        get_user_reg(regs, 2),
+        get_user_reg(regs, 3),
+        get_user_reg(regs, 4),
+    };
+    uint32_t src_size, dst_size;
+    void *dst_buf;
+    uint32_t ffa_sp_count = 0;
+
+    /*
+     * If the guest is v1.0, he does not get back the entry size so we must
+     * use the v1.0 structure size in the destination buffer.
+     * Otherwise use the size of the highest version we support, here 1.1.
+     */
+    if ( ctx->guest_vers == FFA_VERSION_1_0 )
+        dst_size = sizeof(struct ffa_partition_info_1_0);
+    else
+        dst_size = sizeof(struct ffa_partition_info_1_1);
 
     /*
      * FF-A v1.0 has w5 MBZ while v1.1 allows
@@ -75,90 +96,105 @@ int32_t ffa_handle_partition_info_get(uint32_t w1, uint32_t w2, uint32_t w3,
      * FFA_PARTITION_INFO_GET_COUNT is only using registers and not the
      * rxtx buffer so do the partition_info_get directly.
      */
-    if ( w5 == FFA_PARTITION_INFO_GET_COUNT_FLAG &&
+    if ( flags == FFA_PARTITION_INFO_GET_COUNT_FLAG &&
          ctx->guest_vers == FFA_VERSION_1_1 )
     {
         if ( ffa_fw_supports_fid(FFA_PARTITION_INFO_GET) )
-            return ffa_partition_info_get(w1, w2, w3, w4, w5, count, fpi_size);
+            ret = ffa_partition_info_get(uuid, flags, &ffa_sp_count,
+                                        &src_size);
         else
-        {
-            *count = 0;
-            return FFA_RET_OK;
-        }
-    }
-    if ( w5 )
-        return FFA_RET_INVALID_PARAMETERS;
+            ret = FFA_RET_OK;
 
-    if ( !ffa_rx )
-        return FFA_RET_DENIED;
+        goto out;
+    }
 
-    if ( !spin_trylock(&ctx->rx_lock) )
-        return FFA_RET_BUSY;
+    if ( flags )
+    {
+        ret = FFA_RET_INVALID_PARAMETERS;
+        goto out;
+    }
 
     if ( !ffa_fw_supports_fid(FFA_PARTITION_INFO_GET) )
     {
-        if ( ctx->guest_vers == FFA_VERSION_1_0 )
-            *fpi_size = sizeof(struct ffa_partition_info_1_0);
-        else
-            *fpi_size = sizeof(struct ffa_partition_info_1_1);
-
-        *count = 0;
+        /* Just give an empty partition list to the caller */
         ret = FFA_RET_OK;
         goto out;
     }
 
-    if ( !ctx->page_count || !ctx->rx_is_free )
+    if ( !spin_trylock(&ctx->rx_lock) )
+    {
+        ret = FFA_RET_BUSY;
         goto out;
+    }
+
+    dst_buf = ctx->rx;
+
+    if ( !ffa_rx )
+    {
+        ret = FFA_RET_DENIED;
+        goto out_rx_release;
+    }
+
+    if ( !ctx->page_count || !ctx->rx_is_free )
+    {
+        ret = FFA_RET_DENIED;
+        goto out_rx_release;
+    }
+
     spin_lock(&ffa_rx_buffer_lock);
-    ret = ffa_partition_info_get(w1, w2, w3, w4, w5, count, fpi_size);
+
+    ret = ffa_partition_info_get(uuid, 0, &ffa_sp_count, &src_size);
+
     if ( ret )
         goto out_rx_buf_unlock;
+
     /*
      * ffa_partition_info_get() succeeded so we now own the RX buffer we
      * share with the SPMC. We must give it back using ffa_rx_release()
      * once we've copied the content.
      */
 
-    if ( ctx->guest_vers == FFA_VERSION_1_0 )
+    /* we cannot have a size smaller than 1.0 structure */
+    if ( src_size < sizeof(struct ffa_partition_info_1_0) )
     {
-        size_t n;
-        struct ffa_partition_info_1_1 *src = ffa_rx;
-        struct ffa_partition_info_1_0 *dst = ctx->rx;
-
-        if ( ctx->page_count * FFA_PAGE_SIZE < *count * sizeof(*dst) )
-        {
-            ret = FFA_RET_NO_MEMORY;
-            goto out_rx_release;
-        }
+        ret = FFA_RET_NOT_SUPPORTED;
+        goto out_rx_hyp_release;
+    }
 
-        for ( n = 0; n < *count; n++ )
-        {
-            dst[n].id = src[n].id;
-            dst[n].execution_context = src[n].execution_context;
-            dst[n].partition_properties = src[n].partition_properties;
-        }
+    if ( ctx->page_count * FFA_PAGE_SIZE < ffa_sp_count * dst_size )
+    {
+        ret = FFA_RET_NO_MEMORY;
+        goto out_rx_hyp_release;
     }
-    else
+
+    if ( ffa_sp_count > 0 )
     {
-        size_t sz = *count * *fpi_size;
+        uint32_t n;
+        void *src_buf = ffa_rx;
 
-        if ( ctx->page_count * FFA_PAGE_SIZE < sz )
+        /* copy the secure partitions info */
+        for ( n = 0; n < ffa_sp_count; n++ )
         {
-            ret = FFA_RET_NO_MEMORY;
-            goto out_rx_release;
+            memcpy(dst_buf, src_buf, dst_size);
+            dst_buf += dst_size;
+            src_buf += src_size;
         }
-
-        memcpy(ctx->rx, ffa_rx, sz);
     }
+
     ctx->rx_is_free = false;
-out_rx_release:
+
+out_rx_hyp_release:
     ffa_rx_release();
 out_rx_buf_unlock:
     spin_unlock(&ffa_rx_buffer_lock);
-out:
+out_rx_release:
     spin_unlock(&ctx->rx_lock);
 
-    return ret;
+out:
+    if ( ret )
+        ffa_set_regs_error(regs, ret);
+    else
+        ffa_set_regs_success(regs, ffa_sp_count, dst_size);
 }
 
 static int32_t ffa_direct_req_send_vm(uint16_t sp_id, uint16_t vm_id,
@@ -221,19 +257,28 @@ static void uninit_subscribers(void)
         XFREE(subscr_vm_destroyed);
 }
 
-static bool init_subscribers(struct ffa_partition_info_1_1 *fpi, uint16_t count)
+static bool init_subscribers(uint16_t count, uint32_t fpi_size)
 {
     uint16_t n;
     uint16_t c_pos;
     uint16_t d_pos;
+    struct ffa_partition_info_1_1 *fpi;
+
+    if ( fpi_size < sizeof(struct ffa_partition_info_1_1) )
+    {
+        printk(XENLOG_ERR "ffa: partition info size invalid: %u\n", fpi_size);
+        return false;
+    }
 
     subscr_vm_created_count = 0;
     subscr_vm_destroyed_count = 0;
     for ( n = 0; n < count; n++ )
     {
-        if ( fpi[n].partition_properties & FFA_PART_PROP_NOTIF_CREATED )
+        fpi = ffa_rx + n * fpi_size;
+
+        if ( fpi->partition_properties & FFA_PART_PROP_NOTIF_CREATED )
             subscr_vm_created_count++;
-        if ( fpi[n].partition_properties & FFA_PART_PROP_NOTIF_DESTROYED )
+        if ( fpi->partition_properties & FFA_PART_PROP_NOTIF_DESTROYED )
             subscr_vm_destroyed_count++;
     }
 
@@ -252,10 +297,12 @@ static bool init_subscribers(struct ffa_partition_info_1_1 *fpi, uint16_t count)
 
     for ( c_pos = 0, d_pos = 0, n = 0; n < count; n++ )
     {
-        if ( fpi[n].partition_properties & FFA_PART_PROP_NOTIF_CREATED )
-            subscr_vm_created[c_pos++] = fpi[n].id;
-        if ( fpi[n].partition_properties & FFA_PART_PROP_NOTIF_DESTROYED )
-            subscr_vm_destroyed[d_pos++] = fpi[n].id;
+        fpi = ffa_rx + n * fpi_size;
+
+        if ( fpi->partition_properties & FFA_PART_PROP_NOTIF_CREATED )
+            subscr_vm_created[c_pos++] = fpi->id;
+        if ( fpi->partition_properties & FFA_PART_PROP_NOTIF_DESTROYED )
+            subscr_vm_destroyed[d_pos++] = fpi->id;
     }
 
     return true;
@@ -275,7 +322,7 @@ bool ffa_partinfo_init(void)
          !ffa_rx || !ffa_tx )
         return false;
 
-    e = ffa_partition_info_get(0, 0, 0, 0, 0, &count, &fpi_size);
+    e = ffa_partition_info_get(NULL, 0, &count, &fpi_size);
     if ( e )
     {
         printk(XENLOG_ERR "ffa: Failed to get list of SPs: %d\n", e);
@@ -288,7 +335,7 @@ bool ffa_partinfo_init(void)
         goto out;
     }
 
-    ret = init_subscribers(ffa_rx, count);
+    ret = init_subscribers(count, fpi_size);
 
 out:
     ffa_rx_release();
diff --git a/xen/arch/arm/tee/ffa_private.h b/xen/arch/arm/tee/ffa_private.h
index 85eb61c134..e5bc73f903 100644
--- a/xen/arch/arm/tee/ffa_private.h
+++ b/xen/arch/arm/tee/ffa_private.h
@@ -316,9 +316,7 @@ int ffa_handle_mem_reclaim(uint64_t handle, uint32_t flags);
 bool ffa_partinfo_init(void);
 int ffa_partinfo_domain_init(struct domain *d);
 bool ffa_partinfo_domain_destroy(struct domain *d);
-int32_t ffa_handle_partition_info_get(uint32_t w1, uint32_t w2, uint32_t w3,
-                                      uint32_t w4, uint32_t w5, uint32_t *count,
-                                      uint32_t *fpi_size);
+void ffa_handle_partition_info_get(struct cpu_user_regs *regs);
 
 bool ffa_rxtx_init(void);
 void ffa_rxtx_destroy(void);
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Dec 17 08:00:52 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 17 Dec 2024 08:00:52 +0000
Received: from list by lists.xenproject.org with outflank-mailman.858550.1270792 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tNSVg-0001Yu-TZ; Tue, 17 Dec 2024 08:00:52 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 858550.1270792; Tue, 17 Dec 2024 08:00:52 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tNSVg-0001Yn-R2; Tue, 17 Dec 2024 08:00:52 +0000
Received: by outflank-mailman (input) for mailman id 858550;
 Tue, 17 Dec 2024 08: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 1tNSVg-0001Yf-9y
 for xen-changelog@lists.xenproject.org; Tue, 17 Dec 2024 08:00:52 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1tNSVf-007vvT-39
 for xen-changelog@lists.xenproject.org;
 Tue, 17 Dec 2024 08:00:52 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1tNSVg-00DZ5X-0l
 for xen-changelog@lists.xenproject.org;
 Tue, 17 Dec 2024 08: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>
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/arm: ffa: Use bit 15 convention for SPs
Message-Id: <E1tNSVg-00DZ5X-0l@xenbits.xenproject.org>
Date: Tue, 17 Dec 2024 08:00:52 +0000

commit 2833aa172fdabeb77a7e0cbb36a1dcb05ab1af13
Author:     Bertrand Marquis <bertrand.marquis@arm.com>
AuthorDate: Wed Nov 27 17:07:38 2024 +0100
Commit:     Julien Grall <julien@xen.org>
CommitDate: Mon Dec 16 21:01:16 2024 +0100

    xen/arm: ffa: Use bit 15 convention for SPs
    
    Make use and required to have bit 15 convention respected by secure
    world (having bit 15 of IDs set for secure endpoints and non-set for
    non-secure ones).
    If any secure partition has an ID with bit 15 not set, it will not be
    possible to contact or detect them.
    Print an error log during probe for each secure endpoint detected with
    bit 15 not set.
    
    We are switching to this convention because Xen is currently not using
    VMIDs with bit 15 set so we are sure that no VM will have it set (this
    is ensured by BUILD_BUG_ON in case this becomes false in the future).
    It is allowing to easily distinguish between secure and non-secure
    endpoints, preventing the need to store a list of secure endpoint IDs in
    Xen.
    
    Signed-off-by: Bertrand Marquis <bertrand.marquis@arm.com>
    Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
---
 xen/arch/arm/tee/ffa.c          | 22 ++++++++++++++----
 xen/arch/arm/tee/ffa_partinfo.c | 51 +++++++++++++++++++++++++++++++----------
 xen/arch/arm/tee/ffa_private.h  |  7 ++++++
 xen/arch/arm/tee/ffa_shm.c      | 12 +++++++++-
 4 files changed, 74 insertions(+), 18 deletions(-)

diff --git a/xen/arch/arm/tee/ffa.c b/xen/arch/arm/tee/ffa.c
index 4b283a4de5..0026ac9134 100644
--- a/xen/arch/arm/tee/ffa.c
+++ b/xen/arch/arm/tee/ffa.c
@@ -195,6 +195,14 @@ static void handle_msg_send_direct_req(struct cpu_user_regs *regs, uint32_t fid)
         goto out;
     }
 
+    /* we do not support direct messages to VMs */
+    if ( !FFA_ID_IS_SECURE(src_dst & GENMASK(15,0)) )
+    {
+        resp.a0 = FFA_ERROR;
+        resp.a2 = FFA_RET_NOT_SUPPORTED;
+        goto out;
+    }
+
     arg.a1 = src_dst;
     arg.a2 = get_user_reg(regs, 2) & mask;
     arg.a3 = get_user_reg(regs, 3) & mask;
@@ -391,11 +399,15 @@ static int ffa_domain_init(struct domain *d)
 
     if ( !ffa_fw_version )
         return -ENODEV;
-     /*
-      * We can't use that last possible domain ID or ffa_get_vm_id() would
-      * cause an overflow.
-      */
-    if ( d->domain_id >= UINT16_MAX)
+    /*
+     * We are using the domain_id + 1 as the FF-A ID for VMs as FF-A ID 0 is
+     * reserved for the hypervisor and we only support secure endpoints using
+     * FF-A IDs with BIT 15 set to 1 so make sure those are not used by Xen.
+     */
+    BUILD_BUG_ON(DOMID_FIRST_RESERVED >= UINT16_MAX);
+    BUILD_BUG_ON((DOMID_MASK & BIT(15, U)) != 0);
+
+    if ( d->domain_id >= DOMID_FIRST_RESERVED )
         return -ERANGE;
 
     ctx = xzalloc(struct ffa_ctx);
diff --git a/xen/arch/arm/tee/ffa_partinfo.c b/xen/arch/arm/tee/ffa_partinfo.c
index 75a073d090..74324e1d9d 100644
--- a/xen/arch/arm/tee/ffa_partinfo.c
+++ b/xen/arch/arm/tee/ffa_partinfo.c
@@ -169,14 +169,23 @@ void ffa_handle_partition_info_get(struct cpu_user_regs *regs)
 
     if ( ffa_sp_count > 0 )
     {
-        uint32_t n;
+        uint32_t n, n_limit = ffa_sp_count;
         void *src_buf = ffa_rx;
 
         /* copy the secure partitions info */
-        for ( n = 0; n < ffa_sp_count; n++ )
+        for ( n = 0; n < n_limit; n++ )
         {
-            memcpy(dst_buf, src_buf, dst_size);
-            dst_buf += dst_size;
+            struct ffa_partition_info_1_1 *fpi = src_buf;
+
+            /* filter out SP not following bit 15 convention if any */
+            if ( FFA_ID_IS_SECURE(fpi->id) )
+            {
+                memcpy(dst_buf, src_buf, dst_size);
+                dst_buf += dst_size;
+            }
+            else
+                ffa_sp_count--;
+
             src_buf += src_size;
         }
     }
@@ -276,10 +285,25 @@ static bool init_subscribers(uint16_t count, uint32_t fpi_size)
     {
         fpi = ffa_rx + n * fpi_size;
 
-        if ( fpi->partition_properties & FFA_PART_PROP_NOTIF_CREATED )
-            subscr_vm_created_count++;
-        if ( fpi->partition_properties & FFA_PART_PROP_NOTIF_DESTROYED )
-            subscr_vm_destroyed_count++;
+        /*
+         * We need to have secure partitions using bit 15 set convention for
+         * secure partition IDs.
+         * Inform the user with a log and discard giving created or destroy
+         * event to those IDs.
+         */
+        if ( !FFA_ID_IS_SECURE(fpi->id) )
+        {
+            printk(XENLOG_ERR "ffa: Firmware is not using bit 15 convention for IDs !!\n"
+                              "ffa: Secure partition with id 0x%04x cannot be used\n",
+                              fpi->id);
+        }
+        else
+        {
+            if ( fpi->partition_properties & FFA_PART_PROP_NOTIF_CREATED )
+                subscr_vm_created_count++;
+            if ( fpi->partition_properties & FFA_PART_PROP_NOTIF_DESTROYED )
+                subscr_vm_destroyed_count++;
+        }
     }
 
     if ( subscr_vm_created_count )
@@ -299,10 +323,13 @@ static bool init_subscribers(uint16_t count, uint32_t fpi_size)
     {
         fpi = ffa_rx + n * fpi_size;
 
-        if ( fpi->partition_properties & FFA_PART_PROP_NOTIF_CREATED )
-            subscr_vm_created[c_pos++] = fpi->id;
-        if ( fpi->partition_properties & FFA_PART_PROP_NOTIF_DESTROYED )
-            subscr_vm_destroyed[d_pos++] = fpi->id;
+        if ( FFA_ID_IS_SECURE(fpi->id) )
+        {
+            if ( fpi->partition_properties & FFA_PART_PROP_NOTIF_CREATED )
+                subscr_vm_created[c_pos++] = fpi->id;
+            if ( fpi->partition_properties & FFA_PART_PROP_NOTIF_DESTROYED )
+                subscr_vm_destroyed[d_pos++] = fpi->id;
+        }
     }
 
     return true;
diff --git a/xen/arch/arm/tee/ffa_private.h b/xen/arch/arm/tee/ffa_private.h
index e5bc73f903..afe69b43db 100644
--- a/xen/arch/arm/tee/ffa_private.h
+++ b/xen/arch/arm/tee/ffa_private.h
@@ -108,6 +108,13 @@
  */
 #define FFA_CTX_TEARDOWN_DELAY          SECONDS(1)
 
+/*
+ * We rely on the convention suggested but not mandated by the FF-A
+ * specification that secure world endpoint identifiers have the bit 15
+ * set and normal world have it set to 0.
+ */
+#define FFA_ID_IS_SECURE(id)    ((id) & BIT(15, U))
+
 /* FF-A-1.1-REL0 section 10.9.2 Memory region handle, page 167 */
 #define FFA_HANDLE_HYP_FLAG             BIT(63, ULL)
 #define FFA_HANDLE_INVALID              0xffffffffffffffffULL
diff --git a/xen/arch/arm/tee/ffa_shm.c b/xen/arch/arm/tee/ffa_shm.c
index efa5b67db8..29675f9ba3 100644
--- a/xen/arch/arm/tee/ffa_shm.c
+++ b/xen/arch/arm/tee/ffa_shm.c
@@ -469,6 +469,7 @@ void ffa_handle_mem_share(struct cpu_user_regs *regs)
     int ret = FFA_RET_DENIED;
     uint32_t range_count;
     uint32_t region_offs;
+    uint16_t dst_id;
 
     if ( !ffa_fw_supports_fid(FFA_MEM_SHARE_64) )
     {
@@ -537,6 +538,15 @@ void ffa_handle_mem_share(struct cpu_user_regs *regs)
         goto out_unlock;
 
     mem_access = ctx->tx + trans.mem_access_offs;
+
+    dst_id = ACCESS_ONCE(mem_access->access_perm.endpoint_id);
+    if ( !FFA_ID_IS_SECURE(dst_id) )
+    {
+        /* we do not support sharing with VMs */
+        ret = FFA_RET_NOT_SUPPORTED;
+        goto out_unlock;
+    }
+
     if ( ACCESS_ONCE(mem_access->access_perm.perm) != FFA_MEM_ACC_RW )
     {
         ret = FFA_RET_NOT_SUPPORTED;
@@ -567,7 +577,7 @@ void ffa_handle_mem_share(struct cpu_user_regs *regs)
         goto out_unlock;
     }
     shm->sender_id = trans.sender_id;
-    shm->ep_id = ACCESS_ONCE(mem_access->access_perm.endpoint_id);
+    shm->ep_id = dst_id;
 
     /*
      * Check that the Composite memory region descriptor fits.
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Dec 17 08:01:02 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 17 Dec 2024 08:01:02 +0000
Received: from list by lists.xenproject.org with outflank-mailman.858551.1270797 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tNSVq-0001bP-VO; Tue, 17 Dec 2024 08:01:02 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 858551.1270797; Tue, 17 Dec 2024 08:01: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 1tNSVq-0001bF-Sa; Tue, 17 Dec 2024 08:01:02 +0000
Received: by outflank-mailman (input) for mailman id 858551;
 Tue, 17 Dec 2024 08: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 1tNSVq-0001b8-Eb
 for xen-changelog@lists.xenproject.org; Tue, 17 Dec 2024 08:01:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1tNSVq-007vvm-0J
 for xen-changelog@lists.xenproject.org;
 Tue, 17 Dec 2024 08:01:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1tNSVq-00DZ7Q-16
 for xen-changelog@lists.xenproject.org;
 Tue, 17 Dec 2024 08: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>
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/arm: ffa: Transmit RXTX buffers to the SPMC
Message-Id: <E1tNSVq-00DZ7Q-16@xenbits.xenproject.org>
Date: Tue, 17 Dec 2024 08:01:02 +0000

commit 6dceb1378d740bd45f237bcc41bf1dfe7a862d64
Author:     Bertrand Marquis <bertrand.marquis@arm.com>
AuthorDate: Wed Nov 27 17:07:39 2024 +0100
Commit:     Julien Grall <julien@xen.org>
CommitDate: Mon Dec 16 21:04:15 2024 +0100

    xen/arm: ffa: Transmit RXTX buffers to the SPMC
    
    When an RXTX buffer is mapped by a VM transmit it to the SPMC when it
    supports RX_ACQUIRE.
    As a consequence of that, we must acquire the RX buffer of a VM from the
    SPMC when we want to use it:
    - create a generic acquire and release function to get the rx buffer of
      a VM which gets it from the SPMC when supported
    - rename the rx_acquire to hyp_rx_acquire to remove confusion
    - rework the rx_lock to only lock access to rx_is_free and only allow
      usage of the rx buffer to one who managed to acquire it, thus removing
      the trylock and returning busy if rx_is_free is false
    
    As part of this change move some structure definition to ffa_private
    from ffa_shm as those are need for the MAP call with the SPMC.
    
    While there also fix ffa_handle_rxtx_map which was testing the wrong
    variable after getting the page for the rx buffer, testing tx_pg
    instead of rx_pg.
    
    Fixes: be75f686eb03 ("xen/arm: ffa: separate rxtx buffer routines")
    
    Signed-off-by: Bertrand Marquis <bertrand.marquis@arm.com>
    Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
---
 xen/arch/arm/tee/ffa.c          |   2 +-
 xen/arch/arm/tee/ffa_partinfo.c |  36 ++++-----
 xen/arch/arm/tee/ffa_private.h  |  22 +++++-
 xen/arch/arm/tee/ffa_rxtx.c     | 161 +++++++++++++++++++++++++++++++++-------
 xen/arch/arm/tee/ffa_shm.c      |  15 ----
 5 files changed, 170 insertions(+), 66 deletions(-)

diff --git a/xen/arch/arm/tee/ffa.c b/xen/arch/arm/tee/ffa.c
index 0026ac9134..bc2722d53f 100644
--- a/xen/arch/arm/tee/ffa.c
+++ b/xen/arch/arm/tee/ffa.c
@@ -347,7 +347,7 @@ static bool ffa_handle_call(struct cpu_user_regs *regs)
         ffa_handle_partition_info_get(regs);
         return true;
     case FFA_RX_RELEASE:
-        e = ffa_handle_rx_release();
+        e = ffa_rx_release(d);
         break;
     case FFA_MSG_SEND_DIRECT_REQ_32:
     case FFA_MSG_SEND_DIRECT_REQ_64:
diff --git a/xen/arch/arm/tee/ffa_partinfo.c b/xen/arch/arm/tee/ffa_partinfo.c
index 74324e1d9d..c0510ceb83 100644
--- a/xen/arch/arm/tee/ffa_partinfo.c
+++ b/xen/arch/arm/tee/ffa_partinfo.c
@@ -121,11 +121,9 @@ void ffa_handle_partition_info_get(struct cpu_user_regs *regs)
         goto out;
     }
 
-    if ( !spin_trylock(&ctx->rx_lock) )
-    {
-        ret = FFA_RET_BUSY;
+    ret = ffa_rx_acquire(d);
+    if ( ret != FFA_RET_OK )
         goto out;
-    }
 
     dst_buf = ctx->rx;
 
@@ -135,22 +133,16 @@ void ffa_handle_partition_info_get(struct cpu_user_regs *regs)
         goto out_rx_release;
     }
 
-    if ( !ctx->page_count || !ctx->rx_is_free )
-    {
-        ret = FFA_RET_DENIED;
-        goto out_rx_release;
-    }
-
     spin_lock(&ffa_rx_buffer_lock);
 
     ret = ffa_partition_info_get(uuid, 0, &ffa_sp_count, &src_size);
 
     if ( ret )
-        goto out_rx_buf_unlock;
+        goto out_rx_hyp_unlock;
 
     /*
      * ffa_partition_info_get() succeeded so we now own the RX buffer we
-     * share with the SPMC. We must give it back using ffa_rx_release()
+     * share with the SPMC. We must give it back using ffa_hyp_rx_release()
      * once we've copied the content.
      */
 
@@ -190,15 +182,20 @@ void ffa_handle_partition_info_get(struct cpu_user_regs *regs)
         }
     }
 
-    ctx->rx_is_free = false;
-
 out_rx_hyp_release:
-    ffa_rx_release();
-out_rx_buf_unlock:
+    ffa_hyp_rx_release();
+out_rx_hyp_unlock:
     spin_unlock(&ffa_rx_buffer_lock);
 out_rx_release:
-    spin_unlock(&ctx->rx_lock);
-
+    /*
+     * The calling VM RX buffer only contains data to be used by the VM if the
+     * call was successful, in which case the VM has to release the buffer
+     * once it has used the data.
+     * If something went wrong during the call, we have to release the RX
+     * buffer back to the SPMC as the VM will not do it.
+     */
+    if ( ret != FFA_RET_OK )
+        ffa_rx_release(d);
 out:
     if ( ret )
         ffa_set_regs_error(regs, ret);
@@ -365,8 +362,7 @@ bool ffa_partinfo_init(void)
     ret = init_subscribers(count, fpi_size);
 
 out:
-    ffa_rx_release();
-
+    ffa_hyp_rx_release();
     return ret;
 }
 
diff --git a/xen/arch/arm/tee/ffa_private.h b/xen/arch/arm/tee/ffa_private.h
index afe69b43db..9adfe687c3 100644
--- a/xen/arch/arm/tee/ffa_private.h
+++ b/xen/arch/arm/tee/ffa_private.h
@@ -265,6 +265,21 @@
 #define FFA_ABI_BITNUM(id)    ((FFA_ABI_ID(id) - FFA_ABI_MIN) << 1 | \
                                FFA_ABI_CONV(id))
 
+/* Constituent memory region descriptor */
+struct ffa_address_range {
+    uint64_t address;
+    uint32_t page_count;
+    uint32_t reserved;
+};
+
+/* Composite memory region descriptor */
+struct ffa_mem_region {
+    uint32_t total_page_count;
+    uint32_t address_range_count;
+    uint64_t reserved;
+    struct ffa_address_range address_range_array[];
+};
+
 struct ffa_ctx_notif {
     bool enabled;
 
@@ -292,7 +307,7 @@ struct ffa_ctx {
     struct ffa_ctx_notif notif;
     /*
      * tx_lock is used to serialize access to tx
-     * rx_lock is used to serialize access to rx
+     * rx_lock is used to serialize access to rx_is_free
      * lock is used for the rest in this struct
      */
     spinlock_t tx_lock;
@@ -331,7 +346,8 @@ void ffa_rxtx_domain_destroy(struct domain *d);
 uint32_t ffa_handle_rxtx_map(uint32_t fid, register_t tx_addr,
 			     register_t rx_addr, uint32_t page_count);
 uint32_t ffa_handle_rxtx_unmap(void);
-int32_t ffa_handle_rx_release(void);
+int32_t ffa_rx_acquire(struct domain *d);
+int32_t ffa_rx_release(struct domain *d);
 
 void ffa_notif_init(void);
 void ffa_notif_init_interrupt(void);
@@ -420,7 +436,7 @@ static inline int32_t ffa_simple_call(uint32_t fid, register_t a1,
     return ffa_get_ret_code(&resp);
 }
 
-static inline int32_t ffa_rx_release(void)
+static inline int32_t ffa_hyp_rx_release(void)
 {
     return ffa_simple_call(FFA_RX_RELEASE, 0, 0, 0, 0);
 }
diff --git a/xen/arch/arm/tee/ffa_rxtx.c b/xen/arch/arm/tee/ffa_rxtx.c
index 132a798240..a40e5b32e3 100644
--- a/xen/arch/arm/tee/ffa_rxtx.c
+++ b/xen/arch/arm/tee/ffa_rxtx.c
@@ -30,6 +30,17 @@ struct ffa_endpoint_rxtx_descriptor_1_1 {
     uint32_t tx_region_offs;
 };
 
+static int32_t ffa_rxtx_map(paddr_t tx_addr, paddr_t rx_addr,
+                            uint32_t page_count)
+{
+    return ffa_simple_call(FFA_RXTX_MAP_64, tx_addr, rx_addr, page_count, 0);
+}
+
+static int32_t ffa_rxtx_unmap(uint16_t id)
+{
+    return ffa_simple_call(FFA_RXTX_UNMAP, ((uint64_t)id) << 16, 0, 0, 0);
+}
+
 uint32_t ffa_handle_rxtx_map(uint32_t fid, register_t tx_addr,
 			     register_t rx_addr, uint32_t page_count)
 {
@@ -42,6 +53,9 @@ uint32_t ffa_handle_rxtx_map(uint32_t fid, register_t tx_addr,
     void *rx;
     void *tx;
 
+    /* The code is considering that we only get one page for now */
+    BUILD_BUG_ON(FFA_MAX_RXTX_PAGE_COUNT != 1);
+
     if ( !smccc_is_conv_64(fid) )
     {
         /*
@@ -72,7 +86,7 @@ uint32_t ffa_handle_rxtx_map(uint32_t fid, register_t tx_addr,
         goto err_put_tx_pg;
 
     rx_pg = get_page_from_gfn(d, gfn_x(gaddr_to_gfn(rx_addr)), &t, P2M_ALLOC);
-    if ( !tx_pg )
+    if ( !rx_pg )
         goto err_put_tx_pg;
 
     /* Only normal RW RAM for now */
@@ -87,6 +101,66 @@ uint32_t ffa_handle_rxtx_map(uint32_t fid, register_t tx_addr,
     if ( !rx )
         goto err_unmap_tx;
 
+    /*
+     * Transmit the RX/TX buffer information to the SPM if acquire is supported
+     * as the spec says that if not there is not need to acquire/release/map
+     * rxtx buffers from the SPMC
+     */
+    if ( ffa_fw_supports_fid(FFA_RX_ACQUIRE) )
+    {
+        struct ffa_endpoint_rxtx_descriptor_1_1 *rxtx_desc;
+        struct ffa_mem_region *mem_reg;
+
+        /* All must fit in our TX buffer */
+        BUILD_BUG_ON(sizeof(*rxtx_desc) + sizeof(*mem_reg) * 2 +
+                     sizeof(struct ffa_address_range) * 2 >
+                     FFA_MAX_RXTX_PAGE_COUNT * FFA_PAGE_SIZE);
+
+        spin_lock(&ffa_tx_buffer_lock);
+        rxtx_desc = ffa_tx;
+
+        /*
+         * We have only one page for each so we pack everything:
+         * - rx region descriptor
+         * - rx region range
+         * - tx region descriptor
+         * - tx region range
+         */
+        rxtx_desc->sender_id = ffa_get_vm_id(d);
+        rxtx_desc->reserved = 0;
+        rxtx_desc->rx_region_offs = sizeof(*rxtx_desc);
+        rxtx_desc->tx_region_offs = sizeof(*rxtx_desc) +
+                                    offsetof(struct ffa_mem_region,
+                                             address_range_array[1]);
+
+        /* rx buffer */
+        mem_reg = ffa_tx + sizeof(*rxtx_desc);
+        mem_reg->total_page_count = 1;
+        mem_reg->address_range_count = 1;
+        mem_reg->reserved = 0;
+
+        mem_reg->address_range_array[0].address = page_to_maddr(rx_pg);
+        mem_reg->address_range_array[0].page_count = 1;
+        mem_reg->address_range_array[0].reserved = 0;
+
+        /* tx buffer */
+        mem_reg = ffa_tx + rxtx_desc->tx_region_offs;
+        mem_reg->total_page_count = 1;
+        mem_reg->address_range_count = 1;
+        mem_reg->reserved = 0;
+
+        mem_reg->address_range_array[0].address = page_to_maddr(tx_pg);
+        mem_reg->address_range_array[0].page_count = 1;
+        mem_reg->address_range_array[0].reserved = 0;
+
+        ret = ffa_rxtx_map(0, 0, 0);
+
+        spin_unlock(&ffa_tx_buffer_lock);
+
+        if ( ret != FFA_RET_OK )
+            goto err_unmap_rx;
+    }
+
     ctx->rx = rx;
     ctx->tx = tx;
     ctx->rx_pg = rx_pg;
@@ -95,6 +169,8 @@ uint32_t ffa_handle_rxtx_map(uint32_t fid, register_t tx_addr,
     ctx->rx_is_free = true;
     return FFA_RET_OK;
 
+err_unmap_rx:
+    unmap_domain_page_global(rx);
 err_unmap_tx:
     unmap_domain_page_global(tx);
 err_put_rx_pg:
@@ -105,8 +181,22 @@ err_put_tx_pg:
     return ret;
 }
 
-static void rxtx_unmap(struct ffa_ctx *ctx)
+static uint32_t  rxtx_unmap(struct domain *d)
 {
+    struct ffa_ctx *ctx = d->arch.tee;
+
+    if ( !ctx->page_count )
+        return FFA_RET_INVALID_PARAMETERS;
+
+    if ( ffa_fw_supports_fid(FFA_RX_ACQUIRE) )
+    {
+        uint32_t ret;
+
+        ret = ffa_rxtx_unmap(ffa_get_vm_id(d));
+        if ( ret != FFA_RET_OK )
+            return ret;
+    }
+
     unmap_domain_page_global(ctx->rx);
     unmap_domain_page_global(ctx->tx);
     put_page(ctx->rx_pg);
@@ -117,32 +207,63 @@ static void rxtx_unmap(struct ffa_ctx *ctx)
     ctx->tx_pg = NULL;
     ctx->page_count = 0;
     ctx->rx_is_free = false;
+
+    return FFA_RET_OK;
 }
 
 uint32_t ffa_handle_rxtx_unmap(void)
 {
-    struct domain *d = current->domain;
+    return rxtx_unmap(current->domain);
+}
+
+int32_t ffa_rx_acquire(struct domain *d)
+{
+    int32_t ret = FFA_RET_OK;
     struct ffa_ctx *ctx = d->arch.tee;
 
-    if ( !ctx->rx )
-        return FFA_RET_INVALID_PARAMETERS;
+    spin_lock(&ctx->rx_lock);
 
-    rxtx_unmap(ctx);
+    if ( !ctx->page_count )
+    {
+        ret = FFA_RET_DENIED;
+        goto out;
+    }
 
-    return FFA_RET_OK;
+    if ( !ctx->rx_is_free )
+    {
+        ret = FFA_RET_BUSY;
+        goto out;
+    }
+
+    if ( ffa_fw_supports_fid(FFA_RX_ACQUIRE) )
+    {
+        ret = ffa_simple_call(FFA_RX_ACQUIRE, ffa_get_vm_id(d), 0, 0, 0);
+        if ( ret != FFA_RET_OK )
+            goto out;
+    }
+    ctx->rx_is_free = false;
+out:
+    spin_unlock(&ctx->rx_lock);
+
+    return ret;
 }
 
-int32_t ffa_handle_rx_release(void)
+int32_t ffa_rx_release(struct domain *d)
 {
     int32_t ret = FFA_RET_DENIED;
-    struct domain *d = current->domain;
     struct ffa_ctx *ctx = d->arch.tee;
 
-    if ( !spin_trylock(&ctx->rx_lock) )
-        return FFA_RET_BUSY;
+    spin_lock(&ctx->rx_lock);
 
     if ( !ctx->page_count || ctx->rx_is_free )
         goto out;
+
+    if ( ffa_fw_supports_fid(FFA_RX_ACQUIRE) )
+    {
+        ret = ffa_simple_call(FFA_RX_RELEASE, ffa_get_vm_id(d), 0, 0, 0);
+        if ( ret != FFA_RET_OK )
+            goto out;
+    }
     ret = FFA_RET_OK;
     ctx->rx_is_free = true;
 out:
@@ -151,23 +272,9 @@ out:
     return ret;
 }
 
-static int32_t ffa_rxtx_map(paddr_t tx_addr, paddr_t rx_addr,
-                            uint32_t page_count)
-{
-    return ffa_simple_call(FFA_RXTX_MAP_64, tx_addr, rx_addr, page_count, 0);
-}
-
-static int32_t ffa_rxtx_unmap(void)
-{
-    return ffa_simple_call(FFA_RXTX_UNMAP, 0, 0, 0, 0);
-}
-
 void ffa_rxtx_domain_destroy(struct domain *d)
 {
-    struct ffa_ctx *ctx = d->arch.tee;
-
-    if ( ctx->rx )
-        rxtx_unmap(ctx);
+    rxtx_unmap(d);
 }
 
 void ffa_rxtx_destroy(void)
@@ -186,7 +293,7 @@ void ffa_rxtx_destroy(void)
     }
 
     if ( need_unmap )
-        ffa_rxtx_unmap();
+        ffa_rxtx_unmap(0);
 }
 
 bool ffa_rxtx_init(void)
diff --git a/xen/arch/arm/tee/ffa_shm.c b/xen/arch/arm/tee/ffa_shm.c
index 29675f9ba3..d628c1b706 100644
--- a/xen/arch/arm/tee/ffa_shm.c
+++ b/xen/arch/arm/tee/ffa_shm.c
@@ -16,21 +16,6 @@
 
 #include "ffa_private.h"
 
-/* Constituent memory region descriptor */
-struct ffa_address_range {
-    uint64_t address;
-    uint32_t page_count;
-    uint32_t reserved;
-};
-
-/* Composite memory region descriptor */
-struct ffa_mem_region {
-    uint32_t total_page_count;
-    uint32_t address_range_count;
-    uint64_t reserved;
-    struct ffa_address_range address_range_array[];
-};
-
 /* Memory access permissions descriptor */
 struct ffa_mem_access_perm {
     uint16_t endpoint_id;
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Dec 17 08:01:13 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 17 Dec 2024 08:01:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.858552.1270801 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tNSW1-0001eC-25; Tue, 17 Dec 2024 08:01:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 858552.1270801; Tue, 17 Dec 2024 08:01:13 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tNSW0-0001e5-Vi; Tue, 17 Dec 2024 08:01:12 +0000
Received: by outflank-mailman (input) for mailman id 858552;
 Tue, 17 Dec 2024 08:01: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 1tNSW0-0001dx-HJ
 for xen-changelog@lists.xenproject.org; Tue, 17 Dec 2024 08:01:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1tNSW0-007vvt-0g
 for xen-changelog@lists.xenproject.org;
 Tue, 17 Dec 2024 08:01:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1tNSW0-00DZ8M-1T
 for xen-changelog@lists.xenproject.org;
 Tue, 17 Dec 2024 08: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>
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/arm: ffa: move message function into ffa_msg.c
Message-Id: <E1tNSW0-00DZ8M-1T@xenbits.xenproject.org>
Date: Tue, 17 Dec 2024 08:01:12 +0000

commit 42b6f47132474d1bf4aae8c9ab31c1a8f1df9e45
Author:     Bertrand Marquis <bertrand.marquis@arm.com>
AuthorDate: Wed Nov 27 17:07:40 2024 +0100
Commit:     Julien Grall <julien@xen.org>
CommitDate: Mon Dec 16 21:04:17 2024 +0100

    xen/arm: ffa: move message function into ffa_msg.c
    
    Move the direct message handling function in its own source file and
    rename it to have a ffa_ prefix.
    This is a preparation to add support for indirect messages which will
    go into this newly created source file.
    
    Signed-off-by: Bertrand Marquis <bertrand.marquis@arm.com>
    Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
---
 xen/arch/arm/tee/Makefile      |  1 +
 xen/arch/arm/tee/ffa.c         | 69 +-----------------------------------
 xen/arch/arm/tee/ffa_msg.c     | 80 ++++++++++++++++++++++++++++++++++++++++++
 xen/arch/arm/tee/ffa_private.h |  2 ++
 4 files changed, 84 insertions(+), 68 deletions(-)

diff --git a/xen/arch/arm/tee/Makefile b/xen/arch/arm/tee/Makefile
index 7c0f46f7f4..0848c833fe 100644
--- a/xen/arch/arm/tee/Makefile
+++ b/xen/arch/arm/tee/Makefile
@@ -3,5 +3,6 @@ obj-$(CONFIG_FFA) += ffa_shm.o
 obj-$(CONFIG_FFA) += ffa_partinfo.o
 obj-$(CONFIG_FFA) += ffa_rxtx.o
 obj-$(CONFIG_FFA) += ffa_notif.o
+obj-$(CONFIG_FFA) += ffa_msg.o
 obj-y += tee.o
 obj-$(CONFIG_OPTEE) += optee.o
diff --git a/xen/arch/arm/tee/ffa.c b/xen/arch/arm/tee/ffa.c
index bc2722d53f..8488fe6af9 100644
--- a/xen/arch/arm/tee/ffa.c
+++ b/xen/arch/arm/tee/ffa.c
@@ -167,73 +167,6 @@ static void handle_version(struct cpu_user_regs *regs)
     ffa_set_regs(regs, FFA_MY_VERSION, 0, 0, 0, 0, 0, 0, 0);
 }
 
-static void handle_msg_send_direct_req(struct cpu_user_regs *regs, uint32_t fid)
-{
-    struct arm_smccc_1_2_regs arg = { .a0 = fid, };
-    struct arm_smccc_1_2_regs resp = { };
-    struct domain *d = current->domain;
-    uint32_t src_dst;
-    uint64_t mask;
-
-    if ( smccc_is_conv_64(fid) )
-        mask = GENMASK_ULL(63, 0);
-    else
-        mask = GENMASK_ULL(31, 0);
-
-    if ( !ffa_fw_supports_fid(fid) )
-    {
-        resp.a0 = FFA_ERROR;
-        resp.a2 = FFA_RET_NOT_SUPPORTED;
-        goto out;
-    }
-
-    src_dst = get_user_reg(regs, 1);
-    if ( (src_dst >> 16) != ffa_get_vm_id(d) )
-    {
-        resp.a0 = FFA_ERROR;
-        resp.a2 = FFA_RET_INVALID_PARAMETERS;
-        goto out;
-    }
-
-    /* we do not support direct messages to VMs */
-    if ( !FFA_ID_IS_SECURE(src_dst & GENMASK(15,0)) )
-    {
-        resp.a0 = FFA_ERROR;
-        resp.a2 = FFA_RET_NOT_SUPPORTED;
-        goto out;
-    }
-
-    arg.a1 = src_dst;
-    arg.a2 = get_user_reg(regs, 2) & mask;
-    arg.a3 = get_user_reg(regs, 3) & mask;
-    arg.a4 = get_user_reg(regs, 4) & mask;
-    arg.a5 = get_user_reg(regs, 5) & mask;
-    arg.a6 = get_user_reg(regs, 6) & mask;
-    arg.a7 = get_user_reg(regs, 7) & mask;
-
-    arm_smccc_1_2_smc(&arg, &resp);
-    switch ( resp.a0 )
-    {
-    case FFA_ERROR:
-    case FFA_SUCCESS_32:
-    case FFA_SUCCESS_64:
-    case FFA_MSG_SEND_DIRECT_RESP_32:
-    case FFA_MSG_SEND_DIRECT_RESP_64:
-        break;
-    default:
-        /* Bad fid, report back to the caller. */
-        memset(&resp, 0, sizeof(resp));
-        resp.a0 = FFA_ERROR;
-        resp.a1 = src_dst;
-        resp.a2 = FFA_RET_ABORTED;
-    }
-
-out:
-    ffa_set_regs(regs, resp.a0, resp.a1 & mask, resp.a2 & mask, resp.a3 & mask,
-                 resp.a4 & mask, resp.a5 & mask, resp.a6 & mask,
-                 resp.a7 & mask);
-}
-
 static void handle_features(struct cpu_user_regs *regs)
 {
     struct domain *d = current->domain;
@@ -351,7 +284,7 @@ static bool ffa_handle_call(struct cpu_user_regs *regs)
         break;
     case FFA_MSG_SEND_DIRECT_REQ_32:
     case FFA_MSG_SEND_DIRECT_REQ_64:
-        handle_msg_send_direct_req(regs, fid);
+        ffa_handle_msg_send_direct_req(regs, fid);
         return true;
     case FFA_MEM_SHARE_32:
     case FFA_MEM_SHARE_64:
diff --git a/xen/arch/arm/tee/ffa_msg.c b/xen/arch/arm/tee/ffa_msg.c
new file mode 100644
index 0000000000..ae263e5489
--- /dev/null
+++ b/xen/arch/arm/tee/ffa_msg.c
@@ -0,0 +1,80 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+/*
+ * Copyright (C) 2024  Linaro Limited
+ */
+
+#include <xen/const.h>
+#include <xen/sizes.h>
+#include <xen/types.h>
+
+#include <asm/smccc.h>
+#include <asm/regs.h>
+
+#include "ffa_private.h"
+
+void ffa_handle_msg_send_direct_req(struct cpu_user_regs *regs, uint32_t fid)
+{
+    struct arm_smccc_1_2_regs arg = { .a0 = fid, };
+    struct arm_smccc_1_2_regs resp = { };
+    struct domain *d = current->domain;
+    uint32_t src_dst;
+    uint64_t mask;
+
+    if ( smccc_is_conv_64(fid) )
+        mask = GENMASK_ULL(63, 0);
+    else
+        mask = GENMASK_ULL(31, 0);
+
+    if ( !ffa_fw_supports_fid(fid) )
+    {
+        resp.a0 = FFA_ERROR;
+        resp.a2 = FFA_RET_NOT_SUPPORTED;
+        goto out;
+    }
+
+    src_dst = get_user_reg(regs, 1);
+    if ( (src_dst >> 16) != ffa_get_vm_id(d) )
+    {
+        resp.a0 = FFA_ERROR;
+        resp.a2 = FFA_RET_INVALID_PARAMETERS;
+        goto out;
+    }
+
+    /* we do not support direct messages to VMs */
+    if ( !FFA_ID_IS_SECURE(src_dst & GENMASK(15,0)) )
+    {
+        resp.a0 = FFA_ERROR;
+        resp.a2 = FFA_RET_NOT_SUPPORTED;
+        goto out;
+    }
+
+    arg.a1 = src_dst;
+    arg.a2 = get_user_reg(regs, 2) & mask;
+    arg.a3 = get_user_reg(regs, 3) & mask;
+    arg.a4 = get_user_reg(regs, 4) & mask;
+    arg.a5 = get_user_reg(regs, 5) & mask;
+    arg.a6 = get_user_reg(regs, 6) & mask;
+    arg.a7 = get_user_reg(regs, 7) & mask;
+
+    arm_smccc_1_2_smc(&arg, &resp);
+    switch ( resp.a0 )
+    {
+    case FFA_ERROR:
+    case FFA_SUCCESS_32:
+    case FFA_SUCCESS_64:
+    case FFA_MSG_SEND_DIRECT_RESP_32:
+    case FFA_MSG_SEND_DIRECT_RESP_64:
+        break;
+    default:
+        /* Bad fid, report back to the caller. */
+        memset(&resp, 0, sizeof(resp));
+        resp.a0 = FFA_ERROR;
+        resp.a1 = src_dst;
+        resp.a2 = FFA_RET_ABORTED;
+    }
+
+out:
+    ffa_set_regs(regs, resp.a0, resp.a1 & mask, resp.a2 & mask, resp.a3 & mask,
+                 resp.a4 & mask, resp.a5 & mask, resp.a6 & mask,
+                 resp.a7 & mask);
+}
diff --git a/xen/arch/arm/tee/ffa_private.h b/xen/arch/arm/tee/ffa_private.h
index 9adfe687c3..02162e0ee4 100644
--- a/xen/arch/arm/tee/ffa_private.h
+++ b/xen/arch/arm/tee/ffa_private.h
@@ -360,6 +360,8 @@ void ffa_handle_notification_info_get(struct cpu_user_regs *regs);
 void ffa_handle_notification_get(struct cpu_user_regs *regs);
 int ffa_handle_notification_set(struct cpu_user_regs *regs);
 
+void ffa_handle_msg_send_direct_req(struct cpu_user_regs *regs, uint32_t fid);
+
 static inline uint16_t ffa_get_vm_id(const struct domain *d)
 {
     /* +1 since 0 is reserved for the hypervisor in FF-A */
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Dec 17 08:01:24 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 17 Dec 2024 08:01:24 +0000
Received: from list by lists.xenproject.org with outflank-mailman.858553.1270804 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tNSWC-0001gi-3d; Tue, 17 Dec 2024 08:01:24 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 858553.1270804; Tue, 17 Dec 2024 08: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 1tNSWC-0001gb-1G; Tue, 17 Dec 2024 08:01:24 +0000
Received: by outflank-mailman (input) for mailman id 858553;
 Tue, 17 Dec 2024 08:01: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 1tNSWA-0001gT-Kd
 for xen-changelog@lists.xenproject.org; Tue, 17 Dec 2024 08:01:22 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1tNSWA-007vvz-11
 for xen-changelog@lists.xenproject.org;
 Tue, 17 Dec 2024 08:01:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1tNSWA-00DZAb-1p
 for xen-changelog@lists.xenproject.org;
 Tue, 17 Dec 2024 08:01: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>
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/arm: ffa: Remove per VM notif_enabled
Message-Id: <E1tNSWA-00DZAb-1p@xenbits.xenproject.org>
Date: Tue, 17 Dec 2024 08:01:22 +0000

commit e6794b683b817463a8a3f8670dd720f33ed11f1f
Author:     Bertrand Marquis <bertrand.marquis@arm.com>
AuthorDate: Wed Nov 27 17:07:41 2024 +0100
Commit:     Julien Grall <julien@xen.org>
CommitDate: Mon Dec 16 21:04:17 2024 +0100

    xen/arm: ffa: Remove per VM notif_enabled
    
    Remove the per VM flag to store if notifications are enabled or not as
    the only case where they are not, if notifications are enabled globally,
    will make the VM creation fail.
    Also use the opportunity to always give the notifications interrupts IDs
    to VM. If the firmware does not support notifications, there won't be
    any generated and setting one will give back a NOT_SUPPORTED.
    
    Signed-off-by: Bertrand Marquis <bertrand.marquis@arm.com>
    Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
---
 xen/arch/arm/tee/ffa.c         | 17 +++--------------
 xen/arch/arm/tee/ffa_notif.c   | 14 +++++---------
 xen/arch/arm/tee/ffa_private.h |  2 --
 3 files changed, 8 insertions(+), 25 deletions(-)

diff --git a/xen/arch/arm/tee/ffa.c b/xen/arch/arm/tee/ffa.c
index 8488fe6af9..04d2403415 100644
--- a/xen/arch/arm/tee/ffa.c
+++ b/xen/arch/arm/tee/ffa.c
@@ -169,8 +169,6 @@ static void handle_version(struct cpu_user_regs *regs)
 
 static void handle_features(struct cpu_user_regs *regs)
 {
-    struct domain *d = current->domain;
-    struct ffa_ctx *ctx = d->arch.tee;
     uint32_t a1 = get_user_reg(regs, 1);
     unsigned int n;
 
@@ -218,16 +216,10 @@ static void handle_features(struct cpu_user_regs *regs)
         ffa_set_regs_success(regs, 0, 0);
         break;
     case FFA_FEATURE_NOTIF_PEND_INTR:
-        if ( ctx->notif.enabled )
-            ffa_set_regs_success(regs, GUEST_FFA_NOTIF_PEND_INTR_ID, 0);
-        else
-            ffa_set_regs_error(regs, FFA_RET_NOT_SUPPORTED);
+        ffa_set_regs_success(regs, GUEST_FFA_NOTIF_PEND_INTR_ID, 0);
         break;
     case FFA_FEATURE_SCHEDULE_RECV_INTR:
-        if ( ctx->notif.enabled )
-            ffa_set_regs_success(regs, GUEST_FFA_SCHEDULE_RECV_INTR_ID, 0);
-        else
-            ffa_set_regs_error(regs, FFA_RET_NOT_SUPPORTED);
+        ffa_set_regs_success(regs, GUEST_FFA_SCHEDULE_RECV_INTR_ID, 0);
         break;
 
     case FFA_NOTIFICATION_BIND:
@@ -236,10 +228,7 @@ static void handle_features(struct cpu_user_regs *regs)
     case FFA_NOTIFICATION_SET:
     case FFA_NOTIFICATION_INFO_GET_32:
     case FFA_NOTIFICATION_INFO_GET_64:
-        if ( ctx->notif.enabled )
-            ffa_set_regs_success(regs, 0, 0);
-        else
-            ffa_set_regs_error(regs, FFA_RET_NOT_SUPPORTED);
+        ffa_set_regs_success(regs, 0, 0);
         break;
     default:
         ffa_set_regs_error(regs, FFA_RET_NOT_SUPPORTED);
diff --git a/xen/arch/arm/tee/ffa_notif.c b/xen/arch/arm/tee/ffa_notif.c
index 4b3e46318f..21b9e78f63 100644
--- a/xen/arch/arm/tee/ffa_notif.c
+++ b/xen/arch/arm/tee/ffa_notif.c
@@ -405,7 +405,6 @@ void ffa_notif_init(void)
 
 int ffa_notif_domain_init(struct domain *d)
 {
-    struct ffa_ctx *ctx = d->arch.tee;
     int32_t res;
 
     if ( !notif_enabled )
@@ -415,18 +414,15 @@ int ffa_notif_domain_init(struct domain *d)
     if ( res )
         return -ENOMEM;
 
-    ctx->notif.enabled = true;
-
     return 0;
 }
 
 void ffa_notif_domain_destroy(struct domain *d)
 {
-    struct ffa_ctx *ctx = d->arch.tee;
-
-    if ( ctx->notif.enabled )
-    {
+    /*
+     * Call bitmap_destroy even if bitmap create failed as the SPMC will
+     * return a DENIED error that we will ignore.
+     */
+    if ( notif_enabled )
         ffa_notification_bitmap_destroy(ffa_get_vm_id(d));
-        ctx->notif.enabled = false;
-    }
 }
diff --git a/xen/arch/arm/tee/ffa_private.h b/xen/arch/arm/tee/ffa_private.h
index 02162e0ee4..973ee55be0 100644
--- a/xen/arch/arm/tee/ffa_private.h
+++ b/xen/arch/arm/tee/ffa_private.h
@@ -281,8 +281,6 @@ struct ffa_mem_region {
 };
 
 struct ffa_ctx_notif {
-    bool enabled;
-
     /*
      * True if domain is reported by FFA_NOTIFICATION_INFO_GET to have
      * pending global notifications.
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Dec 17 08:01:34 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 17 Dec 2024 08:01:34 +0000
Received: from list by lists.xenproject.org with outflank-mailman.858554.1270808 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tNSWM-0001iw-5k; Tue, 17 Dec 2024 08:01:34 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 858554.1270808; Tue, 17 Dec 2024 08: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 1tNSWM-0001io-3J; Tue, 17 Dec 2024 08:01:34 +0000
Received: by outflank-mailman (input) for mailman id 858554;
 Tue, 17 Dec 2024 08:01: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 1tNSWK-0001ii-P9
 for xen-changelog@lists.xenproject.org; Tue, 17 Dec 2024 08:01:32 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1tNSWK-007vwA-1N
 for xen-changelog@lists.xenproject.org;
 Tue, 17 Dec 2024 08:01:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1tNSWK-00DZCI-2C
 for xen-changelog@lists.xenproject.org;
 Tue, 17 Dec 2024 08:01: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>
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/arm: ffa: Add indirect message support
Message-Id: <E1tNSWK-00DZCI-2C@xenbits.xenproject.org>
Date: Tue, 17 Dec 2024 08:01:32 +0000

commit df8a0eec1c66fac9a74a3fb62f4d9713999392c3
Author:     Bertrand Marquis <bertrand.marquis@arm.com>
AuthorDate: Wed Nov 27 17:07:42 2024 +0100
Commit:     Julien Grall <julien@xen.org>
CommitDate: Mon Dec 16 21:04:17 2024 +0100

    xen/arm: ffa: Add indirect message support
    
    Add support for FFA_MSG_SEND2 to send indirect messages from a VM to a
    secure partition.
    
    Signed-off-by: Bertrand Marquis <bertrand.marquis@arm.com>
    Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
---
 xen/arch/arm/tee/ffa.c         |  5 +++++
 xen/arch/arm/tee/ffa_msg.c     | 50 ++++++++++++++++++++++++++++++++++++++++++
 xen/arch/arm/tee/ffa_private.h |  1 +
 3 files changed, 56 insertions(+)

diff --git a/xen/arch/arm/tee/ffa.c b/xen/arch/arm/tee/ffa.c
index 04d2403415..87775ed88f 100644
--- a/xen/arch/arm/tee/ffa.c
+++ b/xen/arch/arm/tee/ffa.c
@@ -101,6 +101,7 @@ static const struct ffa_fw_abi ffa_fw_abi_needed[] = {
     FW_ABI(FFA_MEM_RECLAIM),
     FW_ABI(FFA_MSG_SEND_DIRECT_REQ_32),
     FW_ABI(FFA_MSG_SEND_DIRECT_REQ_64),
+    FW_ABI(FFA_MSG_SEND2),
 };
 
 /*
@@ -195,6 +196,7 @@ static void handle_features(struct cpu_user_regs *regs)
     case FFA_PARTITION_INFO_GET:
     case FFA_MSG_SEND_DIRECT_REQ_32:
     case FFA_MSG_SEND_DIRECT_REQ_64:
+    case FFA_MSG_SEND2:
         ffa_set_regs_success(regs, 0, 0);
         break;
     case FFA_MEM_SHARE_64:
@@ -275,6 +277,9 @@ static bool ffa_handle_call(struct cpu_user_regs *regs)
     case FFA_MSG_SEND_DIRECT_REQ_64:
         ffa_handle_msg_send_direct_req(regs, fid);
         return true;
+    case FFA_MSG_SEND2:
+        e = ffa_handle_msg_send2(regs);
+        break;
     case FFA_MEM_SHARE_32:
     case FFA_MEM_SHARE_64:
         ffa_handle_mem_share(regs);
diff --git a/xen/arch/arm/tee/ffa_msg.c b/xen/arch/arm/tee/ffa_msg.c
index ae263e5489..ee594e737f 100644
--- a/xen/arch/arm/tee/ffa_msg.c
+++ b/xen/arch/arm/tee/ffa_msg.c
@@ -12,6 +12,15 @@
 
 #include "ffa_private.h"
 
+/* Encoding of partition message in RX/TX buffer */
+struct ffa_part_msg_rxtx {
+    uint32_t flags;
+    uint32_t reserved;
+    uint32_t msg_offset;
+    uint32_t send_recv_id;
+    uint32_t msg_size;
+};
+
 void ffa_handle_msg_send_direct_req(struct cpu_user_regs *regs, uint32_t fid)
 {
     struct arm_smccc_1_2_regs arg = { .a0 = fid, };
@@ -78,3 +87,44 @@ out:
                  resp.a4 & mask, resp.a5 & mask, resp.a6 & mask,
                  resp.a7 & mask);
 }
+
+int32_t ffa_handle_msg_send2(struct cpu_user_regs *regs)
+{
+    struct domain *src_d = current->domain;
+    struct ffa_ctx *src_ctx = src_d->arch.tee;
+    const struct ffa_part_msg_rxtx *src_msg;
+    uint16_t dst_id, src_id;
+    int32_t ret;
+
+    if ( !ffa_fw_supports_fid(FFA_MSG_SEND2) )
+        return FFA_RET_NOT_SUPPORTED;
+
+    if ( !spin_trylock(&src_ctx->tx_lock) )
+        return FFA_RET_BUSY;
+
+    src_msg = src_ctx->tx;
+    src_id = src_msg->send_recv_id >> 16;
+    dst_id = src_msg->send_recv_id & GENMASK(15,0);
+
+    if ( src_id != ffa_get_vm_id(src_d) || !FFA_ID_IS_SECURE(dst_id) )
+    {
+        ret = FFA_RET_INVALID_PARAMETERS;
+        goto out_unlock_tx;
+    }
+
+    /* check source message fits in buffer */
+    if ( src_ctx->page_count * FFA_PAGE_SIZE <
+         src_msg->msg_offset + src_msg->msg_size ||
+         src_msg->msg_offset < sizeof(struct ffa_part_msg_rxtx) )
+    {
+        ret = FFA_RET_INVALID_PARAMETERS;
+        goto out_unlock_tx;
+    }
+
+    ret = ffa_simple_call(FFA_MSG_SEND2,
+                          ((uint32_t)ffa_get_vm_id(src_d)) << 16, 0, 0, 0);
+
+out_unlock_tx:
+    spin_unlock(&src_ctx->tx_lock);
+    return ret;
+}
diff --git a/xen/arch/arm/tee/ffa_private.h b/xen/arch/arm/tee/ffa_private.h
index 973ee55be0..d441c0ca55 100644
--- a/xen/arch/arm/tee/ffa_private.h
+++ b/xen/arch/arm/tee/ffa_private.h
@@ -359,6 +359,7 @@ void ffa_handle_notification_get(struct cpu_user_regs *regs);
 int ffa_handle_notification_set(struct cpu_user_regs *regs);
 
 void ffa_handle_msg_send_direct_req(struct cpu_user_regs *regs, uint32_t fid);
+int32_t ffa_handle_msg_send2(struct cpu_user_regs *regs);
 
 static inline uint16_t ffa_get_vm_id(const struct domain *d)
 {
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Dec 17 09:33:14 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 17 Dec 2024 09:33:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.858689.1270933 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tNTwz-0003FK-59; Tue, 17 Dec 2024 09:33:09 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 858689.1270933; Tue, 17 Dec 2024 09:33:09 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tNTwz-0003FC-2d; Tue, 17 Dec 2024 09:33:09 +0000
Received: by outflank-mailman (input) for mailman id 858689;
 Tue, 17 Dec 2024 09:33:08 +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 1tNTwx-0003F6-VH
 for xen-changelog@lists.xenproject.org; Tue, 17 Dec 2024 09:33:07 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1tNTwx-007xsO-16
 for xen-changelog@lists.xenproject.org;
 Tue, 17 Dec 2024 09:33:07 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1tNTwx-00DjUJ-1t
 for xen-changelog@lists.xenproject.org;
 Tue, 17 Dec 2024 09:33:07 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/arm: Check for Static Heap feature when freeing resources
Message-Id: <E1tNTwx-00DjUJ-1t@xenbits.xenproject.org>
Date: Tue, 17 Dec 2024 09:33:07 +0000

commit 4cde11cdae7fecbb92acfa49c8ae7f7e3530a4eb
Author:     Penny Zheng <Penny.Zheng@arm.com>
AuthorDate: Fri Dec 13 10:50:47 2024 +0000
Commit:     Michal Orzel <michal.orzel@amd.com>
CommitDate: Tue Dec 17 09:58:47 2024 +0100

    xen/arm: Check for Static Heap feature when freeing resources
    
    If the Xen heap is statically configured in Device Tree, its size is
    definite, so only the defined memory shall be given to the boot
    allocator. Have a check where init_domheap_pages() is called
    which takes into account if static heap feature is used.
    
    Extract static_heap flag from init data bootinfo, as it will be needed
    after destroying the init data section, rename it to using_static_heap
    and use it to tell whether the Xen static heap feature is enabled.
    
    Signed-off-by: Penny Zheng <penny.zheng@arm.com>
    Signed-off-by: Wei Chen <wei.chen@arm.com>
    Signed-off-by: Luca Fancellu <luca.fancellu@arm.com>
    Reviewed-by: Michal Orzel <michal.orzel@amd.com>
---
 xen/arch/arm/arm32/mmu/mm.c       | 4 ++--
 xen/arch/arm/kernel.c             | 7 +++++++
 xen/arch/arm/mmu/setup.c          | 8 ++++++--
 xen/arch/arm/setup.c              | 8 ++++++++
 xen/common/device-tree/bootfdt.c  | 2 +-
 xen/common/device-tree/bootinfo.c | 2 +-
 xen/common/page_alloc.c           | 3 +++
 xen/include/xen/bootfdt.h         | 1 -
 xen/include/xen/mm.h              | 2 ++
 9 files changed, 30 insertions(+), 7 deletions(-)

diff --git a/xen/arch/arm/arm32/mmu/mm.c b/xen/arch/arm/arm32/mmu/mm.c
index 063611412b..0824d61323 100644
--- a/xen/arch/arm/arm32/mmu/mm.c
+++ b/xen/arch/arm/arm32/mmu/mm.c
@@ -199,7 +199,7 @@ void __init setup_mm(void)
 
     total_pages = ram_size >> PAGE_SHIFT;
 
-    if ( bootinfo.static_heap )
+    if ( using_static_heap )
     {
         const struct membanks *reserved_mem = bootinfo_get_reserved_mem();
 
@@ -246,7 +246,7 @@ void __init setup_mm(void)
 
     do
     {
-        e = bootinfo.static_heap ?
+        e = using_static_heap ?
             fit_xenheap_in_static_heap(pfn_to_paddr(xenheap_pages), MB(32)) :
             consider_modules(ram_start, ram_end,
                              pfn_to_paddr(xenheap_pages),
diff --git a/xen/arch/arm/kernel.c b/xen/arch/arm/kernel.c
index 293d7efaed..80fad8b336 100644
--- a/xen/arch/arm/kernel.c
+++ b/xen/arch/arm/kernel.c
@@ -235,6 +235,13 @@ static __init int kernel_decompress(struct bootmodule *mod, uint32_t offset)
     for ( ; i < (1 << kernel_order_out); i++ )
         free_domheap_page(pages + i);
 
+    /*
+     * When using static heap feature, don't give bootmodules memory back to
+     * the heap allocator
+     */
+    if ( using_static_heap )
+        return 0;
+
     /*
      * When freeing the kernel, we need to pass the module start address and
      * size as they were before taking an offset to gzip header into account,
diff --git a/xen/arch/arm/mmu/setup.c b/xen/arch/arm/mmu/setup.c
index 9664e85ee6..8c87649bc8 100644
--- a/xen/arch/arm/mmu/setup.c
+++ b/xen/arch/arm/mmu/setup.c
@@ -341,8 +341,12 @@ void free_init_memory(void)
     if ( rc )
         panic("Unable to remove the init section (rc = %d)\n", rc);
 
-    init_domheap_pages(pa, pa + len);
-    printk("Freed %ldkB init memory.\n", (long)(__init_end-__init_begin)>>10);
+    if ( !using_static_heap )
+    {
+        init_domheap_pages(pa, pa + len);
+        printk("Freed %ldkB init memory.\n",
+               (long)(__init_end-__init_begin) >> 10);
+    }
 }
 
 /**
diff --git a/xen/arch/arm/setup.c b/xen/arch/arm/setup.c
index 2e27af4560..545702d8a3 100644
--- a/xen/arch/arm/setup.c
+++ b/xen/arch/arm/setup.c
@@ -206,6 +206,13 @@ void __init discard_initial_modules(void)
     struct bootmodules *mi = &bootinfo.modules;
     int i;
 
+    /*
+     * When using static heap feature, don't give bootmodules memory back to
+     * the heap allocator
+     */
+    if ( using_static_heap )
+        goto out;
+
     for ( i = 0; i < mi->nr_mods; i++ )
     {
         paddr_t s = mi->module[i].start;
@@ -223,6 +230,7 @@ void __init discard_initial_modules(void)
 
     mi->nr_mods = 0;
 
+ out:
     remove_early_mappings();
 }
 
diff --git a/xen/common/device-tree/bootfdt.c b/xen/common/device-tree/bootfdt.c
index fc93d86e82..47386d4fff 100644
--- a/xen/common/device-tree/bootfdt.c
+++ b/xen/common/device-tree/bootfdt.c
@@ -410,7 +410,7 @@ static int __init process_chosen_node(const void *fdt, int node,
         if ( rc )
             return rc;
 
-        bootinfo.static_heap = true;
+        using_static_heap = true;
     }
 
     printk("Checking for initrd in /chosen\n");
diff --git a/xen/common/device-tree/bootinfo.c b/xen/common/device-tree/bootinfo.c
index 0daf5e941a..76d652c0de 100644
--- a/xen/common/device-tree/bootinfo.c
+++ b/xen/common/device-tree/bootinfo.c
@@ -407,7 +407,7 @@ void __init populate_boot_allocator(void)
     const struct membanks *reserved_mem = bootinfo_get_reserved_mem();
     paddr_t s, e;
 
-    if ( bootinfo.static_heap )
+    if ( using_static_heap )
     {
         for ( i = 0 ; i < reserved_mem->nr_banks; i++ )
         {
diff --git a/xen/common/page_alloc.c b/xen/common/page_alloc.c
index 92abed6514..1f424333db 100644
--- a/xen/common/page_alloc.c
+++ b/xen/common/page_alloc.c
@@ -165,6 +165,9 @@
 #define PGT_TYPE_INFO_INITIALIZER 0
 #endif
 
+/* Flag saved when Xen is using the static heap feature */
+bool __ro_after_init using_static_heap;
+
 unsigned long __read_mostly max_page;
 unsigned long __read_mostly total_pages;
 paddr_t __ro_after_init mem_hotplug;
diff --git a/xen/include/xen/bootfdt.h b/xen/include/xen/bootfdt.h
index 343c48b73d..c8bbfd8979 100644
--- a/xen/include/xen/bootfdt.h
+++ b/xen/include/xen/bootfdt.h
@@ -139,7 +139,6 @@ struct bootinfo {
 #ifdef CONFIG_STATIC_SHM
     struct shared_meminfo shmem;
 #endif
-    bool static_heap;
 };
 
 #ifdef CONFIG_ACPI
diff --git a/xen/include/xen/mm.h b/xen/include/xen/mm.h
index d7dcf0f063..16f733281a 100644
--- a/xen/include/xen/mm.h
+++ b/xen/include/xen/mm.h
@@ -72,6 +72,8 @@
 
 struct page_info;
 
+extern bool using_static_heap;
+
 void put_page(struct page_info *page);
 bool __must_check get_page(struct page_info *page,
                            const struct domain *domain);
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Dec 17 10:44:09 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 17 Dec 2024 10:44:09 +0000
Received: from list by lists.xenproject.org with outflank-mailman.858755.1270987 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tNV3c-000735-5g; Tue, 17 Dec 2024 10:44:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 858755.1270987; Tue, 17 Dec 2024 10: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 1tNV3c-00072x-2b; Tue, 17 Dec 2024 10:44:04 +0000
Received: by outflank-mailman (input) for mailman id 858755;
 Tue, 17 Dec 2024 10: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 1tNV3a-00072r-3k
 for xen-changelog@lists.xenproject.org; Tue, 17 Dec 2024 10:44:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1tNV3Z-007zdJ-1u
 for xen-changelog@lists.xenproject.org;
 Tue, 17 Dec 2024 10:44:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1tNV3Z-00DrQ4-2d
 for xen-changelog@lists.xenproject.org;
 Tue, 17 Dec 2024 10:44:01 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/arm: Check for Static Heap feature when freeing resources
Message-Id: <E1tNV3Z-00DrQ4-2d@xenbits.xenproject.org>
Date: Tue, 17 Dec 2024 10:44:01 +0000

commit 4cde11cdae7fecbb92acfa49c8ae7f7e3530a4eb
Author:     Penny Zheng <Penny.Zheng@arm.com>
AuthorDate: Fri Dec 13 10:50:47 2024 +0000
Commit:     Michal Orzel <michal.orzel@amd.com>
CommitDate: Tue Dec 17 09:58:47 2024 +0100

    xen/arm: Check for Static Heap feature when freeing resources
    
    If the Xen heap is statically configured in Device Tree, its size is
    definite, so only the defined memory shall be given to the boot
    allocator. Have a check where init_domheap_pages() is called
    which takes into account if static heap feature is used.
    
    Extract static_heap flag from init data bootinfo, as it will be needed
    after destroying the init data section, rename it to using_static_heap
    and use it to tell whether the Xen static heap feature is enabled.
    
    Signed-off-by: Penny Zheng <penny.zheng@arm.com>
    Signed-off-by: Wei Chen <wei.chen@arm.com>
    Signed-off-by: Luca Fancellu <luca.fancellu@arm.com>
    Reviewed-by: Michal Orzel <michal.orzel@amd.com>
---
 xen/arch/arm/arm32/mmu/mm.c       | 4 ++--
 xen/arch/arm/kernel.c             | 7 +++++++
 xen/arch/arm/mmu/setup.c          | 8 ++++++--
 xen/arch/arm/setup.c              | 8 ++++++++
 xen/common/device-tree/bootfdt.c  | 2 +-
 xen/common/device-tree/bootinfo.c | 2 +-
 xen/common/page_alloc.c           | 3 +++
 xen/include/xen/bootfdt.h         | 1 -
 xen/include/xen/mm.h              | 2 ++
 9 files changed, 30 insertions(+), 7 deletions(-)

diff --git a/xen/arch/arm/arm32/mmu/mm.c b/xen/arch/arm/arm32/mmu/mm.c
index 063611412b..0824d61323 100644
--- a/xen/arch/arm/arm32/mmu/mm.c
+++ b/xen/arch/arm/arm32/mmu/mm.c
@@ -199,7 +199,7 @@ void __init setup_mm(void)
 
     total_pages = ram_size >> PAGE_SHIFT;
 
-    if ( bootinfo.static_heap )
+    if ( using_static_heap )
     {
         const struct membanks *reserved_mem = bootinfo_get_reserved_mem();
 
@@ -246,7 +246,7 @@ void __init setup_mm(void)
 
     do
     {
-        e = bootinfo.static_heap ?
+        e = using_static_heap ?
             fit_xenheap_in_static_heap(pfn_to_paddr(xenheap_pages), MB(32)) :
             consider_modules(ram_start, ram_end,
                              pfn_to_paddr(xenheap_pages),
diff --git a/xen/arch/arm/kernel.c b/xen/arch/arm/kernel.c
index 293d7efaed..80fad8b336 100644
--- a/xen/arch/arm/kernel.c
+++ b/xen/arch/arm/kernel.c
@@ -235,6 +235,13 @@ static __init int kernel_decompress(struct bootmodule *mod, uint32_t offset)
     for ( ; i < (1 << kernel_order_out); i++ )
         free_domheap_page(pages + i);
 
+    /*
+     * When using static heap feature, don't give bootmodules memory back to
+     * the heap allocator
+     */
+    if ( using_static_heap )
+        return 0;
+
     /*
      * When freeing the kernel, we need to pass the module start address and
      * size as they were before taking an offset to gzip header into account,
diff --git a/xen/arch/arm/mmu/setup.c b/xen/arch/arm/mmu/setup.c
index 9664e85ee6..8c87649bc8 100644
--- a/xen/arch/arm/mmu/setup.c
+++ b/xen/arch/arm/mmu/setup.c
@@ -341,8 +341,12 @@ void free_init_memory(void)
     if ( rc )
         panic("Unable to remove the init section (rc = %d)\n", rc);
 
-    init_domheap_pages(pa, pa + len);
-    printk("Freed %ldkB init memory.\n", (long)(__init_end-__init_begin)>>10);
+    if ( !using_static_heap )
+    {
+        init_domheap_pages(pa, pa + len);
+        printk("Freed %ldkB init memory.\n",
+               (long)(__init_end-__init_begin) >> 10);
+    }
 }
 
 /**
diff --git a/xen/arch/arm/setup.c b/xen/arch/arm/setup.c
index 2e27af4560..545702d8a3 100644
--- a/xen/arch/arm/setup.c
+++ b/xen/arch/arm/setup.c
@@ -206,6 +206,13 @@ void __init discard_initial_modules(void)
     struct bootmodules *mi = &bootinfo.modules;
     int i;
 
+    /*
+     * When using static heap feature, don't give bootmodules memory back to
+     * the heap allocator
+     */
+    if ( using_static_heap )
+        goto out;
+
     for ( i = 0; i < mi->nr_mods; i++ )
     {
         paddr_t s = mi->module[i].start;
@@ -223,6 +230,7 @@ void __init discard_initial_modules(void)
 
     mi->nr_mods = 0;
 
+ out:
     remove_early_mappings();
 }
 
diff --git a/xen/common/device-tree/bootfdt.c b/xen/common/device-tree/bootfdt.c
index fc93d86e82..47386d4fff 100644
--- a/xen/common/device-tree/bootfdt.c
+++ b/xen/common/device-tree/bootfdt.c
@@ -410,7 +410,7 @@ static int __init process_chosen_node(const void *fdt, int node,
         if ( rc )
             return rc;
 
-        bootinfo.static_heap = true;
+        using_static_heap = true;
     }
 
     printk("Checking for initrd in /chosen\n");
diff --git a/xen/common/device-tree/bootinfo.c b/xen/common/device-tree/bootinfo.c
index 0daf5e941a..76d652c0de 100644
--- a/xen/common/device-tree/bootinfo.c
+++ b/xen/common/device-tree/bootinfo.c
@@ -407,7 +407,7 @@ void __init populate_boot_allocator(void)
     const struct membanks *reserved_mem = bootinfo_get_reserved_mem();
     paddr_t s, e;
 
-    if ( bootinfo.static_heap )
+    if ( using_static_heap )
     {
         for ( i = 0 ; i < reserved_mem->nr_banks; i++ )
         {
diff --git a/xen/common/page_alloc.c b/xen/common/page_alloc.c
index 92abed6514..1f424333db 100644
--- a/xen/common/page_alloc.c
+++ b/xen/common/page_alloc.c
@@ -165,6 +165,9 @@
 #define PGT_TYPE_INFO_INITIALIZER 0
 #endif
 
+/* Flag saved when Xen is using the static heap feature */
+bool __ro_after_init using_static_heap;
+
 unsigned long __read_mostly max_page;
 unsigned long __read_mostly total_pages;
 paddr_t __ro_after_init mem_hotplug;
diff --git a/xen/include/xen/bootfdt.h b/xen/include/xen/bootfdt.h
index 343c48b73d..c8bbfd8979 100644
--- a/xen/include/xen/bootfdt.h
+++ b/xen/include/xen/bootfdt.h
@@ -139,7 +139,6 @@ struct bootinfo {
 #ifdef CONFIG_STATIC_SHM
     struct shared_meminfo shmem;
 #endif
-    bool static_heap;
 };
 
 #ifdef CONFIG_ACPI
diff --git a/xen/include/xen/mm.h b/xen/include/xen/mm.h
index d7dcf0f063..16f733281a 100644
--- a/xen/include/xen/mm.h
+++ b/xen/include/xen/mm.h
@@ -72,6 +72,8 @@
 
 struct page_info;
 
+extern bool using_static_heap;
+
 void put_page(struct page_info *page);
 bool __must_check get_page(struct page_info *page,
                            const struct domain *domain);
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Dec 17 10:55:10 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 17 Dec 2024 10:55:10 +0000
Received: from list by lists.xenproject.org with outflank-mailman.858757.1270990 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tNVEJ-0008OH-W3; Tue, 17 Dec 2024 10:55:07 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 858757.1270990; Tue, 17 Dec 2024 10:55:07 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tNVEJ-0008OA-Ta; Tue, 17 Dec 2024 10:55:07 +0000
Received: by outflank-mailman (input) for mailman id 858757;
 Tue, 17 Dec 2024 10:55:07 +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 1tNVEJ-0008O4-DZ
 for xen-changelog@lists.xenproject.org; Tue, 17 Dec 2024 10:55:07 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1tNVEI-007zr6-37
 for xen-changelog@lists.xenproject.org;
 Tue, 17 Dec 2024 10:55:07 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1tNVEJ-00Dsu3-0a
 for xen-changelog@lists.xenproject.org;
 Tue, 17 Dec 2024 10:55:07 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/io-apic: prevent early exit from i8259 loop detection
Message-Id: <E1tNVEJ-00Dsu3-0a@xenbits.xenproject.org>
Date: Tue, 17 Dec 2024 10:55:07 +0000

commit f38fd27c4ceadf7ec4e82e82d0731b6ea415c51e
Author:     Roger Pau Monne <roger.pau@citrix.com>
AuthorDate: Mon Dec 16 19:33:29 2024 +0100
Commit:     Roger Pau Monne <roger.pau@citrix.com>
CommitDate: Tue Dec 17 11:15:30 2024 +0100

    x86/io-apic: prevent early exit from i8259 loop detection
    
    Avoid exiting early from the loop when a pin that could be connected to the
    i8259 is found, as such early exit would leave the EOI handler translation
    array only partially allocated and/or initialized.
    
    Otherwise on systems with multiple IO-APICs and an unmasked ExtINT pin on
    any IO-APIC that's no the last one the following NULL pointer dereference
    triggers:
    
    (XEN) Enabling APIC mode.  Using 2 I/O APICs
    (XEN) ----[ Xen-4.20-unstable  x86_64  debug=y  Not tainted ]----
    (XEN) CPU:    0
    (XEN) RIP:    e008:[<ffff82d040328046>] __ioapic_write_entry+0x83/0x95
    [...]
    (XEN) Xen call trace:
    (XEN)    [<ffff82d040328046>] R __ioapic_write_entry+0x83/0x95
    (XEN)    [<ffff82d04027464b>] F amd_iommu_ioapic_update_ire+0x1ea/0x273
    (XEN)    [<ffff82d0402755a1>] F iommu_update_ire_from_apic+0xa/0xc
    (XEN)    [<ffff82d040328056>] F __ioapic_write_entry+0x93/0x95
    (XEN)    [<ffff82d0403283c1>] F arch/x86/io_apic.c#clear_IO_APIC_pin+0x7c/0x10e
    (XEN)    [<ffff82d040328480>] F arch/x86/io_apic.c#clear_IO_APIC+0x2d/0x61
    (XEN)    [<ffff82d0404448b7>] F enable_IO_APIC+0x2e3/0x34f
    (XEN)    [<ffff82d04044c9b0>] F smp_prepare_cpus+0x254/0x27a
    (XEN)    [<ffff82d04044bec2>] F __start_xen+0x1ce1/0x23ae
    (XEN)    [<ffff82d0402033ae>] F __high_start+0x8e/0x90
    (XEN)
    (XEN) Pagetable walk from 0000000000000000:
    (XEN)  L4[0x000] = 000000007dbfd063 ffffffffffffffff
    (XEN)  L3[0x000] = 000000007dbfa063 ffffffffffffffff
    (XEN)  L2[0x000] = 000000007dbcc063 ffffffffffffffff
    (XEN)  L1[0x000] = 0000000000000000 ffffffffffffffff
    (XEN)
    (XEN) ****************************************
    (XEN) Panic on CPU 0:
    (XEN) FATAL PAGE FAULT
    (XEN) [error_code=0002]
    (XEN) Faulting linear address: 0000000000000000
    (XEN) ****************************************
    (XEN)
    (XEN) Reboot in five seconds...
    
    Reported-by: Sergii Dmytruk <sergii.dmytruk@3mdeb.com>
    Fixes: 86001b3970fe ('x86/io-apic: fix directed EOI when using AMD-Vi interrupt remapping')
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/io_apic.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/xen/arch/x86/io_apic.c b/xen/arch/x86/io_apic.c
index d9db2efc4f..68680c102f 100644
--- a/xen/arch/x86/io_apic.c
+++ b/xen/arch/x86/io_apic.c
@@ -1389,14 +1389,14 @@ void __init enable_IO_APIC(void)
             /* If the interrupt line is enabled and in ExtInt mode
              * I have found the pin where the i8259 is connected.
              */
-            if ((entry.mask == 0) && (entry.delivery_mode == dest_ExtINT)) {
+            if ( ioapic_i8259.pin == -1 && entry.mask == 0 &&
+                 entry.delivery_mode == dest_ExtINT )
+            {
                 ioapic_i8259.apic = apic;
                 ioapic_i8259.pin  = pin;
-                goto found_i8259;
             }
         }
     }
- found_i8259:
     /* Look to see what if the MP table has reported the ExtINT */
     /* If we could not find the appropriate pin by looking at the ioapic
      * the i8259 probably is not connected the ioapic but give the
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Dec 17 11:33:09 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 17 Dec 2024 11:33:09 +0000
Received: from list by lists.xenproject.org with outflank-mailman.858861.1271085 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tNVp0-00021G-QE; Tue, 17 Dec 2024 11:33:02 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 858861.1271085; Tue, 17 Dec 2024 11:33:02 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tNVp0-000218-Ng; Tue, 17 Dec 2024 11:33:02 +0000
Received: by outflank-mailman (input) for mailman id 858861;
 Tue, 17 Dec 2024 11: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 1tNVoz-000210-H5
 for xen-changelog@lists.xenproject.org; Tue, 17 Dec 2024 11:33:01 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1tNVoz-0080lL-0B
 for xen-changelog@lists.xenproject.org;
 Tue, 17 Dec 2024 11:33:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1tNVoz-00DwoR-12
 for xen-changelog@lists.xenproject.org;
 Tue, 17 Dec 2024 11:33:01 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/io-apic: prevent early exit from i8259 loop detection
Message-Id: <E1tNVoz-00DwoR-12@xenbits.xenproject.org>
Date: Tue, 17 Dec 2024 11:33:01 +0000

commit f38fd27c4ceadf7ec4e82e82d0731b6ea415c51e
Author:     Roger Pau Monne <roger.pau@citrix.com>
AuthorDate: Mon Dec 16 19:33:29 2024 +0100
Commit:     Roger Pau Monne <roger.pau@citrix.com>
CommitDate: Tue Dec 17 11:15:30 2024 +0100

    x86/io-apic: prevent early exit from i8259 loop detection
    
    Avoid exiting early from the loop when a pin that could be connected to the
    i8259 is found, as such early exit would leave the EOI handler translation
    array only partially allocated and/or initialized.
    
    Otherwise on systems with multiple IO-APICs and an unmasked ExtINT pin on
    any IO-APIC that's no the last one the following NULL pointer dereference
    triggers:
    
    (XEN) Enabling APIC mode.  Using 2 I/O APICs
    (XEN) ----[ Xen-4.20-unstable  x86_64  debug=y  Not tainted ]----
    (XEN) CPU:    0
    (XEN) RIP:    e008:[<ffff82d040328046>] __ioapic_write_entry+0x83/0x95
    [...]
    (XEN) Xen call trace:
    (XEN)    [<ffff82d040328046>] R __ioapic_write_entry+0x83/0x95
    (XEN)    [<ffff82d04027464b>] F amd_iommu_ioapic_update_ire+0x1ea/0x273
    (XEN)    [<ffff82d0402755a1>] F iommu_update_ire_from_apic+0xa/0xc
    (XEN)    [<ffff82d040328056>] F __ioapic_write_entry+0x93/0x95
    (XEN)    [<ffff82d0403283c1>] F arch/x86/io_apic.c#clear_IO_APIC_pin+0x7c/0x10e
    (XEN)    [<ffff82d040328480>] F arch/x86/io_apic.c#clear_IO_APIC+0x2d/0x61
    (XEN)    [<ffff82d0404448b7>] F enable_IO_APIC+0x2e3/0x34f
    (XEN)    [<ffff82d04044c9b0>] F smp_prepare_cpus+0x254/0x27a
    (XEN)    [<ffff82d04044bec2>] F __start_xen+0x1ce1/0x23ae
    (XEN)    [<ffff82d0402033ae>] F __high_start+0x8e/0x90
    (XEN)
    (XEN) Pagetable walk from 0000000000000000:
    (XEN)  L4[0x000] = 000000007dbfd063 ffffffffffffffff
    (XEN)  L3[0x000] = 000000007dbfa063 ffffffffffffffff
    (XEN)  L2[0x000] = 000000007dbcc063 ffffffffffffffff
    (XEN)  L1[0x000] = 0000000000000000 ffffffffffffffff
    (XEN)
    (XEN) ****************************************
    (XEN) Panic on CPU 0:
    (XEN) FATAL PAGE FAULT
    (XEN) [error_code=0002]
    (XEN) Faulting linear address: 0000000000000000
    (XEN) ****************************************
    (XEN)
    (XEN) Reboot in five seconds...
    
    Reported-by: Sergii Dmytruk <sergii.dmytruk@3mdeb.com>
    Fixes: 86001b3970fe ('x86/io-apic: fix directed EOI when using AMD-Vi interrupt remapping')
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/io_apic.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/xen/arch/x86/io_apic.c b/xen/arch/x86/io_apic.c
index d9db2efc4f..68680c102f 100644
--- a/xen/arch/x86/io_apic.c
+++ b/xen/arch/x86/io_apic.c
@@ -1389,14 +1389,14 @@ void __init enable_IO_APIC(void)
             /* If the interrupt line is enabled and in ExtInt mode
              * I have found the pin where the i8259 is connected.
              */
-            if ((entry.mask == 0) && (entry.delivery_mode == dest_ExtINT)) {
+            if ( ioapic_i8259.pin == -1 && entry.mask == 0 &&
+                 entry.delivery_mode == dest_ExtINT )
+            {
                 ioapic_i8259.apic = apic;
                 ioapic_i8259.pin  = pin;
-                goto found_i8259;
             }
         }
     }
- found_i8259:
     /* Look to see what if the MP table has reported the ExtINT */
     /* If we could not find the appropriate pin by looking at the ioapic
      * the i8259 probably is not connected the ioapic but give the
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Dec 17 11:55:13 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 17 Dec 2024 11:55:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.858891.1271119 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tNWAO-0006nu-V3; Tue, 17 Dec 2024 11:55:08 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 858891.1271119; Tue, 17 Dec 2024 11:55:08 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tNWAO-0006nm-SQ; Tue, 17 Dec 2024 11:55:08 +0000
Received: by outflank-mailman (input) for mailman id 858891;
 Tue, 17 Dec 2024 11:55:07 +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 1tNWAN-0006ng-MD
 for xen-changelog@lists.xenproject.org; Tue, 17 Dec 2024 11:55:07 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1tNWAN-0081Ey-00
 for xen-changelog@lists.xenproject.org;
 Tue, 17 Dec 2024 11:55:07 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1tNWAN-00DzIO-0c
 for xen-changelog@lists.xenproject.org;
 Tue, 17 Dec 2024 11:55:07 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.19] x86/io-apic: prevent early exit from i8259 loop detection
Message-Id: <E1tNWAN-00DzIO-0c@xenbits.xenproject.org>
Date: Tue, 17 Dec 2024 11:55:07 +0000

commit c41c22bf8e9f7ff6c5d4dbe9fcf19a61643543c9
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Tue Dec 17 12:46:29 2024 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Dec 17 12:46:29 2024 +0100

    x86/io-apic: prevent early exit from i8259 loop detection
    
    Avoid exiting early from the loop when a pin that could be connected to the
    i8259 is found, as such early exit would leave the EOI handler translation
    array only partially allocated and/or initialized.
    
    Otherwise on systems with multiple IO-APICs and an unmasked ExtINT pin on
    any IO-APIC that's no the last one the following NULL pointer dereference
    triggers:
    
    (XEN) Enabling APIC mode.  Using 2 I/O APICs
    (XEN) ----[ Xen-4.20-unstable  x86_64  debug=y  Not tainted ]----
    (XEN) CPU:    0
    (XEN) RIP:    e008:[<ffff82d040328046>] __ioapic_write_entry+0x83/0x95
    [...]
    (XEN) Xen call trace:
    (XEN)    [<ffff82d040328046>] R __ioapic_write_entry+0x83/0x95
    (XEN)    [<ffff82d04027464b>] F amd_iommu_ioapic_update_ire+0x1ea/0x273
    (XEN)    [<ffff82d0402755a1>] F iommu_update_ire_from_apic+0xa/0xc
    (XEN)    [<ffff82d040328056>] F __ioapic_write_entry+0x93/0x95
    (XEN)    [<ffff82d0403283c1>] F arch/x86/io_apic.c#clear_IO_APIC_pin+0x7c/0x10e
    (XEN)    [<ffff82d040328480>] F arch/x86/io_apic.c#clear_IO_APIC+0x2d/0x61
    (XEN)    [<ffff82d0404448b7>] F enable_IO_APIC+0x2e3/0x34f
    (XEN)    [<ffff82d04044c9b0>] F smp_prepare_cpus+0x254/0x27a
    (XEN)    [<ffff82d04044bec2>] F __start_xen+0x1ce1/0x23ae
    (XEN)    [<ffff82d0402033ae>] F __high_start+0x8e/0x90
    (XEN)
    (XEN) Pagetable walk from 0000000000000000:
    (XEN)  L4[0x000] = 000000007dbfd063 ffffffffffffffff
    (XEN)  L3[0x000] = 000000007dbfa063 ffffffffffffffff
    (XEN)  L2[0x000] = 000000007dbcc063 ffffffffffffffff
    (XEN)  L1[0x000] = 0000000000000000 ffffffffffffffff
    (XEN)
    (XEN) ****************************************
    (XEN) Panic on CPU 0:
    (XEN) FATAL PAGE FAULT
    (XEN) [error_code=0002]
    (XEN) Faulting linear address: 0000000000000000
    (XEN) ****************************************
    (XEN)
    (XEN) Reboot in five seconds...
    
    Reported-by: Sergii Dmytruk <sergii.dmytruk@3mdeb.com>
    Fixes: 86001b3970fe ('x86/io-apic: fix directed EOI when using AMD-Vi interrupt remapping')
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: f38fd27c4ceadf7ec4e82e82d0731b6ea415c51e
    master date: 2024-12-17 11:15:30 +0100
---
 xen/arch/x86/io_apic.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/xen/arch/x86/io_apic.c b/xen/arch/x86/io_apic.c
index 1fd9559a06..65b019db02 100644
--- a/xen/arch/x86/io_apic.c
+++ b/xen/arch/x86/io_apic.c
@@ -1372,14 +1372,14 @@ void __init enable_IO_APIC(void)
             /* If the interrupt line is enabled and in ExtInt mode
              * I have found the pin where the i8259 is connected.
              */
-            if ((entry.mask == 0) && (entry.delivery_mode == dest_ExtINT)) {
+            if ( ioapic_i8259.pin == -1 && entry.mask == 0 &&
+                 entry.delivery_mode == dest_ExtINT )
+            {
                 ioapic_i8259.apic = apic;
                 ioapic_i8259.pin  = pin;
-                goto found_i8259;
             }
         }
     }
- found_i8259:
     /* Look to see what if the MP table has reported the ExtINT */
     /* If we could not find the appropriate pin by looking at the ioapic
      * the i8259 probably is not connected the ioapic but give the
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.19


From xen-changelog-bounces@lists.xenproject.org Tue Dec 17 11:55:19 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 17 Dec 2024 11:55:19 +0000
Received: from list by lists.xenproject.org with outflank-mailman.858892.1271123 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tNWAZ-0006pz-0G; Tue, 17 Dec 2024 11:55:19 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 858892.1271123; Tue, 17 Dec 2024 11:55: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 1tNWAY-0006pk-Tp; Tue, 17 Dec 2024 11:55:18 +0000
Received: by outflank-mailman (input) for mailman id 858892;
 Tue, 17 Dec 2024 11:55:17 +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 1tNWAX-0006pX-JR
 for xen-changelog@lists.xenproject.org; Tue, 17 Dec 2024 11:55:17 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1tNWAX-0081F6-0q
 for xen-changelog@lists.xenproject.org;
 Tue, 17 Dec 2024 11:55:17 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1tNWAX-00DzKA-1h
 for xen-changelog@lists.xenproject.org;
 Tue, 17 Dec 2024 11:55:17 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.18] x86/io-apic: prevent early exit from i8259 loop detection
Message-Id: <E1tNWAX-00DzKA-1h@xenbits.xenproject.org>
Date: Tue, 17 Dec 2024 11:55:17 +0000

commit 1b7dfe88f5fb64c608f5145fbd453178665001d8
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Tue Dec 17 12:47:22 2024 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Dec 17 12:47:22 2024 +0100

    x86/io-apic: prevent early exit from i8259 loop detection
    
    Avoid exiting early from the loop when a pin that could be connected to the
    i8259 is found, as such early exit would leave the EOI handler translation
    array only partially allocated and/or initialized.
    
    Otherwise on systems with multiple IO-APICs and an unmasked ExtINT pin on
    any IO-APIC that's no the last one the following NULL pointer dereference
    triggers:
    
    (XEN) Enabling APIC mode.  Using 2 I/O APICs
    (XEN) ----[ Xen-4.20-unstable  x86_64  debug=y  Not tainted ]----
    (XEN) CPU:    0
    (XEN) RIP:    e008:[<ffff82d040328046>] __ioapic_write_entry+0x83/0x95
    [...]
    (XEN) Xen call trace:
    (XEN)    [<ffff82d040328046>] R __ioapic_write_entry+0x83/0x95
    (XEN)    [<ffff82d04027464b>] F amd_iommu_ioapic_update_ire+0x1ea/0x273
    (XEN)    [<ffff82d0402755a1>] F iommu_update_ire_from_apic+0xa/0xc
    (XEN)    [<ffff82d040328056>] F __ioapic_write_entry+0x93/0x95
    (XEN)    [<ffff82d0403283c1>] F arch/x86/io_apic.c#clear_IO_APIC_pin+0x7c/0x10e
    (XEN)    [<ffff82d040328480>] F arch/x86/io_apic.c#clear_IO_APIC+0x2d/0x61
    (XEN)    [<ffff82d0404448b7>] F enable_IO_APIC+0x2e3/0x34f
    (XEN)    [<ffff82d04044c9b0>] F smp_prepare_cpus+0x254/0x27a
    (XEN)    [<ffff82d04044bec2>] F __start_xen+0x1ce1/0x23ae
    (XEN)    [<ffff82d0402033ae>] F __high_start+0x8e/0x90
    (XEN)
    (XEN) Pagetable walk from 0000000000000000:
    (XEN)  L4[0x000] = 000000007dbfd063 ffffffffffffffff
    (XEN)  L3[0x000] = 000000007dbfa063 ffffffffffffffff
    (XEN)  L2[0x000] = 000000007dbcc063 ffffffffffffffff
    (XEN)  L1[0x000] = 0000000000000000 ffffffffffffffff
    (XEN)
    (XEN) ****************************************
    (XEN) Panic on CPU 0:
    (XEN) FATAL PAGE FAULT
    (XEN) [error_code=0002]
    (XEN) Faulting linear address: 0000000000000000
    (XEN) ****************************************
    (XEN)
    (XEN) Reboot in five seconds...
    
    Reported-by: Sergii Dmytruk <sergii.dmytruk@3mdeb.com>
    Fixes: 86001b3970fe ('x86/io-apic: fix directed EOI when using AMD-Vi interrupt remapping')
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: f38fd27c4ceadf7ec4e82e82d0731b6ea415c51e
    master date: 2024-12-17 11:15:30 +0100
---
 xen/arch/x86/io_apic.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/xen/arch/x86/io_apic.c b/xen/arch/x86/io_apic.c
index 0450b5f784..b677d714c0 100644
--- a/xen/arch/x86/io_apic.c
+++ b/xen/arch/x86/io_apic.c
@@ -1372,14 +1372,14 @@ void __init enable_IO_APIC(void)
             /* If the interrupt line is enabled and in ExtInt mode
              * I have found the pin where the i8259 is connected.
              */
-            if ((entry.mask == 0) && (entry.delivery_mode == dest_ExtINT)) {
+            if ( ioapic_i8259.pin == -1 && entry.mask == 0 &&
+                 entry.delivery_mode == dest_ExtINT )
+            {
                 ioapic_i8259.apic = apic;
                 ioapic_i8259.pin  = pin;
-                goto found_i8259;
             }
         }
     }
- found_i8259:
     /* Look to see what if the MP table has reported the ExtINT */
     /* If we could not find the appropriate pin by looking at the ioapic
      * the i8259 probably is not connected the ioapic but give the
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.18


From xen-changelog-bounces@lists.xenproject.org Tue Dec 17 12:22:11 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 17 Dec 2024 12:22:11 +0000
Received: from list by lists.xenproject.org with outflank-mailman.859020.1271219 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tNWaX-00081e-OR; Tue, 17 Dec 2024 12:22:09 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 859020.1271219; Tue, 17 Dec 2024 12:22:09 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tNWaX-00081X-Lg; Tue, 17 Dec 2024 12:22:09 +0000
Received: by outflank-mailman (input) for mailman id 859020;
 Tue, 17 Dec 2024 12:22:08 +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 1tNWaW-00081D-Cz
 for xen-changelog@lists.xenproject.org; Tue, 17 Dec 2024 12:22:08 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1tNWaV-0081of-2O
 for xen-changelog@lists.xenproject.org;
 Tue, 17 Dec 2024 12:22:08 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1tNWaV-00E2eb-39
 for xen-changelog@lists.xenproject.org;
 Tue, 17 Dec 2024 12:22:07 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] docs/guest-guide: Discuss when not use a hypercall page
Message-Id: <E1tNWaV-00E2eb-39@xenbits.xenproject.org>
Date: Tue, 17 Dec 2024 12:22:07 +0000

commit d95703eb8315a956090394db0b5ac95a4d232e1a
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Fri Nov 22 16:00:37 2024 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Dec 17 12:21:22 2024 +0000

    docs/guest-guide: Discuss when not use a hypercall page
    
    The Linux rethunk and safe-ret speculative safety techniques involve
    transforming `ret` to `jmp __x86_return_thunk` at compile time.  Placing naked
    `ret`s back in executable .text breaks these mitigations.
    
    CET-IBT requires ENDBR instructions, and while we could in principle fix that,
    the need to select between ENDBR32 or ENDBR64 means that the contents of the
    hypercall page would need to become more mode-specific than it currently
    is (HVM hypercall pages are currently 32bit and 64bit compatbile).  However,
    there's no feasible way to make a hypercall page compatible with fine-grain
    CFI schemes such as FineIBT.
    
    OSes which care about either of these things are better off avoiding the
    hypercall page.
    
    This is part of XSA-466.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 docs/guest-guide/x86/hypercall-abi.rst | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/docs/guest-guide/x86/hypercall-abi.rst b/docs/guest-guide/x86/hypercall-abi.rst
index 8004122ca4..745fbbb64a 100644
--- a/docs/guest-guide/x86/hypercall-abi.rst
+++ b/docs/guest-guide/x86/hypercall-abi.rst
@@ -82,6 +82,13 @@ The hypercall page is a page of guest RAM into which Xen will write suitable
 transfer stubs.  It is intended as a convenience for guests, but use of the
 hypercall page is not mandatory for making hypercalls to Xen.
 
+.. note::
+
+   There are cases where a hypercall page should not be used.  It contains
+   ``ret`` instructions which are not compatible with certain speculative
+   security techniques, and it does not contain ``endbr`` instructions which
+   are necessary for certain Control-flow Integrity schemes.
+
 Creating a hypercall page is an isolated operation from Xen's point of view.
 It is the guests responsibility to ensure that the hypercall page, once
 written by Xen, is mapped with executable permissions so it may be used.
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Dec 17 13:11:11 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 17 Dec 2024 13:11:11 +0000
Received: from list by lists.xenproject.org with outflank-mailman.859126.1271263 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tNXLr-0008Eh-Tq; Tue, 17 Dec 2024 13:11:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 859126.1271263; Tue, 17 Dec 2024 13:11:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tNXLr-0008Ea-RM; Tue, 17 Dec 2024 13:11:03 +0000
Received: by outflank-mailman (input) for mailman id 859126;
 Tue, 17 Dec 2024 13: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 1tNXLp-0008ES-TX
 for xen-changelog@lists.xenproject.org; Tue, 17 Dec 2024 13:11:01 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1tNXLp-0082o5-0T
 for xen-changelog@lists.xenproject.org;
 Tue, 17 Dec 2024 13:11:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1tNXLp-00E7iG-1F
 for xen-changelog@lists.xenproject.org;
 Tue, 17 Dec 2024 13:11:01 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.19] x86/io-apic: prevent early exit from i8259 loop detection
Message-Id: <E1tNXLp-00E7iG-1F@xenbits.xenproject.org>
Date: Tue, 17 Dec 2024 13:11:01 +0000

commit c41c22bf8e9f7ff6c5d4dbe9fcf19a61643543c9
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Tue Dec 17 12:46:29 2024 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Dec 17 12:46:29 2024 +0100

    x86/io-apic: prevent early exit from i8259 loop detection
    
    Avoid exiting early from the loop when a pin that could be connected to the
    i8259 is found, as such early exit would leave the EOI handler translation
    array only partially allocated and/or initialized.
    
    Otherwise on systems with multiple IO-APICs and an unmasked ExtINT pin on
    any IO-APIC that's no the last one the following NULL pointer dereference
    triggers:
    
    (XEN) Enabling APIC mode.  Using 2 I/O APICs
    (XEN) ----[ Xen-4.20-unstable  x86_64  debug=y  Not tainted ]----
    (XEN) CPU:    0
    (XEN) RIP:    e008:[<ffff82d040328046>] __ioapic_write_entry+0x83/0x95
    [...]
    (XEN) Xen call trace:
    (XEN)    [<ffff82d040328046>] R __ioapic_write_entry+0x83/0x95
    (XEN)    [<ffff82d04027464b>] F amd_iommu_ioapic_update_ire+0x1ea/0x273
    (XEN)    [<ffff82d0402755a1>] F iommu_update_ire_from_apic+0xa/0xc
    (XEN)    [<ffff82d040328056>] F __ioapic_write_entry+0x93/0x95
    (XEN)    [<ffff82d0403283c1>] F arch/x86/io_apic.c#clear_IO_APIC_pin+0x7c/0x10e
    (XEN)    [<ffff82d040328480>] F arch/x86/io_apic.c#clear_IO_APIC+0x2d/0x61
    (XEN)    [<ffff82d0404448b7>] F enable_IO_APIC+0x2e3/0x34f
    (XEN)    [<ffff82d04044c9b0>] F smp_prepare_cpus+0x254/0x27a
    (XEN)    [<ffff82d04044bec2>] F __start_xen+0x1ce1/0x23ae
    (XEN)    [<ffff82d0402033ae>] F __high_start+0x8e/0x90
    (XEN)
    (XEN) Pagetable walk from 0000000000000000:
    (XEN)  L4[0x000] = 000000007dbfd063 ffffffffffffffff
    (XEN)  L3[0x000] = 000000007dbfa063 ffffffffffffffff
    (XEN)  L2[0x000] = 000000007dbcc063 ffffffffffffffff
    (XEN)  L1[0x000] = 0000000000000000 ffffffffffffffff
    (XEN)
    (XEN) ****************************************
    (XEN) Panic on CPU 0:
    (XEN) FATAL PAGE FAULT
    (XEN) [error_code=0002]
    (XEN) Faulting linear address: 0000000000000000
    (XEN) ****************************************
    (XEN)
    (XEN) Reboot in five seconds...
    
    Reported-by: Sergii Dmytruk <sergii.dmytruk@3mdeb.com>
    Fixes: 86001b3970fe ('x86/io-apic: fix directed EOI when using AMD-Vi interrupt remapping')
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: f38fd27c4ceadf7ec4e82e82d0731b6ea415c51e
    master date: 2024-12-17 11:15:30 +0100
---
 xen/arch/x86/io_apic.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/xen/arch/x86/io_apic.c b/xen/arch/x86/io_apic.c
index 1fd9559a06..65b019db02 100644
--- a/xen/arch/x86/io_apic.c
+++ b/xen/arch/x86/io_apic.c
@@ -1372,14 +1372,14 @@ void __init enable_IO_APIC(void)
             /* If the interrupt line is enabled and in ExtInt mode
              * I have found the pin where the i8259 is connected.
              */
-            if ((entry.mask == 0) && (entry.delivery_mode == dest_ExtINT)) {
+            if ( ioapic_i8259.pin == -1 && entry.mask == 0 &&
+                 entry.delivery_mode == dest_ExtINT )
+            {
                 ioapic_i8259.apic = apic;
                 ioapic_i8259.pin  = pin;
-                goto found_i8259;
             }
         }
     }
- found_i8259:
     /* Look to see what if the MP table has reported the ExtINT */
     /* If we could not find the appropriate pin by looking at the ioapic
      * the i8259 probably is not connected the ioapic but give the
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.19


From xen-changelog-bounces@lists.xenproject.org Tue Dec 17 13:33:06 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 17 Dec 2024 13:33:06 +0000
Received: from list by lists.xenproject.org with outflank-mailman.859164.1271307 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tNXh8-0004eS-TB; Tue, 17 Dec 2024 13:33:02 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 859164.1271307; Tue, 17 Dec 2024 13: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 1tNXh8-0004eK-QT; Tue, 17 Dec 2024 13:33:02 +0000
Received: by outflank-mailman (input) for mailman id 859164;
 Tue, 17 Dec 2024 13: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 1tNXh7-0004eE-WD
 for xen-changelog@lists.xenproject.org; Tue, 17 Dec 2024 13:33:01 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1tNXh7-0083Gk-0q
 for xen-changelog@lists.xenproject.org;
 Tue, 17 Dec 2024 13:33:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1tNXh7-00EAKj-1Z
 for xen-changelog@lists.xenproject.org;
 Tue, 17 Dec 2024 13:33:01 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.18] x86/io-apic: prevent early exit from i8259 loop detection
Message-Id: <E1tNXh7-00EAKj-1Z@xenbits.xenproject.org>
Date: Tue, 17 Dec 2024 13:33:01 +0000

commit 1b7dfe88f5fb64c608f5145fbd453178665001d8
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Tue Dec 17 12:47:22 2024 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Dec 17 12:47:22 2024 +0100

    x86/io-apic: prevent early exit from i8259 loop detection
    
    Avoid exiting early from the loop when a pin that could be connected to the
    i8259 is found, as such early exit would leave the EOI handler translation
    array only partially allocated and/or initialized.
    
    Otherwise on systems with multiple IO-APICs and an unmasked ExtINT pin on
    any IO-APIC that's no the last one the following NULL pointer dereference
    triggers:
    
    (XEN) Enabling APIC mode.  Using 2 I/O APICs
    (XEN) ----[ Xen-4.20-unstable  x86_64  debug=y  Not tainted ]----
    (XEN) CPU:    0
    (XEN) RIP:    e008:[<ffff82d040328046>] __ioapic_write_entry+0x83/0x95
    [...]
    (XEN) Xen call trace:
    (XEN)    [<ffff82d040328046>] R __ioapic_write_entry+0x83/0x95
    (XEN)    [<ffff82d04027464b>] F amd_iommu_ioapic_update_ire+0x1ea/0x273
    (XEN)    [<ffff82d0402755a1>] F iommu_update_ire_from_apic+0xa/0xc
    (XEN)    [<ffff82d040328056>] F __ioapic_write_entry+0x93/0x95
    (XEN)    [<ffff82d0403283c1>] F arch/x86/io_apic.c#clear_IO_APIC_pin+0x7c/0x10e
    (XEN)    [<ffff82d040328480>] F arch/x86/io_apic.c#clear_IO_APIC+0x2d/0x61
    (XEN)    [<ffff82d0404448b7>] F enable_IO_APIC+0x2e3/0x34f
    (XEN)    [<ffff82d04044c9b0>] F smp_prepare_cpus+0x254/0x27a
    (XEN)    [<ffff82d04044bec2>] F __start_xen+0x1ce1/0x23ae
    (XEN)    [<ffff82d0402033ae>] F __high_start+0x8e/0x90
    (XEN)
    (XEN) Pagetable walk from 0000000000000000:
    (XEN)  L4[0x000] = 000000007dbfd063 ffffffffffffffff
    (XEN)  L3[0x000] = 000000007dbfa063 ffffffffffffffff
    (XEN)  L2[0x000] = 000000007dbcc063 ffffffffffffffff
    (XEN)  L1[0x000] = 0000000000000000 ffffffffffffffff
    (XEN)
    (XEN) ****************************************
    (XEN) Panic on CPU 0:
    (XEN) FATAL PAGE FAULT
    (XEN) [error_code=0002]
    (XEN) Faulting linear address: 0000000000000000
    (XEN) ****************************************
    (XEN)
    (XEN) Reboot in five seconds...
    
    Reported-by: Sergii Dmytruk <sergii.dmytruk@3mdeb.com>
    Fixes: 86001b3970fe ('x86/io-apic: fix directed EOI when using AMD-Vi interrupt remapping')
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: f38fd27c4ceadf7ec4e82e82d0731b6ea415c51e
    master date: 2024-12-17 11:15:30 +0100
---
 xen/arch/x86/io_apic.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/xen/arch/x86/io_apic.c b/xen/arch/x86/io_apic.c
index 0450b5f784..b677d714c0 100644
--- a/xen/arch/x86/io_apic.c
+++ b/xen/arch/x86/io_apic.c
@@ -1372,14 +1372,14 @@ void __init enable_IO_APIC(void)
             /* If the interrupt line is enabled and in ExtInt mode
              * I have found the pin where the i8259 is connected.
              */
-            if ((entry.mask == 0) && (entry.delivery_mode == dest_ExtINT)) {
+            if ( ioapic_i8259.pin == -1 && entry.mask == 0 &&
+                 entry.delivery_mode == dest_ExtINT )
+            {
                 ioapic_i8259.apic = apic;
                 ioapic_i8259.pin  = pin;
-                goto found_i8259;
             }
         }
     }
- found_i8259:
     /* Look to see what if the MP table has reported the ExtINT */
     /* If we could not find the appropriate pin by looking at the ioapic
      * the i8259 probably is not connected the ioapic but give the
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.18


From xen-changelog-bounces@lists.xenproject.org Tue Dec 17 14:55:08 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 17 Dec 2024 14:55:08 +0000
Received: from list by lists.xenproject.org with outflank-mailman.859292.1271403 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tNYyV-0003wD-VA; Tue, 17 Dec 2024 14:55:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 859292.1271403; Tue, 17 Dec 2024 14:55:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tNYyV-0003w5-Sl; Tue, 17 Dec 2024 14:55:03 +0000
Received: by outflank-mailman (input) for mailman id 859292;
 Tue, 17 Dec 2024 14: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 1tNYyU-0003vz-AQ
 for xen-changelog@lists.xenproject.org; Tue, 17 Dec 2024 14:55:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1tNYyT-0084z2-2a
 for xen-changelog@lists.xenproject.org;
 Tue, 17 Dec 2024 14:55:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1tNYyU-00EIp3-09
 for xen-changelog@lists.xenproject.org;
 Tue, 17 Dec 2024 14:55:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] docs/guest-guide: Discuss when not use a hypercall page
Message-Id: <E1tNYyU-00EIp3-09@xenbits.xenproject.org>
Date: Tue, 17 Dec 2024 14:55:02 +0000

commit d95703eb8315a956090394db0b5ac95a4d232e1a
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Fri Nov 22 16:00:37 2024 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Dec 17 12:21:22 2024 +0000

    docs/guest-guide: Discuss when not use a hypercall page
    
    The Linux rethunk and safe-ret speculative safety techniques involve
    transforming `ret` to `jmp __x86_return_thunk` at compile time.  Placing naked
    `ret`s back in executable .text breaks these mitigations.
    
    CET-IBT requires ENDBR instructions, and while we could in principle fix that,
    the need to select between ENDBR32 or ENDBR64 means that the contents of the
    hypercall page would need to become more mode-specific than it currently
    is (HVM hypercall pages are currently 32bit and 64bit compatbile).  However,
    there's no feasible way to make a hypercall page compatible with fine-grain
    CFI schemes such as FineIBT.
    
    OSes which care about either of these things are better off avoiding the
    hypercall page.
    
    This is part of XSA-466.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 docs/guest-guide/x86/hypercall-abi.rst | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/docs/guest-guide/x86/hypercall-abi.rst b/docs/guest-guide/x86/hypercall-abi.rst
index 8004122ca4..745fbbb64a 100644
--- a/docs/guest-guide/x86/hypercall-abi.rst
+++ b/docs/guest-guide/x86/hypercall-abi.rst
@@ -82,6 +82,13 @@ The hypercall page is a page of guest RAM into which Xen will write suitable
 transfer stubs.  It is intended as a convenience for guests, but use of the
 hypercall page is not mandatory for making hypercalls to Xen.
 
+.. note::
+
+   There are cases where a hypercall page should not be used.  It contains
+   ``ret`` instructions which are not compatible with certain speculative
+   security techniques, and it does not contain ``endbr`` instructions which
+   are necessary for certain Control-flow Integrity schemes.
+
 Creating a hypercall page is an isolated operation from Xen's point of view.
 It is the guests responsibility to ensure that the hypercall page, once
 written by Xen, is mapped with executable permissions so it may be used.
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Dec 17 15:11:15 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 17 Dec 2024 15:11:15 +0000
Received: from list by lists.xenproject.org with outflank-mailman.859296.1271410 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tNZE6-0006UW-4W; Tue, 17 Dec 2024 15:11:10 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 859296.1271410; Tue, 17 Dec 2024 15:11:10 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tNZE6-0006UP-0y; Tue, 17 Dec 2024 15:11:10 +0000
Received: by outflank-mailman (input) for mailman id 859296;
 Tue, 17 Dec 2024 15:11:08 +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 1tNZE4-0006Sx-GG
 for xen-changelog@lists.xenproject.org; Tue, 17 Dec 2024 15:11:08 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1tNZE3-0085K0-2S
 for xen-changelog@lists.xenproject.org;
 Tue, 17 Dec 2024 15:11:08 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1tNZE4-00EKqC-01
 for xen-changelog@lists.xenproject.org;
 Tue, 17 Dec 2024 15:11:08 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen: update ECLAIR service identifiers from MC3R1 to MC3A2.
Message-Id: <E1tNZE4-00EKqC-01@xenbits.xenproject.org>
Date: Tue, 17 Dec 2024 15:11:08 +0000

commit 631f535a3d4ffd66a270672f0f787d79f3bf38f8
Author:     Alessandro Zucchelli <alessandro.zucchelli@bugseng.com>
AuthorDate: Tue Dec 10 11:37:23 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Dec 17 13:04:48 2024 +0000

    xen: update ECLAIR service identifiers from MC3R1 to MC3A2.
    
    Rename all instances of ECLAIR MISRA C:2012 service identifiers,
    identified by the prefix MC3R1, to use the prefix MC3A2, which
    refers to MISRA C:2012 Amendment 2 guidelines.
    
    This update is motivated by the need to upgrade ECLAIR GitLab runners
    that use the new naming scheme for MISRA C:2012 Amendment 2 guidelines.
    
    Changes to the docs/misra directory are needed in order to keep
    comment-based deviation up to date.
    
    Signed-off-by: Alessandro Zucchelli <alessandro.zucchelli@bugseng.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
---
 automation/eclair_analysis/ECLAIR/B.UNEVALEFF.ecl  |   2 +-
 .../eclair_analysis/ECLAIR/accepted_guidelines.sh  |   2 +-
 automation/eclair_analysis/ECLAIR/analysis.ecl     |   6 +-
 automation/eclair_analysis/ECLAIR/deviations.ecl   | 244 ++++++++++-----------
 automation/eclair_analysis/ECLAIR/monitored.ecl    | 208 +++++++++---------
 automation/eclair_analysis/ECLAIR/tagging.ecl      | 176 +++++++--------
 docs/misra/documenting-violations.rst              |   6 +-
 docs/misra/safe.json                               |  32 +--
 8 files changed, 338 insertions(+), 338 deletions(-)

diff --git a/automation/eclair_analysis/ECLAIR/B.UNEVALEFF.ecl b/automation/eclair_analysis/ECLAIR/B.UNEVALEFF.ecl
index 92d8db8986..fa249b8e36 100644
--- a/automation/eclair_analysis/ECLAIR/B.UNEVALEFF.ecl
+++ b/automation/eclair_analysis/ECLAIR/B.UNEVALEFF.ecl
@@ -1,4 +1,4 @@
--clone_service=MC3R1.R13.6,B.UNEVALEFF
+-clone_service=MC3A2.R13.6,B.UNEVALEFF
 
 -config=B.UNEVALEFF,summary="The operand of the `alignof' and `typeof'  operators shall not contain any expression which has potential side effects"
 -config=B.UNEVALEFF,stmt_child_matcher=
diff --git a/automation/eclair_analysis/ECLAIR/accepted_guidelines.sh b/automation/eclair_analysis/ECLAIR/accepted_guidelines.sh
index 368135122c..2c4b339d0d 100755
--- a/automation/eclair_analysis/ECLAIR/accepted_guidelines.sh
+++ b/automation/eclair_analysis/ECLAIR/accepted_guidelines.sh
@@ -10,6 +10,6 @@ script_dir="$(
 accepted_rst=$1
 
 grep -Eo "\`(Dir|Rule) [0-9]+\.[0-9]+" ${accepted_rst} \
-     | sed -e 's/`Rule /MC3R1.R/' -e  's/`Dir /MC3R1.D/' -e 's/.*/-enable=&/' > ${script_dir}/accepted.ecl
+     | sed -e 's/`Rule /MC3A2.R/' -e  's/`Dir /MC3A2.D/' -e 's/.*/-enable=&/' > ${script_dir}/accepted.ecl
 
 echo "-enable=B.UNEVALEFF" >> ${script_dir}/accepted.ecl
diff --git a/automation/eclair_analysis/ECLAIR/analysis.ecl b/automation/eclair_analysis/ECLAIR/analysis.ecl
index df0b551812..824283a989 100644
--- a/automation/eclair_analysis/ECLAIR/analysis.ecl
+++ b/automation/eclair_analysis/ECLAIR/analysis.ecl
@@ -22,15 +22,15 @@ setq(analysis_kind,getenv("ANALYSIS_KIND"))
 -doc_begin="These configurations serve the purpose of recognizing the 'mem*' macros as
 their Standard Library equivalents."
 
--config=MC3R1.R21.14,call_select+=
+-config=MC3A2.R21.14,call_select+=
 {"macro(^memcmp$)&&any_arg(1..2, skip(__non_syntactic_paren_cast_stmts, node(string_literal)))",
  "any()", violation, "%{__callslct_any_base_fmt()}", {{arg, "%{__callslct_arg_fmt()}"}}}
 
--config=MC3R1.R21.15,call_args+=
+-config=MC3A2.R21.15,call_args+=
 {"macro(^mem(cmp|move|cpy)$)", {1, 2}, "unqual_pointee_compatible",
  "%{__argscmpr_culprit_fmt()}", "%{__argscmpr_evidence_fmt()}"}
 
--config=MC3R1.R21.16,call_select+=
+-config=MC3A2.R21.16,call_select+=
 {"macro(^memcmp$)&&any_arg(1..2, skip(__non_syntactic_paren_stmts, type(canonical(__memcmp_pte_types))))",
  "any()", violation, "%{__callslct_any_base_fmt()}", {{arg,"%{__callslct_arg_type_fmt()}"}}}
 
diff --git a/automation/eclair_analysis/ECLAIR/deviations.ecl b/automation/eclair_analysis/ECLAIR/deviations.ecl
index 2f58f29203..ae25eeb76a 100644
--- a/automation/eclair_analysis/ECLAIR/deviations.ecl
+++ b/automation/eclair_analysis/ECLAIR/deviations.ecl
@@ -4,36 +4,36 @@
 
 -doc_begin="The compiler implementation guarantees that the unreachable code is removed.
 Constant expressions and unreachable branches of if and switch statements are expected."
--config=MC3R1.R2.1,+reports={safe,"first_area(^.*has an invariantly.*$)"}
--config=MC3R1.R2.1,+reports={safe,"first_area(^.*incompatible with labeled statement$)"}
+-config=MC3A2.R2.1,+reports={safe,"first_area(^.*has an invariantly.*$)"}
+-config=MC3A2.R2.1,+reports={safe,"first_area(^.*incompatible with labeled statement$)"}
 -doc_end
 
 -doc_begin="Some functions are intended to be not referenced."
--config=MC3R1.R2.1,+reports={deliberate,"first_area(^.*is never referenced$)"}
+-config=MC3A2.R2.1,+reports={deliberate,"first_area(^.*is never referenced$)"}
 -doc_end
 
 -doc_begin="Unreachability caused by calls to the following functions or macros is deliberate and there is no risk of code being unexpectedly left out."
--config=MC3R1.R2.1,statements+={deliberate,"macro(name(BUG||assert_failed))"}
--config=MC3R1.R2.1,statements+={deliberate, "call(decl(name(__builtin_unreachable||panic||do_unexpected_trap||machine_halt||machine_restart||reboot_or_halt)))"}
+-config=MC3A2.R2.1,statements+={deliberate,"macro(name(BUG||assert_failed))"}
+-config=MC3A2.R2.1,statements+={deliberate, "call(decl(name(__builtin_unreachable||panic||do_unexpected_trap||machine_halt||machine_restart||reboot_or_halt)))"}
 -doc_end
 
 -doc_begin="Unreachability inside an ASSERT_UNREACHABLE() and analogous macro calls is deliberate and safe."
--config=MC3R1.R2.1,reports+={deliberate, "any_area(any_loc(any_exp(macro(name(ASSERT_UNREACHABLE||PARSE_ERR_RET||PARSE_ERR||FAIL_MSR||FAIL_CPUID)))))"}
+-config=MC3A2.R2.1,reports+={deliberate, "any_area(any_loc(any_exp(macro(name(ASSERT_UNREACHABLE||PARSE_ERR_RET||PARSE_ERR||FAIL_MSR||FAIL_CPUID)))))"}
 -doc_end
 
 -doc_begin="The asm-offset files are not linked deliberately, since they are used to generate definitions for asm modules."
 -file_tag+={asm_offsets, "^xen/arch/(arm|x86)/(arm32|arm64|x86_64)/asm-offsets\\.c$"}
--config=MC3R1.R2.1,reports+={deliberate, "any_area(any_loc(file(asm_offsets)))"}
+-config=MC3A2.R2.1,reports+={deliberate, "any_area(any_loc(file(asm_offsets)))"}
 -doc_end
 
 -doc_begin="Pure declarations (i.e., declarations without initialization) are
 not executable, and therefore it is safe for them to be unreachable."
--config=MC3R1.R2.1,ignored_stmts+={"any()", "pure_decl()"}
+-config=MC3A2.R2.1,ignored_stmts+={"any()", "pure_decl()"}
 -doc_end
 
 -doc_begin="The following autogenerated file is not linked deliberately."
 -file_tag+={C_runtime_failures,"^automation/eclair_analysis/C-runtime-failures\\.rst\\.c$"}
--config=MC3R1.R2.1,reports+={deliberate, "any_area(any_loc(file(C_runtime_failures)))"}
+-config=MC3A2.R2.1,reports+={deliberate, "any_area(any_loc(file(C_runtime_failures)))"}
 -doc_end
 
 -doc_begin="Proving compliance with respect to Rule 2.2 is generally impossible:
@@ -42,11 +42,11 @@ confidence that no evidence of errors in the program's logic has been missed due
 to undetected violations of Rule 2.2, if any. Testing on time behavior gives us
 confidence on the fact that, should the program contain dead code that is not
 removed by the compiler, the resulting slowdown is negligible."
--config=MC3R1.R2.2,reports+={disapplied,"any()"}
+-config=MC3A2.R2.2,reports+={disapplied,"any()"}
 -doc_end
 
 -doc_begin="Some labels are unused in certain build configurations, or are deliberately marked as unused, so that the compiler is entitled to remove them."
--config=MC3R1.R2.6,reports+={deliberate, "any_area(text(^.*__maybe_unused.*$))"}
+-config=MC3A2.R2.6,reports+={deliberate, "any_area(text(^.*__maybe_unused.*$))"}
 -doc_end
 
 #
@@ -55,7 +55,7 @@ removed by the compiler, the resulting slowdown is negligible."
 
 -doc_begin="Comments starting with '/*' and containing hyperlinks are safe as
 they are not instances of commented-out code."
--config=MC3R1.R3.1,reports+={safe, "first_area(text(^.*https?://.*$))"}
+-config=MC3A2.R3.1,reports+={safe, "first_area(text(^.*https?://.*$))"}
 -doc_end
 
 #
@@ -63,25 +63,25 @@ they are not instances of commented-out code."
 #
 
 -doc_begin="The directive has been accepted only for the ARM codebase."
--config=MC3R1.D4.3,reports+={disapplied,"!(any_area(any_loc(file(^xen/arch/arm/arm64/.*$))))"}
+-config=MC3A2.D4.3,reports+={disapplied,"!(any_area(any_loc(file(^xen/arch/arm/arm64/.*$))))"}
 -doc_end
 
 -doc_begin="The inline asm in 'arm64/lib/bitops.c' is tightly coupled with the surronding C code that acts as a wrapper, so it has been decided not to add an additional encapsulation layer."
 -file_tag+={arm64_bitops, "^xen/arch/arm/arm64/lib/bitops\\.c$"}
--config=MC3R1.D4.3,reports+={deliberate, "all_area(any_loc(file(arm64_bitops)&&any_exp(macro(^(bit|test)op$))))"}
--config=MC3R1.D4.3,reports+={deliberate, "any_area(any_loc(file(arm64_bitops))&&context(name(int_clear_mask16)))"}
+-config=MC3A2.D4.3,reports+={deliberate, "all_area(any_loc(file(arm64_bitops)&&any_exp(macro(^(bit|test)op$))))"}
+-config=MC3A2.D4.3,reports+={deliberate, "any_area(any_loc(file(arm64_bitops))&&context(name(int_clear_mask16)))"}
 -doc_end
 
 -doc_begin="Files that are intended to be included more than once do not need to
 conform to the directive."
--config=MC3R1.D4.10,reports+={safe, "first_area(text(^/\\* This file is legitimately included multiple times\\. \\*/$, begin-4))"}
--config=MC3R1.D4.10,reports+={safe, "first_area(text(^/\\* Generated file, do not edit! \\*/$, begin-3))"}
--config=MC3R1.D4.10,reports+={safe, "all_area(all_loc(file(^xen/include/generated/autoconf.h$)))"}
+-config=MC3A2.D4.10,reports+={safe, "first_area(text(^/\\* This file is legitimately included multiple times\\. \\*/$, begin-4))"}
+-config=MC3A2.D4.10,reports+={safe, "first_area(text(^/\\* Generated file, do not edit! \\*/$, begin-3))"}
+-config=MC3A2.D4.10,reports+={safe, "all_area(all_loc(file(^xen/include/generated/autoconf.h$)))"}
 -doc_end
 
 -doc_begin="Including multiple times a .c file is safe because every function or data item
 it defines would (in the common case) be already defined. Peer reviewed by the community."
--config=MC3R1.D4.10,reports+={safe, "all_area(all_loc(^.*\\.c$))"}
+-config=MC3A2.D4.10,reports+={safe, "all_area(all_loc(^.*\\.c$))"}
 -doc_end
 
 #
@@ -90,50 +90,50 @@ it defines would (in the common case) be already defined. Peer reviewed by the c
 
 -doc_begin="The project adopted the rule with an exception listed in
 'docs/misra/rules.rst'"
--config=MC3R1.R5.3,reports+={safe, "any_area(any_loc(any_exp(macro(^READ_SYSREG$))&&any_exp(macro(^WRITE_SYSREG$))))"}
--config=MC3R1.R5.3,reports+={safe, "any_area(any_loc(any_exp(macro(^max(_t)?$))&&any_exp(macro(^min(_t)?$))))"}
--config=MC3R1.R5.3,reports+={safe, "any_area(any_loc(any_exp(macro(^read[bwlq]$))&&any_exp(macro(^read[bwlq]_relaxed$))))"}
--config=MC3R1.R5.3,reports+={safe, "any_area(any_loc(any_exp(macro(^per_cpu$))&&any_exp(macro(^this_cpu$))))"}
--config=MC3R1.R5.3,reports+={safe, "any_area(any_loc(any_exp(macro(^__emulate_2op$))&&any_exp(macro(^__emulate_2op_nobyte$))))"}
--config=MC3R1.R5.3,reports+={safe, "any_area(any_loc(any_exp(macro(^read_debugreg$))&&any_exp(macro(^write_debugreg$))))"}
+-config=MC3A2.R5.3,reports+={safe, "any_area(any_loc(any_exp(macro(^READ_SYSREG$))&&any_exp(macro(^WRITE_SYSREG$))))"}
+-config=MC3A2.R5.3,reports+={safe, "any_area(any_loc(any_exp(macro(^max(_t)?$))&&any_exp(macro(^min(_t)?$))))"}
+-config=MC3A2.R5.3,reports+={safe, "any_area(any_loc(any_exp(macro(^read[bwlq]$))&&any_exp(macro(^read[bwlq]_relaxed$))))"}
+-config=MC3A2.R5.3,reports+={safe, "any_area(any_loc(any_exp(macro(^per_cpu$))&&any_exp(macro(^this_cpu$))))"}
+-config=MC3A2.R5.3,reports+={safe, "any_area(any_loc(any_exp(macro(^__emulate_2op$))&&any_exp(macro(^__emulate_2op_nobyte$))))"}
+-config=MC3A2.R5.3,reports+={safe, "any_area(any_loc(any_exp(macro(^read_debugreg$))&&any_exp(macro(^write_debugreg$))))"}
 -doc_end
 
 -doc_begin="Macros expanding to their own identifier (e.g., \"#define x x\") are deliberate."
--config=MC3R1.R5.5,reports+={deliberate, "all_area(macro(same_id_body())||!macro(!same_id_body()))"}
+-config=MC3A2.R5.5,reports+={deliberate, "all_area(macro(same_id_body())||!macro(!same_id_body()))"}
 -doc_end
 
 -doc_begin="There is no clash between function like macros and not callable objects."
--config=MC3R1.R5.5,reports+={deliberate, "all_area(macro(function_like())||decl(any()))&&all_area(macro(any())||!decl(kind(function))&&!decl(__function_pointer_decls))"}
+-config=MC3A2.R5.5,reports+={deliberate, "all_area(macro(function_like())||decl(any()))&&all_area(macro(any())||!decl(kind(function))&&!decl(__function_pointer_decls))"}
 -doc_end
 
 -doc_begin="Clashes between function names and macros are deliberate for string handling functions since some architectures may want to use their own arch-specific implementation."
--config=MC3R1.R5.5,reports+={deliberate, "all_area(all_loc(file(^xen/arch/x86/string\\.c|xen/include/xen/string\\.h|xen/lib/.*$)))"}
+-config=MC3A2.R5.5,reports+={deliberate, "all_area(all_loc(file(^xen/arch/x86/string\\.c|xen/include/xen/string\\.h|xen/lib/.*$)))"}
 -doc_end
 
 -doc_begin="In libelf, clashes between macros and function names are deliberate and needed to prevent the use of undecorated versions of memcpy, memset and memmove."
--config=MC3R1.R5.5,reports+={deliberate, "any_area(decl(kind(function))||any_loc(macro(name(memcpy||memset||memmove))))&&any_area(any_loc(file(^xen/common/libelf/libelf-private\\.h$)))"}
+-config=MC3A2.R5.5,reports+={deliberate, "any_area(decl(kind(function))||any_loc(macro(name(memcpy||memset||memmove))))&&any_area(any_loc(file(^xen/common/libelf/libelf-private\\.h$)))"}
 -doc_end
 
 -doc_begin="The type \"ret_t\" is deliberately defined multiple times,
 depending on the guest."
--config=MC3R1.R5.6,reports+={deliberate,"any_area(any_loc(text(^.*ret_t.*$)))"}
+-config=MC3A2.R5.6,reports+={deliberate,"any_area(any_loc(text(^.*ret_t.*$)))"}
 -doc_end
 
 -doc_begin="On X86, the types \"guest_intpte_t\", \"guest_l1e_t\" and
 \"guest_l2e_t\" are deliberately defined multiple times, depending on the
 number of guest paging levels."
--config=MC3R1.R5.6,reports+={deliberate,"any_area(any_loc(file(^xen/arch/x86/include/asm/guest_pt\\.h$)))&&any_area(any_loc(text(^.*(guest_intpte_t|guest_l[12]e_t).*$)))"}
+-config=MC3A2.R5.6,reports+={deliberate,"any_area(any_loc(file(^xen/arch/x86/include/asm/guest_pt\\.h$)))&&any_area(any_loc(text(^.*(guest_intpte_t|guest_l[12]e_t).*$)))"}
 -doc_end
 
 -doc_begin="The following files are imported from the gnu-efi package."
 -file_tag+={adopted_r5_6,"^xen/include/efi/.*$"}
 -file_tag+={adopted_r5_6,"^xen/arch/.*/include/asm/.*/efibind\\.h$"}
--config=MC3R1.R5.6,reports+={deliberate,"any_area(any_loc(file(adopted_r5_6)))"}
+-config=MC3A2.R5.6,reports+={deliberate,"any_area(any_loc(file(adopted_r5_6)))"}
 -doc_end
 
 -doc_begin="The project intentionally reuses tag names in order to have identifiers matching the applicable external specifications as well as established internal conventions.
 As there is little possibility for developer confusion not resulting into compilation errors, the risk of renaming outweighs the potential advantages of compliance."
--config=MC3R1.R5.7,reports+={deliberate,"any()"}
+-config=MC3A2.R5.7,reports+={deliberate,"any()"}
 -doc_end
 
 #
@@ -142,7 +142,7 @@ As there is little possibility for developer confusion not resulting into compil
 
 -doc_begin="It is safe to use certain octal constants the way they are defined
 in specifications, manuals, and algorithm descriptions."
--config=MC3R1.R7.1,reports+={safe, "any_area(any_loc(any_exp(text(^.*octal-ok.*$))))"}
+-config=MC3A2.R7.1,reports+={safe, "any_area(any_loc(any_exp(text(^.*octal-ok.*$))))"}
 -doc_end
 
 -doc_begin="Violations in files that maintainers have asked to not modify in the
@@ -155,17 +155,17 @@ context of R7.2."
 -file_tag+={adopted_r7_2,"^xen/arch/x86/cpu/intel\\.c$"}
 -file_tag+={adopted_r7_2,"^xen/arch/x86/cpu/amd\\.c$"}
 -file_tag+={adopted_r7_2,"^xen/arch/x86/cpu/common\\.c$"}
--config=MC3R1.R7.2,reports+={deliberate,"any_area(any_loc(file(adopted_r7_2)))"}
+-config=MC3A2.R7.2,reports+={deliberate,"any_area(any_loc(file(adopted_r7_2)))"}
 -doc_end
 
 -doc_begin="Violations caused by __HYPERVISOR_VIRT_START are related to the
 particular use of it done in xen_mk_ulong."
--config=MC3R1.R7.2,reports+={deliberate,"any_area(any_loc(macro(name(BUILD_BUG_ON))))"}
+-config=MC3A2.R7.2,reports+={deliberate,"any_area(any_loc(macro(name(BUILD_BUG_ON))))"}
 -doc_end
 
 -doc_begin="Allow pointers of non-character type as long as the pointee is
 const-qualified."
--config=MC3R1.R7.4,same_pointee=false
+-config=MC3A2.R7.4,same_pointee=false
 -doc_end
 
 #
@@ -173,7 +173,7 @@ const-qualified."
 #
 
 -doc_begin="The type ret_t is deliberately used and defined as int or long depending on the architecture."
--config=MC3R1.R8.3,reports+={deliberate,"any_area(any_loc(text(^.*ret_t.*$)))"}
+-config=MC3A2.R8.3,reports+={deliberate,"any_area(any_loc(text(^.*ret_t.*$)))"}
 -doc_end
 
 -doc_begin="The following files are imported from Linux and decompress.h defines a unique and documented interface towards all the (adopted) decompress functions."
@@ -183,71 +183,71 @@ const-qualified."
 -file_tag+={adopted_decompress_r8_3,"^xen/common/unlzo\\.c$"}
 -file_tag+={adopted_decompress_r8_3,"^xen/common/unxz\\.c$"}
 -file_tag+={adopted_decompress_r8_3,"^xen/common/unzstd\\.c$"}
--config=MC3R1.R8.3,reports+={deliberate,"any_area(any_loc(file(adopted_decompress_r8_3)))&&any_area(any_loc(file(^xen/include/xen/decompress\\.h$)))"}
+-config=MC3A2.R8.3,reports+={deliberate,"any_area(any_loc(file(adopted_decompress_r8_3)))&&any_area(any_loc(file(^xen/include/xen/decompress\\.h$)))"}
 -doc_end
 
 -doc_begin="Parameter name \"unused\" (with an optional numeric suffix) is deliberate and makes explicit the intention of not using such parameter within the function."
--config=MC3R1.R8.3,reports+={deliberate, "any_area(^.*parameter `unused[0-9]*'.*$)"}
+-config=MC3A2.R8.3,reports+={deliberate, "any_area(^.*parameter `unused[0-9]*'.*$)"}
 -doc_end
 
 -doc_begin="The following file is imported from Linux: ignore for now."
 -file_tag+={adopted_time_r8_3,"^xen/arch/x86/time\\.c$"}
--config=MC3R1.R8.3,reports+={deliberate,"any_area(any_loc(file(adopted_time_r8_3)))&&(any_area(any_loc(file(^xen/include/xen/time\\.h$)))||any_area(any_loc(file(^xen/arch/x86/include/asm/setup\\.h$))))"}
+-config=MC3A2.R8.3,reports+={deliberate,"any_area(any_loc(file(adopted_time_r8_3)))&&(any_area(any_loc(file(^xen/include/xen/time\\.h$)))||any_area(any_loc(file(^xen/arch/x86/include/asm/setup\\.h$))))"}
 -doc_end
 
 -doc_begin="The following file is imported from Linux: ignore for now."
 -file_tag+={adopted_cpu_idle_r8_3,"^xen/arch/x86/acpi/cpu_idle\\.c$"}
--config=MC3R1.R8.3,reports+={deliberate,"any_area(any_loc(file(adopted_cpu_idle_r8_3)))&&any_area(any_loc(file(^xen/include/xen/pmstat\\.h$)))"}
+-config=MC3A2.R8.3,reports+={deliberate,"any_area(any_loc(file(adopted_cpu_idle_r8_3)))&&any_area(any_loc(file(^xen/include/xen/pmstat\\.h$)))"}
 -doc_end
 
 -doc_begin="The following file is imported from Linux: ignore for now."
 -file_tag+={adopted_mpparse_r8_3,"^xen/arch/x86/mpparse\\.c$"}
--config=MC3R1.R8.3,reports+={deliberate,"any_area(any_loc(file(adopted_mpparse_r8_3)))&&any_area(any_loc(file(^xen/arch/x86/include/asm/mpspec\\.h$)))"}
+-config=MC3A2.R8.3,reports+={deliberate,"any_area(any_loc(file(adopted_mpparse_r8_3)))&&any_area(any_loc(file(^xen/arch/x86/include/asm/mpspec\\.h$)))"}
 -doc_end
 
 -doc_begin="The definitions present in this file are meant to generate definitions for asm modules, and are not called by C code. Therefore the absence of prior declarations is safe."
 -file_tag+={asm_offsets, "^xen/arch/(arm|x86)/(arm32|arm64|x86_64)/asm-offsets\\.c$"}
--config=MC3R1.R8.4,reports+={safe, "first_area(any_loc(file(asm_offsets)))"}
+-config=MC3A2.R8.4,reports+={safe, "first_area(any_loc(file(asm_offsets)))"}
 -doc_end
 
 -doc_begin="The functions defined in this file are meant to be called from gcc-generated code in a non-release build configuration.
 Therefore the absence of prior declarations is safe."
 -file_tag+={gcov, "^xen/common/coverage/gcov_base\\.c$"}
--config=MC3R1.R8.4,reports+={safe, "first_area(any_loc(file(gcov)))"}
+-config=MC3A2.R8.4,reports+={safe, "first_area(any_loc(file(gcov)))"}
 -doc_end
 
 -doc_begin="Recognize the occurrence of current_stack_pointer as a declaration."
 -file_tag+={asm_defns, "^xen/arch/x86/include/asm/asm_defns\\.h$"}
--config=MC3R1.R8.4,declarations+={safe, "loc(file(asm_defns))&&^current_stack_pointer$"}
+-config=MC3A2.R8.4,declarations+={safe, "loc(file(asm_defns))&&^current_stack_pointer$"}
 -doc_end
 
 -doc_begin="The function apei_(read|check|clear)_mce are dead code and are excluded from non-debug builds, therefore the absence of prior declarations is safe."
--config=MC3R1.R8.4,declarations+={safe, "^apei_(read|check|clear)_mce\\(.*$"}
+-config=MC3A2.R8.4,declarations+={safe, "^apei_(read|check|clear)_mce\\(.*$"}
 -doc_end
 
 -doc_begin="asmlinkage is a marker to indicate that the function is only used to interface with asm modules."
--config=MC3R1.R8.4,declarations+={safe,"loc(text(^(?s).*asmlinkage.*$, -1..0))"}
+-config=MC3A2.R8.4,declarations+={safe,"loc(text(^(?s).*asmlinkage.*$, -1..0))"}
 -doc_end
 
 -doc_begin="Given that bsearch and sort are defined with the attribute 'gnu_inline', it's deliberate not to have a prior declaration.
 See Section \"6.33.1 Common Function Attributes\" of \"GCC_MANUAL\" for a full explanation of gnu_inline."
 -file_tag+={bsearch_sort, "^xen/include/xen/(sort|lib)\\.h$"}
--config=MC3R1.R8.4,reports+={deliberate, "any_area(any_loc(file(bsearch_sort))&&decl(name(bsearch||sort)))"}
+-config=MC3A2.R8.4,reports+={deliberate, "any_area(any_loc(file(bsearch_sort))&&decl(name(bsearch||sort)))"}
 -doc_end
 
 -doc_begin="first_valid_mfn is defined in this way because the current lack of NUMA support in Arm and PPC requires it."
 -file_tag+={first_valid_mfn, "^xen/common/page_alloc\\.c$"}
--config=MC3R1.R8.4,declarations+={deliberate,"loc(file(first_valid_mfn))"}
+-config=MC3A2.R8.4,declarations+={deliberate,"loc(file(first_valid_mfn))"}
 -doc_end
 
 -doc_begin="The following variables are compiled in multiple translation units
 belonging to different executables and therefore are safe."
--config=MC3R1.R8.6,declarations+={safe, "name(current_stack_pointer||bsearch||sort)"}
+-config=MC3A2.R8.6,declarations+={safe, "name(current_stack_pointer||bsearch||sort)"}
 -doc_end
 
 -doc_begin="Declarations without definitions are allowed (specifically when the
 definition is compiled-out or optimized-out by the compiler)"
--config=MC3R1.R8.6,reports+={deliberate, "first_area(^.*has no definition$)"}
+-config=MC3A2.R8.6,reports+={deliberate, "first_area(^.*has no definition$)"}
 -doc_end
 
 -doc_begin="The search procedure for Unix linkers is well defined, see ld(1)
@@ -258,11 +258,11 @@ the linker will include the appropriate file(s) from the archive\".
 In Xen, thanks to the order in which file names appear in the build commands,
 if arch-specific definitions are present, they get always linked in before
 searching in the lib.a archive resulting from xen/lib."
--config=MC3R1.R8.6,declarations+={deliberate, "loc(file(^xen/lib/.*$))"}
+-config=MC3A2.R8.6,declarations+={deliberate, "loc(file(^xen/lib/.*$))"}
 -doc_end
 
 -doc_begin="The gnu_inline attribute without static is deliberately allowed."
--config=MC3R1.R8.10,declarations+={deliberate,"property(gnu_inline)"}
+-config=MC3A2.R8.10,declarations+={deliberate,"property(gnu_inline)"}
 -doc_end
 
 #
@@ -272,12 +272,12 @@ searching in the lib.a archive resulting from xen/lib."
 -doc_begin="Violations in files that maintainers have asked to not modify in the
 context of R9.1."
 -file_tag+={adopted_r9_1,"^xen/arch/arm/arm64/lib/find_next_bit\\.c$"}
--config=MC3R1.R9.1,reports+={deliberate,"any_area(any_loc(file(adopted_r9_1)))"}
+-config=MC3A2.R9.1,reports+={deliberate,"any_area(any_loc(file(adopted_r9_1)))"}
 -doc_end
 
 -doc_begin="The possibility of committing mistakes by specifying an explicit
 dimension is higher than omitting the dimension."
--config=MC3R1.R9.5,reports+={deliberate, "any()"}
+-config=MC3A2.R9.5,reports+={deliberate, "any()"}
 -doc_end
 
 #
@@ -285,45 +285,45 @@ dimension is higher than omitting the dimension."
 #
 
 -doc_begin="The value-preserving conversions of integer constants are safe"
--config=MC3R1.R10.1,etypes={safe,"any()","preserved_integer_constant()"}
--config=MC3R1.R10.3,etypes={safe,"any()","preserved_integer_constant()"}
--config=MC3R1.R10.4,etypes={safe,"any()","preserved_integer_constant()||sibling(rhs,preserved_integer_constant())"}
+-config=MC3A2.R10.1,etypes={safe,"any()","preserved_integer_constant()"}
+-config=MC3A2.R10.3,etypes={safe,"any()","preserved_integer_constant()"}
+-config=MC3A2.R10.4,etypes={safe,"any()","preserved_integer_constant()||sibling(rhs,preserved_integer_constant())"}
 -doc_end
 
 -doc_begin="Shifting non-negative integers to the right is safe."
--config=MC3R1.R10.1,etypes+={safe,
+-config=MC3A2.R10.1,etypes+={safe,
   "stmt(node(binary_operator)&&operator(shr))",
   "src_expr(definitely_in(0..))"}
 -doc_end
 
 -doc_begin="Shifting non-negative integers to the left is safe if the result is
 still non-negative."
--config=MC3R1.R10.1,etypes+={safe,
+-config=MC3A2.R10.1,etypes+={safe,
   "stmt(node(binary_operator)&&operator(shl)&&definitely_in(0..))",
   "src_expr(definitely_in(0..))"}
 -doc_end
 
 -doc_begin="Bitwise logical operations on non-negative integers are safe."
--config=MC3R1.R10.1,etypes+={safe,
+-config=MC3A2.R10.1,etypes+={safe,
   "stmt(node(binary_operator)&&operator(and||or||xor))",
   "src_expr(definitely_in(0..))"}
 -doc_end
 
 -doc_begin="The implicit conversion to Boolean for logical operator arguments is well known to all Xen developers to be a comparison with 0"
--config=MC3R1.R10.1,etypes+={safe, "stmt(operator(logical)||node(conditional_operator||binary_conditional_operator))", "dst_type(ebool||boolean)"}
+-config=MC3A2.R10.1,etypes+={safe, "stmt(operator(logical)||node(conditional_operator||binary_conditional_operator))", "dst_type(ebool||boolean)"}
 -doc_end
 
 -doc_begin="The macro ISOLATE_LSB encapsulates a well-known pattern to obtain
 a mask where only the lowest bit set in the argument is set, if any, for unsigned
 integers arguments on two's complement architectures
 (all the architectures supported by Xen satisfy this requirement)."
--config=MC3R1.R10.1,reports+={safe, "any_area(any_loc(any_exp(macro(^ISOLATE_LSB$))))"}
+-config=MC3A2.R10.1,reports+={safe, "any_area(any_loc(any_exp(macro(^ISOLATE_LSB$))))"}
 -doc_end
 
 -doc_begin="XEN only supports architectures where signed integers are
 representend using two's complement and all the XEN developers are aware of
 this."
--config=MC3R1.R10.1,etypes+={safe,
+-config=MC3A2.R10.1,etypes+={safe,
   "stmt(operator(and||or||xor||not||and_assign||or_assign||xor_assign))",
   "any()"}
 -doc_end
@@ -334,7 +334,7 @@ C language, GCC does not use the latitude given in C99 and C11 only to treat
 certain aspects of signed `<<' as undefined. However, -fsanitize=shift (and
 -fsanitize=undefined) will diagnose such cases. They are also diagnosed where
 constant expressions are required.\""
--config=MC3R1.R10.1,etypes+={safe,
+-config=MC3A2.R10.1,etypes+={safe,
   "stmt(operator(shl||shr||shl_assign||shr_assign))",
   "any()"}
 -doc_end
@@ -344,7 +344,7 @@ constant expressions are required.\""
 #
 
 -doc_begin="The conversion from a function pointer to unsigned long or (void *) does not lose any information, provided that the target type has enough bits to store it."
--config=MC3R1.R11.1,casts+={safe,
+-config=MC3A2.R11.1,casts+={safe,
   "from(type(canonical(__function_pointer_types)))
    &&to(type(canonical(builtin(unsigned long)||pointer(builtin(void)))))
    &&relation(definitely_preserves_value)"
@@ -352,14 +352,14 @@ constant expressions are required.\""
 -doc_end
 
 -doc_begin="The conversion from a function pointer to a boolean has a well-known semantics that do not lead to unexpected behaviour."
--config=MC3R1.R11.1,casts+={safe,
+-config=MC3A2.R11.1,casts+={safe,
   "from(type(canonical(__function_pointer_types)))
    &&kind(pointer_to_boolean)"
 }
 -doc_end
 
 -doc_begin="The conversion from a pointer to an incomplete type to unsigned long does not lose any information, provided that the target type has enough bits to store it."
--config=MC3R1.R11.2,casts+={safe,
+-config=MC3A2.R11.2,casts+={safe,
   "from(type(any()))
    &&to(type(canonical(builtin(unsigned long))))
    &&relation(definitely_preserves_value)"
@@ -367,20 +367,20 @@ constant expressions are required.\""
 -doc_end
 
 -doc_begin="Conversions to object pointers that have a pointee type with a smaller (i.e., less strict) alignment requirement are safe."
--config=MC3R1.R11.3,casts+={safe,
+-config=MC3A2.R11.3,casts+={safe,
   "!relation(more_aligned_pointee)"
 }
 -doc_end
 
 -doc_begin="Conversions from and to integral types are safe, in the assumption that the target type has enough bits to store the value.
 See also Section \"4.7 Arrays and Pointers\" of \"GCC_MANUAL\""
--config=MC3R1.R11.6,casts+={safe,
+-config=MC3A2.R11.6,casts+={safe,
     "(from(type(canonical(integral())))||to(type(canonical(integral()))))
      &&relation(definitely_preserves_value)"}
 -doc_end
 
 -doc_begin="The conversion from a pointer to a boolean has a well-known semantics that do not lead to unexpected behaviour."
--config=MC3R1.R11.6,casts+={safe,
+-config=MC3A2.R11.6,casts+={safe,
   "from(type(canonical(__pointer_types)))
    &&kind(pointer_to_boolean)"
 }
@@ -390,11 +390,11 @@ See also Section \"4.7 Arrays and Pointers\" of \"GCC_MANUAL\""
 with the provided offset. The resulting pointer is then immediately cast back to its
 original type, which preserves the qualifier. This use is deemed safe.
 Fixing this violation would require to increase code complexity and lower readability."
--config=MC3R1.R11.8,reports+={safe,"any_area(any_loc(any_exp(macro(^container_of$))))"}
+-config=MC3A2.R11.8,reports+={safe,"any_area(any_loc(any_exp(macro(^container_of$))))"}
 -doc_end
 
 -doc_begin="This construct is used to check if the type is scalar, and for this purpose the use of 0 as a null pointer constant is deliberate."
--config=MC3R1.R11.9,reports+={deliberate, "any_area(any_loc(any_exp(macro(^__ACCESS_ONCE$))))"
+-config=MC3A2.R11.9,reports+={deliberate, "any_area(any_loc(any_exp(macro(^__ACCESS_ONCE$))))"
 }
 -doc_end
 
@@ -404,16 +404,16 @@ Fixing this violation would require to increase code complexity and lower readab
 
 -doc_begin="All developers and reviewers can be safely assumed to be well aware
 of the short-circuit evaluation strategy of such logical operators."
--config=MC3R1.R13.5,reports+={disapplied,"any()"}
+-config=MC3A2.R13.5,reports+={disapplied,"any()"}
 -doc_end
 
 -doc_begin="Macros alternative_v?call[0-9] use sizeof and typeof to check that the argument types match the corresponding parameter ones."
--config=MC3R1.R13.6,reports+={deliberate,"any_area(any_loc(any_exp(macro(^alternative_vcall[0-9]$))&&file(^xen/arch/x86/include/asm/alternative\\.h*$)))"}
+-config=MC3A2.R13.6,reports+={deliberate,"any_area(any_loc(any_exp(macro(^alternative_vcall[0-9]$))&&file(^xen/arch/x86/include/asm/alternative\\.h*$)))"}
 -config=B.UNEVALEFF,reports+={deliberate,"any_area(any_loc(any_exp(macro(^alternative_v?call[0-9]$))&&file(^xen/arch/x86/include/asm/alterantive\\.h*$)))"}
 -doc_end
 
 -doc_begin="Anything, no matter how complicated, inside the BUILD_BUG_ON macro is subject to a compile-time evaluation without relevant side effects."
--config=MC3R1.R13.6,reports+={safe,"any_area(any_loc(any_exp(macro(name(BUILD_BUG_ON)))))"}
+-config=MC3A2.R13.6,reports+={safe,"any_area(any_loc(any_exp(macro(name(BUILD_BUG_ON)))))"}
 -config=B.UNEVALEFF,reports+={safe,"any_area(any_loc(any_exp(macro(name(BUILD_BUG_ON)))))"}
 -doc_end
 
@@ -424,31 +424,31 @@ of the short-circuit evaluation strategy of such logical operators."
 -doc_begin="The severe restrictions imposed by this rule on the use of for
 statements are not balanced by the presumed facilitation of the peer review
 activity."
--config=MC3R1.R14.2,reports+={disapplied,"any()"}
+-config=MC3A2.R14.2,reports+={disapplied,"any()"}
 -doc_end
 
 -doc_begin="The XEN team relies on the fact that invariant conditions of 'if' statements and conditional operators are deliberate"
--config=MC3R1.R14.3,statements+={deliberate, "wrapped(any(),node(if_stmt||conditional_operator||binary_conditional_operator))" }
+-config=MC3A2.R14.3,statements+={deliberate, "wrapped(any(),node(if_stmt||conditional_operator||binary_conditional_operator))" }
 -doc_end
 
 -doc_begin="Switches having a 'sizeof' operator as the condition are deliberate and have limited scope."
--config=MC3R1.R14.3,statements+={deliberate, "wrapped(any(),node(switch_stmt)&&child(cond, operator(sizeof)))" }
+-config=MC3A2.R14.3,statements+={deliberate, "wrapped(any(),node(switch_stmt)&&child(cond, operator(sizeof)))" }
 -doc_end
 
 -doc_begin="The use of an invariant size argument in {put,get}_unsafe_size and array_access_ok, as defined in arch/x86(_64)?/include/asm/uaccess.h is deliberate and is deemed safe."
 -file_tag+={x86_uaccess, "^xen/arch/x86(_64)?/include/asm/uaccess\\.h$"}
--config=MC3R1.R14.3,reports+={deliberate, "any_area(any_loc(file(x86_uaccess)&&any_exp(macro(^(put|get)_unsafe_size$))))"}
--config=MC3R1.R14.3,reports+={deliberate, "any_area(any_loc(file(x86_uaccess)&&any_exp(macro(^array_access_ok$))))"}
+-config=MC3A2.R14.3,reports+={deliberate, "any_area(any_loc(file(x86_uaccess)&&any_exp(macro(^(put|get)_unsafe_size$))))"}
+-config=MC3A2.R14.3,reports+={deliberate, "any_area(any_loc(file(x86_uaccess)&&any_exp(macro(^array_access_ok$))))"}
 -doc_end
 
 -doc_begin="A controlling expression of 'if' and iteration statements having integer, character or pointer type has a semantics that is well-known to all Xen developers."
--config=MC3R1.R14.4,etypes+={deliberate, "any()", "src_type(integer||character)||src_expr(type(desugar(pointer(any()))))"}
+-config=MC3A2.R14.4,etypes+={deliberate, "any()", "src_type(integer||character)||src_expr(type(desugar(pointer(any()))))"}
 -doc_end
 
 -doc_begin="The XEN team relies on the fact that the enum is_dying has the
 constant with assigned value 0 act as false and the other ones as true,
 therefore have the same behavior of a boolean"
--config=MC3R1.R14.4,etypes+={deliberate, "stmt(child(cond,child(expr,ref(^<?domain>?::is_dying$))))","src_type(enum)"}
+-config=MC3A2.R14.4,etypes+={deliberate, "stmt(child(cond,child(expr,ref(^<?domain>?::is_dying$))))","src_type(enum)"}
 -doc_end
 
 #
@@ -459,58 +459,58 @@ therefore have the same behavior of a boolean"
 therefore it is deemed better to leave such files as is."
 -file_tag+={x86_emulate,"^xen/arch/x86/x86_emulate/.*$"}
 -file_tag+={x86_svm_emulate,"^xen/arch/x86/hvm/svm/emulate\\.c$"}
--config=MC3R1.R16.2,reports+={deliberate, "any_area(any_loc(file(x86_emulate||x86_svm_emulate)))"}
+-config=MC3A2.R16.2,reports+={deliberate, "any_area(any_loc(file(x86_emulate||x86_svm_emulate)))"}
 -doc_end
 
 -doc_begin="Statements that change the control flow (i.e., break, continue, goto, return) and calls to functions that do not return the control back are \"allowed terminal statements\"."
 -stmt_selector+={r16_3_allowed_terminal, "node(break_stmt||continue_stmt||goto_stmt||return_stmt)||call(property(noreturn))"}
--config=MC3R1.R16.3,terminals+={safe, "r16_3_allowed_terminal"}
+-config=MC3A2.R16.3,terminals+={safe, "r16_3_allowed_terminal"}
 -doc_end
 
 -doc_begin="An if-else statement having both branches ending with an allowed terminal statement is itself an allowed terminal statement."
 -stmt_selector+={r16_3_if, "node(if_stmt)&&(child(then,r16_3_allowed_terminal)||child(then,any_stmt(stmt,-1,r16_3_allowed_terminal)))"}
 -stmt_selector+={r16_3_else, "node(if_stmt)&&(child(else,r16_3_allowed_terminal)||child(else,any_stmt(stmt,-1,r16_3_allowed_terminal)))"}
 -stmt_selector+={r16_3_if_else, "r16_3_if&&r16_3_else"}
--config=MC3R1.R16.3,terminals+={safe, "r16_3_if_else"}
+-config=MC3A2.R16.3,terminals+={safe, "r16_3_if_else"}
 -doc_end
 
 -doc_begin="An if-else statement having an always true condition and the true branch ending with an allowed terminal statement is itself an allowed terminal statement."
 -stmt_selector+={r16_3_if_true, "r16_3_if&&child(cond,definitely_in(1..))"}
--config=MC3R1.R16.3,terminals+={safe, "r16_3_if_true"}
+-config=MC3A2.R16.3,terminals+={safe, "r16_3_if_true"}
 -doc_end
 
 -doc_begin="A switch clause ending with a statement expression which, in turn, ends with an allowed terminal statement is safe."
--config=MC3R1.R16.3,terminals+={safe, "node(stmt_expr)&&child(stmt,node(compound_stmt)&&any_stmt(stmt,-1,r16_3_allowed_terminal||r16_3_if_else||r16_3_if_true))"}
+-config=MC3A2.R16.3,terminals+={safe, "node(stmt_expr)&&child(stmt,node(compound_stmt)&&any_stmt(stmt,-1,r16_3_allowed_terminal||r16_3_if_else||r16_3_if_true))"}
 -doc_end
 
 -doc_begin="A switch clause ending with a do-while-false the body of which, in turn, ends with an allowed terminal statement is safe.
 An exception to that is the macro ASSERT_UNREACHABLE() which is effective in debug build only: a switch clause ending with ASSERT_UNREACHABLE() is not considered safe."
--config=MC3R1.R16.3,terminals+={safe, "!macro(name(ASSERT_UNREACHABLE))&&node(do_stmt)&&child(cond,definitely_in(0))&&child(body,any_stmt(stmt,-1,r16_3_allowed_terminal||r16_3_if_else||r16_3_if_true))"}
+-config=MC3A2.R16.3,terminals+={safe, "!macro(name(ASSERT_UNREACHABLE))&&node(do_stmt)&&child(cond,definitely_in(0))&&child(body,any_stmt(stmt,-1,r16_3_allowed_terminal||r16_3_if_else||r16_3_if_true))"}
 -doc_end
 
 -doc_begin="Switch clauses ending with pseudo-keyword \"fallthrough\" are
 safe."
--config=MC3R1.R16.3,reports+={safe, "any_area(end_loc(any_exp(text(/fallthrough;/))))"}
+-config=MC3A2.R16.3,reports+={safe, "any_area(end_loc(any_exp(text(/fallthrough;/))))"}
 -doc_end
 
 -doc_begin="Switch clauses ending with failure method \"BUG()\" are safe."
--config=MC3R1.R16.3,reports+={safe, "any_area(end_loc(any_exp(text(/BUG\\(\\);/))))"}
+-config=MC3A2.R16.3,reports+={safe, "any_area(end_loc(any_exp(text(/BUG\\(\\);/))))"}
 -doc_end
 
 -doc_begin="Switch clauses ending with an explicit comment indicating the fallthrough intention are safe."
--config=MC3R1.R16.3,reports+={safe, "any_area(end_loc(any_exp(text(^(?s).*/\\* [fF]all ?through\\.? \\*/.*$,0..2))))"}
+-config=MC3A2.R16.3,reports+={safe, "any_area(end_loc(any_exp(text(^(?s).*/\\* [fF]all ?through\\.? \\*/.*$,0..2))))"}
 -doc_end
 
 -doc_begin="Switch statements having a controlling expression of enum type deliberately do not have a default case: gcc -Wall enables -Wswitch which warns (and breaks the build as we use -Werror) if one of the enum labels is missing from the switch."
--config=MC3R1.R16.4,reports+={deliberate,'any_area(kind(context)&&^.* has no `default.*$&&stmt(node(switch_stmt)&&child(cond,skip(__non_syntactic_paren_stmts,type(canonical(enum_underlying_type(any())))))))'}
+-config=MC3A2.R16.4,reports+={deliberate,'any_area(kind(context)&&^.* has no `default.*$&&stmt(node(switch_stmt)&&child(cond,skip(__non_syntactic_paren_stmts,type(canonical(enum_underlying_type(any())))))))'}
 -doc_end
 
 -doc_begin="A switch statement with a single switch clause and no default label may be used in place of an equivalent if statement if it is considered to improve readability."
--config=MC3R1.R16.4,switch_clauses+={deliberate,"switch(1)&&default(0)"}
+-config=MC3A2.R16.4,switch_clauses+={deliberate,"switch(1)&&default(0)"}
 -doc_end
 
 -doc_begin="A switch statement with a single switch clause and no default label may be used in place of an equivalent if statement if it is considered to improve readability."
--config=MC3R1.R16.6,switch_clauses+={deliberate, "default(0)"}
+-config=MC3A2.R16.6,switch_clauses+={deliberate, "default(0)"}
 -doc_end
 
 #
@@ -518,16 +518,16 @@ safe."
 #
 
 -doc_begin="printf()-like functions are allowed to use the variadic features provided by stdarg.h."
--config=MC3R1.R17.1,reports+={deliberate,"any_area(^.*va_list.*$&&context(ancestor_or_self(^.*printk\\(.*\\)$)))"}
--config=MC3R1.R17.1,reports+={deliberate,"any_area(^.*va_list.*$&&context(ancestor_or_self(^.*printf\\(.*\\)$)))"}
--config=MC3R1.R17.1,reports+={deliberate,"any_area(^.*va_list.*$&&context(ancestor_or_self(name(panic)&&kind(function))))"}
--config=MC3R1.R17.1,reports+={deliberate,"any_area(^.*va_list.*$&&context(ancestor_or_self(name(elf_call_log_callback)&&kind(function))))"}
--config=MC3R1.R17.1,reports+={deliberate,"any_area(^.*va_list.*$&&context(ancestor_or_self(name(vprintk_common)&&kind(function))))"}
--config=MC3R1.R17.1,macros+={hide , "^va_(arg|start|copy|end)$"}
+-config=MC3A2.R17.1,reports+={deliberate,"any_area(^.*va_list.*$&&context(ancestor_or_self(^.*printk\\(.*\\)$)))"}
+-config=MC3A2.R17.1,reports+={deliberate,"any_area(^.*va_list.*$&&context(ancestor_or_self(^.*printf\\(.*\\)$)))"}
+-config=MC3A2.R17.1,reports+={deliberate,"any_area(^.*va_list.*$&&context(ancestor_or_self(name(panic)&&kind(function))))"}
+-config=MC3A2.R17.1,reports+={deliberate,"any_area(^.*va_list.*$&&context(ancestor_or_self(name(elf_call_log_callback)&&kind(function))))"}
+-config=MC3A2.R17.1,reports+={deliberate,"any_area(^.*va_list.*$&&context(ancestor_or_self(name(vprintk_common)&&kind(function))))"}
+-config=MC3A2.R17.1,macros+={hide , "^va_(arg|start|copy|end)$"}
 -doc_end
 
 -doc_begin="Not using the return value of a function does not endanger safety if it coincides with an actual argument."
--config=MC3R1.R17.7,calls+={safe, "any()", "decl(name(__builtin_memcpy||__builtin_memmove||__builtin_memset||cpumask_check))"}
+-config=MC3A2.R17.7,calls+={safe, "any()", "decl(name(__builtin_memcpy||__builtin_memmove||__builtin_memset||cpumask_check))"}
 -doc_end
 
 #
@@ -538,16 +538,16 @@ safe."
 are guaranteed not to be exploited by a compiler that relies on the absence of
 C99 Undefined Behaviour 45: Pointers that do not point into, or just beyond, the same array object are subtracted (6.5.6)."
 -eval_file=linker_symbols.ecl
--config=MC3R1.R18.2,reports+={safe, "any_area(stmt(operator(sub)&&child(lhs||rhs, skip(__non_syntactic_paren_stmts, ref(linker_symbols)))))"}
+-config=MC3A2.R18.2,reports+={safe, "any_area(stmt(operator(sub)&&child(lhs||rhs, skip(__non_syntactic_paren_stmts, ref(linker_symbols)))))"}
 -doc_end
 
 -doc_begin="The following macro performs a subtraction between pointers to obtain the mfn, but does not lead to undefined behaviour."
--config=MC3R1.R18.2,reports+={safe, "any_area(any_loc(any_exp(macro(^page_to_mfn$))))"}
+-config=MC3A2.R18.2,reports+={safe, "any_area(any_loc(any_exp(macro(^page_to_mfn$))))"}
 -doc_end
 
 -doc_begin="Flexible array members are deliberately used and XEN developers are aware of the dangers related to them:
 unexpected result when the structure is given as argument to a sizeof() operator and the truncation in assignment between structures."
--config=MC3R1.R18.7,reports+={deliberate, "any()"}
+-config=MC3A2.R18.7,reports+={deliberate, "any()"}
 -doc_end
 
 #
@@ -558,7 +558,7 @@ unexpected result when the structure is given as argument to a sizeof() operator
 as function arguments; (2) as macro arguments; (3) as array indices; (4) as lhs
 in assignments; (5) as initializers, possibly designated, in initalizer lists;
 (6) as the constant expression in a switch clause label."
--config=MC3R1.R20.7,expansion_context=
+-config=MC3A2.R20.7,expansion_context=
 {safe, "context(__call_expr_arg_contexts)"},
 {safe, "left_right(^[(,\\[]$,^[),\\]]$)"},
 {safe, "context(skip_to(__expr_non_syntactic_contexts, stmt_child(node(array_subscript_expr), subscript)))"},
@@ -571,62 +571,62 @@ in assignments; (5) as initializers, possibly designated, in initalizer lists;
 breaking the macro's logic; futhermore, the macro is only ever used in the context
 of the IS_ENABLED or STATIC_IF/STATIC_IF_NOT macros, so it always receives a literal
 0 or 1 as input, posing no risk to safety."
--config=MC3R1.R20.7,reports+={safe, "any_area(any_loc(any_exp(macro(^___config_enabled$))))"}
+-config=MC3A2.R20.7,reports+={safe, "any_area(any_loc(any_exp(macro(^___config_enabled$))))"}
 -doc_end
 
 -doc_begin="Violations due to the use of macros defined in files that are
 not in scope for compliance are allowed, as that is imported code."
 -file_tag+={gnu_efi_include, "^xen/include/efi/.*$"}
 -file_tag+={acpi_cpu_idle, "^xen/arch/x86/acpi/cpu_idle\\.c$"}
--config=MC3R1.R20.7,reports+={safe, "any_area(any_loc(file(gnu_efi_include)||any_exp(macro(^NextMemoryDescriptor$))))"}
--config=MC3R1.R20.7,reports+={safe, "any_area(any_loc(file(acpi_cpu_idle)))"}
+-config=MC3A2.R20.7,reports+={safe, "any_area(any_loc(file(gnu_efi_include)||any_exp(macro(^NextMemoryDescriptor$))))"}
+-config=MC3A2.R20.7,reports+={safe, "any_area(any_loc(file(acpi_cpu_idle)))"}
 -doc_end
 
 -doc_begin="To avoid compromising readability, the macros alternative_(v)?call[0-9] are allowed
 not to parenthesize their arguments."
--config=MC3R1.R20.7,reports+={safe, "any_area(any_loc(any_exp(macro(^alternative_(v)?call[0-9]$))))"}
+-config=MC3A2.R20.7,reports+={safe, "any_area(any_loc(any_exp(macro(^alternative_(v)?call[0-9]$))))"}
 -doc_end
 
 -doc_begin="The argument 'x' of the count_args_ macro can't be parenthesized as
 the rule would require, without breaking the functionality of the macro. The uses
 of this macro do not lead to developer confusion, and can thus be deviated."
--config=MC3R1.R20.7,reports+={safe, "any_area(any_loc(any_exp(macro(^count_args_$))))"}
+-config=MC3A2.R20.7,reports+={safe, "any_area(any_loc(any_exp(macro(^count_args_$))))"}
 -doc_end
 
 -doc_begin="The argument \"fn\" in macros {COMPILE,RUNTIME}_CHECK is not parenthesized
 on purpose, to be able to test function-like macros. Given the specialized and limited
 use of this macro, it is deemed ok to deviate them."
--config=MC3R1.R20.7,reports+={deliberate, "any_area(any_loc(any_exp(macro(^(COMPILE_CHECK|RUNTIME_CHECK)$))))"}
+-config=MC3A2.R20.7,reports+={deliberate, "any_area(any_loc(any_exp(macro(^(COMPILE_CHECK|RUNTIME_CHECK)$))))"}
 -doc_end
 
 -doc_begin="Problems related to operator precedence can not occur if the expansion of the macro argument is surrounded by tokens '{', '}' and ';'."
--config=MC3R1.R20.7,expansion_context+={safe, "left_right(^[\\{;]$,^[;\\}]$)"}
+-config=MC3A2.R20.7,expansion_context+={safe, "left_right(^[\\{;]$,^[;\\}]$)"}
 -doc_end
 
 -doc_begin="Uses of variadic macros that have one of their arguments defined as
 a macro and used within the body for both ordinary parameter expansion and as an
 operand to the # or ## operators have a behavior that is well-understood and
 deliberate."
--config=MC3R1.R20.12,macros+={deliberate, "variadic()"}
+-config=MC3A2.R20.12,macros+={deliberate, "variadic()"}
 -doc_end
 
 -doc_begin="Uses of a macro parameter for ordinary expansion and as an operand
 to the # or ## operators within the following macros are deliberate, to provide
 useful diagnostic messages to the user."
--config=MC3R1.R20.12,macros+={deliberate, "name(ASSERT||BUILD_BUG_ON||BUILD_BUG_ON_ZERO||RUNTIME_CHECK)"}
+-config=MC3A2.R20.12,macros+={deliberate, "name(ASSERT||BUILD_BUG_ON||BUILD_BUG_ON_ZERO||RUNTIME_CHECK)"}
 -doc_end
 
 -doc_begin="The helper macro GENERATE_CASE may use a macro parameter for ordinary
 expansion and token pasting to improve readability. Only instances where this
 leads to a violation of the Rule are deviated."
 -file_tag+={deliberate_generate_case, "^xen/arch/arm/vcpreg\\.c$"}
--config=MC3R1.R20.12,macros+={deliberate, "name(GENERATE_CASE)&&loc(file(deliberate_generate_case))"}
+-config=MC3A2.R20.12,macros+={deliberate, "name(GENERATE_CASE)&&loc(file(deliberate_generate_case))"}
 -doc_end
 
 -doc_begin="The macro DEFINE is defined and used in excluded files asm-offsets.c.
 This may still cause violations if entities outside these files are referred to
 in the expansion."
--config=MC3R1.R20.12,macros+={deliberate, "name(DEFINE)&&loc(file(asm_offsets))"}
+-config=MC3A2.R20.12,macros+={deliberate, "name(DEFINE)&&loc(file(asm_offsets))"}
 -doc_end
 
 #
@@ -636,7 +636,7 @@ in the expansion."
 -doc_begin="or, and and xor are reserved identifiers because they constitute alternate
 spellings for the corresponding operators (they are defined as macros by iso646.h).
 However, Xen doesn't use standard library headers, so there is no risk of overlap."
--config=MC3R1.R21.2,reports+={safe, "any_area(stmt(ref(kind(label)&&^(or|and|xor|not)$)))"}
+-config=MC3A2.R21.2,reports+={safe, "any_area(stmt(ref(kind(label)&&^(or|and|xor|not)$)))"}
 -doc_end
 
 -doc_begin="Xen does not use the functions provided by the Standard Library, but
@@ -645,8 +645,8 @@ The implementation of these functions is available in source form, so the undefi
 or implementation-defined behaviors contemplated by the C Standard do not apply.
 If some undefined or unspecified behavior does arise in the implementation, it
 falls under the jurisdiction of other MISRA rules."
--config=MC3R1.R21.9,reports+={deliberate, "any()"}
--config=MC3R1.R21.10,reports+={deliberate, "any()"}
+-config=MC3A2.R21.9,reports+={deliberate, "any()"}
+-config=MC3A2.R21.10,reports+={deliberate, "any()"}
 -doc_end
 
 #
@@ -671,7 +671,7 @@ falls under the jurisdiction of other MISRA rules."
 programmers:no developers' confusion is not possible. In addition, adopted code
 is assumed to work as is. Reports that are fully contained in adopted code are
 hidden/tagged with the 'adopted' tag."
--service_selector={developer_confusion_guidelines,"^(MC3R1\\.R2\\.1|MC3R1\\.R2\\.2|MC3R1\\.R2\\.3|MC3R1\\.R2\\.4|MC3R1\\.R2\\.5|MC3R1\\.R2\\.6|MC3R1\\.R2\\.7|MC3R1\\.R4\\.1|MC3R1\\.R5\\.3|MC3R1\\.R5\\.6|MC3R1\\.R5\\.7|MC3R1\\.R5\\.8|MC3R1\\.R5\\.9|MC3R1\\.R7\\.1|MC3R1\\.R7\\.2|MC3R1\\.R7\\.3|MC3R1\\.R8\\.7|MC3R1\\.R8\\.8|MC3R1\\.R8\\.9|MC3R1\\.R8\\.11|MC3R1\\.R8\\.12|MC3R1\\.R8\\.13|MC3R1\\.R9\\.3|MC3R1\\.R9\\.4|MC3R1\\.R9\\.5|MC3R1\\.R10\\.2|MC3R1\\.R10\\.5|MC3R1\\.R10\\.6|MC3R1\\.R10\\.7|MC3R1\\.R10\\.8|MC3R1\\.R11\\.9|MC3R1\\.R12\\.1|MC3R1\\.R12\\.3|MC3R1\\.R12\\.4|MC3R1\\.R13\\.5|MC3R1\\.R14\\.1|MC3R1\\.R14\\.2|MC3R1\\.R14\\.3|MC3R1\\.R15\\.1|MC3R1\\.R15\\.2|MC3R1\\.R15\\.3|MC3R1\\.R15\\.4|MC3R1\\.R15\\.5|MC3R1\\.R15\\.6|MC3R1\\.R15\\.7|MC3R1\\.R16\\.1|MC3R1\\.R16\\.2|MC3R1\\.R16\\.3|MC3R1\\.R16\\.4|MC3R1\\.R16\\.5|MC3R1\\.R16\\.6|MC3R1\\.R16\\.7|MC3R1\\.R17\\.7|MC3R1\\.R17\\.8|MC3R1\\.R18\\.4|MC3R1\\.R18\\.5)$"
+-service_selector={developer_confusion_guidelines,"^(MC3A2\\.R2\\.1|MC3A2\\.R2\\.2|MC3A2\\.R2\\.3|MC3A2\\.R2\\.4|MC3A2\\.R2\\.5|MC3A2\\.R2\\.6|MC3A2\\.R2\\.7|MC3A2\\.R4\\.1|MC3A2\\.R5\\.3|MC3A2\\.R5\\.6|MC3A2\\.R5\\.7|MC3A2\\.R5\\.8|MC3A2\\.R5\\.9|MC3A2\\.R7\\.1|MC3A2\\.R7\\.2|MC3A2\\.R7\\.3|MC3A2\\.R8\\.7|MC3A2\\.R8\\.8|MC3A2\\.R8\\.9|MC3A2\\.R8\\.11|MC3A2\\.R8\\.12|MC3A2\\.R8\\.13|MC3A2\\.R9\\.3|MC3A2\\.R9\\.4|MC3A2\\.R9\\.5|MC3A2\\.R10\\.2|MC3A2\\.R10\\.5|MC3A2\\.R10\\.6|MC3A2\\.R10\\.7|MC3A2\\.R10\\.8|MC3A2\\.R11\\.9|MC3A2\\.R12\\.1|MC3A2\\.R12\\.3|MC3A2\\.R12\\.4|MC3A2\\.R13\\.5|MC3A2\\.R14\\.1|MC3A2\\.R14\\.2|MC3A2\\.R14\\.3|MC3A2\\.R15\\.1|MC3A2\\.R15\\.2|MC3A2\\.R15\\.3|MC3A2\\.R15\\.4|MC3A2\\.R15\\.5|MC3A2\\.R15\\.6|MC3A2\\.R15\\.7|MC3A2\\.R16\\.1|MC3A2\\.R16\\.2|MC3A2\\.R16\\.3|MC3A2\\.R16\\.4|MC3A2\\.R16\\.5|MC3A2\\.R16\\.6|MC3A2\\.R16\\.7|MC3A2\\.R17\\.7|MC3A2\\.R17\\.8|MC3A2\\.R18\\.4|MC3A2\\.R18\\.5)$"
 }
 -config=developer_confusion_guidelines,reports+={relied,adopted_report}
 -doc_end
diff --git a/automation/eclair_analysis/ECLAIR/monitored.ecl b/automation/eclair_analysis/ECLAIR/monitored.ecl
index 4e1deef7a7..8351996ec8 100644
--- a/automation/eclair_analysis/ECLAIR/monitored.ecl
+++ b/automation/eclair_analysis/ECLAIR/monitored.ecl
@@ -1,106 +1,106 @@
 -doc_begin="A set of guidelines that are clean or that only have few violations left."
--enable=MC3R1.D1.1
--enable=MC3R1.D2.1
--enable=MC3R1.D4.1
--enable=MC3R1.D4.3
--enable=MC3R1.D4.7
--enable=MC3R1.D4.10
--enable=MC3R1.D4.11
--enable=MC3R1.D4.14
--enable=MC3R1.R1.1
--enable=MC3R1.R1.3
--enable=MC3R1.R1.4
--enable=MC3R1.R2.1
--enable=MC3R1.R2.6
--enable=MC3R1.R3.1
--enable=MC3R1.R3.2
--enable=MC3R1.R4.1
--enable=MC3R1.R4.2
--enable=MC3R1.R5.1
--enable=MC3R1.R5.2
--enable=MC3R1.R5.3
--enable=MC3R1.R5.4
--enable=MC3R1.R5.5
--enable=MC3R1.R5.6
--enable=MC3R1.R6.1
--enable=MC3R1.R6.2
--enable=MC3R1.R7.1
--enable=MC3R1.R7.2
--enable=MC3R1.R7.3
--enable=MC3R1.R7.4
--enable=MC3R1.R8.1
--enable=MC3R1.R8.2
--enable=MC3R1.R8.3
--enable=MC3R1.R8.4
--enable=MC3R1.R8.5
--enable=MC3R1.R8.6
--enable=MC3R1.R8.8
--enable=MC3R1.R8.10
--enable=MC3R1.R8.12
--enable=MC3R1.R8.14
--enable=MC3R1.R9.2
--enable=MC3R1.R9.3
--enable=MC3R1.R9.4
--enable=MC3R1.R10.1
--enable=MC3R1.R10.2
--enable=MC3R1.R11.1
--enable=MC3R1.R11.2
--enable=MC3R1.R11.7
--enable=MC3R1.R11.8
--enable=MC3R1.R11.9
--enable=MC3R1.R12.5
--enable=MC3R1.R13.1
--enable=MC3R1.R13.2
--enable=MC3R1.R13.6
--enable=MC3R1.R14.1
--enable=MC3R1.R14.4
--enable=MC3R1.R16.2
--enable=MC3R1.R16.3
--enable=MC3R1.R16.4
--enable=MC3R1.R16.6
--enable=MC3R1.R16.7
--enable=MC3R1.R17.1
--enable=MC3R1.R17.3
--enable=MC3R1.R17.4
--enable=MC3R1.R17.5
--enable=MC3R1.R17.6
--enable=MC3R1.R18.1
--enable=MC3R1.R18.2
--enable=MC3R1.R18.6
--enable=MC3R1.R18.8
--enable=MC3R1.R19.1
--enable=MC3R1.R20.2
--enable=MC3R1.R20.3
--enable=MC3R1.R20.4
--enable=MC3R1.R20.6
--enable=MC3R1.R20.7
--enable=MC3R1.R20.9
--enable=MC3R1.R20.11
--enable=MC3R1.R20.12
--enable=MC3R1.R20.13
--enable=MC3R1.R20.14
--enable=MC3R1.R21.3
--enable=MC3R1.R21.4
--enable=MC3R1.R21.5
--enable=MC3R1.R21.7
--enable=MC3R1.R21.8
--enable=MC3R1.R21.9
--enable=MC3R1.R21.10
--enable=MC3R1.R21.12
--enable=MC3R1.R21.13
--enable=MC3R1.R21.17
--enable=MC3R1.R21.18
--enable=MC3R1.R21.19
--enable=MC3R1.R21.20
--enable=MC3R1.R21.21
--enable=MC3R1.R22.1
--enable=MC3R1.R22.2
--enable=MC3R1.R22.3
--enable=MC3R1.R22.4
--enable=MC3R1.R22.5
--enable=MC3R1.R22.6
--enable=MC3R1.R22.7
--enable=MC3R1.R22.8
--enable=MC3R1.R22.9
--enable=MC3R1.R22.10
+-enable=MC3A2.D1.1
+-enable=MC3A2.D2.1
+-enable=MC3A2.D4.1
+-enable=MC3A2.D4.3
+-enable=MC3A2.D4.7
+-enable=MC3A2.D4.10
+-enable=MC3A2.D4.11
+-enable=MC3A2.D4.14
+-enable=MC3A2.R1.1
+-enable=MC3A2.R1.3
+-enable=MC3A2.R1.4
+-enable=MC3A2.R2.1
+-enable=MC3A2.R2.6
+-enable=MC3A2.R3.1
+-enable=MC3A2.R3.2
+-enable=MC3A2.R4.1
+-enable=MC3A2.R4.2
+-enable=MC3A2.R5.1
+-enable=MC3A2.R5.2
+-enable=MC3A2.R5.3
+-enable=MC3A2.R5.4
+-enable=MC3A2.R5.5
+-enable=MC3A2.R5.6
+-enable=MC3A2.R6.1
+-enable=MC3A2.R6.2
+-enable=MC3A2.R7.1
+-enable=MC3A2.R7.2
+-enable=MC3A2.R7.3
+-enable=MC3A2.R7.4
+-enable=MC3A2.R8.1
+-enable=MC3A2.R8.2
+-enable=MC3A2.R8.3
+-enable=MC3A2.R8.4
+-enable=MC3A2.R8.5
+-enable=MC3A2.R8.6
+-enable=MC3A2.R8.8
+-enable=MC3A2.R8.10
+-enable=MC3A2.R8.12
+-enable=MC3A2.R8.14
+-enable=MC3A2.R9.2
+-enable=MC3A2.R9.3
+-enable=MC3A2.R9.4
+-enable=MC3A2.R10.1
+-enable=MC3A2.R10.2
+-enable=MC3A2.R11.1
+-enable=MC3A2.R11.2
+-enable=MC3A2.R11.7
+-enable=MC3A2.R11.8
+-enable=MC3A2.R11.9
+-enable=MC3A2.R12.5
+-enable=MC3A2.R13.1
+-enable=MC3A2.R13.2
+-enable=MC3A2.R13.6
+-enable=MC3A2.R14.1
+-enable=MC3A2.R14.4
+-enable=MC3A2.R16.2
+-enable=MC3A2.R16.3
+-enable=MC3A2.R16.4
+-enable=MC3A2.R16.6
+-enable=MC3A2.R16.7
+-enable=MC3A2.R17.1
+-enable=MC3A2.R17.3
+-enable=MC3A2.R17.4
+-enable=MC3A2.R17.5
+-enable=MC3A2.R17.6
+-enable=MC3A2.R18.1
+-enable=MC3A2.R18.2
+-enable=MC3A2.R18.6
+-enable=MC3A2.R18.8
+-enable=MC3A2.R19.1
+-enable=MC3A2.R20.2
+-enable=MC3A2.R20.3
+-enable=MC3A2.R20.4
+-enable=MC3A2.R20.6
+-enable=MC3A2.R20.7
+-enable=MC3A2.R20.9
+-enable=MC3A2.R20.11
+-enable=MC3A2.R20.12
+-enable=MC3A2.R20.13
+-enable=MC3A2.R20.14
+-enable=MC3A2.R21.3
+-enable=MC3A2.R21.4
+-enable=MC3A2.R21.5
+-enable=MC3A2.R21.7
+-enable=MC3A2.R21.8
+-enable=MC3A2.R21.9
+-enable=MC3A2.R21.10
+-enable=MC3A2.R21.12
+-enable=MC3A2.R21.13
+-enable=MC3A2.R21.17
+-enable=MC3A2.R21.18
+-enable=MC3A2.R21.19
+-enable=MC3A2.R21.20
+-enable=MC3A2.R21.21
+-enable=MC3A2.R22.1
+-enable=MC3A2.R22.2
+-enable=MC3A2.R22.3
+-enable=MC3A2.R22.4
+-enable=MC3A2.R22.5
+-enable=MC3A2.R22.6
+-enable=MC3A2.R22.7
+-enable=MC3A2.R22.8
+-enable=MC3A2.R22.9
+-enable=MC3A2.R22.10
 -doc_end
diff --git a/automation/eclair_analysis/ECLAIR/tagging.ecl b/automation/eclair_analysis/ECLAIR/tagging.ecl
index 755ea3271f..b524318591 100644
--- a/automation/eclair_analysis/ECLAIR/tagging.ecl
+++ b/automation/eclair_analysis/ECLAIR/tagging.ecl
@@ -20,93 +20,93 @@
 -doc_begin="Clean guidelines: new violations for these guidelines are not accepted."
 
 -service_selector={clean_guidelines_common,
-"MC3R1.D1.1||
-MC3R1.D2.1||
-MC3R1.D4.1||
-MC3R1.D4.11||
-MC3R1.D4.14||
-MC3R1.R1.1||
-MC3R1.R1.3||
-MC3R1.R1.4||
-MC3R1.R2.6||
-MC3R1.R3.1||
-MC3R1.R3.2||
-MC3R1.R4.1||
-MC3R1.R4.2||
-MC3R1.R5.1||
-MC3R1.R5.2||
-MC3R1.R5.3||
-MC3R1.R5.4||
-MC3R1.R5.6||
-MC3R1.R6.1||
-MC3R1.R6.2||
-MC3R1.R7.1||
-MC3R1.R7.2||
-MC3R1.R7.3||
-MC3R1.R7.4||
-MC3R1.R8.1||
-MC3R1.R8.2||
-MC3R1.R8.3||
-MC3R1.R8.4||
-MC3R1.R8.5||
-MC3R1.R8.6||
-MC3R1.R8.8||
-MC3R1.R8.10||
-MC3R1.R8.12||
-MC3R1.R8.14||
-MC3R1.R9.2||
-MC3R1.R9.3||
-MC3R1.R9.4||
-MC3R1.R10.2||
-MC3R1.R11.6||
-MC3R1.R11.7||
-MC3R1.R11.9||
-MC3R1.R12.5||
-MC3R1.R13.6||
-MC3R1.R14.1||
-MC3R1.R14.3||
-MC3R1.R14.4||
-MC3R1.R16.2||
-MC3R1.R16.3||
-MC3R1.R16.7||
-MC3R1.R17.1||
-MC3R1.R17.3||
-MC3R1.R17.4||
-MC3R1.R17.5||
-MC3R1.R17.6||
-MC3R1.R18.6||
-MC3R1.R18.8||
-MC3R1.R20.2||
-MC3R1.R20.3||
-MC3R1.R20.4||
-MC3R1.R20.6||
-MC3R1.R20.9||
-MC3R1.R20.11||
-MC3R1.R20.12||
-MC3R1.R20.13||
-MC3R1.R20.14||
-MC3R1.R21.3||
-MC3R1.R21.4||
-MC3R1.R21.5||
-MC3R1.R21.7||
-MC3R1.R21.8||
-MC3R1.R21.9||
-MC3R1.R21.10||
-MC3R1.R21.11||
-MC3R1.R21.12||
-MC3R1.R21.13||
-MC3R1.R21.19||
-MC3R1.R21.21||
-MC3R1.R22.1||
-MC3R1.R22.2||
-MC3R1.R22.3||
-MC3R1.R22.4||
-MC3R1.R22.5||
-MC3R1.R22.6||
-MC3R1.R22.7||
-MC3R1.R22.8||
-MC3R1.R22.9||
-MC3R1.R22.10"
+"MC3A2.D1.1||
+MC3A2.D2.1||
+MC3A2.D4.1||
+MC3A2.D4.11||
+MC3A2.D4.14||
+MC3A2.R1.1||
+MC3A2.R1.3||
+MC3A2.R1.4||
+MC3A2.R2.6||
+MC3A2.R3.1||
+MC3A2.R3.2||
+MC3A2.R4.1||
+MC3A2.R4.2||
+MC3A2.R5.1||
+MC3A2.R5.2||
+MC3A2.R5.3||
+MC3A2.R5.4||
+MC3A2.R5.6||
+MC3A2.R6.1||
+MC3A2.R6.2||
+MC3A2.R7.1||
+MC3A2.R7.2||
+MC3A2.R7.3||
+MC3A2.R7.4||
+MC3A2.R8.1||
+MC3A2.R8.2||
+MC3A2.R8.3||
+MC3A2.R8.4||
+MC3A2.R8.5||
+MC3A2.R8.6||
+MC3A2.R8.8||
+MC3A2.R8.10||
+MC3A2.R8.12||
+MC3A2.R8.14||
+MC3A2.R9.2||
+MC3A2.R9.3||
+MC3A2.R9.4||
+MC3A2.R10.2||
+MC3A2.R11.6||
+MC3A2.R11.7||
+MC3A2.R11.9||
+MC3A2.R12.5||
+MC3A2.R13.6||
+MC3A2.R14.1||
+MC3A2.R14.3||
+MC3A2.R14.4||
+MC3A2.R16.2||
+MC3A2.R16.3||
+MC3A2.R16.7||
+MC3A2.R17.1||
+MC3A2.R17.3||
+MC3A2.R17.4||
+MC3A2.R17.5||
+MC3A2.R17.6||
+MC3A2.R18.6||
+MC3A2.R18.8||
+MC3A2.R20.2||
+MC3A2.R20.3||
+MC3A2.R20.4||
+MC3A2.R20.6||
+MC3A2.R20.9||
+MC3A2.R20.11||
+MC3A2.R20.12||
+MC3A2.R20.13||
+MC3A2.R20.14||
+MC3A2.R21.3||
+MC3A2.R21.4||
+MC3A2.R21.5||
+MC3A2.R21.7||
+MC3A2.R21.8||
+MC3A2.R21.9||
+MC3A2.R21.10||
+MC3A2.R21.11||
+MC3A2.R21.12||
+MC3A2.R21.13||
+MC3A2.R21.19||
+MC3A2.R21.21||
+MC3A2.R22.1||
+MC3A2.R22.2||
+MC3A2.R22.3||
+MC3A2.R22.4||
+MC3A2.R22.5||
+MC3A2.R22.6||
+MC3A2.R22.7||
+MC3A2.R22.8||
+MC3A2.R22.9||
+MC3A2.R22.10"
 }
 
 -setq=target,getenv("XEN_TARGET_ARCH")
@@ -116,7 +116,7 @@ if(string_equal(target,"x86_64"),
 )
 
 if(string_equal(target,"arm64"),
-    service_selector({"additional_clean_guidelines","MC3R1.R2.1||MC3R1.R5.3||MC3.R11.2||MC3R1.R16.6||MC3R1.R20.7"})
+    service_selector({"additional_clean_guidelines","MC3A2.R2.1||MC3A2.R5.3||MC3.R11.2||MC3A2.R16.6||MC3A2.R20.7"})
 )
 
 -reports+={clean:added,"service(clean_guidelines_common||additional_clean_guidelines)"}
diff --git a/docs/misra/documenting-violations.rst b/docs/misra/documenting-violations.rst
index 8f1cbd83b8..d26377d5aa 100644
--- a/docs/misra/documenting-violations.rst
+++ b/docs/misra/documenting-violations.rst
@@ -53,7 +53,7 @@ Here is an example to add a new justification in safe.json::
 |            "analyser": {
 |                "cppcheck": "misra-c2012-20.7",
 |                "coverity": "misra_c_2012_rule_20_7_violation",
-|                "eclair": "MC3R1.R20.7"
+|                "eclair": "MC3A2.R20.7"
 |            },
 |            "name": "R20.7 C macro parameters not used as expression",
 |            "text": "The macro parameters used in this [...]"
@@ -138,7 +138,7 @@ 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
+| MC3A2.R8.6 for program 'xen/xen-syms', variable '_start' has no definition
 
 Also coverity reports it, here is an extract of the finding:
 
@@ -165,7 +165,7 @@ We will prepare our entry in the safe.json database::
 |        {
 |            "id": "SAF-1-safe",
 |            "analyser": {
-|                "eclair": "MC3R1.R8.6",
+|                "eclair": "MC3A2.R8.6",
 |                "coverity": "misra_c_2012_rule_8_6_violation"
 |            },
 |            "name": "Rule 8.6: linker script defined symbols",
diff --git a/docs/misra/safe.json b/docs/misra/safe.json
index 684346386e..b8a4f878ea 100644
--- a/docs/misra/safe.json
+++ b/docs/misra/safe.json
@@ -4,7 +4,7 @@
         {
             "id": "SAF-0-safe",
             "analyser": {
-                "eclair": "MC3R1.R8.6",
+                "eclair": "MC3A2.R8.6",
                 "coverity": "misra_c_2012_rule_8_6_violation"
             },
             "name": "Rule 8.6: linker script defined symbols",
@@ -13,7 +13,7 @@
         {
             "id": "SAF-1-safe",
             "analyser": {
-                "eclair": "MC3R1.R8.4"
+                "eclair": "MC3A2.R8.4"
             },
             "name": "Rule 8.4: asm-only definition",
             "text": "Functions and variables used only by asm modules do not need to have a visible declaration prior to their definition."
@@ -21,23 +21,23 @@
         {
             "id": "SAF-2-safe",
             "analyser": {
-                "eclair": "MC3R1.R10.1"
+                "eclair": "MC3A2.R10.1"
             },
-            "name": "MC3R1.R10.1: use of an enumeration constant in an arithmetic operation",
+            "name": "MC3A2.R10.1: use of an enumeration constant in an arithmetic operation",
             "text": "This violation can be fixed with a cast to (int) of the enumeration constant, but a deviation was chosen due to code readability (see also the comment in BITS_TO_LONGS)."
         },
         {
             "id": "SAF-3-safe",
             "analyser": {
-                "eclair": "MC3R1.R20.4"
+                "eclair": "MC3A2.R20.4"
             },
-            "name": "MC3R1.R20.4: allow the definition of a macro with the same name as a keyword in some special cases",
+            "name": "MC3A2.R20.4: allow the definition of a macro with the same name as a keyword in some special cases",
             "text": "The definition of a macro with the same name as a keyword can be useful in certain configurations to improve the guarantees that can be provided by Xen. See docs/misra/deviations.rst for a precise rationale for all such cases."
         },
         {
             "id": "SAF-4-safe",
             "analyser": {
-                "eclair": "MC3R1.R17.1"
+                "eclair": "MC3A2.R17.1"
             },
             "name": "Rule 17.1: internal helper functions made to break long running hypercalls into multiple calls.",
             "text": "They need to take a variable number of arguments depending on the original hypercall they are trying to continue."
@@ -45,31 +45,31 @@
         {
             "id": "SAF-5-safe",
             "analyser": {
-                "eclair": "MC3R1.R16.2"
+                "eclair": "MC3A2.R16.2"
             },
-            "name": "MC3R1.R16.2: using a case label when the most closely-enclosing compound statement is not a switch statement",
+            "name": "MC3A2.R16.2: using a case label when the most closely-enclosing compound statement is not a switch statement",
             "text": "A switch label enclosed by some compound statement that is not the body of a switch is permitted within local helper macros that are unlikely to be misused or misunderstood."
         },
         {
             "id": "SAF-6-safe",
             "analyser": {
-                "eclair": "MC3R1.R20.12"
+                "eclair": "MC3A2.R20.12"
             },
-            "name": "MC3R1.R20.12: use of a macro argument that deliberately violates the Rule",
+            "name": "MC3A2.R20.12: use of a macro argument that deliberately violates the Rule",
             "text": "A macro parameter that is itself a macro is intentionally used within the macro both as a regular parameter and for text replacement."
         },
         {
             "id": "SAF-7-safe",
             "analyser": {
-                "eclair": "MC3R1.R20.7"
+                "eclair": "MC3A2.R20.7"
             },
-            "name": "MC3R1.R20.7: deliberately non-parenthesized macro argument",
+            "name": "MC3A2.R20.7: deliberately non-parenthesized macro argument",
             "text": "A macro parameter expands to an expression that is non-parenthesized, as doing so would break the functionality."
         },
         {
             "id": "SAF-8-safe",
             "analyser": {
-                "eclair": "MC3R1.D4.10"
+                "eclair": "MC3A2.D4.10"
             },
             "name": "Dir 4.10: headers that leave it up to the caller to include them correctly",
             "text": "Headers that deliberatively leave the responsability of their correct inclusion to the caller are allowed."
@@ -77,7 +77,7 @@
         {
             "id": "SAF-9-safe",
             "analyser": {
-                "eclair": "MC3R1.D4.10"
+                "eclair": "MC3A2.D4.10"
             },
             "name": "Dir 4.10: empty headers",
             "text": "Empty headers pose no risk if included more than once."
@@ -85,7 +85,7 @@
         {
             "id": "SAF-10-safe",
             "analyser": {
-                "eclair": "MC3R1.D4.10"
+                "eclair": "MC3A2.D4.10"
             },
             "name": "Dir 4.10: direct inclusion guard before",
             "text": "Headers with just the direct inclusion guard before the inclusion guard are safe."
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Dec 17 15:11:20 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 17 Dec 2024 15:11:20 +0000
Received: from list by lists.xenproject.org with outflank-mailman.859297.1271415 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tNZEG-0006Wz-8X; Tue, 17 Dec 2024 15:11:20 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 859297.1271415; Tue, 17 Dec 2024 15:11:20 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tNZEG-0006Wr-4U; Tue, 17 Dec 2024 15:11:20 +0000
Received: by outflank-mailman (input) for mailman id 859297;
 Tue, 17 Dec 2024 15:11:18 +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 1tNZEE-0006Wf-Ec
 for xen-changelog@lists.xenproject.org; Tue, 17 Dec 2024 15:11:18 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1tNZEE-0085KD-0J
 for xen-changelog@lists.xenproject.org;
 Tue, 17 Dec 2024 15:11:18 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1tNZEE-00EKrB-0z
 for xen-changelog@lists.xenproject.org;
 Tue, 17 Dec 2024 15:11:18 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.19] xen: update ECLAIR service identifiers from MC3R1 to MC3A2.
Message-Id: <E1tNZEE-00EKrB-0z@xenbits.xenproject.org>
Date: Tue, 17 Dec 2024 15:11:18 +0000

commit 8b584c97f88724a390fd17b08b2735f488d5f980
Author:     Alessandro Zucchelli <alessandro.zucchelli@bugseng.com>
AuthorDate: Tue Dec 10 11:37:23 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Dec 17 13:09:58 2024 +0000

    xen: update ECLAIR service identifiers from MC3R1 to MC3A2.
    
    Rename all instances of ECLAIR MISRA C:2012 service identifiers,
    identified by the prefix MC3R1, to use the prefix MC3A2, which
    refers to MISRA C:2012 Amendment 2 guidelines.
    
    This update is motivated by the need to upgrade ECLAIR GitLab runners
    that use the new naming scheme for MISRA C:2012 Amendment 2 guidelines.
    
    Changes to the docs/misra directory are needed in order to keep
    comment-based deviation up to date.
    
    Signed-off-by: Alessandro Zucchelli <alessandro.zucchelli@bugseng.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
    (cherry picked from commit 631f535a3d4ffd66a270672f0f787d79f3bf38f8)
---
 automation/eclair_analysis/ECLAIR/B.UNEVALEFF.ecl  |   2 +-
 .../eclair_analysis/ECLAIR/accepted_guidelines.sh  |   2 +-
 automation/eclair_analysis/ECLAIR/analysis.ecl     |   6 +-
 automation/eclair_analysis/ECLAIR/deviations.ecl   | 228 ++++++++++-----------
 automation/eclair_analysis/ECLAIR/monitored.ecl    | 204 +++++++++---------
 automation/eclair_analysis/ECLAIR/tagging.ecl      | 160 +++++++--------
 docs/misra/documenting-violations.rst              |   6 +-
 docs/misra/safe.json                               |  26 +--
 8 files changed, 317 insertions(+), 317 deletions(-)

diff --git a/automation/eclair_analysis/ECLAIR/B.UNEVALEFF.ecl b/automation/eclair_analysis/ECLAIR/B.UNEVALEFF.ecl
index 92d8db8986..fa249b8e36 100644
--- a/automation/eclair_analysis/ECLAIR/B.UNEVALEFF.ecl
+++ b/automation/eclair_analysis/ECLAIR/B.UNEVALEFF.ecl
@@ -1,4 +1,4 @@
--clone_service=MC3R1.R13.6,B.UNEVALEFF
+-clone_service=MC3A2.R13.6,B.UNEVALEFF
 
 -config=B.UNEVALEFF,summary="The operand of the `alignof' and `typeof'  operators shall not contain any expression which has potential side effects"
 -config=B.UNEVALEFF,stmt_child_matcher=
diff --git a/automation/eclair_analysis/ECLAIR/accepted_guidelines.sh b/automation/eclair_analysis/ECLAIR/accepted_guidelines.sh
index 368135122c..2c4b339d0d 100755
--- a/automation/eclair_analysis/ECLAIR/accepted_guidelines.sh
+++ b/automation/eclair_analysis/ECLAIR/accepted_guidelines.sh
@@ -10,6 +10,6 @@ script_dir="$(
 accepted_rst=$1
 
 grep -Eo "\`(Dir|Rule) [0-9]+\.[0-9]+" ${accepted_rst} \
-     | sed -e 's/`Rule /MC3R1.R/' -e  's/`Dir /MC3R1.D/' -e 's/.*/-enable=&/' > ${script_dir}/accepted.ecl
+     | sed -e 's/`Rule /MC3A2.R/' -e  's/`Dir /MC3A2.D/' -e 's/.*/-enable=&/' > ${script_dir}/accepted.ecl
 
 echo "-enable=B.UNEVALEFF" >> ${script_dir}/accepted.ecl
diff --git a/automation/eclair_analysis/ECLAIR/analysis.ecl b/automation/eclair_analysis/ECLAIR/analysis.ecl
index df0b551812..824283a989 100644
--- a/automation/eclair_analysis/ECLAIR/analysis.ecl
+++ b/automation/eclair_analysis/ECLAIR/analysis.ecl
@@ -22,15 +22,15 @@ setq(analysis_kind,getenv("ANALYSIS_KIND"))
 -doc_begin="These configurations serve the purpose of recognizing the 'mem*' macros as
 their Standard Library equivalents."
 
--config=MC3R1.R21.14,call_select+=
+-config=MC3A2.R21.14,call_select+=
 {"macro(^memcmp$)&&any_arg(1..2, skip(__non_syntactic_paren_cast_stmts, node(string_literal)))",
  "any()", violation, "%{__callslct_any_base_fmt()}", {{arg, "%{__callslct_arg_fmt()}"}}}
 
--config=MC3R1.R21.15,call_args+=
+-config=MC3A2.R21.15,call_args+=
 {"macro(^mem(cmp|move|cpy)$)", {1, 2}, "unqual_pointee_compatible",
  "%{__argscmpr_culprit_fmt()}", "%{__argscmpr_evidence_fmt()}"}
 
--config=MC3R1.R21.16,call_select+=
+-config=MC3A2.R21.16,call_select+=
 {"macro(^memcmp$)&&any_arg(1..2, skip(__non_syntactic_paren_stmts, type(canonical(__memcmp_pte_types))))",
  "any()", violation, "%{__callslct_any_base_fmt()}", {{arg,"%{__callslct_arg_type_fmt()}"}}}
 
diff --git a/automation/eclair_analysis/ECLAIR/deviations.ecl b/automation/eclair_analysis/ECLAIR/deviations.ecl
index 0af1cb93d1..046d378087 100644
--- a/automation/eclair_analysis/ECLAIR/deviations.ecl
+++ b/automation/eclair_analysis/ECLAIR/deviations.ecl
@@ -4,36 +4,36 @@
 
 -doc_begin="The compiler implementation guarantees that the unreachable code is removed.
 Constant expressions and unreachable branches of if and switch statements are expected."
--config=MC3R1.R2.1,+reports={safe,"first_area(^.*has an invariantly.*$)"}
--config=MC3R1.R2.1,+reports={safe,"first_area(^.*incompatible with labeled statement$)"}
+-config=MC3A2.R2.1,+reports={safe,"first_area(^.*has an invariantly.*$)"}
+-config=MC3A2.R2.1,+reports={safe,"first_area(^.*incompatible with labeled statement$)"}
 -doc_end
 
 -doc_begin="Some functions are intended to be not referenced."
--config=MC3R1.R2.1,+reports={deliberate,"first_area(^.*is never referenced$)"}
+-config=MC3A2.R2.1,+reports={deliberate,"first_area(^.*is never referenced$)"}
 -doc_end
 
 -doc_begin="Unreachability caused by calls to the following functions or macros is deliberate and there is no risk of code being unexpectedly left out."
--config=MC3R1.R2.1,statements+={deliberate,"macro(name(BUG||assert_failed))"}
--config=MC3R1.R2.1,statements+={deliberate, "call(decl(name(__builtin_unreachable||panic||do_unexpected_trap||machine_halt||machine_restart||reboot_or_halt)))"}
+-config=MC3A2.R2.1,statements+={deliberate,"macro(name(BUG||assert_failed))"}
+-config=MC3A2.R2.1,statements+={deliberate, "call(decl(name(__builtin_unreachable||panic||do_unexpected_trap||machine_halt||machine_restart||reboot_or_halt)))"}
 -doc_end
 
 -doc_begin="Unreachability inside an ASSERT_UNREACHABLE() and analogous macro calls is deliberate and safe."
--config=MC3R1.R2.1,reports+={deliberate, "any_area(any_loc(any_exp(macro(name(ASSERT_UNREACHABLE||PARSE_ERR_RET||PARSE_ERR||FAIL_MSR||FAIL_CPUID)))))"}
+-config=MC3A2.R2.1,reports+={deliberate, "any_area(any_loc(any_exp(macro(name(ASSERT_UNREACHABLE||PARSE_ERR_RET||PARSE_ERR||FAIL_MSR||FAIL_CPUID)))))"}
 -doc_end
 
 -doc_begin="The asm-offset files are not linked deliberately, since they are used to generate definitions for asm modules."
 -file_tag+={asm_offsets, "^xen/arch/(arm|x86)/(arm32|arm64|x86_64)/asm-offsets\\.c$"}
--config=MC3R1.R2.1,reports+={deliberate, "any_area(any_loc(file(asm_offsets)))"}
+-config=MC3A2.R2.1,reports+={deliberate, "any_area(any_loc(file(asm_offsets)))"}
 -doc_end
 
 -doc_begin="Pure declarations (i.e., declarations without initialization) are
 not executable, and therefore it is safe for them to be unreachable."
--config=MC3R1.R2.1,ignored_stmts+={"any()", "pure_decl()"}
+-config=MC3A2.R2.1,ignored_stmts+={"any()", "pure_decl()"}
 -doc_end
 
 -doc_begin="The following autogenerated file is not linked deliberately."
 -file_tag+={C_runtime_failures,"^automation/eclair_analysis/C-runtime-failures\\.rst\\.c$"}
--config=MC3R1.R2.1,reports+={deliberate, "any_area(any_loc(file(C_runtime_failures)))"}
+-config=MC3A2.R2.1,reports+={deliberate, "any_area(any_loc(file(C_runtime_failures)))"}
 -doc_end
 
 -doc_begin="Proving compliance with respect to Rule 2.2 is generally impossible:
@@ -42,11 +42,11 @@ confidence that no evidence of errors in the program's logic has been missed due
 to undetected violations of Rule 2.2, if any. Testing on time behavior gives us
 confidence on the fact that, should the program contain dead code that is not
 removed by the compiler, the resulting slowdown is negligible."
--config=MC3R1.R2.2,reports+={disapplied,"any()"}
+-config=MC3A2.R2.2,reports+={disapplied,"any()"}
 -doc_end
 
 -doc_begin="Some labels are unused in certain build configurations, or are deliberately marked as unused, so that the compiler is entitled to remove them."
--config=MC3R1.R2.6,reports+={deliberate, "any_area(text(^.*__maybe_unused.*$))"}
+-config=MC3A2.R2.6,reports+={deliberate, "any_area(text(^.*__maybe_unused.*$))"}
 -doc_end
 
 #
@@ -55,7 +55,7 @@ removed by the compiler, the resulting slowdown is negligible."
 
 -doc_begin="Comments starting with '/*' and containing hyperlinks are safe as
 they are not instances of commented-out code."
--config=MC3R1.R3.1,reports+={safe, "first_area(text(^.*https?://.*$))"}
+-config=MC3A2.R3.1,reports+={safe, "first_area(text(^.*https?://.*$))"}
 -doc_end
 
 #
@@ -63,26 +63,26 @@ they are not instances of commented-out code."
 #
 
 -doc_begin="The directive has been accepted only for the ARM codebase."
--config=MC3R1.D4.3,reports+={disapplied,"!(any_area(any_loc(file(^xen/arch/arm/arm64/.*$))))"}
+-config=MC3A2.D4.3,reports+={disapplied,"!(any_area(any_loc(file(^xen/arch/arm/arm64/.*$))))"}
 -doc_end
 
 -doc_begin="The inline asm in 'arm64/lib/bitops.c' is tightly coupled with the surronding C code that acts as a wrapper, so it has been decided not to add an additional encapsulation layer."
 -file_tag+={arm64_bitops, "^xen/arch/arm/arm64/lib/bitops\\.c$"}
--config=MC3R1.D4.3,reports+={deliberate, "all_area(any_loc(file(arm64_bitops)&&any_exp(macro(^(bit|test)op$))))"}
--config=MC3R1.D4.3,reports+={deliberate, "any_area(any_loc(file(arm64_bitops))&&context(name(int_clear_mask16)))"}
+-config=MC3A2.D4.3,reports+={deliberate, "all_area(any_loc(file(arm64_bitops)&&any_exp(macro(^(bit|test)op$))))"}
+-config=MC3A2.D4.3,reports+={deliberate, "any_area(any_loc(file(arm64_bitops))&&context(name(int_clear_mask16)))"}
 -doc_end
 
 -doc_begin="This header file is autogenerated or empty, therefore it poses no
 risk if included more than once."
 -file_tag+={empty_header, "^xen/arch/arm/efi/runtime\\.h$"}
 -file_tag+={autogen_headers, "^xen/include/xen/compile\\.h$||^xen/include/generated/autoconf.h$||^xen/include/xen/hypercall-defs.h$"}
--config=MC3R1.D4.10,reports+={safe, "all_area(all_loc(file(empty_header||autogen_headers)))"}
+-config=MC3A2.D4.10,reports+={safe, "all_area(all_loc(file(empty_header||autogen_headers)))"}
 -doc_end
 
 -doc_begin="Files that are intended to be included more than once do not need to
 conform to the directive."
--config=MC3R1.D4.10,reports+={safe, "first_area(text(^/\\* This file is legitimately included multiple times\\. \\*/$, begin-4))"}
--config=MC3R1.D4.10,reports+={safe, "first_area(text(^/\\* Generated file, do not edit! \\*/$, begin-3))"}
+-config=MC3A2.D4.10,reports+={safe, "first_area(text(^/\\* This file is legitimately included multiple times\\. \\*/$, begin-4))"}
+-config=MC3A2.D4.10,reports+={safe, "first_area(text(^/\\* Generated file, do not edit! \\*/$, begin-3))"}
 -doc_end
 
 #
@@ -91,50 +91,50 @@ conform to the directive."
 
 -doc_begin="The project adopted the rule with an exception listed in
 'docs/misra/rules.rst'"
--config=MC3R1.R5.3,reports+={safe, "any_area(any_loc(any_exp(macro(^READ_SYSREG$))&&any_exp(macro(^WRITE_SYSREG$))))"}
--config=MC3R1.R5.3,reports+={safe, "any_area(any_loc(any_exp(macro(^max(_t)?$))&&any_exp(macro(^min(_t)?$))))"}
--config=MC3R1.R5.3,reports+={safe, "any_area(any_loc(any_exp(macro(^read[bwlq]$))&&any_exp(macro(^read[bwlq]_relaxed$))))"}
--config=MC3R1.R5.3,reports+={safe, "any_area(any_loc(any_exp(macro(^per_cpu$))&&any_exp(macro(^this_cpu$))))"}
--config=MC3R1.R5.3,reports+={safe, "any_area(any_loc(any_exp(macro(^__emulate_2op$))&&any_exp(macro(^__emulate_2op_nobyte$))))"}
--config=MC3R1.R5.3,reports+={safe, "any_area(any_loc(any_exp(macro(^read_debugreg$))&&any_exp(macro(^write_debugreg$))))"}
+-config=MC3A2.R5.3,reports+={safe, "any_area(any_loc(any_exp(macro(^READ_SYSREG$))&&any_exp(macro(^WRITE_SYSREG$))))"}
+-config=MC3A2.R5.3,reports+={safe, "any_area(any_loc(any_exp(macro(^max(_t)?$))&&any_exp(macro(^min(_t)?$))))"}
+-config=MC3A2.R5.3,reports+={safe, "any_area(any_loc(any_exp(macro(^read[bwlq]$))&&any_exp(macro(^read[bwlq]_relaxed$))))"}
+-config=MC3A2.R5.3,reports+={safe, "any_area(any_loc(any_exp(macro(^per_cpu$))&&any_exp(macro(^this_cpu$))))"}
+-config=MC3A2.R5.3,reports+={safe, "any_area(any_loc(any_exp(macro(^__emulate_2op$))&&any_exp(macro(^__emulate_2op_nobyte$))))"}
+-config=MC3A2.R5.3,reports+={safe, "any_area(any_loc(any_exp(macro(^read_debugreg$))&&any_exp(macro(^write_debugreg$))))"}
 -doc_end
 
 -doc_begin="Macros expanding to their own identifier (e.g., \"#define x x\") are deliberate."
--config=MC3R1.R5.5,reports+={deliberate, "all_area(macro(same_id_body())||!macro(!same_id_body()))"}
+-config=MC3A2.R5.5,reports+={deliberate, "all_area(macro(same_id_body())||!macro(!same_id_body()))"}
 -doc_end
 
 -doc_begin="There is no clash between function like macros and not callable objects."
--config=MC3R1.R5.5,reports+={deliberate, "all_area(macro(function_like())||decl(any()))&&all_area(macro(any())||!decl(kind(function))&&!decl(__function_pointer_decls))"}
+-config=MC3A2.R5.5,reports+={deliberate, "all_area(macro(function_like())||decl(any()))&&all_area(macro(any())||!decl(kind(function))&&!decl(__function_pointer_decls))"}
 -doc_end
 
 -doc_begin="Clashes between function names and macros are deliberate for string handling functions since some architectures may want to use their own arch-specific implementation."
--config=MC3R1.R5.5,reports+={deliberate, "all_area(all_loc(file(^xen/arch/x86/string\\.c|xen/include/xen/string\\.h|xen/lib/.*$)))"}
+-config=MC3A2.R5.5,reports+={deliberate, "all_area(all_loc(file(^xen/arch/x86/string\\.c|xen/include/xen/string\\.h|xen/lib/.*$)))"}
 -doc_end
 
 -doc_begin="In libelf, clashes between macros and function names are deliberate and needed to prevent the use of undecorated versions of memcpy, memset and memmove."
--config=MC3R1.R5.5,reports+={deliberate, "any_area(decl(kind(function))||any_loc(macro(name(memcpy||memset||memmove))))&&any_area(any_loc(file(^xen/common/libelf/libelf-private\\.h$)))"}
+-config=MC3A2.R5.5,reports+={deliberate, "any_area(decl(kind(function))||any_loc(macro(name(memcpy||memset||memmove))))&&any_area(any_loc(file(^xen/common/libelf/libelf-private\\.h$)))"}
 -doc_end
 
 -doc_begin="The type \"ret_t\" is deliberately defined multiple times,
 depending on the guest."
--config=MC3R1.R5.6,reports+={deliberate,"any_area(any_loc(text(^.*ret_t.*$)))"}
+-config=MC3A2.R5.6,reports+={deliberate,"any_area(any_loc(text(^.*ret_t.*$)))"}
 -doc_end
 
 -doc_begin="On X86, the types \"guest_intpte_t\", \"guest_l1e_t\" and
 \"guest_l2e_t\" are deliberately defined multiple times, depending on the
 number of guest paging levels."
--config=MC3R1.R5.6,reports+={deliberate,"any_area(any_loc(file(^xen/arch/x86/include/asm/guest_pt\\.h$)))&&any_area(any_loc(text(^.*(guest_intpte_t|guest_l[12]e_t).*$)))"}
+-config=MC3A2.R5.6,reports+={deliberate,"any_area(any_loc(file(^xen/arch/x86/include/asm/guest_pt\\.h$)))&&any_area(any_loc(text(^.*(guest_intpte_t|guest_l[12]e_t).*$)))"}
 -doc_end
 
 -doc_begin="The following files are imported from the gnu-efi package."
 -file_tag+={adopted_r5_6,"^xen/include/efi/.*$"}
 -file_tag+={adopted_r5_6,"^xen/arch/.*/include/asm/.*/efibind\\.h$"}
--config=MC3R1.R5.6,reports+={deliberate,"any_area(any_loc(file(adopted_r5_6)))"}
+-config=MC3A2.R5.6,reports+={deliberate,"any_area(any_loc(file(adopted_r5_6)))"}
 -doc_end
 
 -doc_begin="The project intentionally reuses tag names in order to have identifiers matching the applicable external specifications as well as established internal conventions.
 As there is little possibility for developer confusion not resulting into compilation errors, the risk of renaming outweighs the potential advantages of compliance."
--config=MC3R1.R5.7,reports+={deliberate,"any()"}
+-config=MC3A2.R5.7,reports+={deliberate,"any()"}
 -doc_end
 
 #
@@ -143,7 +143,7 @@ As there is little possibility for developer confusion not resulting into compil
 
 -doc_begin="It is safe to use certain octal constants the way they are defined
 in specifications, manuals, and algorithm descriptions."
--config=MC3R1.R7.1,reports+={safe, "any_area(any_loc(any_exp(text(^.*octal-ok.*$))))"}
+-config=MC3A2.R7.1,reports+={safe, "any_area(any_loc(any_exp(text(^.*octal-ok.*$))))"}
 -doc_end
 
 -doc_begin="Violations in files that maintainers have asked to not modify in the
@@ -156,17 +156,17 @@ context of R7.2."
 -file_tag+={adopted_r7_2,"^xen/arch/x86/cpu/intel\\.c$"}
 -file_tag+={adopted_r7_2,"^xen/arch/x86/cpu/amd\\.c$"}
 -file_tag+={adopted_r7_2,"^xen/arch/x86/cpu/common\\.c$"}
--config=MC3R1.R7.2,reports+={deliberate,"any_area(any_loc(file(adopted_r7_2)))"}
+-config=MC3A2.R7.2,reports+={deliberate,"any_area(any_loc(file(adopted_r7_2)))"}
 -doc_end
 
 -doc_begin="Violations caused by __HYPERVISOR_VIRT_START are related to the
 particular use of it done in xen_mk_ulong."
--config=MC3R1.R7.2,reports+={deliberate,"any_area(any_loc(macro(name(BUILD_BUG_ON))))"}
+-config=MC3A2.R7.2,reports+={deliberate,"any_area(any_loc(macro(name(BUILD_BUG_ON))))"}
 -doc_end
 
 -doc_begin="Allow pointers of non-character type as long as the pointee is
 const-qualified."
--config=MC3R1.R7.4,same_pointee=false
+-config=MC3A2.R7.4,same_pointee=false
 -doc_end
 
 #
@@ -174,7 +174,7 @@ const-qualified."
 #
 
 -doc_begin="The type ret_t is deliberately used and defined as int or long depending on the architecture."
--config=MC3R1.R8.3,reports+={deliberate,"any_area(any_loc(text(^.*ret_t.*$)))"}
+-config=MC3A2.R8.3,reports+={deliberate,"any_area(any_loc(text(^.*ret_t.*$)))"}
 -doc_end
 
 -doc_begin="The following files are imported from Linux and decompress.h defines a unique and documented interface towards all the (adopted) decompress functions."
@@ -184,71 +184,71 @@ const-qualified."
 -file_tag+={adopted_decompress_r8_3,"^xen/common/unlzo\\.c$"}
 -file_tag+={adopted_decompress_r8_3,"^xen/common/unxz\\.c$"}
 -file_tag+={adopted_decompress_r8_3,"^xen/common/unzstd\\.c$"}
--config=MC3R1.R8.3,reports+={deliberate,"any_area(any_loc(file(adopted_decompress_r8_3)))&&any_area(any_loc(file(^xen/include/xen/decompress\\.h$)))"}
+-config=MC3A2.R8.3,reports+={deliberate,"any_area(any_loc(file(adopted_decompress_r8_3)))&&any_area(any_loc(file(^xen/include/xen/decompress\\.h$)))"}
 -doc_end
 
 -doc_begin="Parameter name \"unused\" (with an optional numeric suffix) is deliberate and makes explicit the intention of not using such parameter within the function."
--config=MC3R1.R8.3,reports+={deliberate, "any_area(^.*parameter `unused[0-9]*'.*$)"}
+-config=MC3A2.R8.3,reports+={deliberate, "any_area(^.*parameter `unused[0-9]*'.*$)"}
 -doc_end
 
 -doc_begin="The following file is imported from Linux: ignore for now."
 -file_tag+={adopted_time_r8_3,"^xen/arch/x86/time\\.c$"}
--config=MC3R1.R8.3,reports+={deliberate,"any_area(any_loc(file(adopted_time_r8_3)))&&(any_area(any_loc(file(^xen/include/xen/time\\.h$)))||any_area(any_loc(file(^xen/arch/x86/include/asm/setup\\.h$))))"}
+-config=MC3A2.R8.3,reports+={deliberate,"any_area(any_loc(file(adopted_time_r8_3)))&&(any_area(any_loc(file(^xen/include/xen/time\\.h$)))||any_area(any_loc(file(^xen/arch/x86/include/asm/setup\\.h$))))"}
 -doc_end
 
 -doc_begin="The following file is imported from Linux: ignore for now."
 -file_tag+={adopted_cpu_idle_r8_3,"^xen/arch/x86/acpi/cpu_idle\\.c$"}
--config=MC3R1.R8.3,reports+={deliberate,"any_area(any_loc(file(adopted_cpu_idle_r8_3)))&&any_area(any_loc(file(^xen/include/xen/pmstat\\.h$)))"}
+-config=MC3A2.R8.3,reports+={deliberate,"any_area(any_loc(file(adopted_cpu_idle_r8_3)))&&any_area(any_loc(file(^xen/include/xen/pmstat\\.h$)))"}
 -doc_end
 
 -doc_begin="The following file is imported from Linux: ignore for now."
 -file_tag+={adopted_mpparse_r8_3,"^xen/arch/x86/mpparse\\.c$"}
--config=MC3R1.R8.3,reports+={deliberate,"any_area(any_loc(file(adopted_mpparse_r8_3)))&&any_area(any_loc(file(^xen/arch/x86/include/asm/mpspec\\.h$)))"}
+-config=MC3A2.R8.3,reports+={deliberate,"any_area(any_loc(file(adopted_mpparse_r8_3)))&&any_area(any_loc(file(^xen/arch/x86/include/asm/mpspec\\.h$)))"}
 -doc_end
 
 -doc_begin="The definitions present in this file are meant to generate definitions for asm modules, and are not called by C code. Therefore the absence of prior declarations is safe."
 -file_tag+={asm_offsets, "^xen/arch/(arm|x86)/(arm32|arm64|x86_64)/asm-offsets\\.c$"}
--config=MC3R1.R8.4,reports+={safe, "first_area(any_loc(file(asm_offsets)))"}
+-config=MC3A2.R8.4,reports+={safe, "first_area(any_loc(file(asm_offsets)))"}
 -doc_end
 
 -doc_begin="The functions defined in this file are meant to be called from gcc-generated code in a non-release build configuration.
 Therefore the absence of prior declarations is safe."
 -file_tag+={gcov, "^xen/common/coverage/gcov_base\\.c$"}
--config=MC3R1.R8.4,reports+={safe, "first_area(any_loc(file(gcov)))"}
+-config=MC3A2.R8.4,reports+={safe, "first_area(any_loc(file(gcov)))"}
 -doc_end
 
 -doc_begin="Recognize the occurrence of current_stack_pointer as a declaration."
 -file_tag+={asm_defns, "^xen/arch/x86/include/asm/asm_defns\\.h$"}
--config=MC3R1.R8.4,declarations+={safe, "loc(file(asm_defns))&&^current_stack_pointer$"}
+-config=MC3A2.R8.4,declarations+={safe, "loc(file(asm_defns))&&^current_stack_pointer$"}
 -doc_end
 
 -doc_begin="The function apei_(read|check|clear)_mce are dead code and are excluded from non-debug builds, therefore the absence of prior declarations is safe."
--config=MC3R1.R8.4,declarations+={safe, "^apei_(read|check|clear)_mce\\(.*$"}
+-config=MC3A2.R8.4,declarations+={safe, "^apei_(read|check|clear)_mce\\(.*$"}
 -doc_end
 
 -doc_begin="asmlinkage is a marker to indicate that the function is only used to interface with asm modules."
--config=MC3R1.R8.4,declarations+={safe,"loc(text(^(?s).*asmlinkage.*$, -1..0))"}
+-config=MC3A2.R8.4,declarations+={safe,"loc(text(^(?s).*asmlinkage.*$, -1..0))"}
 -doc_end
 
 -doc_begin="Given that bsearch and sort are defined with the attribute 'gnu_inline', it's deliberate not to have a prior declaration.
 See Section \"6.33.1 Common Function Attributes\" of \"GCC_MANUAL\" for a full explanation of gnu_inline."
 -file_tag+={bsearch_sort, "^xen/include/xen/(sort|lib)\\.h$"}
--config=MC3R1.R8.4,reports+={deliberate, "any_area(any_loc(file(bsearch_sort))&&decl(name(bsearch||sort)))"}
+-config=MC3A2.R8.4,reports+={deliberate, "any_area(any_loc(file(bsearch_sort))&&decl(name(bsearch||sort)))"}
 -doc_end
 
 -doc_begin="first_valid_mfn is defined in this way because the current lack of NUMA support in Arm and PPC requires it."
 -file_tag+={first_valid_mfn, "^xen/common/page_alloc\\.c$"}
--config=MC3R1.R8.4,declarations+={deliberate,"loc(file(first_valid_mfn))"}
+-config=MC3A2.R8.4,declarations+={deliberate,"loc(file(first_valid_mfn))"}
 -doc_end
 
 -doc_begin="The following variables are compiled in multiple translation units
 belonging to different executables and therefore are safe."
--config=MC3R1.R8.6,declarations+={safe, "name(current_stack_pointer||bsearch||sort)"}
+-config=MC3A2.R8.6,declarations+={safe, "name(current_stack_pointer||bsearch||sort)"}
 -doc_end
 
 -doc_begin="Declarations without definitions are allowed (specifically when the
 definition is compiled-out or optimized-out by the compiler)"
--config=MC3R1.R8.6,reports+={deliberate, "first_area(^.*has no definition$)"}
+-config=MC3A2.R8.6,reports+={deliberate, "first_area(^.*has no definition$)"}
 -doc_end
 
 -doc_begin="The search procedure for Unix linkers is well defined, see ld(1)
@@ -259,11 +259,11 @@ the linker will include the appropriate file(s) from the archive\".
 In Xen, thanks to the order in which file names appear in the build commands,
 if arch-specific definitions are present, they get always linked in before
 searching in the lib.a archive resulting from xen/lib."
--config=MC3R1.R8.6,declarations+={deliberate, "loc(file(^xen/lib/.*$))"}
+-config=MC3A2.R8.6,declarations+={deliberate, "loc(file(^xen/lib/.*$))"}
 -doc_end
 
 -doc_begin="The gnu_inline attribute without static is deliberately allowed."
--config=MC3R1.R8.10,declarations+={deliberate,"property(gnu_inline)"}
+-config=MC3A2.R8.10,declarations+={deliberate,"property(gnu_inline)"}
 -doc_end
 
 #
@@ -273,12 +273,12 @@ searching in the lib.a archive resulting from xen/lib."
 -doc_begin="Violations in files that maintainers have asked to not modify in the
 context of R9.1."
 -file_tag+={adopted_r9_1,"^xen/arch/arm/arm64/lib/find_next_bit\\.c$"}
--config=MC3R1.R9.1,reports+={deliberate,"any_area(any_loc(file(adopted_r9_1)))"}
+-config=MC3A2.R9.1,reports+={deliberate,"any_area(any_loc(file(adopted_r9_1)))"}
 -doc_end
 
 -doc_begin="The possibility of committing mistakes by specifying an explicit
 dimension is higher than omitting the dimension."
--config=MC3R1.R9.5,reports+={deliberate, "any()"}
+-config=MC3A2.R9.5,reports+={deliberate, "any()"}
 -doc_end
 
 #
@@ -286,45 +286,45 @@ dimension is higher than omitting the dimension."
 #
 
 -doc_begin="The value-preserving conversions of integer constants are safe"
--config=MC3R1.R10.1,etypes={safe,"any()","preserved_integer_constant()"}
--config=MC3R1.R10.3,etypes={safe,"any()","preserved_integer_constant()"}
--config=MC3R1.R10.4,etypes={safe,"any()","preserved_integer_constant()||sibling(rhs,preserved_integer_constant())"}
+-config=MC3A2.R10.1,etypes={safe,"any()","preserved_integer_constant()"}
+-config=MC3A2.R10.3,etypes={safe,"any()","preserved_integer_constant()"}
+-config=MC3A2.R10.4,etypes={safe,"any()","preserved_integer_constant()||sibling(rhs,preserved_integer_constant())"}
 -doc_end
 
 -doc_begin="Shifting non-negative integers to the right is safe."
--config=MC3R1.R10.1,etypes+={safe,
+-config=MC3A2.R10.1,etypes+={safe,
   "stmt(node(binary_operator)&&operator(shr))",
   "src_expr(definitely_in(0..))"}
 -doc_end
 
 -doc_begin="Shifting non-negative integers to the left is safe if the result is
 still non-negative."
--config=MC3R1.R10.1,etypes+={safe,
+-config=MC3A2.R10.1,etypes+={safe,
   "stmt(node(binary_operator)&&operator(shl)&&definitely_in(0..))",
   "src_expr(definitely_in(0..))"}
 -doc_end
 
 -doc_begin="Bitwise logical operations on non-negative integers are safe."
--config=MC3R1.R10.1,etypes+={safe,
+-config=MC3A2.R10.1,etypes+={safe,
   "stmt(node(binary_operator)&&operator(and||or||xor))",
   "src_expr(definitely_in(0..))"}
 -doc_end
 
 -doc_begin="The implicit conversion to Boolean for logical operator arguments is well known to all Xen developers to be a comparison with 0"
--config=MC3R1.R10.1,etypes+={safe, "stmt(operator(logical)||node(conditional_operator||binary_conditional_operator))", "dst_type(ebool||boolean)"}
+-config=MC3A2.R10.1,etypes+={safe, "stmt(operator(logical)||node(conditional_operator||binary_conditional_operator))", "dst_type(ebool||boolean)"}
 -doc_end
 
 -doc_begin="The macro ISOLATE_LSB encapsulates a well-known pattern to obtain
 a mask where only the lowest bit set in the argument is set, if any, for unsigned
 integers arguments on two's complement architectures
 (all the architectures supported by Xen satisfy this requirement)."
--config=MC3R1.R10.1,reports+={safe, "any_area(any_loc(any_exp(macro(^ISOLATE_LSB$))))"}
+-config=MC3A2.R10.1,reports+={safe, "any_area(any_loc(any_exp(macro(^ISOLATE_LSB$))))"}
 -doc_end
 
 -doc_begin="XEN only supports architectures where signed integers are
 representend using two's complement and all the XEN developers are aware of
 this."
--config=MC3R1.R10.1,etypes+={safe,
+-config=MC3A2.R10.1,etypes+={safe,
   "stmt(operator(and||or||xor||not||and_assign||or_assign||xor_assign))",
   "any()"}
 -doc_end
@@ -335,7 +335,7 @@ C language, GCC does not use the latitude given in C99 and C11 only to treat
 certain aspects of signed `<<' as undefined. However, -fsanitize=shift (and
 -fsanitize=undefined) will diagnose such cases. They are also diagnosed where
 constant expressions are required.\""
--config=MC3R1.R10.1,etypes+={safe,
+-config=MC3A2.R10.1,etypes+={safe,
   "stmt(operator(shl||shr||shl_assign||shr_assign))",
   "any()"}
 -doc_end
@@ -345,7 +345,7 @@ constant expressions are required.\""
 #
 
 -doc_begin="The conversion from a function pointer to unsigned long or (void *) does not lose any information, provided that the target type has enough bits to store it."
--config=MC3R1.R11.1,casts+={safe,
+-config=MC3A2.R11.1,casts+={safe,
   "from(type(canonical(__function_pointer_types)))
    &&to(type(canonical(builtin(unsigned long)||pointer(builtin(void)))))
    &&relation(definitely_preserves_value)"
@@ -353,14 +353,14 @@ constant expressions are required.\""
 -doc_end
 
 -doc_begin="The conversion from a function pointer to a boolean has a well-known semantics that do not lead to unexpected behaviour."
--config=MC3R1.R11.1,casts+={safe,
+-config=MC3A2.R11.1,casts+={safe,
   "from(type(canonical(__function_pointer_types)))
    &&kind(pointer_to_boolean)"
 }
 -doc_end
 
 -doc_begin="The conversion from a pointer to an incomplete type to unsigned long does not lose any information, provided that the target type has enough bits to store it."
--config=MC3R1.R11.2,casts+={safe,
+-config=MC3A2.R11.2,casts+={safe,
   "from(type(any()))
    &&to(type(canonical(builtin(unsigned long))))
    &&relation(definitely_preserves_value)"
@@ -368,20 +368,20 @@ constant expressions are required.\""
 -doc_end
 
 -doc_begin="Conversions to object pointers that have a pointee type with a smaller (i.e., less strict) alignment requirement are safe."
--config=MC3R1.R11.3,casts+={safe,
+-config=MC3A2.R11.3,casts+={safe,
   "!relation(more_aligned_pointee)"
 }
 -doc_end
 
 -doc_begin="Conversions from and to integral types are safe, in the assumption that the target type has enough bits to store the value.
 See also Section \"4.7 Arrays and Pointers\" of \"GCC_MANUAL\""
--config=MC3R1.R11.6,casts+={safe,
+-config=MC3A2.R11.6,casts+={safe,
     "(from(type(canonical(integral())))||to(type(canonical(integral()))))
      &&relation(definitely_preserves_value)"}
 -doc_end
 
 -doc_begin="The conversion from a pointer to a boolean has a well-known semantics that do not lead to unexpected behaviour."
--config=MC3R1.R11.6,casts+={safe,
+-config=MC3A2.R11.6,casts+={safe,
   "from(type(canonical(__pointer_types)))
    &&kind(pointer_to_boolean)"
 }
@@ -391,11 +391,11 @@ See also Section \"4.7 Arrays and Pointers\" of \"GCC_MANUAL\""
 with the provided offset. The resulting pointer is then immediately cast back to its
 original type, which preserves the qualifier. This use is deemed safe.
 Fixing this violation would require to increase code complexity and lower readability."
--config=MC3R1.R11.8,reports+={safe,"any_area(any_loc(any_exp(macro(^container_of$))))"}
+-config=MC3A2.R11.8,reports+={safe,"any_area(any_loc(any_exp(macro(^container_of$))))"}
 -doc_end
 
 -doc_begin="This construct is used to check if the type is scalar, and for this purpose the use of 0 as a null pointer constant is deliberate."
--config=MC3R1.R11.9,reports+={deliberate, "any_area(any_loc(any_exp(macro(^__ACCESS_ONCE$))))"
+-config=MC3A2.R11.9,reports+={deliberate, "any_area(any_loc(any_exp(macro(^__ACCESS_ONCE$))))"
 }
 -doc_end
 
@@ -405,16 +405,16 @@ Fixing this violation would require to increase code complexity and lower readab
 
 -doc_begin="All developers and reviewers can be safely assumed to be well aware
 of the short-circuit evaluation strategy of such logical operators."
--config=MC3R1.R13.5,reports+={disapplied,"any()"}
+-config=MC3A2.R13.5,reports+={disapplied,"any()"}
 -doc_end
 
 -doc_begin="Macros alternative_v?call[0-9] use sizeof and typeof to check that the argument types match the corresponding parameter ones."
--config=MC3R1.R13.6,reports+={deliberate,"any_area(any_loc(any_exp(macro(^alternative_vcall[0-9]$))&&file(^xen/arch/x86/include/asm/alternative\\.h*$)))"}
+-config=MC3A2.R13.6,reports+={deliberate,"any_area(any_loc(any_exp(macro(^alternative_vcall[0-9]$))&&file(^xen/arch/x86/include/asm/alternative\\.h*$)))"}
 -config=B.UNEVALEFF,reports+={deliberate,"any_area(any_loc(any_exp(macro(^alternative_v?call[0-9]$))&&file(^xen/arch/x86/include/asm/alterantive\\.h*$)))"}
 -doc_end
 
 -doc_begin="Anything, no matter how complicated, inside the BUILD_BUG_ON macro is subject to a compile-time evaluation without relevant side effects."
--config=MC3R1.R13.6,reports+={safe,"any_area(any_loc(any_exp(macro(name(BUILD_BUG_ON)))))"}
+-config=MC3A2.R13.6,reports+={safe,"any_area(any_loc(any_exp(macro(name(BUILD_BUG_ON)))))"}
 -config=B.UNEVALEFF,reports+={safe,"any_area(any_loc(any_exp(macro(name(BUILD_BUG_ON)))))"}
 -doc_end
 
@@ -425,31 +425,31 @@ of the short-circuit evaluation strategy of such logical operators."
 -doc_begin="The severe restrictions imposed by this rule on the use of for
 statements are not balanced by the presumed facilitation of the peer review
 activity."
--config=MC3R1.R14.2,reports+={disapplied,"any()"}
+-config=MC3A2.R14.2,reports+={disapplied,"any()"}
 -doc_end
 
 -doc_begin="The XEN team relies on the fact that invariant conditions of 'if' statements and conditional operators are deliberate"
--config=MC3R1.R14.3,statements+={deliberate, "wrapped(any(),node(if_stmt||conditional_operator||binary_conditional_operator))" }
+-config=MC3A2.R14.3,statements+={deliberate, "wrapped(any(),node(if_stmt||conditional_operator||binary_conditional_operator))" }
 -doc_end
 
 -doc_begin="Switches having a 'sizeof' operator as the condition are deliberate and have limited scope."
--config=MC3R1.R14.3,statements+={deliberate, "wrapped(any(),node(switch_stmt)&&child(cond, operator(sizeof)))" }
+-config=MC3A2.R14.3,statements+={deliberate, "wrapped(any(),node(switch_stmt)&&child(cond, operator(sizeof)))" }
 -doc_end
 
 -doc_begin="The use of an invariant size argument in {put,get}_unsafe_size and array_access_ok, as defined in arch/x86(_64)?/include/asm/uaccess.h is deliberate and is deemed safe."
 -file_tag+={x86_uaccess, "^xen/arch/x86(_64)?/include/asm/uaccess\\.h$"}
--config=MC3R1.R14.3,reports+={deliberate, "any_area(any_loc(file(x86_uaccess)&&any_exp(macro(^(put|get)_unsafe_size$))))"}
--config=MC3R1.R14.3,reports+={deliberate, "any_area(any_loc(file(x86_uaccess)&&any_exp(macro(^array_access_ok$))))"}
+-config=MC3A2.R14.3,reports+={deliberate, "any_area(any_loc(file(x86_uaccess)&&any_exp(macro(^(put|get)_unsafe_size$))))"}
+-config=MC3A2.R14.3,reports+={deliberate, "any_area(any_loc(file(x86_uaccess)&&any_exp(macro(^array_access_ok$))))"}
 -doc_end
 
 -doc_begin="A controlling expression of 'if' and iteration statements having integer, character or pointer type has a semantics that is well-known to all Xen developers."
--config=MC3R1.R14.4,etypes+={deliberate, "any()", "src_type(integer||character)||src_expr(type(desugar(pointer(any()))))"}
+-config=MC3A2.R14.4,etypes+={deliberate, "any()", "src_type(integer||character)||src_expr(type(desugar(pointer(any()))))"}
 -doc_end
 
 -doc_begin="The XEN team relies on the fact that the enum is_dying has the
 constant with assigned value 0 act as false and the other ones as true,
 therefore have the same behavior of a boolean"
--config=MC3R1.R14.4,etypes+={deliberate, "stmt(child(cond,child(expr,ref(^<?domain>?::is_dying$))))","src_type(enum)"}
+-config=MC3A2.R14.4,etypes+={deliberate, "stmt(child(cond,child(expr,ref(^<?domain>?::is_dying$))))","src_type(enum)"}
 -doc_end
 
 #
@@ -460,43 +460,43 @@ therefore have the same behavior of a boolean"
 therefore it is deemed better to leave such files as is."
 -file_tag+={x86_emulate,"^xen/arch/x86/x86_emulate/.*$"}
 -file_tag+={x86_svm_emulate,"^xen/arch/x86/hvm/svm/emulate\\.c$"}
--config=MC3R1.R16.2,reports+={deliberate, "any_area(any_loc(file(x86_emulate||x86_svm_emulate)))"}
+-config=MC3A2.R16.2,reports+={deliberate, "any_area(any_loc(file(x86_emulate||x86_svm_emulate)))"}
 -doc_end
 
 -doc_begin="Switch clauses ending with continue, goto, return statements are
 safe."
--config=MC3R1.R16.3,terminals+={safe, "node(continue_stmt||goto_stmt||return_stmt)"}
+-config=MC3A2.R16.3,terminals+={safe, "node(continue_stmt||goto_stmt||return_stmt)"}
 -doc_end
 
 -doc_begin="Switch clauses ending with a call to a function that does not give
 the control back (i.e., a function with attribute noreturn) are safe."
--config=MC3R1.R16.3,terminals+={safe, "call(property(noreturn))"}
+-config=MC3A2.R16.3,terminals+={safe, "call(property(noreturn))"}
 -doc_end
 
 -doc_begin="Switch clauses ending with pseudo-keyword \"fallthrough\" are
 safe."
--config=MC3R1.R16.3,reports+={safe, "any_area(end_loc(any_exp(text(/fallthrough;/))))"}
+-config=MC3A2.R16.3,reports+={safe, "any_area(end_loc(any_exp(text(/fallthrough;/))))"}
 -doc_end
 
 -doc_begin="Switch clauses ending with failure method \"BUG()\" are safe."
--config=MC3R1.R16.3,reports+={safe, "any_area(end_loc(any_exp(text(/BUG\\(\\);/))))"}
+-config=MC3A2.R16.3,reports+={safe, "any_area(end_loc(any_exp(text(/BUG\\(\\);/))))"}
 -doc_end
 
 -doc_begin="Switch clauses not ending with the break statement are safe if an
 explicit comment indicating the fallthrough intention is present."
--config=MC3R1.R16.3,reports+={safe, "any_area(end_loc(any_exp(text(^(?s).*/\\* [fF]all ?through.? \\*/.*$,0..1))))"}
+-config=MC3A2.R16.3,reports+={safe, "any_area(end_loc(any_exp(text(^(?s).*/\\* [fF]all ?through.? \\*/.*$,0..1))))"}
 -doc_end
 
 -doc_begin="Switch statements having a controlling expression of enum type deliberately do not have a default case: gcc -Wall enables -Wswitch which warns (and breaks the build as we use -Werror) if one of the enum labels is missing from the switch."
--config=MC3R1.R16.4,reports+={deliberate,'any_area(kind(context)&&^.* has no `default.*$&&stmt(node(switch_stmt)&&child(cond,skip(__non_syntactic_paren_stmts,type(canonical(enum_underlying_type(any())))))))'}
+-config=MC3A2.R16.4,reports+={deliberate,'any_area(kind(context)&&^.* has no `default.*$&&stmt(node(switch_stmt)&&child(cond,skip(__non_syntactic_paren_stmts,type(canonical(enum_underlying_type(any())))))))'}
 -doc_end
 
 -doc_begin="A switch statement with a single switch clause and no default label may be used in place of an equivalent if statement if it is considered to improve readability."
--config=MC3R1.R16.4,switch_clauses+={deliberate,"switch(1)&&default(0)"}
+-config=MC3A2.R16.4,switch_clauses+={deliberate,"switch(1)&&default(0)"}
 -doc_end
 
 -doc_begin="A switch statement with a single switch clause and no default label may be used in place of an equivalent if statement if it is considered to improve readability."
--config=MC3R1.R16.6,switch_clauses+={deliberate, "default(0)"}
+-config=MC3A2.R16.6,switch_clauses+={deliberate, "default(0)"}
 -doc_end
 
 #
@@ -504,16 +504,16 @@ explicit comment indicating the fallthrough intention is present."
 #
 
 -doc_begin="printf()-like functions are allowed to use the variadic features provided by stdarg.h."
--config=MC3R1.R17.1,reports+={deliberate,"any_area(^.*va_list.*$&&context(ancestor_or_self(^.*printk\\(.*\\)$)))"}
--config=MC3R1.R17.1,reports+={deliberate,"any_area(^.*va_list.*$&&context(ancestor_or_self(^.*printf\\(.*\\)$)))"}
--config=MC3R1.R17.1,reports+={deliberate,"any_area(^.*va_list.*$&&context(ancestor_or_self(name(panic)&&kind(function))))"}
--config=MC3R1.R17.1,reports+={deliberate,"any_area(^.*va_list.*$&&context(ancestor_or_self(name(elf_call_log_callback)&&kind(function))))"}
--config=MC3R1.R17.1,reports+={deliberate,"any_area(^.*va_list.*$&&context(ancestor_or_self(name(vprintk_common)&&kind(function))))"}
--config=MC3R1.R17.1,macros+={hide , "^va_(arg|start|copy|end)$"}
+-config=MC3A2.R17.1,reports+={deliberate,"any_area(^.*va_list.*$&&context(ancestor_or_self(^.*printk\\(.*\\)$)))"}
+-config=MC3A2.R17.1,reports+={deliberate,"any_area(^.*va_list.*$&&context(ancestor_or_self(^.*printf\\(.*\\)$)))"}
+-config=MC3A2.R17.1,reports+={deliberate,"any_area(^.*va_list.*$&&context(ancestor_or_self(name(panic)&&kind(function))))"}
+-config=MC3A2.R17.1,reports+={deliberate,"any_area(^.*va_list.*$&&context(ancestor_or_self(name(elf_call_log_callback)&&kind(function))))"}
+-config=MC3A2.R17.1,reports+={deliberate,"any_area(^.*va_list.*$&&context(ancestor_or_self(name(vprintk_common)&&kind(function))))"}
+-config=MC3A2.R17.1,macros+={hide , "^va_(arg|start|copy|end)$"}
 -doc_end
 
 -doc_begin="Not using the return value of a function does not endanger safety if it coincides with an actual argument."
--config=MC3R1.R17.7,calls+={safe, "any()", "decl(name(__builtin_memcpy||__builtin_memmove||__builtin_memset||cpumask_check))"}
+-config=MC3A2.R17.7,calls+={safe, "any()", "decl(name(__builtin_memcpy||__builtin_memmove||__builtin_memset||cpumask_check))"}
 -doc_end
 
 #
@@ -522,7 +522,7 @@ explicit comment indicating the fallthrough intention is present."
 
 -doc_begin="Flexible array members are deliberately used and XEN developers are aware of the dangers related to them:
 unexpected result when the structure is given as argument to a sizeof() operator and the truncation in assignment between structures."
--config=MC3R1.R18.7,reports+={deliberate, "any()"}
+-config=MC3A2.R18.7,reports+={deliberate, "any()"}
 -doc_end
 
 #
@@ -533,7 +533,7 @@ unexpected result when the structure is given as argument to a sizeof() operator
 as function arguments; (2) as macro arguments; (3) as array indices; (4) as lhs
 in assignments; (5) as initializers, possibly designated, in initalizer lists;
 (6) as the constant expression in a switch clause label."
--config=MC3R1.R20.7,expansion_context=
+-config=MC3A2.R20.7,expansion_context=
 {safe, "context(__call_expr_arg_contexts)"},
 {safe, "left_right(^[(,\\[]$,^[),\\]]$)"},
 {safe, "context(skip_to(__expr_non_syntactic_contexts, stmt_child(node(array_subscript_expr), subscript)))"},
@@ -546,52 +546,52 @@ in assignments; (5) as initializers, possibly designated, in initalizer lists;
 breaking the macro's logic; futhermore, the macro is only ever used in the context
 of the IS_ENABLED or STATIC_IF/STATIC_IF_NOT macros, so it always receives a literal
 0 or 1 as input, posing no risk to safety."
--config=MC3R1.R20.7,reports+={safe, "any_area(any_loc(any_exp(macro(^___config_enabled$))))"}
+-config=MC3A2.R20.7,reports+={safe, "any_area(any_loc(any_exp(macro(^___config_enabled$))))"}
 -doc_end
 
 -doc_begin="Violations due to the use of macros defined in files that are
 not in scope for compliance are allowed, as that is imported code."
 -file_tag+={gnu_efi_include, "^xen/include/efi/.*$"}
 -file_tag+={acpi_cpu_idle, "^xen/arch/x86/acpi/cpu_idle\\.c$"}
--config=MC3R1.R20.7,reports+={safe, "any_area(any_loc(file(gnu_efi_include)))"}
--config=MC3R1.R20.7,reports+={safe, "any_area(any_loc(file(acpi_cpu_idle)))"}
+-config=MC3A2.R20.7,reports+={safe, "any_area(any_loc(file(gnu_efi_include)))"}
+-config=MC3A2.R20.7,reports+={safe, "any_area(any_loc(file(acpi_cpu_idle)))"}
 -doc_end
 
 -doc_begin="To avoid compromising readability, the macros alternative_(v)?call[0-9] are allowed
 not to parenthesize their arguments."
--config=MC3R1.R20.7,reports+={safe, "any_area(any_loc(any_exp(macro(^alternative_(v)?call[0-9]$))))"}
+-config=MC3A2.R20.7,reports+={safe, "any_area(any_loc(any_exp(macro(^alternative_(v)?call[0-9]$))))"}
 -doc_end
 
 -doc_begin="The argument 'x' of the count_args_ macro can't be parenthesized as
 the rule would require, without breaking the functionality of the macro. The uses
 of this macro do not lead to developer confusion, and can thus be deviated."
--config=MC3R1.R20.7,reports+={safe, "any_area(any_loc(any_exp(macro(^count_args_$))))"}
+-config=MC3A2.R20.7,reports+={safe, "any_area(any_loc(any_exp(macro(^count_args_$))))"}
 -doc_end
 
 -doc_begin="Uses of variadic macros that have one of their arguments defined as
 a macro and used within the body for both ordinary parameter expansion and as an
 operand to the # or ## operators have a behavior that is well-understood and
 deliberate."
--config=MC3R1.R20.12,macros+={deliberate, "variadic()"}
+-config=MC3A2.R20.12,macros+={deliberate, "variadic()"}
 -doc_end
 
 -doc_begin="Uses of a macro parameter for ordinary expansion and as an operand
 to the # or ## operators within the following macros are deliberate, to provide
 useful diagnostic messages to the user."
--config=MC3R1.R20.12,macros+={deliberate, "name(ASSERT||BUILD_BUG_ON||BUILD_BUG_ON_ZERO||RUNTIME_CHECK)"}
+-config=MC3A2.R20.12,macros+={deliberate, "name(ASSERT||BUILD_BUG_ON||BUILD_BUG_ON_ZERO||RUNTIME_CHECK)"}
 -doc_end
 
 -doc_begin="The helper macro GENERATE_CASE may use a macro parameter for ordinary
 expansion and token pasting to improve readability. Only instances where this
 leads to a violation of the Rule are deviated."
 -file_tag+={deliberate_generate_case, "^xen/arch/arm/vcpreg\\.c$"}
--config=MC3R1.R20.12,macros+={deliberate, "name(GENERATE_CASE)&&loc(file(deliberate_generate_case))"}
+-config=MC3A2.R20.12,macros+={deliberate, "name(GENERATE_CASE)&&loc(file(deliberate_generate_case))"}
 -doc_end
 
 -doc_begin="The macro DEFINE is defined and used in excluded files asm-offsets.c.
 This may still cause violations if entities outside these files are referred to
 in the expansion."
--config=MC3R1.R20.12,macros+={deliberate, "name(DEFINE)&&loc(file(asm_offsets))"}
+-config=MC3A2.R20.12,macros+={deliberate, "name(DEFINE)&&loc(file(asm_offsets))"}
 -doc_end
 
 #
@@ -601,7 +601,7 @@ in the expansion."
 -doc_begin="or, and and xor are reserved identifiers because they constitute alternate
 spellings for the corresponding operators (they are defined as macros by iso646.h).
 However, Xen doesn't use standard library headers, so there is no risk of overlap."
--config=MC3R1.R21.2,reports+={safe, "any_area(stmt(ref(kind(label)&&^(or|and|xor|not)$)))"}
+-config=MC3A2.R21.2,reports+={safe, "any_area(stmt(ref(kind(label)&&^(or|and|xor|not)$)))"}
 -doc_end
 
 -doc_begin="Xen does not use the functions provided by the Standard Library, but
@@ -610,8 +610,8 @@ The implementation of these functions is available in source form, so the undefi
 or implementation-defined behaviors contemplated by the C Standard do not apply.
 If some undefined or unspecified behavior does arise in the implementation, it
 falls under the jurisdiction of other MISRA rules."
--config=MC3R1.R21.9,reports+={deliberate, "any()"}
--config=MC3R1.R21.10,reports+={deliberate, "any()"}
+-config=MC3A2.R21.9,reports+={deliberate, "any()"}
+-config=MC3A2.R21.10,reports+={deliberate, "any()"}
 -doc_end
 
 #
@@ -636,7 +636,7 @@ falls under the jurisdiction of other MISRA rules."
 programmers:no developers' confusion is not possible. In addition, adopted code
 is assumed to work as is. Reports that are fully contained in adopted code are
 hidden/tagged with the 'adopted' tag."
--service_selector={developer_confusion_guidelines,"^(MC3R1\\.R2\\.1|MC3R1\\.R2\\.2|MC3R1\\.R2\\.3|MC3R1\\.R2\\.4|MC3R1\\.R2\\.5|MC3R1\\.R2\\.6|MC3R1\\.R2\\.7|MC3R1\\.R4\\.1|MC3R1\\.R5\\.3|MC3R1\\.R5\\.6|MC3R1\\.R5\\.7|MC3R1\\.R5\\.8|MC3R1\\.R5\\.9|MC3R1\\.R7\\.1|MC3R1\\.R7\\.2|MC3R1\\.R7\\.3|MC3R1\\.R8\\.7|MC3R1\\.R8\\.8|MC3R1\\.R8\\.9|MC3R1\\.R8\\.11|MC3R1\\.R8\\.12|MC3R1\\.R8\\.13|MC3R1\\.R9\\.3|MC3R1\\.R9\\.4|MC3R1\\.R9\\.5|MC3R1\\.R10\\.2|MC3R1\\.R10\\.5|MC3R1\\.R10\\.6|MC3R1\\.R10\\.7|MC3R1\\.R10\\.8|MC3R1\\.R11\\.9|MC3R1\\.R12\\.1|MC3R1\\.R12\\.3|MC3R1\\.R12\\.4|MC3R1\\.R13\\.5|MC3R1\\.R14\\.1|MC3R1\\.R14\\.2|MC3R1\\.R14\\.3|MC3R1\\.R15\\.1|MC3R1\\.R15\\.2|MC3R1\\.R15\\.3|MC3R1\\.R15\\.4|MC3R1\\.R15\\.5|MC3R1\\.R15\\.6|MC3R1\\.R15\\.7|MC3R1\\.R16\\.1|MC3R1\\.R16\\.2|MC3R1\\.R16\\.3|MC3R1\\.R16\\.4|MC3R1\\.R16\\.5|MC3R1\\.R16\\.6|MC3R1\\.R16\\.7|MC3R1\\.R17\\.7|MC3R1\\.R17\\.8|MC3R1\\.R18\\.4|MC3R1\\.R18\\.5)$"
+-service_selector={developer_confusion_guidelines,"^(MC3A2\\.R2\\.1|MC3A2\\.R2\\.2|MC3A2\\.R2\\.3|MC3A2\\.R2\\.4|MC3A2\\.R2\\.5|MC3A2\\.R2\\.6|MC3A2\\.R2\\.7|MC3A2\\.R4\\.1|MC3A2\\.R5\\.3|MC3A2\\.R5\\.6|MC3A2\\.R5\\.7|MC3A2\\.R5\\.8|MC3A2\\.R5\\.9|MC3A2\\.R7\\.1|MC3A2\\.R7\\.2|MC3A2\\.R7\\.3|MC3A2\\.R8\\.7|MC3A2\\.R8\\.8|MC3A2\\.R8\\.9|MC3A2\\.R8\\.11|MC3A2\\.R8\\.12|MC3A2\\.R8\\.13|MC3A2\\.R9\\.3|MC3A2\\.R9\\.4|MC3A2\\.R9\\.5|MC3A2\\.R10\\.2|MC3A2\\.R10\\.5|MC3A2\\.R10\\.6|MC3A2\\.R10\\.7|MC3A2\\.R10\\.8|MC3A2\\.R11\\.9|MC3A2\\.R12\\.1|MC3A2\\.R12\\.3|MC3A2\\.R12\\.4|MC3A2\\.R13\\.5|MC3A2\\.R14\\.1|MC3A2\\.R14\\.2|MC3A2\\.R14\\.3|MC3A2\\.R15\\.1|MC3A2\\.R15\\.2|MC3A2\\.R15\\.3|MC3A2\\.R15\\.4|MC3A2\\.R15\\.5|MC3A2\\.R15\\.6|MC3A2\\.R15\\.7|MC3A2\\.R16\\.1|MC3A2\\.R16\\.2|MC3A2\\.R16\\.3|MC3A2\\.R16\\.4|MC3A2\\.R16\\.5|MC3A2\\.R16\\.6|MC3A2\\.R16\\.7|MC3A2\\.R17\\.7|MC3A2\\.R17\\.8|MC3A2\\.R18\\.4|MC3A2\\.R18\\.5)$"
 }
 -config=developer_confusion_guidelines,reports+={relied,adopted_report}
 -doc_end
diff --git a/automation/eclair_analysis/ECLAIR/monitored.ecl b/automation/eclair_analysis/ECLAIR/monitored.ecl
index 9ffaebbdc3..464516e780 100644
--- a/automation/eclair_analysis/ECLAIR/monitored.ecl
+++ b/automation/eclair_analysis/ECLAIR/monitored.ecl
@@ -1,104 +1,104 @@
 -doc_begin="A set of guidelines that are clean or that only have few violations left."
--enable=MC3R1.D1.1
--enable=MC3R1.D2.1
--enable=MC3R1.D4.1
--enable=MC3R1.D4.10
--enable=MC3R1.D4.11
--enable=MC3R1.D4.12
--enable=MC3R1.D4.14
--enable=MC3R1.D4.3
--enable=MC3R1.D4.7
--enable=MC3R1.R10.1
--enable=MC3R1.R10.2
--enable=MC3R1.R1.1
--enable=MC3R1.R11.1
--enable=MC3R1.R11.7
--enable=MC3R1.R11.8
--enable=MC3R1.R11.9
--enable=MC3R1.R12.5
--enable=MC3R1.R1.3
--enable=MC3R1.R13.6
--enable=MC3R1.R13.1
--enable=MC3R1.R1.4
--enable=MC3R1.R14.1
--enable=MC3R1.R14.4
--enable=MC3R1.R16.2
--enable=MC3R1.R16.3
--enable=MC3R1.R16.4
--enable=MC3R1.R16.6
--enable=MC3R1.R16.7
--enable=MC3R1.R17.1
--enable=MC3R1.R17.3
--enable=MC3R1.R17.4
--enable=MC3R1.R17.5
--enable=MC3R1.R17.6
--enable=MC3R1.R19.1
--enable=MC3R1.R20.12
--enable=MC3R1.R20.13
--enable=MC3R1.R20.14
--enable=MC3R1.R20.4
--enable=MC3R1.R20.7
--enable=MC3R1.R20.9
--enable=MC3R1.R2.1
--enable=MC3R1.R21.10
--enable=MC3R1.R21.13
--enable=MC3R1.R21.17
--enable=MC3R1.R21.18
--enable=MC3R1.R21.19
--enable=MC3R1.R21.20
--enable=MC3R1.R21.21
--enable=MC3R1.R21.9
--enable=MC3R1.R2.2
--enable=MC3R1.R22.2
--enable=MC3R1.R22.4
--enable=MC3R1.R22.5
--enable=MC3R1.R22.6
--enable=MC3R1.R2.6
--enable=MC3R1.R3.1
--enable=MC3R1.R3.2
--enable=MC3R1.R4.1
--enable=MC3R1.R4.2
--enable=MC3R1.R5.1
--enable=MC3R1.R5.2
--enable=MC3R1.R5.3
--enable=MC3R1.R5.4
--enable=MC3R1.R5.5
--enable=MC3R1.R5.6
--enable=MC3R1.R6.1
--enable=MC3R1.R6.2
--enable=MC3R1.R7.1
--enable=MC3R1.R7.2
--enable=MC3R1.R7.3
--enable=MC3R1.R7.4
--enable=MC3R1.R8.1
--enable=MC3R1.R8.10
--enable=MC3R1.R8.12
--enable=MC3R1.R8.14
--enable=MC3R1.R8.2
--enable=MC3R1.R8.3
--enable=MC3R1.R8.4
--enable=MC3R1.R8.5
--enable=MC3R1.R8.6
--enable=MC3R1.R8.8
--enable=MC3R1.R9.2
--enable=MC3R1.R9.3
--enable=MC3R1.R9.4
--enable=MC3R1.R9.5
--enable=MC3R1.R18.8
--enable=MC3R1.R20.2
--enable=MC3R1.R20.3
--enable=MC3R1.R20.6
--enable=MC3R1.R20.11
--enable=MC3R1.R21.3
--enable=MC3R1.R21.4
--enable=MC3R1.R21.5
--enable=MC3R1.R21.7
--enable=MC3R1.R21.8
--enable=MC3R1.R21.12
--enable=MC3R1.R22.1
--enable=MC3R1.R22.3
--enable=MC3R1.R22.7
--enable=MC3R1.R22.8
--enable=MC3R1.R22.9
--enable=MC3R1.R22.10
+-enable=MC3A2.D1.1
+-enable=MC3A2.D2.1
+-enable=MC3A2.D4.1
+-enable=MC3A2.D4.10
+-enable=MC3A2.D4.11
+-enable=MC3A2.D4.12
+-enable=MC3A2.D4.14
+-enable=MC3A2.D4.3
+-enable=MC3A2.D4.7
+-enable=MC3A2.R10.1
+-enable=MC3A2.R10.2
+-enable=MC3A2.R1.1
+-enable=MC3A2.R11.1
+-enable=MC3A2.R11.7
+-enable=MC3A2.R11.8
+-enable=MC3A2.R11.9
+-enable=MC3A2.R12.5
+-enable=MC3A2.R1.3
+-enable=MC3A2.R13.6
+-enable=MC3A2.R13.1
+-enable=MC3A2.R1.4
+-enable=MC3A2.R14.1
+-enable=MC3A2.R14.4
+-enable=MC3A2.R16.2
+-enable=MC3A2.R16.3
+-enable=MC3A2.R16.4
+-enable=MC3A2.R16.6
+-enable=MC3A2.R16.7
+-enable=MC3A2.R17.1
+-enable=MC3A2.R17.3
+-enable=MC3A2.R17.4
+-enable=MC3A2.R17.5
+-enable=MC3A2.R17.6
+-enable=MC3A2.R19.1
+-enable=MC3A2.R20.12
+-enable=MC3A2.R20.13
+-enable=MC3A2.R20.14
+-enable=MC3A2.R20.4
+-enable=MC3A2.R20.7
+-enable=MC3A2.R20.9
+-enable=MC3A2.R2.1
+-enable=MC3A2.R21.10
+-enable=MC3A2.R21.13
+-enable=MC3A2.R21.17
+-enable=MC3A2.R21.18
+-enable=MC3A2.R21.19
+-enable=MC3A2.R21.20
+-enable=MC3A2.R21.21
+-enable=MC3A2.R21.9
+-enable=MC3A2.R2.2
+-enable=MC3A2.R22.2
+-enable=MC3A2.R22.4
+-enable=MC3A2.R22.5
+-enable=MC3A2.R22.6
+-enable=MC3A2.R2.6
+-enable=MC3A2.R3.1
+-enable=MC3A2.R3.2
+-enable=MC3A2.R4.1
+-enable=MC3A2.R4.2
+-enable=MC3A2.R5.1
+-enable=MC3A2.R5.2
+-enable=MC3A2.R5.3
+-enable=MC3A2.R5.4
+-enable=MC3A2.R5.5
+-enable=MC3A2.R5.6
+-enable=MC3A2.R6.1
+-enable=MC3A2.R6.2
+-enable=MC3A2.R7.1
+-enable=MC3A2.R7.2
+-enable=MC3A2.R7.3
+-enable=MC3A2.R7.4
+-enable=MC3A2.R8.1
+-enable=MC3A2.R8.10
+-enable=MC3A2.R8.12
+-enable=MC3A2.R8.14
+-enable=MC3A2.R8.2
+-enable=MC3A2.R8.3
+-enable=MC3A2.R8.4
+-enable=MC3A2.R8.5
+-enable=MC3A2.R8.6
+-enable=MC3A2.R8.8
+-enable=MC3A2.R9.2
+-enable=MC3A2.R9.3
+-enable=MC3A2.R9.4
+-enable=MC3A2.R9.5
+-enable=MC3A2.R18.8
+-enable=MC3A2.R20.2
+-enable=MC3A2.R20.3
+-enable=MC3A2.R20.6
+-enable=MC3A2.R20.11
+-enable=MC3A2.R21.3
+-enable=MC3A2.R21.4
+-enable=MC3A2.R21.5
+-enable=MC3A2.R21.7
+-enable=MC3A2.R21.8
+-enable=MC3A2.R21.12
+-enable=MC3A2.R22.1
+-enable=MC3A2.R22.3
+-enable=MC3A2.R22.7
+-enable=MC3A2.R22.8
+-enable=MC3A2.R22.9
+-enable=MC3A2.R22.10
 -doc_end
diff --git a/automation/eclair_analysis/ECLAIR/tagging.ecl b/automation/eclair_analysis/ECLAIR/tagging.ecl
index b829655ca0..eec1d50f90 100644
--- a/automation/eclair_analysis/ECLAIR/tagging.ecl
+++ b/automation/eclair_analysis/ECLAIR/tagging.ecl
@@ -20,94 +20,94 @@
 -doc_begin="Clean guidelines: new violations for these guidelines are not accepted."
 
 -service_selector={clean_guidelines_common,
-"MC3R1.D1.1||
-MC3R1.D2.1||
-MC3R1.D4.1||
-MC3R1.D4.11||
-MC3R1.D4.14||
-MC3R1.R1.1||
-MC3R1.R1.3||
-MC3R1.R1.4||
-MC3R1.R2.2||
-MC3R1.R2.6||
-MC3R1.R3.1||
-MC3R1.R3.2||
-MC3R1.R4.1||
-MC3R1.R4.2||
-MC3R1.R5.1||
-MC3R1.R5.2||
-MC3R1.R5.4||
-MC3R1.R5.6||
-MC3R1.R6.1||
-MC3R1.R6.2||
-MC3R1.R7.1||
-MC3R1.R7.2||
-MC3R1.R7.4||
-MC3R1.R8.1||
-MC3R1.R8.2||
-MC3R1.R8.5||
-MC3R1.R8.6||
-MC3R1.R8.8||
-MC3R1.R8.10||
-MC3R1.R8.12||
-MC3R1.R8.14||
-MC3R1.R9.2||
-MC3R1.R9.3||
-MC3R1.R9.4||
-MC3R1.R9.5||
-MC3R1.R10.2||
-MC3R1.R11.7||
-MC3R1.R11.9||
-MC3R1.R12.5||
-MC3R1.R14.1||
-MC3R1.R14.4||
-MC3R1.R16.7||
-MC3R1.R17.1||
-MC3R1.R17.3||
-MC3R1.R17.4||
-MC3R1.R17.5||
-MC3R1.R17.6||
-MC3R1.R18.8||
-MC3R1.R20.2||
-MC3R1.R20.3||
-MC3R1.R20.4||
-MC3R1.R20.6||
-MC3R1.R20.9||
-MC3R1.R20.11||
-MC3R1.R20.12||
-MC3R1.R20.13||
-MC3R1.R20.14||
-MC3R1.R21.3||
-MC3R1.R21.4||
-MC3R1.R21.5||
-MC3R1.R21.7||
-MC3R1.R21.8||
-MC3R1.R21.9||
-MC3R1.R21.10||
-MC3R1.R21.12||
-MC3R1.R21.13||
-MC3R1.R21.19||
-MC3R1.R21.21||
-MC3R1.R22.1||
-MC3R1.R22.2||
-MC3R1.R22.3||
-MC3R1.R22.4||
-MC3R1.R22.5||
-MC3R1.R22.6||
-MC3R1.R22.7||
-MC3R1.R22.8||
-MC3R1.R22.9||
-MC3R1.R22.10"
+"MC3A2.D1.1||
+MC3A2.D2.1||
+MC3A2.D4.1||
+MC3A2.D4.11||
+MC3A2.D4.14||
+MC3A2.R1.1||
+MC3A2.R1.3||
+MC3A2.R1.4||
+MC3A2.R2.2||
+MC3A2.R2.6||
+MC3A2.R3.1||
+MC3A2.R3.2||
+MC3A2.R4.1||
+MC3A2.R4.2||
+MC3A2.R5.1||
+MC3A2.R5.2||
+MC3A2.R5.4||
+MC3A2.R5.6||
+MC3A2.R6.1||
+MC3A2.R6.2||
+MC3A2.R7.1||
+MC3A2.R7.2||
+MC3A2.R7.4||
+MC3A2.R8.1||
+MC3A2.R8.2||
+MC3A2.R8.5||
+MC3A2.R8.6||
+MC3A2.R8.8||
+MC3A2.R8.10||
+MC3A2.R8.12||
+MC3A2.R8.14||
+MC3A2.R9.2||
+MC3A2.R9.3||
+MC3A2.R9.4||
+MC3A2.R9.5||
+MC3A2.R10.2||
+MC3A2.R11.7||
+MC3A2.R11.9||
+MC3A2.R12.5||
+MC3A2.R14.1||
+MC3A2.R14.4||
+MC3A2.R16.7||
+MC3A2.R17.1||
+MC3A2.R17.3||
+MC3A2.R17.4||
+MC3A2.R17.5||
+MC3A2.R17.6||
+MC3A2.R18.8||
+MC3A2.R20.2||
+MC3A2.R20.3||
+MC3A2.R20.4||
+MC3A2.R20.6||
+MC3A2.R20.9||
+MC3A2.R20.11||
+MC3A2.R20.12||
+MC3A2.R20.13||
+MC3A2.R20.14||
+MC3A2.R21.3||
+MC3A2.R21.4||
+MC3A2.R21.5||
+MC3A2.R21.7||
+MC3A2.R21.8||
+MC3A2.R21.9||
+MC3A2.R21.10||
+MC3A2.R21.12||
+MC3A2.R21.13||
+MC3A2.R21.19||
+MC3A2.R21.21||
+MC3A2.R22.1||
+MC3A2.R22.2||
+MC3A2.R22.3||
+MC3A2.R22.4||
+MC3A2.R22.5||
+MC3A2.R22.6||
+MC3A2.R22.7||
+MC3A2.R22.8||
+MC3A2.R22.9||
+MC3A2.R22.10"
 }
 
 -setq=target,getenv("XEN_TARGET_ARCH")
 
 if(string_equal(target,"x86_64"),
-    service_selector({"additional_clean_guidelines","MC3R1.D4.3"})
+    service_selector({"additional_clean_guidelines","MC3A2.D4.3"})
 )
 
 if(string_equal(target,"arm64"),
-    service_selector({"additional_clean_guidelines","MC3R1.R16.6||MC3R1.R2.1||MC3R1.R5.3||MC3R1.R7.3"})
+    service_selector({"additional_clean_guidelines","MC3A2.R16.6||MC3A2.R2.1||MC3A2.R5.3||MC3A2.R7.3"})
 )
 
 -reports+={clean:added,"service(clean_guidelines_common||additional_clean_guidelines)"}
diff --git a/docs/misra/documenting-violations.rst b/docs/misra/documenting-violations.rst
index 8f1cbd83b8..d26377d5aa 100644
--- a/docs/misra/documenting-violations.rst
+++ b/docs/misra/documenting-violations.rst
@@ -53,7 +53,7 @@ Here is an example to add a new justification in safe.json::
 |            "analyser": {
 |                "cppcheck": "misra-c2012-20.7",
 |                "coverity": "misra_c_2012_rule_20_7_violation",
-|                "eclair": "MC3R1.R20.7"
+|                "eclair": "MC3A2.R20.7"
 |            },
 |            "name": "R20.7 C macro parameters not used as expression",
 |            "text": "The macro parameters used in this [...]"
@@ -138,7 +138,7 @@ 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
+| MC3A2.R8.6 for program 'xen/xen-syms', variable '_start' has no definition
 
 Also coverity reports it, here is an extract of the finding:
 
@@ -165,7 +165,7 @@ We will prepare our entry in the safe.json database::
 |        {
 |            "id": "SAF-1-safe",
 |            "analyser": {
-|                "eclair": "MC3R1.R8.6",
+|                "eclair": "MC3A2.R8.6",
 |                "coverity": "misra_c_2012_rule_8_6_violation"
 |            },
 |            "name": "Rule 8.6: linker script defined symbols",
diff --git a/docs/misra/safe.json b/docs/misra/safe.json
index 3f18ef401c..a3b07d1c0d 100644
--- a/docs/misra/safe.json
+++ b/docs/misra/safe.json
@@ -4,7 +4,7 @@
         {
             "id": "SAF-0-safe",
             "analyser": {
-                "eclair": "MC3R1.R8.6",
+                "eclair": "MC3A2.R8.6",
                 "coverity": "misra_c_2012_rule_8_6_violation"
             },
             "name": "Rule 8.6: linker script defined symbols",
@@ -13,7 +13,7 @@
         {
             "id": "SAF-1-safe",
             "analyser": {
-                "eclair": "MC3R1.R8.4"
+                "eclair": "MC3A2.R8.4"
             },
             "name": "Rule 8.4: asm-only definition",
             "text": "Functions and variables used only by asm modules do not need to have a visible declaration prior to their definition."
@@ -21,23 +21,23 @@
         {
             "id": "SAF-2-safe",
             "analyser": {
-                "eclair": "MC3R1.R10.1"
+                "eclair": "MC3A2.R10.1"
             },
-            "name": "MC3R1.R10.1: use of an enumeration constant in an arithmetic operation",
+            "name": "MC3A2.R10.1: use of an enumeration constant in an arithmetic operation",
             "text": "This violation can be fixed with a cast to (int) of the enumeration constant, but a deviation was chosen due to code readability (see also the comment in BITS_TO_LONGS)."
         },
         {
             "id": "SAF-3-safe",
             "analyser": {
-                "eclair": "MC3R1.R20.4"
+                "eclair": "MC3A2.R20.4"
             },
-            "name": "MC3R1.R20.4: allow the definition of a macro with the same name as a keyword in some special cases",
+            "name": "MC3A2.R20.4: allow the definition of a macro with the same name as a keyword in some special cases",
             "text": "The definition of a macro with the same name as a keyword can be useful in certain configurations to improve the guarantees that can be provided by Xen. See docs/misra/deviations.rst for a precise rationale for all such cases."
         },
         {
             "id": "SAF-4-safe",
             "analyser": {
-                "eclair": "MC3R1.R17.1"
+                "eclair": "MC3A2.R17.1"
             },
             "name": "Rule 17.1: internal helper functions made to break long running hypercalls into multiple calls.",
             "text": "They need to take a variable number of arguments depending on the original hypercall they are trying to continue."
@@ -45,25 +45,25 @@
         {
             "id": "SAF-5-safe",
             "analyser": {
-                "eclair": "MC3R1.R16.2"
+                "eclair": "MC3A2.R16.2"
             },
-            "name": "MC3R1.R16.2: using a case label when the most closely-enclosing compound statement is not a switch statement",
+            "name": "MC3A2.R16.2: using a case label when the most closely-enclosing compound statement is not a switch statement",
             "text": "A switch label enclosed by some compound statement that is not the body of a switch is permitted within local helper macros that are unlikely to be misused or misunderstood."
         },
         {
             "id": "SAF-6-safe",
             "analyser": {
-                "eclair": "MC3R1.R20.12"
+                "eclair": "MC3A2.R20.12"
             },
-            "name": "MC3R1.R20.12: use of a macro argument that deliberately violates the Rule",
+            "name": "MC3A2.R20.12: use of a macro argument that deliberately violates the Rule",
             "text": "A macro parameter that is itself a macro is intentionally used within the macro both as a regular parameter and for text replacement."
         },
         {
             "id": "SAF-7-safe",
             "analyser": {
-                "eclair": "MC3R1.R20.7"
+                "eclair": "MC3A2.R20.7"
             },
-            "name": "MC3R1.R20.7: deliberately non-parenthesized macro argument",
+            "name": "MC3A2.R20.7: deliberately non-parenthesized macro argument",
             "text": "A macro parameter expands to an expression that is non-parenthesized, as doing so would break the functionality."
         },
         {
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.19


From xen-changelog-bounces@lists.xenproject.org Tue Dec 17 22:11:17 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 17 Dec 2024 22:11:17 +0000
Received: from list by lists.xenproject.org with outflank-mailman.859908.1271987 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tNfmX-0007mt-JL; Tue, 17 Dec 2024 22:11:09 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 859908.1271987; Tue, 17 Dec 2024 22:11:09 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tNfmX-0007ml-Gm; Tue, 17 Dec 2024 22:11:09 +0000
Received: by outflank-mailman (input) for mailman id 859908;
 Tue, 17 Dec 2024 22:11:08 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tNfmW-0007mc-Ik
 for xen-changelog@lists.xenproject.org; Tue, 17 Dec 2024 22:11:08 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tNfmW-008Eve-06
 for xen-changelog@lists.xenproject.org;
 Tue, 17 Dec 2024 22:11:08 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tNfmW-00FSyw-0f
 for xen-changelog@lists.xenproject.org;
 Tue, 17 Dec 2024 22:11:08 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=bFebNJ90wi/sXx9d9b3MWC0AzqWvnSYFw9/7aqn5QRM=; b=XK7KfC9kMIKsD5QcGcwO4UREse
	XJ6ef78wKHeF7F1JQ9QScIHGbLr6MMNks24na+HW0ChUtcg6wysRsyMDX6K5OvrDwUDkRvgR9tGLI
	KcJT4ST+UD4+5d7jl88gk+dHwiYHszWwRNxRBtmfrPQw9lbsaHttAXXbSQjrEvCsIw3Q=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] MISRA: Unmark Rules 1.1 and 2.1 as clean following Eclair upgrade
Message-Id: <E1tNfmW-00FSyw-0f@xenbits.xenproject.org>
Date: Tue, 17 Dec 2024 22:11:08 +0000

commit 171cb318deaa0be786cc3af3599c72e8909e60f9
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Tue Dec 17 17:04:59 2024 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Dec 17 21:59:54 2024 +0000

    MISRA: Unmark Rules 1.1 and 2.1 as clean following Eclair upgrade
    
    Updating the Eclair runner has had knock-on effects with previously-clean
    rules now flagging violations:
    
     - x86:   Rule 1.1, 1940 violations
     - ARM64: Rule 1.1, 725 violations, Rule 2.1, 255 violations
    
    Fixes: 631f535a3d4f ("xen: update ECLAIR service identifiers from MC3R1 to MC3A2.")
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Roger Pau Monné <roger.pau@citrix.com>
---
 automation/eclair_analysis/ECLAIR/tagging.ecl | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/automation/eclair_analysis/ECLAIR/tagging.ecl b/automation/eclair_analysis/ECLAIR/tagging.ecl
index b524318591..982f506cc7 100644
--- a/automation/eclair_analysis/ECLAIR/tagging.ecl
+++ b/automation/eclair_analysis/ECLAIR/tagging.ecl
@@ -25,7 +25,6 @@ MC3A2.D2.1||
 MC3A2.D4.1||
 MC3A2.D4.11||
 MC3A2.D4.14||
-MC3A2.R1.1||
 MC3A2.R1.3||
 MC3A2.R1.4||
 MC3A2.R2.6||
@@ -116,7 +115,7 @@ if(string_equal(target,"x86_64"),
 )
 
 if(string_equal(target,"arm64"),
-    service_selector({"additional_clean_guidelines","MC3A2.R2.1||MC3A2.R5.3||MC3.R11.2||MC3A2.R16.6||MC3A2.R20.7"})
+    service_selector({"additional_clean_guidelines","MC3A2.R5.3||MC3.R11.2||MC3A2.R16.6||MC3A2.R20.7"})
 )
 
 -reports+={clean:added,"service(clean_guidelines_common||additional_clean_guidelines)"}
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Dec 17 22:11:19 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 17 Dec 2024 22:11:19 +0000
Received: from list by lists.xenproject.org with outflank-mailman.859909.1271991 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tNfmh-0007oY-Kc; Tue, 17 Dec 2024 22:11:19 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 859909.1271991; Tue, 17 Dec 2024 22:11:19 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tNfmh-0007oR-I8; Tue, 17 Dec 2024 22:11:19 +0000
Received: by outflank-mailman (input) for mailman id 859909;
 Tue, 17 Dec 2024 22:11:18 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tNfmg-0007oH-LU
 for xen-changelog@lists.xenproject.org; Tue, 17 Dec 2024 22:11:18 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tNfmg-008Evn-15
 for xen-changelog@lists.xenproject.org;
 Tue, 17 Dec 2024 22:11:18 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tNfmg-00FSzz-1o
 for xen-changelog@lists.xenproject.org;
 Tue, 17 Dec 2024 22:11:18 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Wt8/L0uP5YrWqEI46P+Qseu4N77aGsscsW/INJbKqmo=; b=1TgfMgTc6O1aVvl+aIgF7UzZCf
	Ff0vw1Q0xAOsgA6OjVZa+vi59cvNkrcqKxwvtP2W9JY9XMcp4zsxEYNWPYexj9ERNms33ABa1Dfh0
	DBMdM37O+/dZL7HKzndNBZCECKG7v8LPsWHMvSzLbehVDe7N85x03/qxujmC9oLLXAE8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.19] MISRA: Unmark Rules 1.1 and 2.1 as clean following Eclair upgrade
Message-Id: <E1tNfmg-00FSzz-1o@xenbits.xenproject.org>
Date: Tue, 17 Dec 2024 22:11:18 +0000

commit 8dd897e69119492989aaa034967f3a887f590197
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Tue Dec 17 17:04:59 2024 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Dec 17 22:01:58 2024 +0000

    MISRA: Unmark Rules 1.1 and 2.1 as clean following Eclair upgrade
    
    Updating the Eclair runner has had knock-on effects with previously-clean
    rules now flagging violations:
    
     - x86:   Rule 1.1, 1940 violations
     - ARM64: Rule 1.1, 725 violations, Rule 2.1, 255 violations
    
    Fixes: 631f535a3d4f ("xen: update ECLAIR service identifiers from MC3R1 to MC3A2.")
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Roger Pau Monné <roger.pau@citrix.com>
    (cherry picked from commit 171cb318deaa0be786cc3af3599c72e8909e60f9)
---
 automation/eclair_analysis/ECLAIR/tagging.ecl | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/automation/eclair_analysis/ECLAIR/tagging.ecl b/automation/eclair_analysis/ECLAIR/tagging.ecl
index eec1d50f90..91f27243dd 100644
--- a/automation/eclair_analysis/ECLAIR/tagging.ecl
+++ b/automation/eclair_analysis/ECLAIR/tagging.ecl
@@ -25,7 +25,6 @@ MC3A2.D2.1||
 MC3A2.D4.1||
 MC3A2.D4.11||
 MC3A2.D4.14||
-MC3A2.R1.1||
 MC3A2.R1.3||
 MC3A2.R1.4||
 MC3A2.R2.2||
@@ -107,7 +106,7 @@ if(string_equal(target,"x86_64"),
 )
 
 if(string_equal(target,"arm64"),
-    service_selector({"additional_clean_guidelines","MC3A2.R16.6||MC3A2.R2.1||MC3A2.R5.3||MC3A2.R7.3"})
+    service_selector({"additional_clean_guidelines","MC3A2.R16.6||MC3A2.R5.3||MC3A2.R7.3"})
 )
 
 -reports+={clean:added,"service(clean_guidelines_common||additional_clean_guidelines)"}
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.19


From xen-changelog-bounces@lists.xenproject.org Tue Dec 17 22:11:30 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 17 Dec 2024 22:11:30 +0000
Received: from list by lists.xenproject.org with outflank-mailman.859910.1271997 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tNfms-0007rb-MF; Tue, 17 Dec 2024 22:11:30 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 859910.1271997; Tue, 17 Dec 2024 22:11:30 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tNfms-0007rT-JZ; Tue, 17 Dec 2024 22:11:30 +0000
Received: by outflank-mailman (input) for mailman id 859910;
 Tue, 17 Dec 2024 22:11:29 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tNfmr-0007rE-0k
 for xen-changelog@lists.xenproject.org; Tue, 17 Dec 2024 22:11:29 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tNfmq-008Evx-2A
 for xen-changelog@lists.xenproject.org;
 Tue, 17 Dec 2024 22:11:28 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tNfmq-00FT0x-2q
 for xen-changelog@lists.xenproject.org;
 Tue, 17 Dec 2024 22:11:28 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=1B3k+ynPD9hABMVzhYX2RkU1zEq494D4YcC5o01w4ow=; b=PfcGlezg/lei+ZGl3b5SNx/CCY
	bCZMUG6s4mr4Wk4//E8+bX6pmGkhOIWExIdmOiqsYkZDXKwWWWESjtxuDpvOw2NraUnx7hsGdYg/8
	SxHp1fWjEEuFuDIvzS/82AdHymisN6jkK7O4+l/apF1otQmvetsm+vJ4nY2MAMcnfWZw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.18] automation/eclair_analysis: substitute deprecated service STD.emptrecd
Message-Id: <E1tNfmq-00FT0x-2q@xenbits.xenproject.org>
Date: Tue, 17 Dec 2024 22:11:28 +0000

commit 246917d90a32c3386cd306d1910d7a7911e24fba
Author:     Nicola Vetrini <nicola.vetrini@bugseng.com>
AuthorDate: Mon Apr 22 15:12:47 2024 +0200
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Dec 17 17:33:40 2024 +0000

    automation/eclair_analysis: substitute deprecated service STD.emptrecd
    
    The ECLAIR service STD.emptrecd (which checks for empty structures) is being
    deprecated; hence, as a preventive measure, STD.anonstct (which checks for
    structures with no named members, an UB in C99) is used here; the latter being
    a more general case than the previous one, this change does not affect the
    analysis. This new service is already supported by the current version of
    ECLAIR.
    
    No functional change.
    
    Signed-off-by: Nicola Vetrini <nicola.vetrini@bugseng.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
    (cherry picked from commit 93d6e6efa8942fb068df799527f36be406fcd2bc)
---
 automation/eclair_analysis/ECLAIR/toolchain.ecl | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/automation/eclair_analysis/ECLAIR/toolchain.ecl b/automation/eclair_analysis/ECLAIR/toolchain.ecl
index e6cd289b5e..e41b27291c 100644
--- a/automation/eclair_analysis/ECLAIR/toolchain.ecl
+++ b/automation/eclair_analysis/ECLAIR/toolchain.ecl
@@ -44,8 +44,8 @@
 -doc_end
 
 -doc_begin="See Section \"6.19 Structures with No Members\" of "GCC_MANUAL"."
--config=STD.emptrecd,behavior+={c99,GCC_ARM64,specified}
--config=STD.emptrecd,behavior+={c99,GCC_X86_64,specified}
+-config=STD.anonstct,behavior+={c99,GCC_ARM64,specified}
+-config=STD.anonstct,behavior+={c99,GCC_X86_64,specified}
 -doc_end
 
 -doc_begin="See Section \"6.18 Arrays of Length Zero\" of "GCC_MANUAL"."
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.18


From xen-changelog-bounces@lists.xenproject.org Tue Dec 17 23:33:09 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 17 Dec 2024 23:33:09 +0000
Received: from list by lists.xenproject.org with outflank-mailman.859938.1272021 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tNh3m-0002fC-Mg; Tue, 17 Dec 2024 23:33:02 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 859938.1272021; Tue, 17 Dec 2024 23: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 1tNh3m-0002f4-JA; Tue, 17 Dec 2024 23:33:02 +0000
Received: by outflank-mailman (input) for mailman id 859938;
 Tue, 17 Dec 2024 23:33:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tNh3m-0002ey-3o
 for xen-changelog@lists.xenproject.org; Tue, 17 Dec 2024 23:33:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tNh3l-008GsG-1R
 for xen-changelog@lists.xenproject.org;
 Tue, 17 Dec 2024 23:33:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tNh3l-00FbKu-2B
 for xen-changelog@lists.xenproject.org;
 Tue, 17 Dec 2024 23:33:01 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=yHV0cyPn6xTHi64n+/aOtEKzCmJk9UO/+rnl67FRfHo=; b=hOEv6n/rTudYrlNDHQwq7iKMhX
	Jp5yW9rYhelp6HACVFf8uLBvOsnci2h/iY0CcGSDfCDP7Gxr8MKsT+++Y0BmpXnlXW00VrJUsFR2B
	4kgrkZ4seh0N0oI28ToUpyQ4ZnjF95u6nX2IiiaUqu4f/DZIRHb73cydvdnNtUlgBGMQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen: update ECLAIR service identifiers from MC3R1 to MC3A2.
Message-Id: <E1tNh3l-00FbKu-2B@xenbits.xenproject.org>
Date: Tue, 17 Dec 2024 23:33:01 +0000

commit 631f535a3d4ffd66a270672f0f787d79f3bf38f8
Author:     Alessandro Zucchelli <alessandro.zucchelli@bugseng.com>
AuthorDate: Tue Dec 10 11:37:23 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Dec 17 13:04:48 2024 +0000

    xen: update ECLAIR service identifiers from MC3R1 to MC3A2.
    
    Rename all instances of ECLAIR MISRA C:2012 service identifiers,
    identified by the prefix MC3R1, to use the prefix MC3A2, which
    refers to MISRA C:2012 Amendment 2 guidelines.
    
    This update is motivated by the need to upgrade ECLAIR GitLab runners
    that use the new naming scheme for MISRA C:2012 Amendment 2 guidelines.
    
    Changes to the docs/misra directory are needed in order to keep
    comment-based deviation up to date.
    
    Signed-off-by: Alessandro Zucchelli <alessandro.zucchelli@bugseng.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
---
 automation/eclair_analysis/ECLAIR/B.UNEVALEFF.ecl  |   2 +-
 .../eclair_analysis/ECLAIR/accepted_guidelines.sh  |   2 +-
 automation/eclair_analysis/ECLAIR/analysis.ecl     |   6 +-
 automation/eclair_analysis/ECLAIR/deviations.ecl   | 244 ++++++++++-----------
 automation/eclair_analysis/ECLAIR/monitored.ecl    | 208 +++++++++---------
 automation/eclair_analysis/ECLAIR/tagging.ecl      | 176 +++++++--------
 docs/misra/documenting-violations.rst              |   6 +-
 docs/misra/safe.json                               |  32 +--
 8 files changed, 338 insertions(+), 338 deletions(-)

diff --git a/automation/eclair_analysis/ECLAIR/B.UNEVALEFF.ecl b/automation/eclair_analysis/ECLAIR/B.UNEVALEFF.ecl
index 92d8db8986..fa249b8e36 100644
--- a/automation/eclair_analysis/ECLAIR/B.UNEVALEFF.ecl
+++ b/automation/eclair_analysis/ECLAIR/B.UNEVALEFF.ecl
@@ -1,4 +1,4 @@
--clone_service=MC3R1.R13.6,B.UNEVALEFF
+-clone_service=MC3A2.R13.6,B.UNEVALEFF
 
 -config=B.UNEVALEFF,summary="The operand of the `alignof' and `typeof'  operators shall not contain any expression which has potential side effects"
 -config=B.UNEVALEFF,stmt_child_matcher=
diff --git a/automation/eclair_analysis/ECLAIR/accepted_guidelines.sh b/automation/eclair_analysis/ECLAIR/accepted_guidelines.sh
index 368135122c..2c4b339d0d 100755
--- a/automation/eclair_analysis/ECLAIR/accepted_guidelines.sh
+++ b/automation/eclair_analysis/ECLAIR/accepted_guidelines.sh
@@ -10,6 +10,6 @@ script_dir="$(
 accepted_rst=$1
 
 grep -Eo "\`(Dir|Rule) [0-9]+\.[0-9]+" ${accepted_rst} \
-     | sed -e 's/`Rule /MC3R1.R/' -e  's/`Dir /MC3R1.D/' -e 's/.*/-enable=&/' > ${script_dir}/accepted.ecl
+     | sed -e 's/`Rule /MC3A2.R/' -e  's/`Dir /MC3A2.D/' -e 's/.*/-enable=&/' > ${script_dir}/accepted.ecl
 
 echo "-enable=B.UNEVALEFF" >> ${script_dir}/accepted.ecl
diff --git a/automation/eclair_analysis/ECLAIR/analysis.ecl b/automation/eclair_analysis/ECLAIR/analysis.ecl
index df0b551812..824283a989 100644
--- a/automation/eclair_analysis/ECLAIR/analysis.ecl
+++ b/automation/eclair_analysis/ECLAIR/analysis.ecl
@@ -22,15 +22,15 @@ setq(analysis_kind,getenv("ANALYSIS_KIND"))
 -doc_begin="These configurations serve the purpose of recognizing the 'mem*' macros as
 their Standard Library equivalents."
 
--config=MC3R1.R21.14,call_select+=
+-config=MC3A2.R21.14,call_select+=
 {"macro(^memcmp$)&&any_arg(1..2, skip(__non_syntactic_paren_cast_stmts, node(string_literal)))",
  "any()", violation, "%{__callslct_any_base_fmt()}", {{arg, "%{__callslct_arg_fmt()}"}}}
 
--config=MC3R1.R21.15,call_args+=
+-config=MC3A2.R21.15,call_args+=
 {"macro(^mem(cmp|move|cpy)$)", {1, 2}, "unqual_pointee_compatible",
  "%{__argscmpr_culprit_fmt()}", "%{__argscmpr_evidence_fmt()}"}
 
--config=MC3R1.R21.16,call_select+=
+-config=MC3A2.R21.16,call_select+=
 {"macro(^memcmp$)&&any_arg(1..2, skip(__non_syntactic_paren_stmts, type(canonical(__memcmp_pte_types))))",
  "any()", violation, "%{__callslct_any_base_fmt()}", {{arg,"%{__callslct_arg_type_fmt()}"}}}
 
diff --git a/automation/eclair_analysis/ECLAIR/deviations.ecl b/automation/eclair_analysis/ECLAIR/deviations.ecl
index 2f58f29203..ae25eeb76a 100644
--- a/automation/eclair_analysis/ECLAIR/deviations.ecl
+++ b/automation/eclair_analysis/ECLAIR/deviations.ecl
@@ -4,36 +4,36 @@
 
 -doc_begin="The compiler implementation guarantees that the unreachable code is removed.
 Constant expressions and unreachable branches of if and switch statements are expected."
--config=MC3R1.R2.1,+reports={safe,"first_area(^.*has an invariantly.*$)"}
--config=MC3R1.R2.1,+reports={safe,"first_area(^.*incompatible with labeled statement$)"}
+-config=MC3A2.R2.1,+reports={safe,"first_area(^.*has an invariantly.*$)"}
+-config=MC3A2.R2.1,+reports={safe,"first_area(^.*incompatible with labeled statement$)"}
 -doc_end
 
 -doc_begin="Some functions are intended to be not referenced."
--config=MC3R1.R2.1,+reports={deliberate,"first_area(^.*is never referenced$)"}
+-config=MC3A2.R2.1,+reports={deliberate,"first_area(^.*is never referenced$)"}
 -doc_end
 
 -doc_begin="Unreachability caused by calls to the following functions or macros is deliberate and there is no risk of code being unexpectedly left out."
--config=MC3R1.R2.1,statements+={deliberate,"macro(name(BUG||assert_failed))"}
--config=MC3R1.R2.1,statements+={deliberate, "call(decl(name(__builtin_unreachable||panic||do_unexpected_trap||machine_halt||machine_restart||reboot_or_halt)))"}
+-config=MC3A2.R2.1,statements+={deliberate,"macro(name(BUG||assert_failed))"}
+-config=MC3A2.R2.1,statements+={deliberate, "call(decl(name(__builtin_unreachable||panic||do_unexpected_trap||machine_halt||machine_restart||reboot_or_halt)))"}
 -doc_end
 
 -doc_begin="Unreachability inside an ASSERT_UNREACHABLE() and analogous macro calls is deliberate and safe."
--config=MC3R1.R2.1,reports+={deliberate, "any_area(any_loc(any_exp(macro(name(ASSERT_UNREACHABLE||PARSE_ERR_RET||PARSE_ERR||FAIL_MSR||FAIL_CPUID)))))"}
+-config=MC3A2.R2.1,reports+={deliberate, "any_area(any_loc(any_exp(macro(name(ASSERT_UNREACHABLE||PARSE_ERR_RET||PARSE_ERR||FAIL_MSR||FAIL_CPUID)))))"}
 -doc_end
 
 -doc_begin="The asm-offset files are not linked deliberately, since they are used to generate definitions for asm modules."
 -file_tag+={asm_offsets, "^xen/arch/(arm|x86)/(arm32|arm64|x86_64)/asm-offsets\\.c$"}
--config=MC3R1.R2.1,reports+={deliberate, "any_area(any_loc(file(asm_offsets)))"}
+-config=MC3A2.R2.1,reports+={deliberate, "any_area(any_loc(file(asm_offsets)))"}
 -doc_end
 
 -doc_begin="Pure declarations (i.e., declarations without initialization) are
 not executable, and therefore it is safe for them to be unreachable."
--config=MC3R1.R2.1,ignored_stmts+={"any()", "pure_decl()"}
+-config=MC3A2.R2.1,ignored_stmts+={"any()", "pure_decl()"}
 -doc_end
 
 -doc_begin="The following autogenerated file is not linked deliberately."
 -file_tag+={C_runtime_failures,"^automation/eclair_analysis/C-runtime-failures\\.rst\\.c$"}
--config=MC3R1.R2.1,reports+={deliberate, "any_area(any_loc(file(C_runtime_failures)))"}
+-config=MC3A2.R2.1,reports+={deliberate, "any_area(any_loc(file(C_runtime_failures)))"}
 -doc_end
 
 -doc_begin="Proving compliance with respect to Rule 2.2 is generally impossible:
@@ -42,11 +42,11 @@ confidence that no evidence of errors in the program's logic has been missed due
 to undetected violations of Rule 2.2, if any. Testing on time behavior gives us
 confidence on the fact that, should the program contain dead code that is not
 removed by the compiler, the resulting slowdown is negligible."
--config=MC3R1.R2.2,reports+={disapplied,"any()"}
+-config=MC3A2.R2.2,reports+={disapplied,"any()"}
 -doc_end
 
 -doc_begin="Some labels are unused in certain build configurations, or are deliberately marked as unused, so that the compiler is entitled to remove them."
--config=MC3R1.R2.6,reports+={deliberate, "any_area(text(^.*__maybe_unused.*$))"}
+-config=MC3A2.R2.6,reports+={deliberate, "any_area(text(^.*__maybe_unused.*$))"}
 -doc_end
 
 #
@@ -55,7 +55,7 @@ removed by the compiler, the resulting slowdown is negligible."
 
 -doc_begin="Comments starting with '/*' and containing hyperlinks are safe as
 they are not instances of commented-out code."
--config=MC3R1.R3.1,reports+={safe, "first_area(text(^.*https?://.*$))"}
+-config=MC3A2.R3.1,reports+={safe, "first_area(text(^.*https?://.*$))"}
 -doc_end
 
 #
@@ -63,25 +63,25 @@ they are not instances of commented-out code."
 #
 
 -doc_begin="The directive has been accepted only for the ARM codebase."
--config=MC3R1.D4.3,reports+={disapplied,"!(any_area(any_loc(file(^xen/arch/arm/arm64/.*$))))"}
+-config=MC3A2.D4.3,reports+={disapplied,"!(any_area(any_loc(file(^xen/arch/arm/arm64/.*$))))"}
 -doc_end
 
 -doc_begin="The inline asm in 'arm64/lib/bitops.c' is tightly coupled with the surronding C code that acts as a wrapper, so it has been decided not to add an additional encapsulation layer."
 -file_tag+={arm64_bitops, "^xen/arch/arm/arm64/lib/bitops\\.c$"}
--config=MC3R1.D4.3,reports+={deliberate, "all_area(any_loc(file(arm64_bitops)&&any_exp(macro(^(bit|test)op$))))"}
--config=MC3R1.D4.3,reports+={deliberate, "any_area(any_loc(file(arm64_bitops))&&context(name(int_clear_mask16)))"}
+-config=MC3A2.D4.3,reports+={deliberate, "all_area(any_loc(file(arm64_bitops)&&any_exp(macro(^(bit|test)op$))))"}
+-config=MC3A2.D4.3,reports+={deliberate, "any_area(any_loc(file(arm64_bitops))&&context(name(int_clear_mask16)))"}
 -doc_end
 
 -doc_begin="Files that are intended to be included more than once do not need to
 conform to the directive."
--config=MC3R1.D4.10,reports+={safe, "first_area(text(^/\\* This file is legitimately included multiple times\\. \\*/$, begin-4))"}
--config=MC3R1.D4.10,reports+={safe, "first_area(text(^/\\* Generated file, do not edit! \\*/$, begin-3))"}
--config=MC3R1.D4.10,reports+={safe, "all_area(all_loc(file(^xen/include/generated/autoconf.h$)))"}
+-config=MC3A2.D4.10,reports+={safe, "first_area(text(^/\\* This file is legitimately included multiple times\\. \\*/$, begin-4))"}
+-config=MC3A2.D4.10,reports+={safe, "first_area(text(^/\\* Generated file, do not edit! \\*/$, begin-3))"}
+-config=MC3A2.D4.10,reports+={safe, "all_area(all_loc(file(^xen/include/generated/autoconf.h$)))"}
 -doc_end
 
 -doc_begin="Including multiple times a .c file is safe because every function or data item
 it defines would (in the common case) be already defined. Peer reviewed by the community."
--config=MC3R1.D4.10,reports+={safe, "all_area(all_loc(^.*\\.c$))"}
+-config=MC3A2.D4.10,reports+={safe, "all_area(all_loc(^.*\\.c$))"}
 -doc_end
 
 #
@@ -90,50 +90,50 @@ it defines would (in the common case) be already defined. Peer reviewed by the c
 
 -doc_begin="The project adopted the rule with an exception listed in
 'docs/misra/rules.rst'"
--config=MC3R1.R5.3,reports+={safe, "any_area(any_loc(any_exp(macro(^READ_SYSREG$))&&any_exp(macro(^WRITE_SYSREG$))))"}
--config=MC3R1.R5.3,reports+={safe, "any_area(any_loc(any_exp(macro(^max(_t)?$))&&any_exp(macro(^min(_t)?$))))"}
--config=MC3R1.R5.3,reports+={safe, "any_area(any_loc(any_exp(macro(^read[bwlq]$))&&any_exp(macro(^read[bwlq]_relaxed$))))"}
--config=MC3R1.R5.3,reports+={safe, "any_area(any_loc(any_exp(macro(^per_cpu$))&&any_exp(macro(^this_cpu$))))"}
--config=MC3R1.R5.3,reports+={safe, "any_area(any_loc(any_exp(macro(^__emulate_2op$))&&any_exp(macro(^__emulate_2op_nobyte$))))"}
--config=MC3R1.R5.3,reports+={safe, "any_area(any_loc(any_exp(macro(^read_debugreg$))&&any_exp(macro(^write_debugreg$))))"}
+-config=MC3A2.R5.3,reports+={safe, "any_area(any_loc(any_exp(macro(^READ_SYSREG$))&&any_exp(macro(^WRITE_SYSREG$))))"}
+-config=MC3A2.R5.3,reports+={safe, "any_area(any_loc(any_exp(macro(^max(_t)?$))&&any_exp(macro(^min(_t)?$))))"}
+-config=MC3A2.R5.3,reports+={safe, "any_area(any_loc(any_exp(macro(^read[bwlq]$))&&any_exp(macro(^read[bwlq]_relaxed$))))"}
+-config=MC3A2.R5.3,reports+={safe, "any_area(any_loc(any_exp(macro(^per_cpu$))&&any_exp(macro(^this_cpu$))))"}
+-config=MC3A2.R5.3,reports+={safe, "any_area(any_loc(any_exp(macro(^__emulate_2op$))&&any_exp(macro(^__emulate_2op_nobyte$))))"}
+-config=MC3A2.R5.3,reports+={safe, "any_area(any_loc(any_exp(macro(^read_debugreg$))&&any_exp(macro(^write_debugreg$))))"}
 -doc_end
 
 -doc_begin="Macros expanding to their own identifier (e.g., \"#define x x\") are deliberate."
--config=MC3R1.R5.5,reports+={deliberate, "all_area(macro(same_id_body())||!macro(!same_id_body()))"}
+-config=MC3A2.R5.5,reports+={deliberate, "all_area(macro(same_id_body())||!macro(!same_id_body()))"}
 -doc_end
 
 -doc_begin="There is no clash between function like macros and not callable objects."
--config=MC3R1.R5.5,reports+={deliberate, "all_area(macro(function_like())||decl(any()))&&all_area(macro(any())||!decl(kind(function))&&!decl(__function_pointer_decls))"}
+-config=MC3A2.R5.5,reports+={deliberate, "all_area(macro(function_like())||decl(any()))&&all_area(macro(any())||!decl(kind(function))&&!decl(__function_pointer_decls))"}
 -doc_end
 
 -doc_begin="Clashes between function names and macros are deliberate for string handling functions since some architectures may want to use their own arch-specific implementation."
--config=MC3R1.R5.5,reports+={deliberate, "all_area(all_loc(file(^xen/arch/x86/string\\.c|xen/include/xen/string\\.h|xen/lib/.*$)))"}
+-config=MC3A2.R5.5,reports+={deliberate, "all_area(all_loc(file(^xen/arch/x86/string\\.c|xen/include/xen/string\\.h|xen/lib/.*$)))"}
 -doc_end
 
 -doc_begin="In libelf, clashes between macros and function names are deliberate and needed to prevent the use of undecorated versions of memcpy, memset and memmove."
--config=MC3R1.R5.5,reports+={deliberate, "any_area(decl(kind(function))||any_loc(macro(name(memcpy||memset||memmove))))&&any_area(any_loc(file(^xen/common/libelf/libelf-private\\.h$)))"}
+-config=MC3A2.R5.5,reports+={deliberate, "any_area(decl(kind(function))||any_loc(macro(name(memcpy||memset||memmove))))&&any_area(any_loc(file(^xen/common/libelf/libelf-private\\.h$)))"}
 -doc_end
 
 -doc_begin="The type \"ret_t\" is deliberately defined multiple times,
 depending on the guest."
--config=MC3R1.R5.6,reports+={deliberate,"any_area(any_loc(text(^.*ret_t.*$)))"}
+-config=MC3A2.R5.6,reports+={deliberate,"any_area(any_loc(text(^.*ret_t.*$)))"}
 -doc_end
 
 -doc_begin="On X86, the types \"guest_intpte_t\", \"guest_l1e_t\" and
 \"guest_l2e_t\" are deliberately defined multiple times, depending on the
 number of guest paging levels."
--config=MC3R1.R5.6,reports+={deliberate,"any_area(any_loc(file(^xen/arch/x86/include/asm/guest_pt\\.h$)))&&any_area(any_loc(text(^.*(guest_intpte_t|guest_l[12]e_t).*$)))"}
+-config=MC3A2.R5.6,reports+={deliberate,"any_area(any_loc(file(^xen/arch/x86/include/asm/guest_pt\\.h$)))&&any_area(any_loc(text(^.*(guest_intpte_t|guest_l[12]e_t).*$)))"}
 -doc_end
 
 -doc_begin="The following files are imported from the gnu-efi package."
 -file_tag+={adopted_r5_6,"^xen/include/efi/.*$"}
 -file_tag+={adopted_r5_6,"^xen/arch/.*/include/asm/.*/efibind\\.h$"}
--config=MC3R1.R5.6,reports+={deliberate,"any_area(any_loc(file(adopted_r5_6)))"}
+-config=MC3A2.R5.6,reports+={deliberate,"any_area(any_loc(file(adopted_r5_6)))"}
 -doc_end
 
 -doc_begin="The project intentionally reuses tag names in order to have identifiers matching the applicable external specifications as well as established internal conventions.
 As there is little possibility for developer confusion not resulting into compilation errors, the risk of renaming outweighs the potential advantages of compliance."
--config=MC3R1.R5.7,reports+={deliberate,"any()"}
+-config=MC3A2.R5.7,reports+={deliberate,"any()"}
 -doc_end
 
 #
@@ -142,7 +142,7 @@ As there is little possibility for developer confusion not resulting into compil
 
 -doc_begin="It is safe to use certain octal constants the way they are defined
 in specifications, manuals, and algorithm descriptions."
--config=MC3R1.R7.1,reports+={safe, "any_area(any_loc(any_exp(text(^.*octal-ok.*$))))"}
+-config=MC3A2.R7.1,reports+={safe, "any_area(any_loc(any_exp(text(^.*octal-ok.*$))))"}
 -doc_end
 
 -doc_begin="Violations in files that maintainers have asked to not modify in the
@@ -155,17 +155,17 @@ context of R7.2."
 -file_tag+={adopted_r7_2,"^xen/arch/x86/cpu/intel\\.c$"}
 -file_tag+={adopted_r7_2,"^xen/arch/x86/cpu/amd\\.c$"}
 -file_tag+={adopted_r7_2,"^xen/arch/x86/cpu/common\\.c$"}
--config=MC3R1.R7.2,reports+={deliberate,"any_area(any_loc(file(adopted_r7_2)))"}
+-config=MC3A2.R7.2,reports+={deliberate,"any_area(any_loc(file(adopted_r7_2)))"}
 -doc_end
 
 -doc_begin="Violations caused by __HYPERVISOR_VIRT_START are related to the
 particular use of it done in xen_mk_ulong."
--config=MC3R1.R7.2,reports+={deliberate,"any_area(any_loc(macro(name(BUILD_BUG_ON))))"}
+-config=MC3A2.R7.2,reports+={deliberate,"any_area(any_loc(macro(name(BUILD_BUG_ON))))"}
 -doc_end
 
 -doc_begin="Allow pointers of non-character type as long as the pointee is
 const-qualified."
--config=MC3R1.R7.4,same_pointee=false
+-config=MC3A2.R7.4,same_pointee=false
 -doc_end
 
 #
@@ -173,7 +173,7 @@ const-qualified."
 #
 
 -doc_begin="The type ret_t is deliberately used and defined as int or long depending on the architecture."
--config=MC3R1.R8.3,reports+={deliberate,"any_area(any_loc(text(^.*ret_t.*$)))"}
+-config=MC3A2.R8.3,reports+={deliberate,"any_area(any_loc(text(^.*ret_t.*$)))"}
 -doc_end
 
 -doc_begin="The following files are imported from Linux and decompress.h defines a unique and documented interface towards all the (adopted) decompress functions."
@@ -183,71 +183,71 @@ const-qualified."
 -file_tag+={adopted_decompress_r8_3,"^xen/common/unlzo\\.c$"}
 -file_tag+={adopted_decompress_r8_3,"^xen/common/unxz\\.c$"}
 -file_tag+={adopted_decompress_r8_3,"^xen/common/unzstd\\.c$"}
--config=MC3R1.R8.3,reports+={deliberate,"any_area(any_loc(file(adopted_decompress_r8_3)))&&any_area(any_loc(file(^xen/include/xen/decompress\\.h$)))"}
+-config=MC3A2.R8.3,reports+={deliberate,"any_area(any_loc(file(adopted_decompress_r8_3)))&&any_area(any_loc(file(^xen/include/xen/decompress\\.h$)))"}
 -doc_end
 
 -doc_begin="Parameter name \"unused\" (with an optional numeric suffix) is deliberate and makes explicit the intention of not using such parameter within the function."
--config=MC3R1.R8.3,reports+={deliberate, "any_area(^.*parameter `unused[0-9]*'.*$)"}
+-config=MC3A2.R8.3,reports+={deliberate, "any_area(^.*parameter `unused[0-9]*'.*$)"}
 -doc_end
 
 -doc_begin="The following file is imported from Linux: ignore for now."
 -file_tag+={adopted_time_r8_3,"^xen/arch/x86/time\\.c$"}
--config=MC3R1.R8.3,reports+={deliberate,"any_area(any_loc(file(adopted_time_r8_3)))&&(any_area(any_loc(file(^xen/include/xen/time\\.h$)))||any_area(any_loc(file(^xen/arch/x86/include/asm/setup\\.h$))))"}
+-config=MC3A2.R8.3,reports+={deliberate,"any_area(any_loc(file(adopted_time_r8_3)))&&(any_area(any_loc(file(^xen/include/xen/time\\.h$)))||any_area(any_loc(file(^xen/arch/x86/include/asm/setup\\.h$))))"}
 -doc_end
 
 -doc_begin="The following file is imported from Linux: ignore for now."
 -file_tag+={adopted_cpu_idle_r8_3,"^xen/arch/x86/acpi/cpu_idle\\.c$"}
--config=MC3R1.R8.3,reports+={deliberate,"any_area(any_loc(file(adopted_cpu_idle_r8_3)))&&any_area(any_loc(file(^xen/include/xen/pmstat\\.h$)))"}
+-config=MC3A2.R8.3,reports+={deliberate,"any_area(any_loc(file(adopted_cpu_idle_r8_3)))&&any_area(any_loc(file(^xen/include/xen/pmstat\\.h$)))"}
 -doc_end
 
 -doc_begin="The following file is imported from Linux: ignore for now."
 -file_tag+={adopted_mpparse_r8_3,"^xen/arch/x86/mpparse\\.c$"}
--config=MC3R1.R8.3,reports+={deliberate,"any_area(any_loc(file(adopted_mpparse_r8_3)))&&any_area(any_loc(file(^xen/arch/x86/include/asm/mpspec\\.h$)))"}
+-config=MC3A2.R8.3,reports+={deliberate,"any_area(any_loc(file(adopted_mpparse_r8_3)))&&any_area(any_loc(file(^xen/arch/x86/include/asm/mpspec\\.h$)))"}
 -doc_end
 
 -doc_begin="The definitions present in this file are meant to generate definitions for asm modules, and are not called by C code. Therefore the absence of prior declarations is safe."
 -file_tag+={asm_offsets, "^xen/arch/(arm|x86)/(arm32|arm64|x86_64)/asm-offsets\\.c$"}
--config=MC3R1.R8.4,reports+={safe, "first_area(any_loc(file(asm_offsets)))"}
+-config=MC3A2.R8.4,reports+={safe, "first_area(any_loc(file(asm_offsets)))"}
 -doc_end
 
 -doc_begin="The functions defined in this file are meant to be called from gcc-generated code in a non-release build configuration.
 Therefore the absence of prior declarations is safe."
 -file_tag+={gcov, "^xen/common/coverage/gcov_base\\.c$"}
--config=MC3R1.R8.4,reports+={safe, "first_area(any_loc(file(gcov)))"}
+-config=MC3A2.R8.4,reports+={safe, "first_area(any_loc(file(gcov)))"}
 -doc_end
 
 -doc_begin="Recognize the occurrence of current_stack_pointer as a declaration."
 -file_tag+={asm_defns, "^xen/arch/x86/include/asm/asm_defns\\.h$"}
--config=MC3R1.R8.4,declarations+={safe, "loc(file(asm_defns))&&^current_stack_pointer$"}
+-config=MC3A2.R8.4,declarations+={safe, "loc(file(asm_defns))&&^current_stack_pointer$"}
 -doc_end
 
 -doc_begin="The function apei_(read|check|clear)_mce are dead code and are excluded from non-debug builds, therefore the absence of prior declarations is safe."
--config=MC3R1.R8.4,declarations+={safe, "^apei_(read|check|clear)_mce\\(.*$"}
+-config=MC3A2.R8.4,declarations+={safe, "^apei_(read|check|clear)_mce\\(.*$"}
 -doc_end
 
 -doc_begin="asmlinkage is a marker to indicate that the function is only used to interface with asm modules."
--config=MC3R1.R8.4,declarations+={safe,"loc(text(^(?s).*asmlinkage.*$, -1..0))"}
+-config=MC3A2.R8.4,declarations+={safe,"loc(text(^(?s).*asmlinkage.*$, -1..0))"}
 -doc_end
 
 -doc_begin="Given that bsearch and sort are defined with the attribute 'gnu_inline', it's deliberate not to have a prior declaration.
 See Section \"6.33.1 Common Function Attributes\" of \"GCC_MANUAL\" for a full explanation of gnu_inline."
 -file_tag+={bsearch_sort, "^xen/include/xen/(sort|lib)\\.h$"}
--config=MC3R1.R8.4,reports+={deliberate, "any_area(any_loc(file(bsearch_sort))&&decl(name(bsearch||sort)))"}
+-config=MC3A2.R8.4,reports+={deliberate, "any_area(any_loc(file(bsearch_sort))&&decl(name(bsearch||sort)))"}
 -doc_end
 
 -doc_begin="first_valid_mfn is defined in this way because the current lack of NUMA support in Arm and PPC requires it."
 -file_tag+={first_valid_mfn, "^xen/common/page_alloc\\.c$"}
--config=MC3R1.R8.4,declarations+={deliberate,"loc(file(first_valid_mfn))"}
+-config=MC3A2.R8.4,declarations+={deliberate,"loc(file(first_valid_mfn))"}
 -doc_end
 
 -doc_begin="The following variables are compiled in multiple translation units
 belonging to different executables and therefore are safe."
--config=MC3R1.R8.6,declarations+={safe, "name(current_stack_pointer||bsearch||sort)"}
+-config=MC3A2.R8.6,declarations+={safe, "name(current_stack_pointer||bsearch||sort)"}
 -doc_end
 
 -doc_begin="Declarations without definitions are allowed (specifically when the
 definition is compiled-out or optimized-out by the compiler)"
--config=MC3R1.R8.6,reports+={deliberate, "first_area(^.*has no definition$)"}
+-config=MC3A2.R8.6,reports+={deliberate, "first_area(^.*has no definition$)"}
 -doc_end
 
 -doc_begin="The search procedure for Unix linkers is well defined, see ld(1)
@@ -258,11 +258,11 @@ the linker will include the appropriate file(s) from the archive\".
 In Xen, thanks to the order in which file names appear in the build commands,
 if arch-specific definitions are present, they get always linked in before
 searching in the lib.a archive resulting from xen/lib."
--config=MC3R1.R8.6,declarations+={deliberate, "loc(file(^xen/lib/.*$))"}
+-config=MC3A2.R8.6,declarations+={deliberate, "loc(file(^xen/lib/.*$))"}
 -doc_end
 
 -doc_begin="The gnu_inline attribute without static is deliberately allowed."
--config=MC3R1.R8.10,declarations+={deliberate,"property(gnu_inline)"}
+-config=MC3A2.R8.10,declarations+={deliberate,"property(gnu_inline)"}
 -doc_end
 
 #
@@ -272,12 +272,12 @@ searching in the lib.a archive resulting from xen/lib."
 -doc_begin="Violations in files that maintainers have asked to not modify in the
 context of R9.1."
 -file_tag+={adopted_r9_1,"^xen/arch/arm/arm64/lib/find_next_bit\\.c$"}
--config=MC3R1.R9.1,reports+={deliberate,"any_area(any_loc(file(adopted_r9_1)))"}
+-config=MC3A2.R9.1,reports+={deliberate,"any_area(any_loc(file(adopted_r9_1)))"}
 -doc_end
 
 -doc_begin="The possibility of committing mistakes by specifying an explicit
 dimension is higher than omitting the dimension."
--config=MC3R1.R9.5,reports+={deliberate, "any()"}
+-config=MC3A2.R9.5,reports+={deliberate, "any()"}
 -doc_end
 
 #
@@ -285,45 +285,45 @@ dimension is higher than omitting the dimension."
 #
 
 -doc_begin="The value-preserving conversions of integer constants are safe"
--config=MC3R1.R10.1,etypes={safe,"any()","preserved_integer_constant()"}
--config=MC3R1.R10.3,etypes={safe,"any()","preserved_integer_constant()"}
--config=MC3R1.R10.4,etypes={safe,"any()","preserved_integer_constant()||sibling(rhs,preserved_integer_constant())"}
+-config=MC3A2.R10.1,etypes={safe,"any()","preserved_integer_constant()"}
+-config=MC3A2.R10.3,etypes={safe,"any()","preserved_integer_constant()"}
+-config=MC3A2.R10.4,etypes={safe,"any()","preserved_integer_constant()||sibling(rhs,preserved_integer_constant())"}
 -doc_end
 
 -doc_begin="Shifting non-negative integers to the right is safe."
--config=MC3R1.R10.1,etypes+={safe,
+-config=MC3A2.R10.1,etypes+={safe,
   "stmt(node(binary_operator)&&operator(shr))",
   "src_expr(definitely_in(0..))"}
 -doc_end
 
 -doc_begin="Shifting non-negative integers to the left is safe if the result is
 still non-negative."
--config=MC3R1.R10.1,etypes+={safe,
+-config=MC3A2.R10.1,etypes+={safe,
   "stmt(node(binary_operator)&&operator(shl)&&definitely_in(0..))",
   "src_expr(definitely_in(0..))"}
 -doc_end
 
 -doc_begin="Bitwise logical operations on non-negative integers are safe."
--config=MC3R1.R10.1,etypes+={safe,
+-config=MC3A2.R10.1,etypes+={safe,
   "stmt(node(binary_operator)&&operator(and||or||xor))",
   "src_expr(definitely_in(0..))"}
 -doc_end
 
 -doc_begin="The implicit conversion to Boolean for logical operator arguments is well known to all Xen developers to be a comparison with 0"
--config=MC3R1.R10.1,etypes+={safe, "stmt(operator(logical)||node(conditional_operator||binary_conditional_operator))", "dst_type(ebool||boolean)"}
+-config=MC3A2.R10.1,etypes+={safe, "stmt(operator(logical)||node(conditional_operator||binary_conditional_operator))", "dst_type(ebool||boolean)"}
 -doc_end
 
 -doc_begin="The macro ISOLATE_LSB encapsulates a well-known pattern to obtain
 a mask where only the lowest bit set in the argument is set, if any, for unsigned
 integers arguments on two's complement architectures
 (all the architectures supported by Xen satisfy this requirement)."
--config=MC3R1.R10.1,reports+={safe, "any_area(any_loc(any_exp(macro(^ISOLATE_LSB$))))"}
+-config=MC3A2.R10.1,reports+={safe, "any_area(any_loc(any_exp(macro(^ISOLATE_LSB$))))"}
 -doc_end
 
 -doc_begin="XEN only supports architectures where signed integers are
 representend using two's complement and all the XEN developers are aware of
 this."
--config=MC3R1.R10.1,etypes+={safe,
+-config=MC3A2.R10.1,etypes+={safe,
   "stmt(operator(and||or||xor||not||and_assign||or_assign||xor_assign))",
   "any()"}
 -doc_end
@@ -334,7 +334,7 @@ C language, GCC does not use the latitude given in C99 and C11 only to treat
 certain aspects of signed `<<' as undefined. However, -fsanitize=shift (and
 -fsanitize=undefined) will diagnose such cases. They are also diagnosed where
 constant expressions are required.\""
--config=MC3R1.R10.1,etypes+={safe,
+-config=MC3A2.R10.1,etypes+={safe,
   "stmt(operator(shl||shr||shl_assign||shr_assign))",
   "any()"}
 -doc_end
@@ -344,7 +344,7 @@ constant expressions are required.\""
 #
 
 -doc_begin="The conversion from a function pointer to unsigned long or (void *) does not lose any information, provided that the target type has enough bits to store it."
--config=MC3R1.R11.1,casts+={safe,
+-config=MC3A2.R11.1,casts+={safe,
   "from(type(canonical(__function_pointer_types)))
    &&to(type(canonical(builtin(unsigned long)||pointer(builtin(void)))))
    &&relation(definitely_preserves_value)"
@@ -352,14 +352,14 @@ constant expressions are required.\""
 -doc_end
 
 -doc_begin="The conversion from a function pointer to a boolean has a well-known semantics that do not lead to unexpected behaviour."
--config=MC3R1.R11.1,casts+={safe,
+-config=MC3A2.R11.1,casts+={safe,
   "from(type(canonical(__function_pointer_types)))
    &&kind(pointer_to_boolean)"
 }
 -doc_end
 
 -doc_begin="The conversion from a pointer to an incomplete type to unsigned long does not lose any information, provided that the target type has enough bits to store it."
--config=MC3R1.R11.2,casts+={safe,
+-config=MC3A2.R11.2,casts+={safe,
   "from(type(any()))
    &&to(type(canonical(builtin(unsigned long))))
    &&relation(definitely_preserves_value)"
@@ -367,20 +367,20 @@ constant expressions are required.\""
 -doc_end
 
 -doc_begin="Conversions to object pointers that have a pointee type with a smaller (i.e., less strict) alignment requirement are safe."
--config=MC3R1.R11.3,casts+={safe,
+-config=MC3A2.R11.3,casts+={safe,
   "!relation(more_aligned_pointee)"
 }
 -doc_end
 
 -doc_begin="Conversions from and to integral types are safe, in the assumption that the target type has enough bits to store the value.
 See also Section \"4.7 Arrays and Pointers\" of \"GCC_MANUAL\""
--config=MC3R1.R11.6,casts+={safe,
+-config=MC3A2.R11.6,casts+={safe,
     "(from(type(canonical(integral())))||to(type(canonical(integral()))))
      &&relation(definitely_preserves_value)"}
 -doc_end
 
 -doc_begin="The conversion from a pointer to a boolean has a well-known semantics that do not lead to unexpected behaviour."
--config=MC3R1.R11.6,casts+={safe,
+-config=MC3A2.R11.6,casts+={safe,
   "from(type(canonical(__pointer_types)))
    &&kind(pointer_to_boolean)"
 }
@@ -390,11 +390,11 @@ See also Section \"4.7 Arrays and Pointers\" of \"GCC_MANUAL\""
 with the provided offset. The resulting pointer is then immediately cast back to its
 original type, which preserves the qualifier. This use is deemed safe.
 Fixing this violation would require to increase code complexity and lower readability."
--config=MC3R1.R11.8,reports+={safe,"any_area(any_loc(any_exp(macro(^container_of$))))"}
+-config=MC3A2.R11.8,reports+={safe,"any_area(any_loc(any_exp(macro(^container_of$))))"}
 -doc_end
 
 -doc_begin="This construct is used to check if the type is scalar, and for this purpose the use of 0 as a null pointer constant is deliberate."
--config=MC3R1.R11.9,reports+={deliberate, "any_area(any_loc(any_exp(macro(^__ACCESS_ONCE$))))"
+-config=MC3A2.R11.9,reports+={deliberate, "any_area(any_loc(any_exp(macro(^__ACCESS_ONCE$))))"
 }
 -doc_end
 
@@ -404,16 +404,16 @@ Fixing this violation would require to increase code complexity and lower readab
 
 -doc_begin="All developers and reviewers can be safely assumed to be well aware
 of the short-circuit evaluation strategy of such logical operators."
--config=MC3R1.R13.5,reports+={disapplied,"any()"}
+-config=MC3A2.R13.5,reports+={disapplied,"any()"}
 -doc_end
 
 -doc_begin="Macros alternative_v?call[0-9] use sizeof and typeof to check that the argument types match the corresponding parameter ones."
--config=MC3R1.R13.6,reports+={deliberate,"any_area(any_loc(any_exp(macro(^alternative_vcall[0-9]$))&&file(^xen/arch/x86/include/asm/alternative\\.h*$)))"}
+-config=MC3A2.R13.6,reports+={deliberate,"any_area(any_loc(any_exp(macro(^alternative_vcall[0-9]$))&&file(^xen/arch/x86/include/asm/alternative\\.h*$)))"}
 -config=B.UNEVALEFF,reports+={deliberate,"any_area(any_loc(any_exp(macro(^alternative_v?call[0-9]$))&&file(^xen/arch/x86/include/asm/alterantive\\.h*$)))"}
 -doc_end
 
 -doc_begin="Anything, no matter how complicated, inside the BUILD_BUG_ON macro is subject to a compile-time evaluation without relevant side effects."
--config=MC3R1.R13.6,reports+={safe,"any_area(any_loc(any_exp(macro(name(BUILD_BUG_ON)))))"}
+-config=MC3A2.R13.6,reports+={safe,"any_area(any_loc(any_exp(macro(name(BUILD_BUG_ON)))))"}
 -config=B.UNEVALEFF,reports+={safe,"any_area(any_loc(any_exp(macro(name(BUILD_BUG_ON)))))"}
 -doc_end
 
@@ -424,31 +424,31 @@ of the short-circuit evaluation strategy of such logical operators."
 -doc_begin="The severe restrictions imposed by this rule on the use of for
 statements are not balanced by the presumed facilitation of the peer review
 activity."
--config=MC3R1.R14.2,reports+={disapplied,"any()"}
+-config=MC3A2.R14.2,reports+={disapplied,"any()"}
 -doc_end
 
 -doc_begin="The XEN team relies on the fact that invariant conditions of 'if' statements and conditional operators are deliberate"
--config=MC3R1.R14.3,statements+={deliberate, "wrapped(any(),node(if_stmt||conditional_operator||binary_conditional_operator))" }
+-config=MC3A2.R14.3,statements+={deliberate, "wrapped(any(),node(if_stmt||conditional_operator||binary_conditional_operator))" }
 -doc_end
 
 -doc_begin="Switches having a 'sizeof' operator as the condition are deliberate and have limited scope."
--config=MC3R1.R14.3,statements+={deliberate, "wrapped(any(),node(switch_stmt)&&child(cond, operator(sizeof)))" }
+-config=MC3A2.R14.3,statements+={deliberate, "wrapped(any(),node(switch_stmt)&&child(cond, operator(sizeof)))" }
 -doc_end
 
 -doc_begin="The use of an invariant size argument in {put,get}_unsafe_size and array_access_ok, as defined in arch/x86(_64)?/include/asm/uaccess.h is deliberate and is deemed safe."
 -file_tag+={x86_uaccess, "^xen/arch/x86(_64)?/include/asm/uaccess\\.h$"}
--config=MC3R1.R14.3,reports+={deliberate, "any_area(any_loc(file(x86_uaccess)&&any_exp(macro(^(put|get)_unsafe_size$))))"}
--config=MC3R1.R14.3,reports+={deliberate, "any_area(any_loc(file(x86_uaccess)&&any_exp(macro(^array_access_ok$))))"}
+-config=MC3A2.R14.3,reports+={deliberate, "any_area(any_loc(file(x86_uaccess)&&any_exp(macro(^(put|get)_unsafe_size$))))"}
+-config=MC3A2.R14.3,reports+={deliberate, "any_area(any_loc(file(x86_uaccess)&&any_exp(macro(^array_access_ok$))))"}
 -doc_end
 
 -doc_begin="A controlling expression of 'if' and iteration statements having integer, character or pointer type has a semantics that is well-known to all Xen developers."
--config=MC3R1.R14.4,etypes+={deliberate, "any()", "src_type(integer||character)||src_expr(type(desugar(pointer(any()))))"}
+-config=MC3A2.R14.4,etypes+={deliberate, "any()", "src_type(integer||character)||src_expr(type(desugar(pointer(any()))))"}
 -doc_end
 
 -doc_begin="The XEN team relies on the fact that the enum is_dying has the
 constant with assigned value 0 act as false and the other ones as true,
 therefore have the same behavior of a boolean"
--config=MC3R1.R14.4,etypes+={deliberate, "stmt(child(cond,child(expr,ref(^<?domain>?::is_dying$))))","src_type(enum)"}
+-config=MC3A2.R14.4,etypes+={deliberate, "stmt(child(cond,child(expr,ref(^<?domain>?::is_dying$))))","src_type(enum)"}
 -doc_end
 
 #
@@ -459,58 +459,58 @@ therefore have the same behavior of a boolean"
 therefore it is deemed better to leave such files as is."
 -file_tag+={x86_emulate,"^xen/arch/x86/x86_emulate/.*$"}
 -file_tag+={x86_svm_emulate,"^xen/arch/x86/hvm/svm/emulate\\.c$"}
--config=MC3R1.R16.2,reports+={deliberate, "any_area(any_loc(file(x86_emulate||x86_svm_emulate)))"}
+-config=MC3A2.R16.2,reports+={deliberate, "any_area(any_loc(file(x86_emulate||x86_svm_emulate)))"}
 -doc_end
 
 -doc_begin="Statements that change the control flow (i.e., break, continue, goto, return) and calls to functions that do not return the control back are \"allowed terminal statements\"."
 -stmt_selector+={r16_3_allowed_terminal, "node(break_stmt||continue_stmt||goto_stmt||return_stmt)||call(property(noreturn))"}
--config=MC3R1.R16.3,terminals+={safe, "r16_3_allowed_terminal"}
+-config=MC3A2.R16.3,terminals+={safe, "r16_3_allowed_terminal"}
 -doc_end
 
 -doc_begin="An if-else statement having both branches ending with an allowed terminal statement is itself an allowed terminal statement."
 -stmt_selector+={r16_3_if, "node(if_stmt)&&(child(then,r16_3_allowed_terminal)||child(then,any_stmt(stmt,-1,r16_3_allowed_terminal)))"}
 -stmt_selector+={r16_3_else, "node(if_stmt)&&(child(else,r16_3_allowed_terminal)||child(else,any_stmt(stmt,-1,r16_3_allowed_terminal)))"}
 -stmt_selector+={r16_3_if_else, "r16_3_if&&r16_3_else"}
--config=MC3R1.R16.3,terminals+={safe, "r16_3_if_else"}
+-config=MC3A2.R16.3,terminals+={safe, "r16_3_if_else"}
 -doc_end
 
 -doc_begin="An if-else statement having an always true condition and the true branch ending with an allowed terminal statement is itself an allowed terminal statement."
 -stmt_selector+={r16_3_if_true, "r16_3_if&&child(cond,definitely_in(1..))"}
--config=MC3R1.R16.3,terminals+={safe, "r16_3_if_true"}
+-config=MC3A2.R16.3,terminals+={safe, "r16_3_if_true"}
 -doc_end
 
 -doc_begin="A switch clause ending with a statement expression which, in turn, ends with an allowed terminal statement is safe."
--config=MC3R1.R16.3,terminals+={safe, "node(stmt_expr)&&child(stmt,node(compound_stmt)&&any_stmt(stmt,-1,r16_3_allowed_terminal||r16_3_if_else||r16_3_if_true))"}
+-config=MC3A2.R16.3,terminals+={safe, "node(stmt_expr)&&child(stmt,node(compound_stmt)&&any_stmt(stmt,-1,r16_3_allowed_terminal||r16_3_if_else||r16_3_if_true))"}
 -doc_end
 
 -doc_begin="A switch clause ending with a do-while-false the body of which, in turn, ends with an allowed terminal statement is safe.
 An exception to that is the macro ASSERT_UNREACHABLE() which is effective in debug build only: a switch clause ending with ASSERT_UNREACHABLE() is not considered safe."
--config=MC3R1.R16.3,terminals+={safe, "!macro(name(ASSERT_UNREACHABLE))&&node(do_stmt)&&child(cond,definitely_in(0))&&child(body,any_stmt(stmt,-1,r16_3_allowed_terminal||r16_3_if_else||r16_3_if_true))"}
+-config=MC3A2.R16.3,terminals+={safe, "!macro(name(ASSERT_UNREACHABLE))&&node(do_stmt)&&child(cond,definitely_in(0))&&child(body,any_stmt(stmt,-1,r16_3_allowed_terminal||r16_3_if_else||r16_3_if_true))"}
 -doc_end
 
 -doc_begin="Switch clauses ending with pseudo-keyword \"fallthrough\" are
 safe."
--config=MC3R1.R16.3,reports+={safe, "any_area(end_loc(any_exp(text(/fallthrough;/))))"}
+-config=MC3A2.R16.3,reports+={safe, "any_area(end_loc(any_exp(text(/fallthrough;/))))"}
 -doc_end
 
 -doc_begin="Switch clauses ending with failure method \"BUG()\" are safe."
--config=MC3R1.R16.3,reports+={safe, "any_area(end_loc(any_exp(text(/BUG\\(\\);/))))"}
+-config=MC3A2.R16.3,reports+={safe, "any_area(end_loc(any_exp(text(/BUG\\(\\);/))))"}
 -doc_end
 
 -doc_begin="Switch clauses ending with an explicit comment indicating the fallthrough intention are safe."
--config=MC3R1.R16.3,reports+={safe, "any_area(end_loc(any_exp(text(^(?s).*/\\* [fF]all ?through\\.? \\*/.*$,0..2))))"}
+-config=MC3A2.R16.3,reports+={safe, "any_area(end_loc(any_exp(text(^(?s).*/\\* [fF]all ?through\\.? \\*/.*$,0..2))))"}
 -doc_end
 
 -doc_begin="Switch statements having a controlling expression of enum type deliberately do not have a default case: gcc -Wall enables -Wswitch which warns (and breaks the build as we use -Werror) if one of the enum labels is missing from the switch."
--config=MC3R1.R16.4,reports+={deliberate,'any_area(kind(context)&&^.* has no `default.*$&&stmt(node(switch_stmt)&&child(cond,skip(__non_syntactic_paren_stmts,type(canonical(enum_underlying_type(any())))))))'}
+-config=MC3A2.R16.4,reports+={deliberate,'any_area(kind(context)&&^.* has no `default.*$&&stmt(node(switch_stmt)&&child(cond,skip(__non_syntactic_paren_stmts,type(canonical(enum_underlying_type(any())))))))'}
 -doc_end
 
 -doc_begin="A switch statement with a single switch clause and no default label may be used in place of an equivalent if statement if it is considered to improve readability."
--config=MC3R1.R16.4,switch_clauses+={deliberate,"switch(1)&&default(0)"}
+-config=MC3A2.R16.4,switch_clauses+={deliberate,"switch(1)&&default(0)"}
 -doc_end
 
 -doc_begin="A switch statement with a single switch clause and no default label may be used in place of an equivalent if statement if it is considered to improve readability."
--config=MC3R1.R16.6,switch_clauses+={deliberate, "default(0)"}
+-config=MC3A2.R16.6,switch_clauses+={deliberate, "default(0)"}
 -doc_end
 
 #
@@ -518,16 +518,16 @@ safe."
 #
 
 -doc_begin="printf()-like functions are allowed to use the variadic features provided by stdarg.h."
--config=MC3R1.R17.1,reports+={deliberate,"any_area(^.*va_list.*$&&context(ancestor_or_self(^.*printk\\(.*\\)$)))"}
--config=MC3R1.R17.1,reports+={deliberate,"any_area(^.*va_list.*$&&context(ancestor_or_self(^.*printf\\(.*\\)$)))"}
--config=MC3R1.R17.1,reports+={deliberate,"any_area(^.*va_list.*$&&context(ancestor_or_self(name(panic)&&kind(function))))"}
--config=MC3R1.R17.1,reports+={deliberate,"any_area(^.*va_list.*$&&context(ancestor_or_self(name(elf_call_log_callback)&&kind(function))))"}
--config=MC3R1.R17.1,reports+={deliberate,"any_area(^.*va_list.*$&&context(ancestor_or_self(name(vprintk_common)&&kind(function))))"}
--config=MC3R1.R17.1,macros+={hide , "^va_(arg|start|copy|end)$"}
+-config=MC3A2.R17.1,reports+={deliberate,"any_area(^.*va_list.*$&&context(ancestor_or_self(^.*printk\\(.*\\)$)))"}
+-config=MC3A2.R17.1,reports+={deliberate,"any_area(^.*va_list.*$&&context(ancestor_or_self(^.*printf\\(.*\\)$)))"}
+-config=MC3A2.R17.1,reports+={deliberate,"any_area(^.*va_list.*$&&context(ancestor_or_self(name(panic)&&kind(function))))"}
+-config=MC3A2.R17.1,reports+={deliberate,"any_area(^.*va_list.*$&&context(ancestor_or_self(name(elf_call_log_callback)&&kind(function))))"}
+-config=MC3A2.R17.1,reports+={deliberate,"any_area(^.*va_list.*$&&context(ancestor_or_self(name(vprintk_common)&&kind(function))))"}
+-config=MC3A2.R17.1,macros+={hide , "^va_(arg|start|copy|end)$"}
 -doc_end
 
 -doc_begin="Not using the return value of a function does not endanger safety if it coincides with an actual argument."
--config=MC3R1.R17.7,calls+={safe, "any()", "decl(name(__builtin_memcpy||__builtin_memmove||__builtin_memset||cpumask_check))"}
+-config=MC3A2.R17.7,calls+={safe, "any()", "decl(name(__builtin_memcpy||__builtin_memmove||__builtin_memset||cpumask_check))"}
 -doc_end
 
 #
@@ -538,16 +538,16 @@ safe."
 are guaranteed not to be exploited by a compiler that relies on the absence of
 C99 Undefined Behaviour 45: Pointers that do not point into, or just beyond, the same array object are subtracted (6.5.6)."
 -eval_file=linker_symbols.ecl
--config=MC3R1.R18.2,reports+={safe, "any_area(stmt(operator(sub)&&child(lhs||rhs, skip(__non_syntactic_paren_stmts, ref(linker_symbols)))))"}
+-config=MC3A2.R18.2,reports+={safe, "any_area(stmt(operator(sub)&&child(lhs||rhs, skip(__non_syntactic_paren_stmts, ref(linker_symbols)))))"}
 -doc_end
 
 -doc_begin="The following macro performs a subtraction between pointers to obtain the mfn, but does not lead to undefined behaviour."
--config=MC3R1.R18.2,reports+={safe, "any_area(any_loc(any_exp(macro(^page_to_mfn$))))"}
+-config=MC3A2.R18.2,reports+={safe, "any_area(any_loc(any_exp(macro(^page_to_mfn$))))"}
 -doc_end
 
 -doc_begin="Flexible array members are deliberately used and XEN developers are aware of the dangers related to them:
 unexpected result when the structure is given as argument to a sizeof() operator and the truncation in assignment between structures."
--config=MC3R1.R18.7,reports+={deliberate, "any()"}
+-config=MC3A2.R18.7,reports+={deliberate, "any()"}
 -doc_end
 
 #
@@ -558,7 +558,7 @@ unexpected result when the structure is given as argument to a sizeof() operator
 as function arguments; (2) as macro arguments; (3) as array indices; (4) as lhs
 in assignments; (5) as initializers, possibly designated, in initalizer lists;
 (6) as the constant expression in a switch clause label."
--config=MC3R1.R20.7,expansion_context=
+-config=MC3A2.R20.7,expansion_context=
 {safe, "context(__call_expr_arg_contexts)"},
 {safe, "left_right(^[(,\\[]$,^[),\\]]$)"},
 {safe, "context(skip_to(__expr_non_syntactic_contexts, stmt_child(node(array_subscript_expr), subscript)))"},
@@ -571,62 +571,62 @@ in assignments; (5) as initializers, possibly designated, in initalizer lists;
 breaking the macro's logic; futhermore, the macro is only ever used in the context
 of the IS_ENABLED or STATIC_IF/STATIC_IF_NOT macros, so it always receives a literal
 0 or 1 as input, posing no risk to safety."
--config=MC3R1.R20.7,reports+={safe, "any_area(any_loc(any_exp(macro(^___config_enabled$))))"}
+-config=MC3A2.R20.7,reports+={safe, "any_area(any_loc(any_exp(macro(^___config_enabled$))))"}
 -doc_end
 
 -doc_begin="Violations due to the use of macros defined in files that are
 not in scope for compliance are allowed, as that is imported code."
 -file_tag+={gnu_efi_include, "^xen/include/efi/.*$"}
 -file_tag+={acpi_cpu_idle, "^xen/arch/x86/acpi/cpu_idle\\.c$"}
--config=MC3R1.R20.7,reports+={safe, "any_area(any_loc(file(gnu_efi_include)||any_exp(macro(^NextMemoryDescriptor$))))"}
--config=MC3R1.R20.7,reports+={safe, "any_area(any_loc(file(acpi_cpu_idle)))"}
+-config=MC3A2.R20.7,reports+={safe, "any_area(any_loc(file(gnu_efi_include)||any_exp(macro(^NextMemoryDescriptor$))))"}
+-config=MC3A2.R20.7,reports+={safe, "any_area(any_loc(file(acpi_cpu_idle)))"}
 -doc_end
 
 -doc_begin="To avoid compromising readability, the macros alternative_(v)?call[0-9] are allowed
 not to parenthesize their arguments."
--config=MC3R1.R20.7,reports+={safe, "any_area(any_loc(any_exp(macro(^alternative_(v)?call[0-9]$))))"}
+-config=MC3A2.R20.7,reports+={safe, "any_area(any_loc(any_exp(macro(^alternative_(v)?call[0-9]$))))"}
 -doc_end
 
 -doc_begin="The argument 'x' of the count_args_ macro can't be parenthesized as
 the rule would require, without breaking the functionality of the macro. The uses
 of this macro do not lead to developer confusion, and can thus be deviated."
--config=MC3R1.R20.7,reports+={safe, "any_area(any_loc(any_exp(macro(^count_args_$))))"}
+-config=MC3A2.R20.7,reports+={safe, "any_area(any_loc(any_exp(macro(^count_args_$))))"}
 -doc_end
 
 -doc_begin="The argument \"fn\" in macros {COMPILE,RUNTIME}_CHECK is not parenthesized
 on purpose, to be able to test function-like macros. Given the specialized and limited
 use of this macro, it is deemed ok to deviate them."
--config=MC3R1.R20.7,reports+={deliberate, "any_area(any_loc(any_exp(macro(^(COMPILE_CHECK|RUNTIME_CHECK)$))))"}
+-config=MC3A2.R20.7,reports+={deliberate, "any_area(any_loc(any_exp(macro(^(COMPILE_CHECK|RUNTIME_CHECK)$))))"}
 -doc_end
 
 -doc_begin="Problems related to operator precedence can not occur if the expansion of the macro argument is surrounded by tokens '{', '}' and ';'."
--config=MC3R1.R20.7,expansion_context+={safe, "left_right(^[\\{;]$,^[;\\}]$)"}
+-config=MC3A2.R20.7,expansion_context+={safe, "left_right(^[\\{;]$,^[;\\}]$)"}
 -doc_end
 
 -doc_begin="Uses of variadic macros that have one of their arguments defined as
 a macro and used within the body for both ordinary parameter expansion and as an
 operand to the # or ## operators have a behavior that is well-understood and
 deliberate."
--config=MC3R1.R20.12,macros+={deliberate, "variadic()"}
+-config=MC3A2.R20.12,macros+={deliberate, "variadic()"}
 -doc_end
 
 -doc_begin="Uses of a macro parameter for ordinary expansion and as an operand
 to the # or ## operators within the following macros are deliberate, to provide
 useful diagnostic messages to the user."
--config=MC3R1.R20.12,macros+={deliberate, "name(ASSERT||BUILD_BUG_ON||BUILD_BUG_ON_ZERO||RUNTIME_CHECK)"}
+-config=MC3A2.R20.12,macros+={deliberate, "name(ASSERT||BUILD_BUG_ON||BUILD_BUG_ON_ZERO||RUNTIME_CHECK)"}
 -doc_end
 
 -doc_begin="The helper macro GENERATE_CASE may use a macro parameter for ordinary
 expansion and token pasting to improve readability. Only instances where this
 leads to a violation of the Rule are deviated."
 -file_tag+={deliberate_generate_case, "^xen/arch/arm/vcpreg\\.c$"}
--config=MC3R1.R20.12,macros+={deliberate, "name(GENERATE_CASE)&&loc(file(deliberate_generate_case))"}
+-config=MC3A2.R20.12,macros+={deliberate, "name(GENERATE_CASE)&&loc(file(deliberate_generate_case))"}
 -doc_end
 
 -doc_begin="The macro DEFINE is defined and used in excluded files asm-offsets.c.
 This may still cause violations if entities outside these files are referred to
 in the expansion."
--config=MC3R1.R20.12,macros+={deliberate, "name(DEFINE)&&loc(file(asm_offsets))"}
+-config=MC3A2.R20.12,macros+={deliberate, "name(DEFINE)&&loc(file(asm_offsets))"}
 -doc_end
 
 #
@@ -636,7 +636,7 @@ in the expansion."
 -doc_begin="or, and and xor are reserved identifiers because they constitute alternate
 spellings for the corresponding operators (they are defined as macros by iso646.h).
 However, Xen doesn't use standard library headers, so there is no risk of overlap."
--config=MC3R1.R21.2,reports+={safe, "any_area(stmt(ref(kind(label)&&^(or|and|xor|not)$)))"}
+-config=MC3A2.R21.2,reports+={safe, "any_area(stmt(ref(kind(label)&&^(or|and|xor|not)$)))"}
 -doc_end
 
 -doc_begin="Xen does not use the functions provided by the Standard Library, but
@@ -645,8 +645,8 @@ The implementation of these functions is available in source form, so the undefi
 or implementation-defined behaviors contemplated by the C Standard do not apply.
 If some undefined or unspecified behavior does arise in the implementation, it
 falls under the jurisdiction of other MISRA rules."
--config=MC3R1.R21.9,reports+={deliberate, "any()"}
--config=MC3R1.R21.10,reports+={deliberate, "any()"}
+-config=MC3A2.R21.9,reports+={deliberate, "any()"}
+-config=MC3A2.R21.10,reports+={deliberate, "any()"}
 -doc_end
 
 #
@@ -671,7 +671,7 @@ falls under the jurisdiction of other MISRA rules."
 programmers:no developers' confusion is not possible. In addition, adopted code
 is assumed to work as is. Reports that are fully contained in adopted code are
 hidden/tagged with the 'adopted' tag."
--service_selector={developer_confusion_guidelines,"^(MC3R1\\.R2\\.1|MC3R1\\.R2\\.2|MC3R1\\.R2\\.3|MC3R1\\.R2\\.4|MC3R1\\.R2\\.5|MC3R1\\.R2\\.6|MC3R1\\.R2\\.7|MC3R1\\.R4\\.1|MC3R1\\.R5\\.3|MC3R1\\.R5\\.6|MC3R1\\.R5\\.7|MC3R1\\.R5\\.8|MC3R1\\.R5\\.9|MC3R1\\.R7\\.1|MC3R1\\.R7\\.2|MC3R1\\.R7\\.3|MC3R1\\.R8\\.7|MC3R1\\.R8\\.8|MC3R1\\.R8\\.9|MC3R1\\.R8\\.11|MC3R1\\.R8\\.12|MC3R1\\.R8\\.13|MC3R1\\.R9\\.3|MC3R1\\.R9\\.4|MC3R1\\.R9\\.5|MC3R1\\.R10\\.2|MC3R1\\.R10\\.5|MC3R1\\.R10\\.6|MC3R1\\.R10\\.7|MC3R1\\.R10\\.8|MC3R1\\.R11\\.9|MC3R1\\.R12\\.1|MC3R1\\.R12\\.3|MC3R1\\.R12\\.4|MC3R1\\.R13\\.5|MC3R1\\.R14\\.1|MC3R1\\.R14\\.2|MC3R1\\.R14\\.3|MC3R1\\.R15\\.1|MC3R1\\.R15\\.2|MC3R1\\.R15\\.3|MC3R1\\.R15\\.4|MC3R1\\.R15\\.5|MC3R1\\.R15\\.6|MC3R1\\.R15\\.7|MC3R1\\.R16\\.1|MC3R1\\.R16\\.2|MC3R1\\.R16\\.3|MC3R1\\.R16\\.4|MC3R1\\.R16\\.5|MC3R1\\.R16\\.6|MC3R1\\.R16\\.7|MC3R1\\.R17\\.7|MC3R1\\.R17\\.8|MC3R1\\.R18\\.4|MC3R1\\.R18\\.5)$"
+-service_selector={developer_confusion_guidelines,"^(MC3A2\\.R2\\.1|MC3A2\\.R2\\.2|MC3A2\\.R2\\.3|MC3A2\\.R2\\.4|MC3A2\\.R2\\.5|MC3A2\\.R2\\.6|MC3A2\\.R2\\.7|MC3A2\\.R4\\.1|MC3A2\\.R5\\.3|MC3A2\\.R5\\.6|MC3A2\\.R5\\.7|MC3A2\\.R5\\.8|MC3A2\\.R5\\.9|MC3A2\\.R7\\.1|MC3A2\\.R7\\.2|MC3A2\\.R7\\.3|MC3A2\\.R8\\.7|MC3A2\\.R8\\.8|MC3A2\\.R8\\.9|MC3A2\\.R8\\.11|MC3A2\\.R8\\.12|MC3A2\\.R8\\.13|MC3A2\\.R9\\.3|MC3A2\\.R9\\.4|MC3A2\\.R9\\.5|MC3A2\\.R10\\.2|MC3A2\\.R10\\.5|MC3A2\\.R10\\.6|MC3A2\\.R10\\.7|MC3A2\\.R10\\.8|MC3A2\\.R11\\.9|MC3A2\\.R12\\.1|MC3A2\\.R12\\.3|MC3A2\\.R12\\.4|MC3A2\\.R13\\.5|MC3A2\\.R14\\.1|MC3A2\\.R14\\.2|MC3A2\\.R14\\.3|MC3A2\\.R15\\.1|MC3A2\\.R15\\.2|MC3A2\\.R15\\.3|MC3A2\\.R15\\.4|MC3A2\\.R15\\.5|MC3A2\\.R15\\.6|MC3A2\\.R15\\.7|MC3A2\\.R16\\.1|MC3A2\\.R16\\.2|MC3A2\\.R16\\.3|MC3A2\\.R16\\.4|MC3A2\\.R16\\.5|MC3A2\\.R16\\.6|MC3A2\\.R16\\.7|MC3A2\\.R17\\.7|MC3A2\\.R17\\.8|MC3A2\\.R18\\.4|MC3A2\\.R18\\.5)$"
 }
 -config=developer_confusion_guidelines,reports+={relied,adopted_report}
 -doc_end
diff --git a/automation/eclair_analysis/ECLAIR/monitored.ecl b/automation/eclair_analysis/ECLAIR/monitored.ecl
index 4e1deef7a7..8351996ec8 100644
--- a/automation/eclair_analysis/ECLAIR/monitored.ecl
+++ b/automation/eclair_analysis/ECLAIR/monitored.ecl
@@ -1,106 +1,106 @@
 -doc_begin="A set of guidelines that are clean or that only have few violations left."
--enable=MC3R1.D1.1
--enable=MC3R1.D2.1
--enable=MC3R1.D4.1
--enable=MC3R1.D4.3
--enable=MC3R1.D4.7
--enable=MC3R1.D4.10
--enable=MC3R1.D4.11
--enable=MC3R1.D4.14
--enable=MC3R1.R1.1
--enable=MC3R1.R1.3
--enable=MC3R1.R1.4
--enable=MC3R1.R2.1
--enable=MC3R1.R2.6
--enable=MC3R1.R3.1
--enable=MC3R1.R3.2
--enable=MC3R1.R4.1
--enable=MC3R1.R4.2
--enable=MC3R1.R5.1
--enable=MC3R1.R5.2
--enable=MC3R1.R5.3
--enable=MC3R1.R5.4
--enable=MC3R1.R5.5
--enable=MC3R1.R5.6
--enable=MC3R1.R6.1
--enable=MC3R1.R6.2
--enable=MC3R1.R7.1
--enable=MC3R1.R7.2
--enable=MC3R1.R7.3
--enable=MC3R1.R7.4
--enable=MC3R1.R8.1
--enable=MC3R1.R8.2
--enable=MC3R1.R8.3
--enable=MC3R1.R8.4
--enable=MC3R1.R8.5
--enable=MC3R1.R8.6
--enable=MC3R1.R8.8
--enable=MC3R1.R8.10
--enable=MC3R1.R8.12
--enable=MC3R1.R8.14
--enable=MC3R1.R9.2
--enable=MC3R1.R9.3
--enable=MC3R1.R9.4
--enable=MC3R1.R10.1
--enable=MC3R1.R10.2
--enable=MC3R1.R11.1
--enable=MC3R1.R11.2
--enable=MC3R1.R11.7
--enable=MC3R1.R11.8
--enable=MC3R1.R11.9
--enable=MC3R1.R12.5
--enable=MC3R1.R13.1
--enable=MC3R1.R13.2
--enable=MC3R1.R13.6
--enable=MC3R1.R14.1
--enable=MC3R1.R14.4
--enable=MC3R1.R16.2
--enable=MC3R1.R16.3
--enable=MC3R1.R16.4
--enable=MC3R1.R16.6
--enable=MC3R1.R16.7
--enable=MC3R1.R17.1
--enable=MC3R1.R17.3
--enable=MC3R1.R17.4
--enable=MC3R1.R17.5
--enable=MC3R1.R17.6
--enable=MC3R1.R18.1
--enable=MC3R1.R18.2
--enable=MC3R1.R18.6
--enable=MC3R1.R18.8
--enable=MC3R1.R19.1
--enable=MC3R1.R20.2
--enable=MC3R1.R20.3
--enable=MC3R1.R20.4
--enable=MC3R1.R20.6
--enable=MC3R1.R20.7
--enable=MC3R1.R20.9
--enable=MC3R1.R20.11
--enable=MC3R1.R20.12
--enable=MC3R1.R20.13
--enable=MC3R1.R20.14
--enable=MC3R1.R21.3
--enable=MC3R1.R21.4
--enable=MC3R1.R21.5
--enable=MC3R1.R21.7
--enable=MC3R1.R21.8
--enable=MC3R1.R21.9
--enable=MC3R1.R21.10
--enable=MC3R1.R21.12
--enable=MC3R1.R21.13
--enable=MC3R1.R21.17
--enable=MC3R1.R21.18
--enable=MC3R1.R21.19
--enable=MC3R1.R21.20
--enable=MC3R1.R21.21
--enable=MC3R1.R22.1
--enable=MC3R1.R22.2
--enable=MC3R1.R22.3
--enable=MC3R1.R22.4
--enable=MC3R1.R22.5
--enable=MC3R1.R22.6
--enable=MC3R1.R22.7
--enable=MC3R1.R22.8
--enable=MC3R1.R22.9
--enable=MC3R1.R22.10
+-enable=MC3A2.D1.1
+-enable=MC3A2.D2.1
+-enable=MC3A2.D4.1
+-enable=MC3A2.D4.3
+-enable=MC3A2.D4.7
+-enable=MC3A2.D4.10
+-enable=MC3A2.D4.11
+-enable=MC3A2.D4.14
+-enable=MC3A2.R1.1
+-enable=MC3A2.R1.3
+-enable=MC3A2.R1.4
+-enable=MC3A2.R2.1
+-enable=MC3A2.R2.6
+-enable=MC3A2.R3.1
+-enable=MC3A2.R3.2
+-enable=MC3A2.R4.1
+-enable=MC3A2.R4.2
+-enable=MC3A2.R5.1
+-enable=MC3A2.R5.2
+-enable=MC3A2.R5.3
+-enable=MC3A2.R5.4
+-enable=MC3A2.R5.5
+-enable=MC3A2.R5.6
+-enable=MC3A2.R6.1
+-enable=MC3A2.R6.2
+-enable=MC3A2.R7.1
+-enable=MC3A2.R7.2
+-enable=MC3A2.R7.3
+-enable=MC3A2.R7.4
+-enable=MC3A2.R8.1
+-enable=MC3A2.R8.2
+-enable=MC3A2.R8.3
+-enable=MC3A2.R8.4
+-enable=MC3A2.R8.5
+-enable=MC3A2.R8.6
+-enable=MC3A2.R8.8
+-enable=MC3A2.R8.10
+-enable=MC3A2.R8.12
+-enable=MC3A2.R8.14
+-enable=MC3A2.R9.2
+-enable=MC3A2.R9.3
+-enable=MC3A2.R9.4
+-enable=MC3A2.R10.1
+-enable=MC3A2.R10.2
+-enable=MC3A2.R11.1
+-enable=MC3A2.R11.2
+-enable=MC3A2.R11.7
+-enable=MC3A2.R11.8
+-enable=MC3A2.R11.9
+-enable=MC3A2.R12.5
+-enable=MC3A2.R13.1
+-enable=MC3A2.R13.2
+-enable=MC3A2.R13.6
+-enable=MC3A2.R14.1
+-enable=MC3A2.R14.4
+-enable=MC3A2.R16.2
+-enable=MC3A2.R16.3
+-enable=MC3A2.R16.4
+-enable=MC3A2.R16.6
+-enable=MC3A2.R16.7
+-enable=MC3A2.R17.1
+-enable=MC3A2.R17.3
+-enable=MC3A2.R17.4
+-enable=MC3A2.R17.5
+-enable=MC3A2.R17.6
+-enable=MC3A2.R18.1
+-enable=MC3A2.R18.2
+-enable=MC3A2.R18.6
+-enable=MC3A2.R18.8
+-enable=MC3A2.R19.1
+-enable=MC3A2.R20.2
+-enable=MC3A2.R20.3
+-enable=MC3A2.R20.4
+-enable=MC3A2.R20.6
+-enable=MC3A2.R20.7
+-enable=MC3A2.R20.9
+-enable=MC3A2.R20.11
+-enable=MC3A2.R20.12
+-enable=MC3A2.R20.13
+-enable=MC3A2.R20.14
+-enable=MC3A2.R21.3
+-enable=MC3A2.R21.4
+-enable=MC3A2.R21.5
+-enable=MC3A2.R21.7
+-enable=MC3A2.R21.8
+-enable=MC3A2.R21.9
+-enable=MC3A2.R21.10
+-enable=MC3A2.R21.12
+-enable=MC3A2.R21.13
+-enable=MC3A2.R21.17
+-enable=MC3A2.R21.18
+-enable=MC3A2.R21.19
+-enable=MC3A2.R21.20
+-enable=MC3A2.R21.21
+-enable=MC3A2.R22.1
+-enable=MC3A2.R22.2
+-enable=MC3A2.R22.3
+-enable=MC3A2.R22.4
+-enable=MC3A2.R22.5
+-enable=MC3A2.R22.6
+-enable=MC3A2.R22.7
+-enable=MC3A2.R22.8
+-enable=MC3A2.R22.9
+-enable=MC3A2.R22.10
 -doc_end
diff --git a/automation/eclair_analysis/ECLAIR/tagging.ecl b/automation/eclair_analysis/ECLAIR/tagging.ecl
index 755ea3271f..b524318591 100644
--- a/automation/eclair_analysis/ECLAIR/tagging.ecl
+++ b/automation/eclair_analysis/ECLAIR/tagging.ecl
@@ -20,93 +20,93 @@
 -doc_begin="Clean guidelines: new violations for these guidelines are not accepted."
 
 -service_selector={clean_guidelines_common,
-"MC3R1.D1.1||
-MC3R1.D2.1||
-MC3R1.D4.1||
-MC3R1.D4.11||
-MC3R1.D4.14||
-MC3R1.R1.1||
-MC3R1.R1.3||
-MC3R1.R1.4||
-MC3R1.R2.6||
-MC3R1.R3.1||
-MC3R1.R3.2||
-MC3R1.R4.1||
-MC3R1.R4.2||
-MC3R1.R5.1||
-MC3R1.R5.2||
-MC3R1.R5.3||
-MC3R1.R5.4||
-MC3R1.R5.6||
-MC3R1.R6.1||
-MC3R1.R6.2||
-MC3R1.R7.1||
-MC3R1.R7.2||
-MC3R1.R7.3||
-MC3R1.R7.4||
-MC3R1.R8.1||
-MC3R1.R8.2||
-MC3R1.R8.3||
-MC3R1.R8.4||
-MC3R1.R8.5||
-MC3R1.R8.6||
-MC3R1.R8.8||
-MC3R1.R8.10||
-MC3R1.R8.12||
-MC3R1.R8.14||
-MC3R1.R9.2||
-MC3R1.R9.3||
-MC3R1.R9.4||
-MC3R1.R10.2||
-MC3R1.R11.6||
-MC3R1.R11.7||
-MC3R1.R11.9||
-MC3R1.R12.5||
-MC3R1.R13.6||
-MC3R1.R14.1||
-MC3R1.R14.3||
-MC3R1.R14.4||
-MC3R1.R16.2||
-MC3R1.R16.3||
-MC3R1.R16.7||
-MC3R1.R17.1||
-MC3R1.R17.3||
-MC3R1.R17.4||
-MC3R1.R17.5||
-MC3R1.R17.6||
-MC3R1.R18.6||
-MC3R1.R18.8||
-MC3R1.R20.2||
-MC3R1.R20.3||
-MC3R1.R20.4||
-MC3R1.R20.6||
-MC3R1.R20.9||
-MC3R1.R20.11||
-MC3R1.R20.12||
-MC3R1.R20.13||
-MC3R1.R20.14||
-MC3R1.R21.3||
-MC3R1.R21.4||
-MC3R1.R21.5||
-MC3R1.R21.7||
-MC3R1.R21.8||
-MC3R1.R21.9||
-MC3R1.R21.10||
-MC3R1.R21.11||
-MC3R1.R21.12||
-MC3R1.R21.13||
-MC3R1.R21.19||
-MC3R1.R21.21||
-MC3R1.R22.1||
-MC3R1.R22.2||
-MC3R1.R22.3||
-MC3R1.R22.4||
-MC3R1.R22.5||
-MC3R1.R22.6||
-MC3R1.R22.7||
-MC3R1.R22.8||
-MC3R1.R22.9||
-MC3R1.R22.10"
+"MC3A2.D1.1||
+MC3A2.D2.1||
+MC3A2.D4.1||
+MC3A2.D4.11||
+MC3A2.D4.14||
+MC3A2.R1.1||
+MC3A2.R1.3||
+MC3A2.R1.4||
+MC3A2.R2.6||
+MC3A2.R3.1||
+MC3A2.R3.2||
+MC3A2.R4.1||
+MC3A2.R4.2||
+MC3A2.R5.1||
+MC3A2.R5.2||
+MC3A2.R5.3||
+MC3A2.R5.4||
+MC3A2.R5.6||
+MC3A2.R6.1||
+MC3A2.R6.2||
+MC3A2.R7.1||
+MC3A2.R7.2||
+MC3A2.R7.3||
+MC3A2.R7.4||
+MC3A2.R8.1||
+MC3A2.R8.2||
+MC3A2.R8.3||
+MC3A2.R8.4||
+MC3A2.R8.5||
+MC3A2.R8.6||
+MC3A2.R8.8||
+MC3A2.R8.10||
+MC3A2.R8.12||
+MC3A2.R8.14||
+MC3A2.R9.2||
+MC3A2.R9.3||
+MC3A2.R9.4||
+MC3A2.R10.2||
+MC3A2.R11.6||
+MC3A2.R11.7||
+MC3A2.R11.9||
+MC3A2.R12.5||
+MC3A2.R13.6||
+MC3A2.R14.1||
+MC3A2.R14.3||
+MC3A2.R14.4||
+MC3A2.R16.2||
+MC3A2.R16.3||
+MC3A2.R16.7||
+MC3A2.R17.1||
+MC3A2.R17.3||
+MC3A2.R17.4||
+MC3A2.R17.5||
+MC3A2.R17.6||
+MC3A2.R18.6||
+MC3A2.R18.8||
+MC3A2.R20.2||
+MC3A2.R20.3||
+MC3A2.R20.4||
+MC3A2.R20.6||
+MC3A2.R20.9||
+MC3A2.R20.11||
+MC3A2.R20.12||
+MC3A2.R20.13||
+MC3A2.R20.14||
+MC3A2.R21.3||
+MC3A2.R21.4||
+MC3A2.R21.5||
+MC3A2.R21.7||
+MC3A2.R21.8||
+MC3A2.R21.9||
+MC3A2.R21.10||
+MC3A2.R21.11||
+MC3A2.R21.12||
+MC3A2.R21.13||
+MC3A2.R21.19||
+MC3A2.R21.21||
+MC3A2.R22.1||
+MC3A2.R22.2||
+MC3A2.R22.3||
+MC3A2.R22.4||
+MC3A2.R22.5||
+MC3A2.R22.6||
+MC3A2.R22.7||
+MC3A2.R22.8||
+MC3A2.R22.9||
+MC3A2.R22.10"
 }
 
 -setq=target,getenv("XEN_TARGET_ARCH")
@@ -116,7 +116,7 @@ if(string_equal(target,"x86_64"),
 )
 
 if(string_equal(target,"arm64"),
-    service_selector({"additional_clean_guidelines","MC3R1.R2.1||MC3R1.R5.3||MC3.R11.2||MC3R1.R16.6||MC3R1.R20.7"})
+    service_selector({"additional_clean_guidelines","MC3A2.R2.1||MC3A2.R5.3||MC3.R11.2||MC3A2.R16.6||MC3A2.R20.7"})
 )
 
 -reports+={clean:added,"service(clean_guidelines_common||additional_clean_guidelines)"}
diff --git a/docs/misra/documenting-violations.rst b/docs/misra/documenting-violations.rst
index 8f1cbd83b8..d26377d5aa 100644
--- a/docs/misra/documenting-violations.rst
+++ b/docs/misra/documenting-violations.rst
@@ -53,7 +53,7 @@ Here is an example to add a new justification in safe.json::
 |            "analyser": {
 |                "cppcheck": "misra-c2012-20.7",
 |                "coverity": "misra_c_2012_rule_20_7_violation",
-|                "eclair": "MC3R1.R20.7"
+|                "eclair": "MC3A2.R20.7"
 |            },
 |            "name": "R20.7 C macro parameters not used as expression",
 |            "text": "The macro parameters used in this [...]"
@@ -138,7 +138,7 @@ 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
+| MC3A2.R8.6 for program 'xen/xen-syms', variable '_start' has no definition
 
 Also coverity reports it, here is an extract of the finding:
 
@@ -165,7 +165,7 @@ We will prepare our entry in the safe.json database::
 |        {
 |            "id": "SAF-1-safe",
 |            "analyser": {
-|                "eclair": "MC3R1.R8.6",
+|                "eclair": "MC3A2.R8.6",
 |                "coverity": "misra_c_2012_rule_8_6_violation"
 |            },
 |            "name": "Rule 8.6: linker script defined symbols",
diff --git a/docs/misra/safe.json b/docs/misra/safe.json
index 684346386e..b8a4f878ea 100644
--- a/docs/misra/safe.json
+++ b/docs/misra/safe.json
@@ -4,7 +4,7 @@
         {
             "id": "SAF-0-safe",
             "analyser": {
-                "eclair": "MC3R1.R8.6",
+                "eclair": "MC3A2.R8.6",
                 "coverity": "misra_c_2012_rule_8_6_violation"
             },
             "name": "Rule 8.6: linker script defined symbols",
@@ -13,7 +13,7 @@
         {
             "id": "SAF-1-safe",
             "analyser": {
-                "eclair": "MC3R1.R8.4"
+                "eclair": "MC3A2.R8.4"
             },
             "name": "Rule 8.4: asm-only definition",
             "text": "Functions and variables used only by asm modules do not need to have a visible declaration prior to their definition."
@@ -21,23 +21,23 @@
         {
             "id": "SAF-2-safe",
             "analyser": {
-                "eclair": "MC3R1.R10.1"
+                "eclair": "MC3A2.R10.1"
             },
-            "name": "MC3R1.R10.1: use of an enumeration constant in an arithmetic operation",
+            "name": "MC3A2.R10.1: use of an enumeration constant in an arithmetic operation",
             "text": "This violation can be fixed with a cast to (int) of the enumeration constant, but a deviation was chosen due to code readability (see also the comment in BITS_TO_LONGS)."
         },
         {
             "id": "SAF-3-safe",
             "analyser": {
-                "eclair": "MC3R1.R20.4"
+                "eclair": "MC3A2.R20.4"
             },
-            "name": "MC3R1.R20.4: allow the definition of a macro with the same name as a keyword in some special cases",
+            "name": "MC3A2.R20.4: allow the definition of a macro with the same name as a keyword in some special cases",
             "text": "The definition of a macro with the same name as a keyword can be useful in certain configurations to improve the guarantees that can be provided by Xen. See docs/misra/deviations.rst for a precise rationale for all such cases."
         },
         {
             "id": "SAF-4-safe",
             "analyser": {
-                "eclair": "MC3R1.R17.1"
+                "eclair": "MC3A2.R17.1"
             },
             "name": "Rule 17.1: internal helper functions made to break long running hypercalls into multiple calls.",
             "text": "They need to take a variable number of arguments depending on the original hypercall they are trying to continue."
@@ -45,31 +45,31 @@
         {
             "id": "SAF-5-safe",
             "analyser": {
-                "eclair": "MC3R1.R16.2"
+                "eclair": "MC3A2.R16.2"
             },
-            "name": "MC3R1.R16.2: using a case label when the most closely-enclosing compound statement is not a switch statement",
+            "name": "MC3A2.R16.2: using a case label when the most closely-enclosing compound statement is not a switch statement",
             "text": "A switch label enclosed by some compound statement that is not the body of a switch is permitted within local helper macros that are unlikely to be misused or misunderstood."
         },
         {
             "id": "SAF-6-safe",
             "analyser": {
-                "eclair": "MC3R1.R20.12"
+                "eclair": "MC3A2.R20.12"
             },
-            "name": "MC3R1.R20.12: use of a macro argument that deliberately violates the Rule",
+            "name": "MC3A2.R20.12: use of a macro argument that deliberately violates the Rule",
             "text": "A macro parameter that is itself a macro is intentionally used within the macro both as a regular parameter and for text replacement."
         },
         {
             "id": "SAF-7-safe",
             "analyser": {
-                "eclair": "MC3R1.R20.7"
+                "eclair": "MC3A2.R20.7"
             },
-            "name": "MC3R1.R20.7: deliberately non-parenthesized macro argument",
+            "name": "MC3A2.R20.7: deliberately non-parenthesized macro argument",
             "text": "A macro parameter expands to an expression that is non-parenthesized, as doing so would break the functionality."
         },
         {
             "id": "SAF-8-safe",
             "analyser": {
-                "eclair": "MC3R1.D4.10"
+                "eclair": "MC3A2.D4.10"
             },
             "name": "Dir 4.10: headers that leave it up to the caller to include them correctly",
             "text": "Headers that deliberatively leave the responsability of their correct inclusion to the caller are allowed."
@@ -77,7 +77,7 @@
         {
             "id": "SAF-9-safe",
             "analyser": {
-                "eclair": "MC3R1.D4.10"
+                "eclair": "MC3A2.D4.10"
             },
             "name": "Dir 4.10: empty headers",
             "text": "Empty headers pose no risk if included more than once."
@@ -85,7 +85,7 @@
         {
             "id": "SAF-10-safe",
             "analyser": {
-                "eclair": "MC3R1.D4.10"
+                "eclair": "MC3A2.D4.10"
             },
             "name": "Dir 4.10: direct inclusion guard before",
             "text": "Headers with just the direct inclusion guard before the inclusion guard are safe."
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Dec 17 23:33:12 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 17 Dec 2024 23:33:12 +0000
Received: from list by lists.xenproject.org with outflank-mailman.859939.1272023 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tNh3w-0002hN-PZ; Tue, 17 Dec 2024 23:33:12 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 859939.1272023; Tue, 17 Dec 2024 23:33:12 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tNh3w-0002hG-Mn; Tue, 17 Dec 2024 23:33:12 +0000
Received: by outflank-mailman (input) for mailman id 859939;
 Tue, 17 Dec 2024 23:33:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tNh3v-0002hA-V1
 for xen-changelog@lists.xenproject.org; Tue, 17 Dec 2024 23:33:11 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tNh3v-008GsP-1t
 for xen-changelog@lists.xenproject.org;
 Tue, 17 Dec 2024 23:33:11 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tNh3v-00FbLi-2Z
 for xen-changelog@lists.xenproject.org;
 Tue, 17 Dec 2024 23:33:11 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=jooK4ZKuyBTWM7r1mVmhqxuAlUWmbTIM8UZKOsTklJQ=; b=Gf8uJwzcDkQ9aNFQJPrKAW2mxC
	rRE/4kouWJ8POlAEC9OeP2chREm+b0KkE86Om79+vUuJRzBCrOf7TjdoBfOPcRLA6hDtoMzSAlmk5
	RZqJHvtf8TcApsGqt8VnPWg9DRRlN8329YV9HlQE+rzPGG2ZYP6Amnop7c/MG1brLoaI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] MISRA: Unmark Rules 1.1 and 2.1 as clean following Eclair upgrade
Message-Id: <E1tNh3v-00FbLi-2Z@xenbits.xenproject.org>
Date: Tue, 17 Dec 2024 23:33:11 +0000

commit 171cb318deaa0be786cc3af3599c72e8909e60f9
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Tue Dec 17 17:04:59 2024 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Dec 17 21:59:54 2024 +0000

    MISRA: Unmark Rules 1.1 and 2.1 as clean following Eclair upgrade
    
    Updating the Eclair runner has had knock-on effects with previously-clean
    rules now flagging violations:
    
     - x86:   Rule 1.1, 1940 violations
     - ARM64: Rule 1.1, 725 violations, Rule 2.1, 255 violations
    
    Fixes: 631f535a3d4f ("xen: update ECLAIR service identifiers from MC3R1 to MC3A2.")
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Roger Pau Monné <roger.pau@citrix.com>
---
 automation/eclair_analysis/ECLAIR/tagging.ecl | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/automation/eclair_analysis/ECLAIR/tagging.ecl b/automation/eclair_analysis/ECLAIR/tagging.ecl
index b524318591..982f506cc7 100644
--- a/automation/eclair_analysis/ECLAIR/tagging.ecl
+++ b/automation/eclair_analysis/ECLAIR/tagging.ecl
@@ -25,7 +25,6 @@ MC3A2.D2.1||
 MC3A2.D4.1||
 MC3A2.D4.11||
 MC3A2.D4.14||
-MC3A2.R1.1||
 MC3A2.R1.3||
 MC3A2.R1.4||
 MC3A2.R2.6||
@@ -116,7 +115,7 @@ if(string_equal(target,"x86_64"),
 )
 
 if(string_equal(target,"arm64"),
-    service_selector({"additional_clean_guidelines","MC3A2.R2.1||MC3A2.R5.3||MC3.R11.2||MC3A2.R16.6||MC3A2.R20.7"})
+    service_selector({"additional_clean_guidelines","MC3A2.R5.3||MC3.R11.2||MC3A2.R16.6||MC3A2.R20.7"})
 )
 
 -reports+={clean:added,"service(clean_guidelines_common||additional_clean_guidelines)"}
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Dec 18 00:55:13 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 18 Dec 2024 00:55:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.859944.1272032 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tNiLJ-000405-1j; Wed, 18 Dec 2024 00:55:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 859944.1272032; Wed, 18 Dec 2024 00: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 1tNiLI-0003zx-VE; Wed, 18 Dec 2024 00:55:12 +0000
Received: by outflank-mailman (input) for mailman id 859944;
 Wed, 18 Dec 2024 00:55:11 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tNiLH-0003zn-Q2
 for xen-changelog@lists.xenproject.org; Wed, 18 Dec 2024 00:55:11 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tNiLH-008J4v-1V
 for xen-changelog@lists.xenproject.org;
 Wed, 18 Dec 2024 00:55:11 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tNiLH-00FjLJ-28
 for xen-changelog@lists.xenproject.org;
 Wed, 18 Dec 2024 00:55:11 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=rbEaLh2cq6Dc7fZ8ovaIlxytlXzpPrccoe7zbr/NDUE=; b=DZB+pyjJrbjyIff9NgK9xN+/GP
	0BZstceabktXpsYrTy7SElms7ApvGEaTfIUP+mig+bpMCNFu9szDFVXeSy49TzHxjpsLFwOKAUf1F
	FvYfSYr1FzhT5scYFDjp38Vjzl3+T2hYdyWftYr0PU61FiSeIHCit1Y24yP1F0GbKS88=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.19] MISRA: Unmark Rules 1.1 and 2.1 as clean following Eclair upgrade
Message-Id: <E1tNiLH-00FjLJ-28@xenbits.xenproject.org>
Date: Wed, 18 Dec 2024 00:55:11 +0000

commit 8dd897e69119492989aaa034967f3a887f590197
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Tue Dec 17 17:04:59 2024 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Dec 17 22:01:58 2024 +0000

    MISRA: Unmark Rules 1.1 and 2.1 as clean following Eclair upgrade
    
    Updating the Eclair runner has had knock-on effects with previously-clean
    rules now flagging violations:
    
     - x86:   Rule 1.1, 1940 violations
     - ARM64: Rule 1.1, 725 violations, Rule 2.1, 255 violations
    
    Fixes: 631f535a3d4f ("xen: update ECLAIR service identifiers from MC3R1 to MC3A2.")
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Roger Pau Monné <roger.pau@citrix.com>
    (cherry picked from commit 171cb318deaa0be786cc3af3599c72e8909e60f9)
---
 automation/eclair_analysis/ECLAIR/tagging.ecl | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/automation/eclair_analysis/ECLAIR/tagging.ecl b/automation/eclair_analysis/ECLAIR/tagging.ecl
index eec1d50f90..91f27243dd 100644
--- a/automation/eclair_analysis/ECLAIR/tagging.ecl
+++ b/automation/eclair_analysis/ECLAIR/tagging.ecl
@@ -25,7 +25,6 @@ MC3A2.D2.1||
 MC3A2.D4.1||
 MC3A2.D4.11||
 MC3A2.D4.14||
-MC3A2.R1.1||
 MC3A2.R1.3||
 MC3A2.R1.4||
 MC3A2.R2.2||
@@ -107,7 +106,7 @@ if(string_equal(target,"x86_64"),
 )
 
 if(string_equal(target,"arm64"),
-    service_selector({"additional_clean_guidelines","MC3A2.R16.6||MC3A2.R2.1||MC3A2.R5.3||MC3A2.R7.3"})
+    service_selector({"additional_clean_guidelines","MC3A2.R16.6||MC3A2.R5.3||MC3A2.R7.3"})
 )
 
 -reports+={clean:added,"service(clean_guidelines_common||additional_clean_guidelines)"}
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.19


From xen-changelog-bounces@lists.xenproject.org Wed Dec 18 00:55:13 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 18 Dec 2024 00:55:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.859943.1272028 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tNiL9-0003y4-Uf; Wed, 18 Dec 2024 00:55:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 859943.1272028; Wed, 18 Dec 2024 00: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 1tNiL9-0003xx-Rc; Wed, 18 Dec 2024 00:55:03 +0000
Received: by outflank-mailman (input) for mailman id 859943;
 Wed, 18 Dec 2024 00:55:01 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tNiL7-0003xp-Ss
 for xen-changelog@lists.xenproject.org; Wed, 18 Dec 2024 00:55:01 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tNiL7-008J4n-0y
 for xen-changelog@lists.xenproject.org;
 Wed, 18 Dec 2024 00:55:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tNiL7-00FjKZ-1d
 for xen-changelog@lists.xenproject.org;
 Wed, 18 Dec 2024 00:55:01 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=elinI2QEZOV93CBVNUZHB/OMC/TlfZ2dCu04XGaPcvM=; b=JKRIFjE6ku+5uPKWrSVjHzn2gm
	XiJuKI0sKuTJAqCoP2VKl4RzpfTHtbWpF2ov92Xf14hC/4Ea+QosS8i2mcW3iKR+TKfRFYLAME5fs
	REwlM/p/vub/+gGsJAh9FOFSgk26Z5LN2FePSuWDbUdWIye88nMGQ+ONE/AabDTrgYRw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.19] xen: update ECLAIR service identifiers from MC3R1 to MC3A2.
Message-Id: <E1tNiL7-00FjKZ-1d@xenbits.xenproject.org>
Date: Wed, 18 Dec 2024 00:55:01 +0000

commit 8b584c97f88724a390fd17b08b2735f488d5f980
Author:     Alessandro Zucchelli <alessandro.zucchelli@bugseng.com>
AuthorDate: Tue Dec 10 11:37:23 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Dec 17 13:09:58 2024 +0000

    xen: update ECLAIR service identifiers from MC3R1 to MC3A2.
    
    Rename all instances of ECLAIR MISRA C:2012 service identifiers,
    identified by the prefix MC3R1, to use the prefix MC3A2, which
    refers to MISRA C:2012 Amendment 2 guidelines.
    
    This update is motivated by the need to upgrade ECLAIR GitLab runners
    that use the new naming scheme for MISRA C:2012 Amendment 2 guidelines.
    
    Changes to the docs/misra directory are needed in order to keep
    comment-based deviation up to date.
    
    Signed-off-by: Alessandro Zucchelli <alessandro.zucchelli@bugseng.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
    (cherry picked from commit 631f535a3d4ffd66a270672f0f787d79f3bf38f8)
---
 automation/eclair_analysis/ECLAIR/B.UNEVALEFF.ecl  |   2 +-
 .../eclair_analysis/ECLAIR/accepted_guidelines.sh  |   2 +-
 automation/eclair_analysis/ECLAIR/analysis.ecl     |   6 +-
 automation/eclair_analysis/ECLAIR/deviations.ecl   | 228 ++++++++++-----------
 automation/eclair_analysis/ECLAIR/monitored.ecl    | 204 +++++++++---------
 automation/eclair_analysis/ECLAIR/tagging.ecl      | 160 +++++++--------
 docs/misra/documenting-violations.rst              |   6 +-
 docs/misra/safe.json                               |  26 +--
 8 files changed, 317 insertions(+), 317 deletions(-)

diff --git a/automation/eclair_analysis/ECLAIR/B.UNEVALEFF.ecl b/automation/eclair_analysis/ECLAIR/B.UNEVALEFF.ecl
index 92d8db8986..fa249b8e36 100644
--- a/automation/eclair_analysis/ECLAIR/B.UNEVALEFF.ecl
+++ b/automation/eclair_analysis/ECLAIR/B.UNEVALEFF.ecl
@@ -1,4 +1,4 @@
--clone_service=MC3R1.R13.6,B.UNEVALEFF
+-clone_service=MC3A2.R13.6,B.UNEVALEFF
 
 -config=B.UNEVALEFF,summary="The operand of the `alignof' and `typeof'  operators shall not contain any expression which has potential side effects"
 -config=B.UNEVALEFF,stmt_child_matcher=
diff --git a/automation/eclair_analysis/ECLAIR/accepted_guidelines.sh b/automation/eclair_analysis/ECLAIR/accepted_guidelines.sh
index 368135122c..2c4b339d0d 100755
--- a/automation/eclair_analysis/ECLAIR/accepted_guidelines.sh
+++ b/automation/eclair_analysis/ECLAIR/accepted_guidelines.sh
@@ -10,6 +10,6 @@ script_dir="$(
 accepted_rst=$1
 
 grep -Eo "\`(Dir|Rule) [0-9]+\.[0-9]+" ${accepted_rst} \
-     | sed -e 's/`Rule /MC3R1.R/' -e  's/`Dir /MC3R1.D/' -e 's/.*/-enable=&/' > ${script_dir}/accepted.ecl
+     | sed -e 's/`Rule /MC3A2.R/' -e  's/`Dir /MC3A2.D/' -e 's/.*/-enable=&/' > ${script_dir}/accepted.ecl
 
 echo "-enable=B.UNEVALEFF" >> ${script_dir}/accepted.ecl
diff --git a/automation/eclair_analysis/ECLAIR/analysis.ecl b/automation/eclair_analysis/ECLAIR/analysis.ecl
index df0b551812..824283a989 100644
--- a/automation/eclair_analysis/ECLAIR/analysis.ecl
+++ b/automation/eclair_analysis/ECLAIR/analysis.ecl
@@ -22,15 +22,15 @@ setq(analysis_kind,getenv("ANALYSIS_KIND"))
 -doc_begin="These configurations serve the purpose of recognizing the 'mem*' macros as
 their Standard Library equivalents."
 
--config=MC3R1.R21.14,call_select+=
+-config=MC3A2.R21.14,call_select+=
 {"macro(^memcmp$)&&any_arg(1..2, skip(__non_syntactic_paren_cast_stmts, node(string_literal)))",
  "any()", violation, "%{__callslct_any_base_fmt()}", {{arg, "%{__callslct_arg_fmt()}"}}}
 
--config=MC3R1.R21.15,call_args+=
+-config=MC3A2.R21.15,call_args+=
 {"macro(^mem(cmp|move|cpy)$)", {1, 2}, "unqual_pointee_compatible",
  "%{__argscmpr_culprit_fmt()}", "%{__argscmpr_evidence_fmt()}"}
 
--config=MC3R1.R21.16,call_select+=
+-config=MC3A2.R21.16,call_select+=
 {"macro(^memcmp$)&&any_arg(1..2, skip(__non_syntactic_paren_stmts, type(canonical(__memcmp_pte_types))))",
  "any()", violation, "%{__callslct_any_base_fmt()}", {{arg,"%{__callslct_arg_type_fmt()}"}}}
 
diff --git a/automation/eclair_analysis/ECLAIR/deviations.ecl b/automation/eclair_analysis/ECLAIR/deviations.ecl
index 0af1cb93d1..046d378087 100644
--- a/automation/eclair_analysis/ECLAIR/deviations.ecl
+++ b/automation/eclair_analysis/ECLAIR/deviations.ecl
@@ -4,36 +4,36 @@
 
 -doc_begin="The compiler implementation guarantees that the unreachable code is removed.
 Constant expressions and unreachable branches of if and switch statements are expected."
--config=MC3R1.R2.1,+reports={safe,"first_area(^.*has an invariantly.*$)"}
--config=MC3R1.R2.1,+reports={safe,"first_area(^.*incompatible with labeled statement$)"}
+-config=MC3A2.R2.1,+reports={safe,"first_area(^.*has an invariantly.*$)"}
+-config=MC3A2.R2.1,+reports={safe,"first_area(^.*incompatible with labeled statement$)"}
 -doc_end
 
 -doc_begin="Some functions are intended to be not referenced."
--config=MC3R1.R2.1,+reports={deliberate,"first_area(^.*is never referenced$)"}
+-config=MC3A2.R2.1,+reports={deliberate,"first_area(^.*is never referenced$)"}
 -doc_end
 
 -doc_begin="Unreachability caused by calls to the following functions or macros is deliberate and there is no risk of code being unexpectedly left out."
--config=MC3R1.R2.1,statements+={deliberate,"macro(name(BUG||assert_failed))"}
--config=MC3R1.R2.1,statements+={deliberate, "call(decl(name(__builtin_unreachable||panic||do_unexpected_trap||machine_halt||machine_restart||reboot_or_halt)))"}
+-config=MC3A2.R2.1,statements+={deliberate,"macro(name(BUG||assert_failed))"}
+-config=MC3A2.R2.1,statements+={deliberate, "call(decl(name(__builtin_unreachable||panic||do_unexpected_trap||machine_halt||machine_restart||reboot_or_halt)))"}
 -doc_end
 
 -doc_begin="Unreachability inside an ASSERT_UNREACHABLE() and analogous macro calls is deliberate and safe."
--config=MC3R1.R2.1,reports+={deliberate, "any_area(any_loc(any_exp(macro(name(ASSERT_UNREACHABLE||PARSE_ERR_RET||PARSE_ERR||FAIL_MSR||FAIL_CPUID)))))"}
+-config=MC3A2.R2.1,reports+={deliberate, "any_area(any_loc(any_exp(macro(name(ASSERT_UNREACHABLE||PARSE_ERR_RET||PARSE_ERR||FAIL_MSR||FAIL_CPUID)))))"}
 -doc_end
 
 -doc_begin="The asm-offset files are not linked deliberately, since they are used to generate definitions for asm modules."
 -file_tag+={asm_offsets, "^xen/arch/(arm|x86)/(arm32|arm64|x86_64)/asm-offsets\\.c$"}
--config=MC3R1.R2.1,reports+={deliberate, "any_area(any_loc(file(asm_offsets)))"}
+-config=MC3A2.R2.1,reports+={deliberate, "any_area(any_loc(file(asm_offsets)))"}
 -doc_end
 
 -doc_begin="Pure declarations (i.e., declarations without initialization) are
 not executable, and therefore it is safe for them to be unreachable."
--config=MC3R1.R2.1,ignored_stmts+={"any()", "pure_decl()"}
+-config=MC3A2.R2.1,ignored_stmts+={"any()", "pure_decl()"}
 -doc_end
 
 -doc_begin="The following autogenerated file is not linked deliberately."
 -file_tag+={C_runtime_failures,"^automation/eclair_analysis/C-runtime-failures\\.rst\\.c$"}
--config=MC3R1.R2.1,reports+={deliberate, "any_area(any_loc(file(C_runtime_failures)))"}
+-config=MC3A2.R2.1,reports+={deliberate, "any_area(any_loc(file(C_runtime_failures)))"}
 -doc_end
 
 -doc_begin="Proving compliance with respect to Rule 2.2 is generally impossible:
@@ -42,11 +42,11 @@ confidence that no evidence of errors in the program's logic has been missed due
 to undetected violations of Rule 2.2, if any. Testing on time behavior gives us
 confidence on the fact that, should the program contain dead code that is not
 removed by the compiler, the resulting slowdown is negligible."
--config=MC3R1.R2.2,reports+={disapplied,"any()"}
+-config=MC3A2.R2.2,reports+={disapplied,"any()"}
 -doc_end
 
 -doc_begin="Some labels are unused in certain build configurations, or are deliberately marked as unused, so that the compiler is entitled to remove them."
--config=MC3R1.R2.6,reports+={deliberate, "any_area(text(^.*__maybe_unused.*$))"}
+-config=MC3A2.R2.6,reports+={deliberate, "any_area(text(^.*__maybe_unused.*$))"}
 -doc_end
 
 #
@@ -55,7 +55,7 @@ removed by the compiler, the resulting slowdown is negligible."
 
 -doc_begin="Comments starting with '/*' and containing hyperlinks are safe as
 they are not instances of commented-out code."
--config=MC3R1.R3.1,reports+={safe, "first_area(text(^.*https?://.*$))"}
+-config=MC3A2.R3.1,reports+={safe, "first_area(text(^.*https?://.*$))"}
 -doc_end
 
 #
@@ -63,26 +63,26 @@ they are not instances of commented-out code."
 #
 
 -doc_begin="The directive has been accepted only for the ARM codebase."
--config=MC3R1.D4.3,reports+={disapplied,"!(any_area(any_loc(file(^xen/arch/arm/arm64/.*$))))"}
+-config=MC3A2.D4.3,reports+={disapplied,"!(any_area(any_loc(file(^xen/arch/arm/arm64/.*$))))"}
 -doc_end
 
 -doc_begin="The inline asm in 'arm64/lib/bitops.c' is tightly coupled with the surronding C code that acts as a wrapper, so it has been decided not to add an additional encapsulation layer."
 -file_tag+={arm64_bitops, "^xen/arch/arm/arm64/lib/bitops\\.c$"}
--config=MC3R1.D4.3,reports+={deliberate, "all_area(any_loc(file(arm64_bitops)&&any_exp(macro(^(bit|test)op$))))"}
--config=MC3R1.D4.3,reports+={deliberate, "any_area(any_loc(file(arm64_bitops))&&context(name(int_clear_mask16)))"}
+-config=MC3A2.D4.3,reports+={deliberate, "all_area(any_loc(file(arm64_bitops)&&any_exp(macro(^(bit|test)op$))))"}
+-config=MC3A2.D4.3,reports+={deliberate, "any_area(any_loc(file(arm64_bitops))&&context(name(int_clear_mask16)))"}
 -doc_end
 
 -doc_begin="This header file is autogenerated or empty, therefore it poses no
 risk if included more than once."
 -file_tag+={empty_header, "^xen/arch/arm/efi/runtime\\.h$"}
 -file_tag+={autogen_headers, "^xen/include/xen/compile\\.h$||^xen/include/generated/autoconf.h$||^xen/include/xen/hypercall-defs.h$"}
--config=MC3R1.D4.10,reports+={safe, "all_area(all_loc(file(empty_header||autogen_headers)))"}
+-config=MC3A2.D4.10,reports+={safe, "all_area(all_loc(file(empty_header||autogen_headers)))"}
 -doc_end
 
 -doc_begin="Files that are intended to be included more than once do not need to
 conform to the directive."
--config=MC3R1.D4.10,reports+={safe, "first_area(text(^/\\* This file is legitimately included multiple times\\. \\*/$, begin-4))"}
--config=MC3R1.D4.10,reports+={safe, "first_area(text(^/\\* Generated file, do not edit! \\*/$, begin-3))"}
+-config=MC3A2.D4.10,reports+={safe, "first_area(text(^/\\* This file is legitimately included multiple times\\. \\*/$, begin-4))"}
+-config=MC3A2.D4.10,reports+={safe, "first_area(text(^/\\* Generated file, do not edit! \\*/$, begin-3))"}
 -doc_end
 
 #
@@ -91,50 +91,50 @@ conform to the directive."
 
 -doc_begin="The project adopted the rule with an exception listed in
 'docs/misra/rules.rst'"
--config=MC3R1.R5.3,reports+={safe, "any_area(any_loc(any_exp(macro(^READ_SYSREG$))&&any_exp(macro(^WRITE_SYSREG$))))"}
--config=MC3R1.R5.3,reports+={safe, "any_area(any_loc(any_exp(macro(^max(_t)?$))&&any_exp(macro(^min(_t)?$))))"}
--config=MC3R1.R5.3,reports+={safe, "any_area(any_loc(any_exp(macro(^read[bwlq]$))&&any_exp(macro(^read[bwlq]_relaxed$))))"}
--config=MC3R1.R5.3,reports+={safe, "any_area(any_loc(any_exp(macro(^per_cpu$))&&any_exp(macro(^this_cpu$))))"}
--config=MC3R1.R5.3,reports+={safe, "any_area(any_loc(any_exp(macro(^__emulate_2op$))&&any_exp(macro(^__emulate_2op_nobyte$))))"}
--config=MC3R1.R5.3,reports+={safe, "any_area(any_loc(any_exp(macro(^read_debugreg$))&&any_exp(macro(^write_debugreg$))))"}
+-config=MC3A2.R5.3,reports+={safe, "any_area(any_loc(any_exp(macro(^READ_SYSREG$))&&any_exp(macro(^WRITE_SYSREG$))))"}
+-config=MC3A2.R5.3,reports+={safe, "any_area(any_loc(any_exp(macro(^max(_t)?$))&&any_exp(macro(^min(_t)?$))))"}
+-config=MC3A2.R5.3,reports+={safe, "any_area(any_loc(any_exp(macro(^read[bwlq]$))&&any_exp(macro(^read[bwlq]_relaxed$))))"}
+-config=MC3A2.R5.3,reports+={safe, "any_area(any_loc(any_exp(macro(^per_cpu$))&&any_exp(macro(^this_cpu$))))"}
+-config=MC3A2.R5.3,reports+={safe, "any_area(any_loc(any_exp(macro(^__emulate_2op$))&&any_exp(macro(^__emulate_2op_nobyte$))))"}
+-config=MC3A2.R5.3,reports+={safe, "any_area(any_loc(any_exp(macro(^read_debugreg$))&&any_exp(macro(^write_debugreg$))))"}
 -doc_end
 
 -doc_begin="Macros expanding to their own identifier (e.g., \"#define x x\") are deliberate."
--config=MC3R1.R5.5,reports+={deliberate, "all_area(macro(same_id_body())||!macro(!same_id_body()))"}
+-config=MC3A2.R5.5,reports+={deliberate, "all_area(macro(same_id_body())||!macro(!same_id_body()))"}
 -doc_end
 
 -doc_begin="There is no clash between function like macros and not callable objects."
--config=MC3R1.R5.5,reports+={deliberate, "all_area(macro(function_like())||decl(any()))&&all_area(macro(any())||!decl(kind(function))&&!decl(__function_pointer_decls))"}
+-config=MC3A2.R5.5,reports+={deliberate, "all_area(macro(function_like())||decl(any()))&&all_area(macro(any())||!decl(kind(function))&&!decl(__function_pointer_decls))"}
 -doc_end
 
 -doc_begin="Clashes between function names and macros are deliberate for string handling functions since some architectures may want to use their own arch-specific implementation."
--config=MC3R1.R5.5,reports+={deliberate, "all_area(all_loc(file(^xen/arch/x86/string\\.c|xen/include/xen/string\\.h|xen/lib/.*$)))"}
+-config=MC3A2.R5.5,reports+={deliberate, "all_area(all_loc(file(^xen/arch/x86/string\\.c|xen/include/xen/string\\.h|xen/lib/.*$)))"}
 -doc_end
 
 -doc_begin="In libelf, clashes between macros and function names are deliberate and needed to prevent the use of undecorated versions of memcpy, memset and memmove."
--config=MC3R1.R5.5,reports+={deliberate, "any_area(decl(kind(function))||any_loc(macro(name(memcpy||memset||memmove))))&&any_area(any_loc(file(^xen/common/libelf/libelf-private\\.h$)))"}
+-config=MC3A2.R5.5,reports+={deliberate, "any_area(decl(kind(function))||any_loc(macro(name(memcpy||memset||memmove))))&&any_area(any_loc(file(^xen/common/libelf/libelf-private\\.h$)))"}
 -doc_end
 
 -doc_begin="The type \"ret_t\" is deliberately defined multiple times,
 depending on the guest."
--config=MC3R1.R5.6,reports+={deliberate,"any_area(any_loc(text(^.*ret_t.*$)))"}
+-config=MC3A2.R5.6,reports+={deliberate,"any_area(any_loc(text(^.*ret_t.*$)))"}
 -doc_end
 
 -doc_begin="On X86, the types \"guest_intpte_t\", \"guest_l1e_t\" and
 \"guest_l2e_t\" are deliberately defined multiple times, depending on the
 number of guest paging levels."
--config=MC3R1.R5.6,reports+={deliberate,"any_area(any_loc(file(^xen/arch/x86/include/asm/guest_pt\\.h$)))&&any_area(any_loc(text(^.*(guest_intpte_t|guest_l[12]e_t).*$)))"}
+-config=MC3A2.R5.6,reports+={deliberate,"any_area(any_loc(file(^xen/arch/x86/include/asm/guest_pt\\.h$)))&&any_area(any_loc(text(^.*(guest_intpte_t|guest_l[12]e_t).*$)))"}
 -doc_end
 
 -doc_begin="The following files are imported from the gnu-efi package."
 -file_tag+={adopted_r5_6,"^xen/include/efi/.*$"}
 -file_tag+={adopted_r5_6,"^xen/arch/.*/include/asm/.*/efibind\\.h$"}
--config=MC3R1.R5.6,reports+={deliberate,"any_area(any_loc(file(adopted_r5_6)))"}
+-config=MC3A2.R5.6,reports+={deliberate,"any_area(any_loc(file(adopted_r5_6)))"}
 -doc_end
 
 -doc_begin="The project intentionally reuses tag names in order to have identifiers matching the applicable external specifications as well as established internal conventions.
 As there is little possibility for developer confusion not resulting into compilation errors, the risk of renaming outweighs the potential advantages of compliance."
--config=MC3R1.R5.7,reports+={deliberate,"any()"}
+-config=MC3A2.R5.7,reports+={deliberate,"any()"}
 -doc_end
 
 #
@@ -143,7 +143,7 @@ As there is little possibility for developer confusion not resulting into compil
 
 -doc_begin="It is safe to use certain octal constants the way they are defined
 in specifications, manuals, and algorithm descriptions."
--config=MC3R1.R7.1,reports+={safe, "any_area(any_loc(any_exp(text(^.*octal-ok.*$))))"}
+-config=MC3A2.R7.1,reports+={safe, "any_area(any_loc(any_exp(text(^.*octal-ok.*$))))"}
 -doc_end
 
 -doc_begin="Violations in files that maintainers have asked to not modify in the
@@ -156,17 +156,17 @@ context of R7.2."
 -file_tag+={adopted_r7_2,"^xen/arch/x86/cpu/intel\\.c$"}
 -file_tag+={adopted_r7_2,"^xen/arch/x86/cpu/amd\\.c$"}
 -file_tag+={adopted_r7_2,"^xen/arch/x86/cpu/common\\.c$"}
--config=MC3R1.R7.2,reports+={deliberate,"any_area(any_loc(file(adopted_r7_2)))"}
+-config=MC3A2.R7.2,reports+={deliberate,"any_area(any_loc(file(adopted_r7_2)))"}
 -doc_end
 
 -doc_begin="Violations caused by __HYPERVISOR_VIRT_START are related to the
 particular use of it done in xen_mk_ulong."
--config=MC3R1.R7.2,reports+={deliberate,"any_area(any_loc(macro(name(BUILD_BUG_ON))))"}
+-config=MC3A2.R7.2,reports+={deliberate,"any_area(any_loc(macro(name(BUILD_BUG_ON))))"}
 -doc_end
 
 -doc_begin="Allow pointers of non-character type as long as the pointee is
 const-qualified."
--config=MC3R1.R7.4,same_pointee=false
+-config=MC3A2.R7.4,same_pointee=false
 -doc_end
 
 #
@@ -174,7 +174,7 @@ const-qualified."
 #
 
 -doc_begin="The type ret_t is deliberately used and defined as int or long depending on the architecture."
--config=MC3R1.R8.3,reports+={deliberate,"any_area(any_loc(text(^.*ret_t.*$)))"}
+-config=MC3A2.R8.3,reports+={deliberate,"any_area(any_loc(text(^.*ret_t.*$)))"}
 -doc_end
 
 -doc_begin="The following files are imported from Linux and decompress.h defines a unique and documented interface towards all the (adopted) decompress functions."
@@ -184,71 +184,71 @@ const-qualified."
 -file_tag+={adopted_decompress_r8_3,"^xen/common/unlzo\\.c$"}
 -file_tag+={adopted_decompress_r8_3,"^xen/common/unxz\\.c$"}
 -file_tag+={adopted_decompress_r8_3,"^xen/common/unzstd\\.c$"}
--config=MC3R1.R8.3,reports+={deliberate,"any_area(any_loc(file(adopted_decompress_r8_3)))&&any_area(any_loc(file(^xen/include/xen/decompress\\.h$)))"}
+-config=MC3A2.R8.3,reports+={deliberate,"any_area(any_loc(file(adopted_decompress_r8_3)))&&any_area(any_loc(file(^xen/include/xen/decompress\\.h$)))"}
 -doc_end
 
 -doc_begin="Parameter name \"unused\" (with an optional numeric suffix) is deliberate and makes explicit the intention of not using such parameter within the function."
--config=MC3R1.R8.3,reports+={deliberate, "any_area(^.*parameter `unused[0-9]*'.*$)"}
+-config=MC3A2.R8.3,reports+={deliberate, "any_area(^.*parameter `unused[0-9]*'.*$)"}
 -doc_end
 
 -doc_begin="The following file is imported from Linux: ignore for now."
 -file_tag+={adopted_time_r8_3,"^xen/arch/x86/time\\.c$"}
--config=MC3R1.R8.3,reports+={deliberate,"any_area(any_loc(file(adopted_time_r8_3)))&&(any_area(any_loc(file(^xen/include/xen/time\\.h$)))||any_area(any_loc(file(^xen/arch/x86/include/asm/setup\\.h$))))"}
+-config=MC3A2.R8.3,reports+={deliberate,"any_area(any_loc(file(adopted_time_r8_3)))&&(any_area(any_loc(file(^xen/include/xen/time\\.h$)))||any_area(any_loc(file(^xen/arch/x86/include/asm/setup\\.h$))))"}
 -doc_end
 
 -doc_begin="The following file is imported from Linux: ignore for now."
 -file_tag+={adopted_cpu_idle_r8_3,"^xen/arch/x86/acpi/cpu_idle\\.c$"}
--config=MC3R1.R8.3,reports+={deliberate,"any_area(any_loc(file(adopted_cpu_idle_r8_3)))&&any_area(any_loc(file(^xen/include/xen/pmstat\\.h$)))"}
+-config=MC3A2.R8.3,reports+={deliberate,"any_area(any_loc(file(adopted_cpu_idle_r8_3)))&&any_area(any_loc(file(^xen/include/xen/pmstat\\.h$)))"}
 -doc_end
 
 -doc_begin="The following file is imported from Linux: ignore for now."
 -file_tag+={adopted_mpparse_r8_3,"^xen/arch/x86/mpparse\\.c$"}
--config=MC3R1.R8.3,reports+={deliberate,"any_area(any_loc(file(adopted_mpparse_r8_3)))&&any_area(any_loc(file(^xen/arch/x86/include/asm/mpspec\\.h$)))"}
+-config=MC3A2.R8.3,reports+={deliberate,"any_area(any_loc(file(adopted_mpparse_r8_3)))&&any_area(any_loc(file(^xen/arch/x86/include/asm/mpspec\\.h$)))"}
 -doc_end
 
 -doc_begin="The definitions present in this file are meant to generate definitions for asm modules, and are not called by C code. Therefore the absence of prior declarations is safe."
 -file_tag+={asm_offsets, "^xen/arch/(arm|x86)/(arm32|arm64|x86_64)/asm-offsets\\.c$"}
--config=MC3R1.R8.4,reports+={safe, "first_area(any_loc(file(asm_offsets)))"}
+-config=MC3A2.R8.4,reports+={safe, "first_area(any_loc(file(asm_offsets)))"}
 -doc_end
 
 -doc_begin="The functions defined in this file are meant to be called from gcc-generated code in a non-release build configuration.
 Therefore the absence of prior declarations is safe."
 -file_tag+={gcov, "^xen/common/coverage/gcov_base\\.c$"}
--config=MC3R1.R8.4,reports+={safe, "first_area(any_loc(file(gcov)))"}
+-config=MC3A2.R8.4,reports+={safe, "first_area(any_loc(file(gcov)))"}
 -doc_end
 
 -doc_begin="Recognize the occurrence of current_stack_pointer as a declaration."
 -file_tag+={asm_defns, "^xen/arch/x86/include/asm/asm_defns\\.h$"}
--config=MC3R1.R8.4,declarations+={safe, "loc(file(asm_defns))&&^current_stack_pointer$"}
+-config=MC3A2.R8.4,declarations+={safe, "loc(file(asm_defns))&&^current_stack_pointer$"}
 -doc_end
 
 -doc_begin="The function apei_(read|check|clear)_mce are dead code and are excluded from non-debug builds, therefore the absence of prior declarations is safe."
--config=MC3R1.R8.4,declarations+={safe, "^apei_(read|check|clear)_mce\\(.*$"}
+-config=MC3A2.R8.4,declarations+={safe, "^apei_(read|check|clear)_mce\\(.*$"}
 -doc_end
 
 -doc_begin="asmlinkage is a marker to indicate that the function is only used to interface with asm modules."
--config=MC3R1.R8.4,declarations+={safe,"loc(text(^(?s).*asmlinkage.*$, -1..0))"}
+-config=MC3A2.R8.4,declarations+={safe,"loc(text(^(?s).*asmlinkage.*$, -1..0))"}
 -doc_end
 
 -doc_begin="Given that bsearch and sort are defined with the attribute 'gnu_inline', it's deliberate not to have a prior declaration.
 See Section \"6.33.1 Common Function Attributes\" of \"GCC_MANUAL\" for a full explanation of gnu_inline."
 -file_tag+={bsearch_sort, "^xen/include/xen/(sort|lib)\\.h$"}
--config=MC3R1.R8.4,reports+={deliberate, "any_area(any_loc(file(bsearch_sort))&&decl(name(bsearch||sort)))"}
+-config=MC3A2.R8.4,reports+={deliberate, "any_area(any_loc(file(bsearch_sort))&&decl(name(bsearch||sort)))"}
 -doc_end
 
 -doc_begin="first_valid_mfn is defined in this way because the current lack of NUMA support in Arm and PPC requires it."
 -file_tag+={first_valid_mfn, "^xen/common/page_alloc\\.c$"}
--config=MC3R1.R8.4,declarations+={deliberate,"loc(file(first_valid_mfn))"}
+-config=MC3A2.R8.4,declarations+={deliberate,"loc(file(first_valid_mfn))"}
 -doc_end
 
 -doc_begin="The following variables are compiled in multiple translation units
 belonging to different executables and therefore are safe."
--config=MC3R1.R8.6,declarations+={safe, "name(current_stack_pointer||bsearch||sort)"}
+-config=MC3A2.R8.6,declarations+={safe, "name(current_stack_pointer||bsearch||sort)"}
 -doc_end
 
 -doc_begin="Declarations without definitions are allowed (specifically when the
 definition is compiled-out or optimized-out by the compiler)"
--config=MC3R1.R8.6,reports+={deliberate, "first_area(^.*has no definition$)"}
+-config=MC3A2.R8.6,reports+={deliberate, "first_area(^.*has no definition$)"}
 -doc_end
 
 -doc_begin="The search procedure for Unix linkers is well defined, see ld(1)
@@ -259,11 +259,11 @@ the linker will include the appropriate file(s) from the archive\".
 In Xen, thanks to the order in which file names appear in the build commands,
 if arch-specific definitions are present, they get always linked in before
 searching in the lib.a archive resulting from xen/lib."
--config=MC3R1.R8.6,declarations+={deliberate, "loc(file(^xen/lib/.*$))"}
+-config=MC3A2.R8.6,declarations+={deliberate, "loc(file(^xen/lib/.*$))"}
 -doc_end
 
 -doc_begin="The gnu_inline attribute without static is deliberately allowed."
--config=MC3R1.R8.10,declarations+={deliberate,"property(gnu_inline)"}
+-config=MC3A2.R8.10,declarations+={deliberate,"property(gnu_inline)"}
 -doc_end
 
 #
@@ -273,12 +273,12 @@ searching in the lib.a archive resulting from xen/lib."
 -doc_begin="Violations in files that maintainers have asked to not modify in the
 context of R9.1."
 -file_tag+={adopted_r9_1,"^xen/arch/arm/arm64/lib/find_next_bit\\.c$"}
--config=MC3R1.R9.1,reports+={deliberate,"any_area(any_loc(file(adopted_r9_1)))"}
+-config=MC3A2.R9.1,reports+={deliberate,"any_area(any_loc(file(adopted_r9_1)))"}
 -doc_end
 
 -doc_begin="The possibility of committing mistakes by specifying an explicit
 dimension is higher than omitting the dimension."
--config=MC3R1.R9.5,reports+={deliberate, "any()"}
+-config=MC3A2.R9.5,reports+={deliberate, "any()"}
 -doc_end
 
 #
@@ -286,45 +286,45 @@ dimension is higher than omitting the dimension."
 #
 
 -doc_begin="The value-preserving conversions of integer constants are safe"
--config=MC3R1.R10.1,etypes={safe,"any()","preserved_integer_constant()"}
--config=MC3R1.R10.3,etypes={safe,"any()","preserved_integer_constant()"}
--config=MC3R1.R10.4,etypes={safe,"any()","preserved_integer_constant()||sibling(rhs,preserved_integer_constant())"}
+-config=MC3A2.R10.1,etypes={safe,"any()","preserved_integer_constant()"}
+-config=MC3A2.R10.3,etypes={safe,"any()","preserved_integer_constant()"}
+-config=MC3A2.R10.4,etypes={safe,"any()","preserved_integer_constant()||sibling(rhs,preserved_integer_constant())"}
 -doc_end
 
 -doc_begin="Shifting non-negative integers to the right is safe."
--config=MC3R1.R10.1,etypes+={safe,
+-config=MC3A2.R10.1,etypes+={safe,
   "stmt(node(binary_operator)&&operator(shr))",
   "src_expr(definitely_in(0..))"}
 -doc_end
 
 -doc_begin="Shifting non-negative integers to the left is safe if the result is
 still non-negative."
--config=MC3R1.R10.1,etypes+={safe,
+-config=MC3A2.R10.1,etypes+={safe,
   "stmt(node(binary_operator)&&operator(shl)&&definitely_in(0..))",
   "src_expr(definitely_in(0..))"}
 -doc_end
 
 -doc_begin="Bitwise logical operations on non-negative integers are safe."
--config=MC3R1.R10.1,etypes+={safe,
+-config=MC3A2.R10.1,etypes+={safe,
   "stmt(node(binary_operator)&&operator(and||or||xor))",
   "src_expr(definitely_in(0..))"}
 -doc_end
 
 -doc_begin="The implicit conversion to Boolean for logical operator arguments is well known to all Xen developers to be a comparison with 0"
--config=MC3R1.R10.1,etypes+={safe, "stmt(operator(logical)||node(conditional_operator||binary_conditional_operator))", "dst_type(ebool||boolean)"}
+-config=MC3A2.R10.1,etypes+={safe, "stmt(operator(logical)||node(conditional_operator||binary_conditional_operator))", "dst_type(ebool||boolean)"}
 -doc_end
 
 -doc_begin="The macro ISOLATE_LSB encapsulates a well-known pattern to obtain
 a mask where only the lowest bit set in the argument is set, if any, for unsigned
 integers arguments on two's complement architectures
 (all the architectures supported by Xen satisfy this requirement)."
--config=MC3R1.R10.1,reports+={safe, "any_area(any_loc(any_exp(macro(^ISOLATE_LSB$))))"}
+-config=MC3A2.R10.1,reports+={safe, "any_area(any_loc(any_exp(macro(^ISOLATE_LSB$))))"}
 -doc_end
 
 -doc_begin="XEN only supports architectures where signed integers are
 representend using two's complement and all the XEN developers are aware of
 this."
--config=MC3R1.R10.1,etypes+={safe,
+-config=MC3A2.R10.1,etypes+={safe,
   "stmt(operator(and||or||xor||not||and_assign||or_assign||xor_assign))",
   "any()"}
 -doc_end
@@ -335,7 +335,7 @@ C language, GCC does not use the latitude given in C99 and C11 only to treat
 certain aspects of signed `<<' as undefined. However, -fsanitize=shift (and
 -fsanitize=undefined) will diagnose such cases. They are also diagnosed where
 constant expressions are required.\""
--config=MC3R1.R10.1,etypes+={safe,
+-config=MC3A2.R10.1,etypes+={safe,
   "stmt(operator(shl||shr||shl_assign||shr_assign))",
   "any()"}
 -doc_end
@@ -345,7 +345,7 @@ constant expressions are required.\""
 #
 
 -doc_begin="The conversion from a function pointer to unsigned long or (void *) does not lose any information, provided that the target type has enough bits to store it."
--config=MC3R1.R11.1,casts+={safe,
+-config=MC3A2.R11.1,casts+={safe,
   "from(type(canonical(__function_pointer_types)))
    &&to(type(canonical(builtin(unsigned long)||pointer(builtin(void)))))
    &&relation(definitely_preserves_value)"
@@ -353,14 +353,14 @@ constant expressions are required.\""
 -doc_end
 
 -doc_begin="The conversion from a function pointer to a boolean has a well-known semantics that do not lead to unexpected behaviour."
--config=MC3R1.R11.1,casts+={safe,
+-config=MC3A2.R11.1,casts+={safe,
   "from(type(canonical(__function_pointer_types)))
    &&kind(pointer_to_boolean)"
 }
 -doc_end
 
 -doc_begin="The conversion from a pointer to an incomplete type to unsigned long does not lose any information, provided that the target type has enough bits to store it."
--config=MC3R1.R11.2,casts+={safe,
+-config=MC3A2.R11.2,casts+={safe,
   "from(type(any()))
    &&to(type(canonical(builtin(unsigned long))))
    &&relation(definitely_preserves_value)"
@@ -368,20 +368,20 @@ constant expressions are required.\""
 -doc_end
 
 -doc_begin="Conversions to object pointers that have a pointee type with a smaller (i.e., less strict) alignment requirement are safe."
--config=MC3R1.R11.3,casts+={safe,
+-config=MC3A2.R11.3,casts+={safe,
   "!relation(more_aligned_pointee)"
 }
 -doc_end
 
 -doc_begin="Conversions from and to integral types are safe, in the assumption that the target type has enough bits to store the value.
 See also Section \"4.7 Arrays and Pointers\" of \"GCC_MANUAL\""
--config=MC3R1.R11.6,casts+={safe,
+-config=MC3A2.R11.6,casts+={safe,
     "(from(type(canonical(integral())))||to(type(canonical(integral()))))
      &&relation(definitely_preserves_value)"}
 -doc_end
 
 -doc_begin="The conversion from a pointer to a boolean has a well-known semantics that do not lead to unexpected behaviour."
--config=MC3R1.R11.6,casts+={safe,
+-config=MC3A2.R11.6,casts+={safe,
   "from(type(canonical(__pointer_types)))
    &&kind(pointer_to_boolean)"
 }
@@ -391,11 +391,11 @@ See also Section \"4.7 Arrays and Pointers\" of \"GCC_MANUAL\""
 with the provided offset. The resulting pointer is then immediately cast back to its
 original type, which preserves the qualifier. This use is deemed safe.
 Fixing this violation would require to increase code complexity and lower readability."
--config=MC3R1.R11.8,reports+={safe,"any_area(any_loc(any_exp(macro(^container_of$))))"}
+-config=MC3A2.R11.8,reports+={safe,"any_area(any_loc(any_exp(macro(^container_of$))))"}
 -doc_end
 
 -doc_begin="This construct is used to check if the type is scalar, and for this purpose the use of 0 as a null pointer constant is deliberate."
--config=MC3R1.R11.9,reports+={deliberate, "any_area(any_loc(any_exp(macro(^__ACCESS_ONCE$))))"
+-config=MC3A2.R11.9,reports+={deliberate, "any_area(any_loc(any_exp(macro(^__ACCESS_ONCE$))))"
 }
 -doc_end
 
@@ -405,16 +405,16 @@ Fixing this violation would require to increase code complexity and lower readab
 
 -doc_begin="All developers and reviewers can be safely assumed to be well aware
 of the short-circuit evaluation strategy of such logical operators."
--config=MC3R1.R13.5,reports+={disapplied,"any()"}
+-config=MC3A2.R13.5,reports+={disapplied,"any()"}
 -doc_end
 
 -doc_begin="Macros alternative_v?call[0-9] use sizeof and typeof to check that the argument types match the corresponding parameter ones."
--config=MC3R1.R13.6,reports+={deliberate,"any_area(any_loc(any_exp(macro(^alternative_vcall[0-9]$))&&file(^xen/arch/x86/include/asm/alternative\\.h*$)))"}
+-config=MC3A2.R13.6,reports+={deliberate,"any_area(any_loc(any_exp(macro(^alternative_vcall[0-9]$))&&file(^xen/arch/x86/include/asm/alternative\\.h*$)))"}
 -config=B.UNEVALEFF,reports+={deliberate,"any_area(any_loc(any_exp(macro(^alternative_v?call[0-9]$))&&file(^xen/arch/x86/include/asm/alterantive\\.h*$)))"}
 -doc_end
 
 -doc_begin="Anything, no matter how complicated, inside the BUILD_BUG_ON macro is subject to a compile-time evaluation without relevant side effects."
--config=MC3R1.R13.6,reports+={safe,"any_area(any_loc(any_exp(macro(name(BUILD_BUG_ON)))))"}
+-config=MC3A2.R13.6,reports+={safe,"any_area(any_loc(any_exp(macro(name(BUILD_BUG_ON)))))"}
 -config=B.UNEVALEFF,reports+={safe,"any_area(any_loc(any_exp(macro(name(BUILD_BUG_ON)))))"}
 -doc_end
 
@@ -425,31 +425,31 @@ of the short-circuit evaluation strategy of such logical operators."
 -doc_begin="The severe restrictions imposed by this rule on the use of for
 statements are not balanced by the presumed facilitation of the peer review
 activity."
--config=MC3R1.R14.2,reports+={disapplied,"any()"}
+-config=MC3A2.R14.2,reports+={disapplied,"any()"}
 -doc_end
 
 -doc_begin="The XEN team relies on the fact that invariant conditions of 'if' statements and conditional operators are deliberate"
--config=MC3R1.R14.3,statements+={deliberate, "wrapped(any(),node(if_stmt||conditional_operator||binary_conditional_operator))" }
+-config=MC3A2.R14.3,statements+={deliberate, "wrapped(any(),node(if_stmt||conditional_operator||binary_conditional_operator))" }
 -doc_end
 
 -doc_begin="Switches having a 'sizeof' operator as the condition are deliberate and have limited scope."
--config=MC3R1.R14.3,statements+={deliberate, "wrapped(any(),node(switch_stmt)&&child(cond, operator(sizeof)))" }
+-config=MC3A2.R14.3,statements+={deliberate, "wrapped(any(),node(switch_stmt)&&child(cond, operator(sizeof)))" }
 -doc_end
 
 -doc_begin="The use of an invariant size argument in {put,get}_unsafe_size and array_access_ok, as defined in arch/x86(_64)?/include/asm/uaccess.h is deliberate and is deemed safe."
 -file_tag+={x86_uaccess, "^xen/arch/x86(_64)?/include/asm/uaccess\\.h$"}
--config=MC3R1.R14.3,reports+={deliberate, "any_area(any_loc(file(x86_uaccess)&&any_exp(macro(^(put|get)_unsafe_size$))))"}
--config=MC3R1.R14.3,reports+={deliberate, "any_area(any_loc(file(x86_uaccess)&&any_exp(macro(^array_access_ok$))))"}
+-config=MC3A2.R14.3,reports+={deliberate, "any_area(any_loc(file(x86_uaccess)&&any_exp(macro(^(put|get)_unsafe_size$))))"}
+-config=MC3A2.R14.3,reports+={deliberate, "any_area(any_loc(file(x86_uaccess)&&any_exp(macro(^array_access_ok$))))"}
 -doc_end
 
 -doc_begin="A controlling expression of 'if' and iteration statements having integer, character or pointer type has a semantics that is well-known to all Xen developers."
--config=MC3R1.R14.4,etypes+={deliberate, "any()", "src_type(integer||character)||src_expr(type(desugar(pointer(any()))))"}
+-config=MC3A2.R14.4,etypes+={deliberate, "any()", "src_type(integer||character)||src_expr(type(desugar(pointer(any()))))"}
 -doc_end
 
 -doc_begin="The XEN team relies on the fact that the enum is_dying has the
 constant with assigned value 0 act as false and the other ones as true,
 therefore have the same behavior of a boolean"
--config=MC3R1.R14.4,etypes+={deliberate, "stmt(child(cond,child(expr,ref(^<?domain>?::is_dying$))))","src_type(enum)"}
+-config=MC3A2.R14.4,etypes+={deliberate, "stmt(child(cond,child(expr,ref(^<?domain>?::is_dying$))))","src_type(enum)"}
 -doc_end
 
 #
@@ -460,43 +460,43 @@ therefore have the same behavior of a boolean"
 therefore it is deemed better to leave such files as is."
 -file_tag+={x86_emulate,"^xen/arch/x86/x86_emulate/.*$"}
 -file_tag+={x86_svm_emulate,"^xen/arch/x86/hvm/svm/emulate\\.c$"}
--config=MC3R1.R16.2,reports+={deliberate, "any_area(any_loc(file(x86_emulate||x86_svm_emulate)))"}
+-config=MC3A2.R16.2,reports+={deliberate, "any_area(any_loc(file(x86_emulate||x86_svm_emulate)))"}
 -doc_end
 
 -doc_begin="Switch clauses ending with continue, goto, return statements are
 safe."
--config=MC3R1.R16.3,terminals+={safe, "node(continue_stmt||goto_stmt||return_stmt)"}
+-config=MC3A2.R16.3,terminals+={safe, "node(continue_stmt||goto_stmt||return_stmt)"}
 -doc_end
 
 -doc_begin="Switch clauses ending with a call to a function that does not give
 the control back (i.e., a function with attribute noreturn) are safe."
--config=MC3R1.R16.3,terminals+={safe, "call(property(noreturn))"}
+-config=MC3A2.R16.3,terminals+={safe, "call(property(noreturn))"}
 -doc_end
 
 -doc_begin="Switch clauses ending with pseudo-keyword \"fallthrough\" are
 safe."
--config=MC3R1.R16.3,reports+={safe, "any_area(end_loc(any_exp(text(/fallthrough;/))))"}
+-config=MC3A2.R16.3,reports+={safe, "any_area(end_loc(any_exp(text(/fallthrough;/))))"}
 -doc_end
 
 -doc_begin="Switch clauses ending with failure method \"BUG()\" are safe."
--config=MC3R1.R16.3,reports+={safe, "any_area(end_loc(any_exp(text(/BUG\\(\\);/))))"}
+-config=MC3A2.R16.3,reports+={safe, "any_area(end_loc(any_exp(text(/BUG\\(\\);/))))"}
 -doc_end
 
 -doc_begin="Switch clauses not ending with the break statement are safe if an
 explicit comment indicating the fallthrough intention is present."
--config=MC3R1.R16.3,reports+={safe, "any_area(end_loc(any_exp(text(^(?s).*/\\* [fF]all ?through.? \\*/.*$,0..1))))"}
+-config=MC3A2.R16.3,reports+={safe, "any_area(end_loc(any_exp(text(^(?s).*/\\* [fF]all ?through.? \\*/.*$,0..1))))"}
 -doc_end
 
 -doc_begin="Switch statements having a controlling expression of enum type deliberately do not have a default case: gcc -Wall enables -Wswitch which warns (and breaks the build as we use -Werror) if one of the enum labels is missing from the switch."
--config=MC3R1.R16.4,reports+={deliberate,'any_area(kind(context)&&^.* has no `default.*$&&stmt(node(switch_stmt)&&child(cond,skip(__non_syntactic_paren_stmts,type(canonical(enum_underlying_type(any())))))))'}
+-config=MC3A2.R16.4,reports+={deliberate,'any_area(kind(context)&&^.* has no `default.*$&&stmt(node(switch_stmt)&&child(cond,skip(__non_syntactic_paren_stmts,type(canonical(enum_underlying_type(any())))))))'}
 -doc_end
 
 -doc_begin="A switch statement with a single switch clause and no default label may be used in place of an equivalent if statement if it is considered to improve readability."
--config=MC3R1.R16.4,switch_clauses+={deliberate,"switch(1)&&default(0)"}
+-config=MC3A2.R16.4,switch_clauses+={deliberate,"switch(1)&&default(0)"}
 -doc_end
 
 -doc_begin="A switch statement with a single switch clause and no default label may be used in place of an equivalent if statement if it is considered to improve readability."
--config=MC3R1.R16.6,switch_clauses+={deliberate, "default(0)"}
+-config=MC3A2.R16.6,switch_clauses+={deliberate, "default(0)"}
 -doc_end
 
 #
@@ -504,16 +504,16 @@ explicit comment indicating the fallthrough intention is present."
 #
 
 -doc_begin="printf()-like functions are allowed to use the variadic features provided by stdarg.h."
--config=MC3R1.R17.1,reports+={deliberate,"any_area(^.*va_list.*$&&context(ancestor_or_self(^.*printk\\(.*\\)$)))"}
--config=MC3R1.R17.1,reports+={deliberate,"any_area(^.*va_list.*$&&context(ancestor_or_self(^.*printf\\(.*\\)$)))"}
--config=MC3R1.R17.1,reports+={deliberate,"any_area(^.*va_list.*$&&context(ancestor_or_self(name(panic)&&kind(function))))"}
--config=MC3R1.R17.1,reports+={deliberate,"any_area(^.*va_list.*$&&context(ancestor_or_self(name(elf_call_log_callback)&&kind(function))))"}
--config=MC3R1.R17.1,reports+={deliberate,"any_area(^.*va_list.*$&&context(ancestor_or_self(name(vprintk_common)&&kind(function))))"}
--config=MC3R1.R17.1,macros+={hide , "^va_(arg|start|copy|end)$"}
+-config=MC3A2.R17.1,reports+={deliberate,"any_area(^.*va_list.*$&&context(ancestor_or_self(^.*printk\\(.*\\)$)))"}
+-config=MC3A2.R17.1,reports+={deliberate,"any_area(^.*va_list.*$&&context(ancestor_or_self(^.*printf\\(.*\\)$)))"}
+-config=MC3A2.R17.1,reports+={deliberate,"any_area(^.*va_list.*$&&context(ancestor_or_self(name(panic)&&kind(function))))"}
+-config=MC3A2.R17.1,reports+={deliberate,"any_area(^.*va_list.*$&&context(ancestor_or_self(name(elf_call_log_callback)&&kind(function))))"}
+-config=MC3A2.R17.1,reports+={deliberate,"any_area(^.*va_list.*$&&context(ancestor_or_self(name(vprintk_common)&&kind(function))))"}
+-config=MC3A2.R17.1,macros+={hide , "^va_(arg|start|copy|end)$"}
 -doc_end
 
 -doc_begin="Not using the return value of a function does not endanger safety if it coincides with an actual argument."
--config=MC3R1.R17.7,calls+={safe, "any()", "decl(name(__builtin_memcpy||__builtin_memmove||__builtin_memset||cpumask_check))"}
+-config=MC3A2.R17.7,calls+={safe, "any()", "decl(name(__builtin_memcpy||__builtin_memmove||__builtin_memset||cpumask_check))"}
 -doc_end
 
 #
@@ -522,7 +522,7 @@ explicit comment indicating the fallthrough intention is present."
 
 -doc_begin="Flexible array members are deliberately used and XEN developers are aware of the dangers related to them:
 unexpected result when the structure is given as argument to a sizeof() operator and the truncation in assignment between structures."
--config=MC3R1.R18.7,reports+={deliberate, "any()"}
+-config=MC3A2.R18.7,reports+={deliberate, "any()"}
 -doc_end
 
 #
@@ -533,7 +533,7 @@ unexpected result when the structure is given as argument to a sizeof() operator
 as function arguments; (2) as macro arguments; (3) as array indices; (4) as lhs
 in assignments; (5) as initializers, possibly designated, in initalizer lists;
 (6) as the constant expression in a switch clause label."
--config=MC3R1.R20.7,expansion_context=
+-config=MC3A2.R20.7,expansion_context=
 {safe, "context(__call_expr_arg_contexts)"},
 {safe, "left_right(^[(,\\[]$,^[),\\]]$)"},
 {safe, "context(skip_to(__expr_non_syntactic_contexts, stmt_child(node(array_subscript_expr), subscript)))"},
@@ -546,52 +546,52 @@ in assignments; (5) as initializers, possibly designated, in initalizer lists;
 breaking the macro's logic; futhermore, the macro is only ever used in the context
 of the IS_ENABLED or STATIC_IF/STATIC_IF_NOT macros, so it always receives a literal
 0 or 1 as input, posing no risk to safety."
--config=MC3R1.R20.7,reports+={safe, "any_area(any_loc(any_exp(macro(^___config_enabled$))))"}
+-config=MC3A2.R20.7,reports+={safe, "any_area(any_loc(any_exp(macro(^___config_enabled$))))"}
 -doc_end
 
 -doc_begin="Violations due to the use of macros defined in files that are
 not in scope for compliance are allowed, as that is imported code."
 -file_tag+={gnu_efi_include, "^xen/include/efi/.*$"}
 -file_tag+={acpi_cpu_idle, "^xen/arch/x86/acpi/cpu_idle\\.c$"}
--config=MC3R1.R20.7,reports+={safe, "any_area(any_loc(file(gnu_efi_include)))"}
--config=MC3R1.R20.7,reports+={safe, "any_area(any_loc(file(acpi_cpu_idle)))"}
+-config=MC3A2.R20.7,reports+={safe, "any_area(any_loc(file(gnu_efi_include)))"}
+-config=MC3A2.R20.7,reports+={safe, "any_area(any_loc(file(acpi_cpu_idle)))"}
 -doc_end
 
 -doc_begin="To avoid compromising readability, the macros alternative_(v)?call[0-9] are allowed
 not to parenthesize their arguments."
--config=MC3R1.R20.7,reports+={safe, "any_area(any_loc(any_exp(macro(^alternative_(v)?call[0-9]$))))"}
+-config=MC3A2.R20.7,reports+={safe, "any_area(any_loc(any_exp(macro(^alternative_(v)?call[0-9]$))))"}
 -doc_end
 
 -doc_begin="The argument 'x' of the count_args_ macro can't be parenthesized as
 the rule would require, without breaking the functionality of the macro. The uses
 of this macro do not lead to developer confusion, and can thus be deviated."
--config=MC3R1.R20.7,reports+={safe, "any_area(any_loc(any_exp(macro(^count_args_$))))"}
+-config=MC3A2.R20.7,reports+={safe, "any_area(any_loc(any_exp(macro(^count_args_$))))"}
 -doc_end
 
 -doc_begin="Uses of variadic macros that have one of their arguments defined as
 a macro and used within the body for both ordinary parameter expansion and as an
 operand to the # or ## operators have a behavior that is well-understood and
 deliberate."
--config=MC3R1.R20.12,macros+={deliberate, "variadic()"}
+-config=MC3A2.R20.12,macros+={deliberate, "variadic()"}
 -doc_end
 
 -doc_begin="Uses of a macro parameter for ordinary expansion and as an operand
 to the # or ## operators within the following macros are deliberate, to provide
 useful diagnostic messages to the user."
--config=MC3R1.R20.12,macros+={deliberate, "name(ASSERT||BUILD_BUG_ON||BUILD_BUG_ON_ZERO||RUNTIME_CHECK)"}
+-config=MC3A2.R20.12,macros+={deliberate, "name(ASSERT||BUILD_BUG_ON||BUILD_BUG_ON_ZERO||RUNTIME_CHECK)"}
 -doc_end
 
 -doc_begin="The helper macro GENERATE_CASE may use a macro parameter for ordinary
 expansion and token pasting to improve readability. Only instances where this
 leads to a violation of the Rule are deviated."
 -file_tag+={deliberate_generate_case, "^xen/arch/arm/vcpreg\\.c$"}
--config=MC3R1.R20.12,macros+={deliberate, "name(GENERATE_CASE)&&loc(file(deliberate_generate_case))"}
+-config=MC3A2.R20.12,macros+={deliberate, "name(GENERATE_CASE)&&loc(file(deliberate_generate_case))"}
 -doc_end
 
 -doc_begin="The macro DEFINE is defined and used in excluded files asm-offsets.c.
 This may still cause violations if entities outside these files are referred to
 in the expansion."
--config=MC3R1.R20.12,macros+={deliberate, "name(DEFINE)&&loc(file(asm_offsets))"}
+-config=MC3A2.R20.12,macros+={deliberate, "name(DEFINE)&&loc(file(asm_offsets))"}
 -doc_end
 
 #
@@ -601,7 +601,7 @@ in the expansion."
 -doc_begin="or, and and xor are reserved identifiers because they constitute alternate
 spellings for the corresponding operators (they are defined as macros by iso646.h).
 However, Xen doesn't use standard library headers, so there is no risk of overlap."
--config=MC3R1.R21.2,reports+={safe, "any_area(stmt(ref(kind(label)&&^(or|and|xor|not)$)))"}
+-config=MC3A2.R21.2,reports+={safe, "any_area(stmt(ref(kind(label)&&^(or|and|xor|not)$)))"}
 -doc_end
 
 -doc_begin="Xen does not use the functions provided by the Standard Library, but
@@ -610,8 +610,8 @@ The implementation of these functions is available in source form, so the undefi
 or implementation-defined behaviors contemplated by the C Standard do not apply.
 If some undefined or unspecified behavior does arise in the implementation, it
 falls under the jurisdiction of other MISRA rules."
--config=MC3R1.R21.9,reports+={deliberate, "any()"}
--config=MC3R1.R21.10,reports+={deliberate, "any()"}
+-config=MC3A2.R21.9,reports+={deliberate, "any()"}
+-config=MC3A2.R21.10,reports+={deliberate, "any()"}
 -doc_end
 
 #
@@ -636,7 +636,7 @@ falls under the jurisdiction of other MISRA rules."
 programmers:no developers' confusion is not possible. In addition, adopted code
 is assumed to work as is. Reports that are fully contained in adopted code are
 hidden/tagged with the 'adopted' tag."
--service_selector={developer_confusion_guidelines,"^(MC3R1\\.R2\\.1|MC3R1\\.R2\\.2|MC3R1\\.R2\\.3|MC3R1\\.R2\\.4|MC3R1\\.R2\\.5|MC3R1\\.R2\\.6|MC3R1\\.R2\\.7|MC3R1\\.R4\\.1|MC3R1\\.R5\\.3|MC3R1\\.R5\\.6|MC3R1\\.R5\\.7|MC3R1\\.R5\\.8|MC3R1\\.R5\\.9|MC3R1\\.R7\\.1|MC3R1\\.R7\\.2|MC3R1\\.R7\\.3|MC3R1\\.R8\\.7|MC3R1\\.R8\\.8|MC3R1\\.R8\\.9|MC3R1\\.R8\\.11|MC3R1\\.R8\\.12|MC3R1\\.R8\\.13|MC3R1\\.R9\\.3|MC3R1\\.R9\\.4|MC3R1\\.R9\\.5|MC3R1\\.R10\\.2|MC3R1\\.R10\\.5|MC3R1\\.R10\\.6|MC3R1\\.R10\\.7|MC3R1\\.R10\\.8|MC3R1\\.R11\\.9|MC3R1\\.R12\\.1|MC3R1\\.R12\\.3|MC3R1\\.R12\\.4|MC3R1\\.R13\\.5|MC3R1\\.R14\\.1|MC3R1\\.R14\\.2|MC3R1\\.R14\\.3|MC3R1\\.R15\\.1|MC3R1\\.R15\\.2|MC3R1\\.R15\\.3|MC3R1\\.R15\\.4|MC3R1\\.R15\\.5|MC3R1\\.R15\\.6|MC3R1\\.R15\\.7|MC3R1\\.R16\\.1|MC3R1\\.R16\\.2|MC3R1\\.R16\\.3|MC3R1\\.R16\\.4|MC3R1\\.R16\\.5|MC3R1\\.R16\\.6|MC3R1\\.R16\\.7|MC3R1\\.R17\\.7|MC3R1\\.R17\\.8|MC3R1\\.R18\\.4|MC3R1\\.R18\\.5)$"
+-service_selector={developer_confusion_guidelines,"^(MC3A2\\.R2\\.1|MC3A2\\.R2\\.2|MC3A2\\.R2\\.3|MC3A2\\.R2\\.4|MC3A2\\.R2\\.5|MC3A2\\.R2\\.6|MC3A2\\.R2\\.7|MC3A2\\.R4\\.1|MC3A2\\.R5\\.3|MC3A2\\.R5\\.6|MC3A2\\.R5\\.7|MC3A2\\.R5\\.8|MC3A2\\.R5\\.9|MC3A2\\.R7\\.1|MC3A2\\.R7\\.2|MC3A2\\.R7\\.3|MC3A2\\.R8\\.7|MC3A2\\.R8\\.8|MC3A2\\.R8\\.9|MC3A2\\.R8\\.11|MC3A2\\.R8\\.12|MC3A2\\.R8\\.13|MC3A2\\.R9\\.3|MC3A2\\.R9\\.4|MC3A2\\.R9\\.5|MC3A2\\.R10\\.2|MC3A2\\.R10\\.5|MC3A2\\.R10\\.6|MC3A2\\.R10\\.7|MC3A2\\.R10\\.8|MC3A2\\.R11\\.9|MC3A2\\.R12\\.1|MC3A2\\.R12\\.3|MC3A2\\.R12\\.4|MC3A2\\.R13\\.5|MC3A2\\.R14\\.1|MC3A2\\.R14\\.2|MC3A2\\.R14\\.3|MC3A2\\.R15\\.1|MC3A2\\.R15\\.2|MC3A2\\.R15\\.3|MC3A2\\.R15\\.4|MC3A2\\.R15\\.5|MC3A2\\.R15\\.6|MC3A2\\.R15\\.7|MC3A2\\.R16\\.1|MC3A2\\.R16\\.2|MC3A2\\.R16\\.3|MC3A2\\.R16\\.4|MC3A2\\.R16\\.5|MC3A2\\.R16\\.6|MC3A2\\.R16\\.7|MC3A2\\.R17\\.7|MC3A2\\.R17\\.8|MC3A2\\.R18\\.4|MC3A2\\.R18\\.5)$"
 }
 -config=developer_confusion_guidelines,reports+={relied,adopted_report}
 -doc_end
diff --git a/automation/eclair_analysis/ECLAIR/monitored.ecl b/automation/eclair_analysis/ECLAIR/monitored.ecl
index 9ffaebbdc3..464516e780 100644
--- a/automation/eclair_analysis/ECLAIR/monitored.ecl
+++ b/automation/eclair_analysis/ECLAIR/monitored.ecl
@@ -1,104 +1,104 @@
 -doc_begin="A set of guidelines that are clean or that only have few violations left."
--enable=MC3R1.D1.1
--enable=MC3R1.D2.1
--enable=MC3R1.D4.1
--enable=MC3R1.D4.10
--enable=MC3R1.D4.11
--enable=MC3R1.D4.12
--enable=MC3R1.D4.14
--enable=MC3R1.D4.3
--enable=MC3R1.D4.7
--enable=MC3R1.R10.1
--enable=MC3R1.R10.2
--enable=MC3R1.R1.1
--enable=MC3R1.R11.1
--enable=MC3R1.R11.7
--enable=MC3R1.R11.8
--enable=MC3R1.R11.9
--enable=MC3R1.R12.5
--enable=MC3R1.R1.3
--enable=MC3R1.R13.6
--enable=MC3R1.R13.1
--enable=MC3R1.R1.4
--enable=MC3R1.R14.1
--enable=MC3R1.R14.4
--enable=MC3R1.R16.2
--enable=MC3R1.R16.3
--enable=MC3R1.R16.4
--enable=MC3R1.R16.6
--enable=MC3R1.R16.7
--enable=MC3R1.R17.1
--enable=MC3R1.R17.3
--enable=MC3R1.R17.4
--enable=MC3R1.R17.5
--enable=MC3R1.R17.6
--enable=MC3R1.R19.1
--enable=MC3R1.R20.12
--enable=MC3R1.R20.13
--enable=MC3R1.R20.14
--enable=MC3R1.R20.4
--enable=MC3R1.R20.7
--enable=MC3R1.R20.9
--enable=MC3R1.R2.1
--enable=MC3R1.R21.10
--enable=MC3R1.R21.13
--enable=MC3R1.R21.17
--enable=MC3R1.R21.18
--enable=MC3R1.R21.19
--enable=MC3R1.R21.20
--enable=MC3R1.R21.21
--enable=MC3R1.R21.9
--enable=MC3R1.R2.2
--enable=MC3R1.R22.2
--enable=MC3R1.R22.4
--enable=MC3R1.R22.5
--enable=MC3R1.R22.6
--enable=MC3R1.R2.6
--enable=MC3R1.R3.1
--enable=MC3R1.R3.2
--enable=MC3R1.R4.1
--enable=MC3R1.R4.2
--enable=MC3R1.R5.1
--enable=MC3R1.R5.2
--enable=MC3R1.R5.3
--enable=MC3R1.R5.4
--enable=MC3R1.R5.5
--enable=MC3R1.R5.6
--enable=MC3R1.R6.1
--enable=MC3R1.R6.2
--enable=MC3R1.R7.1
--enable=MC3R1.R7.2
--enable=MC3R1.R7.3
--enable=MC3R1.R7.4
--enable=MC3R1.R8.1
--enable=MC3R1.R8.10
--enable=MC3R1.R8.12
--enable=MC3R1.R8.14
--enable=MC3R1.R8.2
--enable=MC3R1.R8.3
--enable=MC3R1.R8.4
--enable=MC3R1.R8.5
--enable=MC3R1.R8.6
--enable=MC3R1.R8.8
--enable=MC3R1.R9.2
--enable=MC3R1.R9.3
--enable=MC3R1.R9.4
--enable=MC3R1.R9.5
--enable=MC3R1.R18.8
--enable=MC3R1.R20.2
--enable=MC3R1.R20.3
--enable=MC3R1.R20.6
--enable=MC3R1.R20.11
--enable=MC3R1.R21.3
--enable=MC3R1.R21.4
--enable=MC3R1.R21.5
--enable=MC3R1.R21.7
--enable=MC3R1.R21.8
--enable=MC3R1.R21.12
--enable=MC3R1.R22.1
--enable=MC3R1.R22.3
--enable=MC3R1.R22.7
--enable=MC3R1.R22.8
--enable=MC3R1.R22.9
--enable=MC3R1.R22.10
+-enable=MC3A2.D1.1
+-enable=MC3A2.D2.1
+-enable=MC3A2.D4.1
+-enable=MC3A2.D4.10
+-enable=MC3A2.D4.11
+-enable=MC3A2.D4.12
+-enable=MC3A2.D4.14
+-enable=MC3A2.D4.3
+-enable=MC3A2.D4.7
+-enable=MC3A2.R10.1
+-enable=MC3A2.R10.2
+-enable=MC3A2.R1.1
+-enable=MC3A2.R11.1
+-enable=MC3A2.R11.7
+-enable=MC3A2.R11.8
+-enable=MC3A2.R11.9
+-enable=MC3A2.R12.5
+-enable=MC3A2.R1.3
+-enable=MC3A2.R13.6
+-enable=MC3A2.R13.1
+-enable=MC3A2.R1.4
+-enable=MC3A2.R14.1
+-enable=MC3A2.R14.4
+-enable=MC3A2.R16.2
+-enable=MC3A2.R16.3
+-enable=MC3A2.R16.4
+-enable=MC3A2.R16.6
+-enable=MC3A2.R16.7
+-enable=MC3A2.R17.1
+-enable=MC3A2.R17.3
+-enable=MC3A2.R17.4
+-enable=MC3A2.R17.5
+-enable=MC3A2.R17.6
+-enable=MC3A2.R19.1
+-enable=MC3A2.R20.12
+-enable=MC3A2.R20.13
+-enable=MC3A2.R20.14
+-enable=MC3A2.R20.4
+-enable=MC3A2.R20.7
+-enable=MC3A2.R20.9
+-enable=MC3A2.R2.1
+-enable=MC3A2.R21.10
+-enable=MC3A2.R21.13
+-enable=MC3A2.R21.17
+-enable=MC3A2.R21.18
+-enable=MC3A2.R21.19
+-enable=MC3A2.R21.20
+-enable=MC3A2.R21.21
+-enable=MC3A2.R21.9
+-enable=MC3A2.R2.2
+-enable=MC3A2.R22.2
+-enable=MC3A2.R22.4
+-enable=MC3A2.R22.5
+-enable=MC3A2.R22.6
+-enable=MC3A2.R2.6
+-enable=MC3A2.R3.1
+-enable=MC3A2.R3.2
+-enable=MC3A2.R4.1
+-enable=MC3A2.R4.2
+-enable=MC3A2.R5.1
+-enable=MC3A2.R5.2
+-enable=MC3A2.R5.3
+-enable=MC3A2.R5.4
+-enable=MC3A2.R5.5
+-enable=MC3A2.R5.6
+-enable=MC3A2.R6.1
+-enable=MC3A2.R6.2
+-enable=MC3A2.R7.1
+-enable=MC3A2.R7.2
+-enable=MC3A2.R7.3
+-enable=MC3A2.R7.4
+-enable=MC3A2.R8.1
+-enable=MC3A2.R8.10
+-enable=MC3A2.R8.12
+-enable=MC3A2.R8.14
+-enable=MC3A2.R8.2
+-enable=MC3A2.R8.3
+-enable=MC3A2.R8.4
+-enable=MC3A2.R8.5
+-enable=MC3A2.R8.6
+-enable=MC3A2.R8.8
+-enable=MC3A2.R9.2
+-enable=MC3A2.R9.3
+-enable=MC3A2.R9.4
+-enable=MC3A2.R9.5
+-enable=MC3A2.R18.8
+-enable=MC3A2.R20.2
+-enable=MC3A2.R20.3
+-enable=MC3A2.R20.6
+-enable=MC3A2.R20.11
+-enable=MC3A2.R21.3
+-enable=MC3A2.R21.4
+-enable=MC3A2.R21.5
+-enable=MC3A2.R21.7
+-enable=MC3A2.R21.8
+-enable=MC3A2.R21.12
+-enable=MC3A2.R22.1
+-enable=MC3A2.R22.3
+-enable=MC3A2.R22.7
+-enable=MC3A2.R22.8
+-enable=MC3A2.R22.9
+-enable=MC3A2.R22.10
 -doc_end
diff --git a/automation/eclair_analysis/ECLAIR/tagging.ecl b/automation/eclair_analysis/ECLAIR/tagging.ecl
index b829655ca0..eec1d50f90 100644
--- a/automation/eclair_analysis/ECLAIR/tagging.ecl
+++ b/automation/eclair_analysis/ECLAIR/tagging.ecl
@@ -20,94 +20,94 @@
 -doc_begin="Clean guidelines: new violations for these guidelines are not accepted."
 
 -service_selector={clean_guidelines_common,
-"MC3R1.D1.1||
-MC3R1.D2.1||
-MC3R1.D4.1||
-MC3R1.D4.11||
-MC3R1.D4.14||
-MC3R1.R1.1||
-MC3R1.R1.3||
-MC3R1.R1.4||
-MC3R1.R2.2||
-MC3R1.R2.6||
-MC3R1.R3.1||
-MC3R1.R3.2||
-MC3R1.R4.1||
-MC3R1.R4.2||
-MC3R1.R5.1||
-MC3R1.R5.2||
-MC3R1.R5.4||
-MC3R1.R5.6||
-MC3R1.R6.1||
-MC3R1.R6.2||
-MC3R1.R7.1||
-MC3R1.R7.2||
-MC3R1.R7.4||
-MC3R1.R8.1||
-MC3R1.R8.2||
-MC3R1.R8.5||
-MC3R1.R8.6||
-MC3R1.R8.8||
-MC3R1.R8.10||
-MC3R1.R8.12||
-MC3R1.R8.14||
-MC3R1.R9.2||
-MC3R1.R9.3||
-MC3R1.R9.4||
-MC3R1.R9.5||
-MC3R1.R10.2||
-MC3R1.R11.7||
-MC3R1.R11.9||
-MC3R1.R12.5||
-MC3R1.R14.1||
-MC3R1.R14.4||
-MC3R1.R16.7||
-MC3R1.R17.1||
-MC3R1.R17.3||
-MC3R1.R17.4||
-MC3R1.R17.5||
-MC3R1.R17.6||
-MC3R1.R18.8||
-MC3R1.R20.2||
-MC3R1.R20.3||
-MC3R1.R20.4||
-MC3R1.R20.6||
-MC3R1.R20.9||
-MC3R1.R20.11||
-MC3R1.R20.12||
-MC3R1.R20.13||
-MC3R1.R20.14||
-MC3R1.R21.3||
-MC3R1.R21.4||
-MC3R1.R21.5||
-MC3R1.R21.7||
-MC3R1.R21.8||
-MC3R1.R21.9||
-MC3R1.R21.10||
-MC3R1.R21.12||
-MC3R1.R21.13||
-MC3R1.R21.19||
-MC3R1.R21.21||
-MC3R1.R22.1||
-MC3R1.R22.2||
-MC3R1.R22.3||
-MC3R1.R22.4||
-MC3R1.R22.5||
-MC3R1.R22.6||
-MC3R1.R22.7||
-MC3R1.R22.8||
-MC3R1.R22.9||
-MC3R1.R22.10"
+"MC3A2.D1.1||
+MC3A2.D2.1||
+MC3A2.D4.1||
+MC3A2.D4.11||
+MC3A2.D4.14||
+MC3A2.R1.1||
+MC3A2.R1.3||
+MC3A2.R1.4||
+MC3A2.R2.2||
+MC3A2.R2.6||
+MC3A2.R3.1||
+MC3A2.R3.2||
+MC3A2.R4.1||
+MC3A2.R4.2||
+MC3A2.R5.1||
+MC3A2.R5.2||
+MC3A2.R5.4||
+MC3A2.R5.6||
+MC3A2.R6.1||
+MC3A2.R6.2||
+MC3A2.R7.1||
+MC3A2.R7.2||
+MC3A2.R7.4||
+MC3A2.R8.1||
+MC3A2.R8.2||
+MC3A2.R8.5||
+MC3A2.R8.6||
+MC3A2.R8.8||
+MC3A2.R8.10||
+MC3A2.R8.12||
+MC3A2.R8.14||
+MC3A2.R9.2||
+MC3A2.R9.3||
+MC3A2.R9.4||
+MC3A2.R9.5||
+MC3A2.R10.2||
+MC3A2.R11.7||
+MC3A2.R11.9||
+MC3A2.R12.5||
+MC3A2.R14.1||
+MC3A2.R14.4||
+MC3A2.R16.7||
+MC3A2.R17.1||
+MC3A2.R17.3||
+MC3A2.R17.4||
+MC3A2.R17.5||
+MC3A2.R17.6||
+MC3A2.R18.8||
+MC3A2.R20.2||
+MC3A2.R20.3||
+MC3A2.R20.4||
+MC3A2.R20.6||
+MC3A2.R20.9||
+MC3A2.R20.11||
+MC3A2.R20.12||
+MC3A2.R20.13||
+MC3A2.R20.14||
+MC3A2.R21.3||
+MC3A2.R21.4||
+MC3A2.R21.5||
+MC3A2.R21.7||
+MC3A2.R21.8||
+MC3A2.R21.9||
+MC3A2.R21.10||
+MC3A2.R21.12||
+MC3A2.R21.13||
+MC3A2.R21.19||
+MC3A2.R21.21||
+MC3A2.R22.1||
+MC3A2.R22.2||
+MC3A2.R22.3||
+MC3A2.R22.4||
+MC3A2.R22.5||
+MC3A2.R22.6||
+MC3A2.R22.7||
+MC3A2.R22.8||
+MC3A2.R22.9||
+MC3A2.R22.10"
 }
 
 -setq=target,getenv("XEN_TARGET_ARCH")
 
 if(string_equal(target,"x86_64"),
-    service_selector({"additional_clean_guidelines","MC3R1.D4.3"})
+    service_selector({"additional_clean_guidelines","MC3A2.D4.3"})
 )
 
 if(string_equal(target,"arm64"),
-    service_selector({"additional_clean_guidelines","MC3R1.R16.6||MC3R1.R2.1||MC3R1.R5.3||MC3R1.R7.3"})
+    service_selector({"additional_clean_guidelines","MC3A2.R16.6||MC3A2.R2.1||MC3A2.R5.3||MC3A2.R7.3"})
 )
 
 -reports+={clean:added,"service(clean_guidelines_common||additional_clean_guidelines)"}
diff --git a/docs/misra/documenting-violations.rst b/docs/misra/documenting-violations.rst
index 8f1cbd83b8..d26377d5aa 100644
--- a/docs/misra/documenting-violations.rst
+++ b/docs/misra/documenting-violations.rst
@@ -53,7 +53,7 @@ Here is an example to add a new justification in safe.json::
 |            "analyser": {
 |                "cppcheck": "misra-c2012-20.7",
 |                "coverity": "misra_c_2012_rule_20_7_violation",
-|                "eclair": "MC3R1.R20.7"
+|                "eclair": "MC3A2.R20.7"
 |            },
 |            "name": "R20.7 C macro parameters not used as expression",
 |            "text": "The macro parameters used in this [...]"
@@ -138,7 +138,7 @@ 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
+| MC3A2.R8.6 for program 'xen/xen-syms', variable '_start' has no definition
 
 Also coverity reports it, here is an extract of the finding:
 
@@ -165,7 +165,7 @@ We will prepare our entry in the safe.json database::
 |        {
 |            "id": "SAF-1-safe",
 |            "analyser": {
-|                "eclair": "MC3R1.R8.6",
+|                "eclair": "MC3A2.R8.6",
 |                "coverity": "misra_c_2012_rule_8_6_violation"
 |            },
 |            "name": "Rule 8.6: linker script defined symbols",
diff --git a/docs/misra/safe.json b/docs/misra/safe.json
index 3f18ef401c..a3b07d1c0d 100644
--- a/docs/misra/safe.json
+++ b/docs/misra/safe.json
@@ -4,7 +4,7 @@
         {
             "id": "SAF-0-safe",
             "analyser": {
-                "eclair": "MC3R1.R8.6",
+                "eclair": "MC3A2.R8.6",
                 "coverity": "misra_c_2012_rule_8_6_violation"
             },
             "name": "Rule 8.6: linker script defined symbols",
@@ -13,7 +13,7 @@
         {
             "id": "SAF-1-safe",
             "analyser": {
-                "eclair": "MC3R1.R8.4"
+                "eclair": "MC3A2.R8.4"
             },
             "name": "Rule 8.4: asm-only definition",
             "text": "Functions and variables used only by asm modules do not need to have a visible declaration prior to their definition."
@@ -21,23 +21,23 @@
         {
             "id": "SAF-2-safe",
             "analyser": {
-                "eclair": "MC3R1.R10.1"
+                "eclair": "MC3A2.R10.1"
             },
-            "name": "MC3R1.R10.1: use of an enumeration constant in an arithmetic operation",
+            "name": "MC3A2.R10.1: use of an enumeration constant in an arithmetic operation",
             "text": "This violation can be fixed with a cast to (int) of the enumeration constant, but a deviation was chosen due to code readability (see also the comment in BITS_TO_LONGS)."
         },
         {
             "id": "SAF-3-safe",
             "analyser": {
-                "eclair": "MC3R1.R20.4"
+                "eclair": "MC3A2.R20.4"
             },
-            "name": "MC3R1.R20.4: allow the definition of a macro with the same name as a keyword in some special cases",
+            "name": "MC3A2.R20.4: allow the definition of a macro with the same name as a keyword in some special cases",
             "text": "The definition of a macro with the same name as a keyword can be useful in certain configurations to improve the guarantees that can be provided by Xen. See docs/misra/deviations.rst for a precise rationale for all such cases."
         },
         {
             "id": "SAF-4-safe",
             "analyser": {
-                "eclair": "MC3R1.R17.1"
+                "eclair": "MC3A2.R17.1"
             },
             "name": "Rule 17.1: internal helper functions made to break long running hypercalls into multiple calls.",
             "text": "They need to take a variable number of arguments depending on the original hypercall they are trying to continue."
@@ -45,25 +45,25 @@
         {
             "id": "SAF-5-safe",
             "analyser": {
-                "eclair": "MC3R1.R16.2"
+                "eclair": "MC3A2.R16.2"
             },
-            "name": "MC3R1.R16.2: using a case label when the most closely-enclosing compound statement is not a switch statement",
+            "name": "MC3A2.R16.2: using a case label when the most closely-enclosing compound statement is not a switch statement",
             "text": "A switch label enclosed by some compound statement that is not the body of a switch is permitted within local helper macros that are unlikely to be misused or misunderstood."
         },
         {
             "id": "SAF-6-safe",
             "analyser": {
-                "eclair": "MC3R1.R20.12"
+                "eclair": "MC3A2.R20.12"
             },
-            "name": "MC3R1.R20.12: use of a macro argument that deliberately violates the Rule",
+            "name": "MC3A2.R20.12: use of a macro argument that deliberately violates the Rule",
             "text": "A macro parameter that is itself a macro is intentionally used within the macro both as a regular parameter and for text replacement."
         },
         {
             "id": "SAF-7-safe",
             "analyser": {
-                "eclair": "MC3R1.R20.7"
+                "eclair": "MC3A2.R20.7"
             },
-            "name": "MC3R1.R20.7: deliberately non-parenthesized macro argument",
+            "name": "MC3A2.R20.7: deliberately non-parenthesized macro argument",
             "text": "A macro parameter expands to an expression that is non-parenthesized, as doing so would break the functionality."
         },
         {
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.19


From xen-changelog-bounces@lists.xenproject.org Wed Dec 18 02:11:11 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 18 Dec 2024 02:11:11 +0000
Received: from list by lists.xenproject.org with outflank-mailman.859981.1272066 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tNjWh-0006JY-MO; Wed, 18 Dec 2024 02:11:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 859981.1272066; Wed, 18 Dec 2024 02: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 1tNjWh-0006JQ-Jn; Wed, 18 Dec 2024 02:11:03 +0000
Received: by outflank-mailman (input) for mailman id 859981;
 Wed, 18 Dec 2024 02:11:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tNjWg-0006JK-4D
 for xen-changelog@lists.xenproject.org; Wed, 18 Dec 2024 02:11:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tNjWf-009Vo4-1k
 for xen-changelog@lists.xenproject.org;
 Wed, 18 Dec 2024 02:11:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tNjWf-00FqtM-2R
 for xen-changelog@lists.xenproject.org;
 Wed, 18 Dec 2024 02:11:01 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=IHZ7iu4MIzfctHlgq7+qfvWTpZRLaOP4q0XXjVBXZT8=; b=OCs3Qxyo9zGjNck895DO4gTNsk
	lTuE/V4UtWrk1O3Hedo4ECTWxDvF1L1ZPvdYlFtTjFVnZyTa1DuOEh57J6E3BxOztLhryT7LtSpef
	SG30W+maxvbRQ1DIj8hgTY/hxZjVji8FCqanS9eaokjAPACBic2P5paDF5J3OsrAEkIA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.18] automation/eclair_analysis: substitute deprecated service STD.emptrecd
Message-Id: <E1tNjWf-00FqtM-2R@xenbits.xenproject.org>
Date: Wed, 18 Dec 2024 02:11:01 +0000

commit 246917d90a32c3386cd306d1910d7a7911e24fba
Author:     Nicola Vetrini <nicola.vetrini@bugseng.com>
AuthorDate: Mon Apr 22 15:12:47 2024 +0200
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Dec 17 17:33:40 2024 +0000

    automation/eclair_analysis: substitute deprecated service STD.emptrecd
    
    The ECLAIR service STD.emptrecd (which checks for empty structures) is being
    deprecated; hence, as a preventive measure, STD.anonstct (which checks for
    structures with no named members, an UB in C99) is used here; the latter being
    a more general case than the previous one, this change does not affect the
    analysis. This new service is already supported by the current version of
    ECLAIR.
    
    No functional change.
    
    Signed-off-by: Nicola Vetrini <nicola.vetrini@bugseng.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
    (cherry picked from commit 93d6e6efa8942fb068df799527f36be406fcd2bc)
---
 automation/eclair_analysis/ECLAIR/toolchain.ecl | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/automation/eclair_analysis/ECLAIR/toolchain.ecl b/automation/eclair_analysis/ECLAIR/toolchain.ecl
index e6cd289b5e..e41b27291c 100644
--- a/automation/eclair_analysis/ECLAIR/toolchain.ecl
+++ b/automation/eclair_analysis/ECLAIR/toolchain.ecl
@@ -44,8 +44,8 @@
 -doc_end
 
 -doc_begin="See Section \"6.19 Structures with No Members\" of "GCC_MANUAL"."
--config=STD.emptrecd,behavior+={c99,GCC_ARM64,specified}
--config=STD.emptrecd,behavior+={c99,GCC_X86_64,specified}
+-config=STD.anonstct,behavior+={c99,GCC_ARM64,specified}
+-config=STD.anonstct,behavior+={c99,GCC_X86_64,specified}
 -doc_end
 
 -doc_begin="See Section \"6.18 Arrays of Length Zero\" of "GCC_MANUAL"."
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.18


From xen-changelog-bounces@lists.xenproject.org Wed Dec 18 10:55:17 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 18 Dec 2024 10:55:17 +0000
Received: from list by lists.xenproject.org with outflank-mailman.860265.1272310 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tNrht-00061p-7R; Wed, 18 Dec 2024 10:55:09 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 860265.1272310; Wed, 18 Dec 2024 10:55:09 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tNrht-00061h-4p; Wed, 18 Dec 2024 10:55:09 +0000
Received: by outflank-mailman (input) for mailman id 860265;
 Wed, 18 Dec 2024 10:55:08 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tNrhs-00061Y-4T
 for xen-changelog@lists.xenproject.org; Wed, 18 Dec 2024 10:55:08 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tNrhr-009hzi-1L
 for xen-changelog@lists.xenproject.org;
 Wed, 18 Dec 2024 10:55:07 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tNrhr-00GmXg-28
 for xen-changelog@lists.xenproject.org;
 Wed, 18 Dec 2024 10:55:07 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=CVg1/6Wc/COnNin2HbqSMk8DomuxBBHCmtOrHCdMGZM=; b=6VuJG9CThM2Qfg3po7pKEVfEo0
	eEEXl3e0apAgCGDw9/1sNuk4AvPkXUIIJK+NfjVM0oT2meOmVwc/wYI/KsU7JEvDUMYk1nA66m8Kc
	WLUJkaUwgLEaC4ILba5HWapj/jTc1BVlkIMtmeSg+ReUPXUjjZ1dWFRBHqWLxFM0q2eg=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.18] MISRA: Unmark Rules 1.1 and 2.1 as clean following Eclair upgrade
Message-Id: <E1tNrhr-00GmXg-28@xenbits.xenproject.org>
Date: Wed, 18 Dec 2024 10:55:07 +0000

commit 7c5728046eaeadedc16561c08d43eed124fa9399
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Tue Dec 17 17:04:59 2024 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Wed Dec 18 10:19:07 2024 +0000

    MISRA: Unmark Rules 1.1 and 2.1 as clean following Eclair upgrade
    
    Updating the Eclair runner has had knock-on effects with previously-clean
    rules now flagging violations:
    
     - x86:   Rule 1.1, 1940 violations
     - ARM64: Rule 1.1, 725 violations, Rule 2.1, 255 violations
    
    Fixes: 631f535a3d4f ("xen: update ECLAIR service identifiers from MC3R1 to MC3A2.")
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Roger Pau Monné <roger.pau@citrix.com>
    (cherry picked from commit 171cb318deaa0be786cc3af3599c72e8909e60f9)
    [Xen 4.18 doesn't have R2.1 as clean.  However, D4.11 is unclean too]
---
 automation/eclair_analysis/ECLAIR/tagging.ecl | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/automation/eclair_analysis/ECLAIR/tagging.ecl b/automation/eclair_analysis/ECLAIR/tagging.ecl
index a851127b72..c1cae1f7f9 100644
--- a/automation/eclair_analysis/ECLAIR/tagging.ecl
+++ b/automation/eclair_analysis/ECLAIR/tagging.ecl
@@ -29,7 +29,7 @@
 
 -doc_begin="Clean guidelines: new violations for these guidelines are not accepted."
 
--service_selector={clean_guidelines_common,"^(MC3A2\\.D1\\.1|MC3A2\\.D2\\.1|MC3A2\\.D4\\.11|MC3A2\\.D4\\.14|MC3A2\\.R1\\.1|MC3A2\\.R1\\.3|MC3A2\\.R1\\.4|MC3A2\\.R2\\.2|MC3A2\\.R3\\.1|MC3A2\\.R3\\.2|MC3A2\\.R4\\.1|MC3A2\\.R5\\.1|MC3A2\\.R5\\.2|MC3A2\\.R5\\.4|MC3A2\\.R6\\.1|MC3A2\\.R6\\.2|MC3A2\\.R7\\.1|MC3A2\\.R8\\.1|MC3A2\\.R8\\.5|MC3A2\\.R8\\.8|MC3A2\\.R8\\.10|MC3A2\\.R8\\.12|MC3A2\\.R8\\.14|MC3A2\\.R9\\.2|MC3A2\\.R9\\.4|MC3A2\\.R9\\.5|MC3A2\\.R12\\.5|MC3A2\\.R17\\.3|MC3A2\\.R17\\.4|MC3A2\\.R17\\.6|MC3A2\\.R21\\.13|MC3A2\\.R21\\.19|MC3A2\\.R21\\.21|MC3A2\\.R22\\.2|MC3A2\\.R22\\.4|MC3A2\\.R22\\.5|MC3A2\\.R22\\.6)$"
+-service_selector={clean_guidelines_common,"^(MC3A2\\.D1\\.1|MC3A2\\.D2\\.1|MC3A2\\.D4\\.14|MC3A2\\.R1\\.3|MC3A2\\.R1\\.4|MC3A2\\.R2\\.2|MC3A2\\.R3\\.1|MC3A2\\.R3\\.2|MC3A2\\.R4\\.1|MC3A2\\.R5\\.1|MC3A2\\.R5\\.2|MC3A2\\.R5\\.4|MC3A2\\.R6\\.1|MC3A2\\.R6\\.2|MC3A2\\.R7\\.1|MC3A2\\.R8\\.1|MC3A2\\.R8\\.5|MC3A2\\.R8\\.8|MC3A2\\.R8\\.10|MC3A2\\.R8\\.12|MC3A2\\.R8\\.14|MC3A2\\.R9\\.2|MC3A2\\.R9\\.4|MC3A2\\.R9\\.5|MC3A2\\.R12\\.5|MC3A2\\.R17\\.3|MC3A2\\.R17\\.4|MC3A2\\.R17\\.6|MC3A2\\.R21\\.13|MC3A2\\.R21\\.19|MC3A2\\.R21\\.21|MC3A2\\.R22\\.2|MC3A2\\.R22\\.4|MC3A2\\.R22\\.5|MC3A2\\.R22\\.6)$"
 }
 
 -setq=target,getenv("XEN_TARGET_ARCH")
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.18


From xen-changelog-bounces@lists.xenproject.org Wed Dec 18 12:22:11 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 18 Dec 2024 12:22:11 +0000
Received: from list by lists.xenproject.org with outflank-mailman.860347.1272364 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tNt3z-0007c2-Q9; Wed, 18 Dec 2024 12:22:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 860347.1272364; Wed, 18 Dec 2024 12:22:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tNt3z-0007bu-NU; Wed, 18 Dec 2024 12:22:03 +0000
Received: by outflank-mailman (input) for mailman id 860347;
 Wed, 18 Dec 2024 12:22:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tNt3y-0007bT-4U
 for xen-changelog@lists.xenproject.org; Wed, 18 Dec 2024 12:22:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tNt3x-009jtg-2O
 for xen-changelog@lists.xenproject.org;
 Wed, 18 Dec 2024 12:22:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tNt3x-00GwuV-37
 for xen-changelog@lists.xenproject.org;
 Wed, 18 Dec 2024 12:22:01 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=ENTPS7ueaE6x88nVPcVV0YuFZzUuvGbgGeAQtx70Wqg=; b=kHgHx9SCUWKpJBDZtLQHFvflkS
	jdWQ/0bEarfziaRd3DvvBrtM3yhrT/chzcVGVerhNDeX2eTncB8zzb8vn42JiCz5OYTwcO8tnra2g
	gIrAV0bUbA2/jDbCe4fCUgX59BZLQhIDxcM2FvelpRW7DBhU+tmvyJbGVEJwAI/yFImc=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.18] MISRA: Unmark Rules 1.1 and 2.1 as clean following Eclair upgrade
Message-Id: <E1tNt3x-00GwuV-37@xenbits.xenproject.org>
Date: Wed, 18 Dec 2024 12:22:01 +0000

commit 7c5728046eaeadedc16561c08d43eed124fa9399
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Tue Dec 17 17:04:59 2024 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Wed Dec 18 10:19:07 2024 +0000

    MISRA: Unmark Rules 1.1 and 2.1 as clean following Eclair upgrade
    
    Updating the Eclair runner has had knock-on effects with previously-clean
    rules now flagging violations:
    
     - x86:   Rule 1.1, 1940 violations
     - ARM64: Rule 1.1, 725 violations, Rule 2.1, 255 violations
    
    Fixes: 631f535a3d4f ("xen: update ECLAIR service identifiers from MC3R1 to MC3A2.")
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Roger Pau Monné <roger.pau@citrix.com>
    (cherry picked from commit 171cb318deaa0be786cc3af3599c72e8909e60f9)
    [Xen 4.18 doesn't have R2.1 as clean.  However, D4.11 is unclean too]
---
 automation/eclair_analysis/ECLAIR/tagging.ecl | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/automation/eclair_analysis/ECLAIR/tagging.ecl b/automation/eclair_analysis/ECLAIR/tagging.ecl
index a851127b72..c1cae1f7f9 100644
--- a/automation/eclair_analysis/ECLAIR/tagging.ecl
+++ b/automation/eclair_analysis/ECLAIR/tagging.ecl
@@ -29,7 +29,7 @@
 
 -doc_begin="Clean guidelines: new violations for these guidelines are not accepted."
 
--service_selector={clean_guidelines_common,"^(MC3A2\\.D1\\.1|MC3A2\\.D2\\.1|MC3A2\\.D4\\.11|MC3A2\\.D4\\.14|MC3A2\\.R1\\.1|MC3A2\\.R1\\.3|MC3A2\\.R1\\.4|MC3A2\\.R2\\.2|MC3A2\\.R3\\.1|MC3A2\\.R3\\.2|MC3A2\\.R4\\.1|MC3A2\\.R5\\.1|MC3A2\\.R5\\.2|MC3A2\\.R5\\.4|MC3A2\\.R6\\.1|MC3A2\\.R6\\.2|MC3A2\\.R7\\.1|MC3A2\\.R8\\.1|MC3A2\\.R8\\.5|MC3A2\\.R8\\.8|MC3A2\\.R8\\.10|MC3A2\\.R8\\.12|MC3A2\\.R8\\.14|MC3A2\\.R9\\.2|MC3A2\\.R9\\.4|MC3A2\\.R9\\.5|MC3A2\\.R12\\.5|MC3A2\\.R17\\.3|MC3A2\\.R17\\.4|MC3A2\\.R17\\.6|MC3A2\\.R21\\.13|MC3A2\\.R21\\.19|MC3A2\\.R21\\.21|MC3A2\\.R22\\.2|MC3A2\\.R22\\.4|MC3A2\\.R22\\.5|MC3A2\\.R22\\.6)$"
+-service_selector={clean_guidelines_common,"^(MC3A2\\.D1\\.1|MC3A2\\.D2\\.1|MC3A2\\.D4\\.14|MC3A2\\.R1\\.3|MC3A2\\.R1\\.4|MC3A2\\.R2\\.2|MC3A2\\.R3\\.1|MC3A2\\.R3\\.2|MC3A2\\.R4\\.1|MC3A2\\.R5\\.1|MC3A2\\.R5\\.2|MC3A2\\.R5\\.4|MC3A2\\.R6\\.1|MC3A2\\.R6\\.2|MC3A2\\.R7\\.1|MC3A2\\.R8\\.1|MC3A2\\.R8\\.5|MC3A2\\.R8\\.8|MC3A2\\.R8\\.10|MC3A2\\.R8\\.12|MC3A2\\.R8\\.14|MC3A2\\.R9\\.2|MC3A2\\.R9\\.4|MC3A2\\.R9\\.5|MC3A2\\.R12\\.5|MC3A2\\.R17\\.3|MC3A2\\.R17\\.4|MC3A2\\.R17\\.6|MC3A2\\.R21\\.13|MC3A2\\.R21\\.19|MC3A2\\.R21\\.21|MC3A2\\.R22\\.2|MC3A2\\.R22\\.4|MC3A2\\.R22\\.5|MC3A2\\.R22\\.6)$"
 }
 
 -setq=target,getenv("XEN_TARGET_ARCH")
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.18


From xen-changelog-bounces@lists.xenproject.org Wed Dec 18 14:22:15 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 18 Dec 2024 14:22:15 +0000
Received: from list by lists.xenproject.org with outflank-mailman.860462.1272479 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tNuwD-0003DJ-OJ; Wed, 18 Dec 2024 14:22:09 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 860462.1272479; Wed, 18 Dec 2024 14:22:09 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tNuwD-0003DB-Kh; Wed, 18 Dec 2024 14:22:09 +0000
Received: by outflank-mailman (input) for mailman id 860462;
 Wed, 18 Dec 2024 14:22:07 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tNuwB-0003Cz-LP
 for xen-changelog@lists.xenproject.org; Wed, 18 Dec 2024 14:22:07 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tNuwB-009mXM-0a
 for xen-changelog@lists.xenproject.org;
 Wed, 18 Dec 2024 14:22:07 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tNuwB-00H9Pq-1H
 for xen-changelog@lists.xenproject.org;
 Wed, 18 Dec 2024 14:22:07 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=PnHDZKFH5wnW8//P0jHti2CdkRNX4z6AnG+OCBcTcFc=; b=XNlrH7DW694aaHO2z5sit4ZAnu
	jhOY9WAMnm7vXjVLnBBCbTqb9F4gtpj8MyRQHjXlnBU2ed7dRt0lvZxsM4+3oF9aszAs2GGe6noZz
	sag444Un5hKkj/hM2XQnNOzYHntWiLURIg3tD8KQ75kOWRJKhhfhLeg6cZbDHFthiqQ8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/CET: Support cet=<bool> on the command line
Message-Id: <E1tNuwB-00H9Pq-1H@xenbits.xenproject.org>
Date: Wed, 18 Dec 2024 14:22:07 +0000

commit f9a2e86f21f7c72e8dc7a8939781ec1bc75e21cf
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu Apr 28 09:44:02 2022 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Wed Dec 18 13:18:19 2024 +0000

    x86/CET: Support cet=<bool> on the command line
    
    ... as a shorthand for setting both suboptions at once.  Currently, an admin
    needs to pass cet=no-shstk,no-ibt to turn both off, where cet=0 is a better
    option.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 docs/misc/xen-command-line.pandoc |  4 +++-
 xen/arch/x86/setup.c              | 14 +++++++++++++-
 2 files changed, 16 insertions(+), 2 deletions(-)

diff --git a/docs/misc/xen-command-line.pandoc b/docs/misc/xen-command-line.pandoc
index 293dbc1a95..67727f15e9 100644
--- a/docs/misc/xen-command-line.pandoc
+++ b/docs/misc/xen-command-line.pandoc
@@ -271,7 +271,7 @@ enough. Setting this to a high value may cause boot failure, particularly if
 the NMI watchdog is also enabled.
 
 ### cet
-    = List of [ shstk=<bool>, ibt=<bool> ]
+    = List of [ <bool>, shstk=<bool>, ibt=<bool> ]
 
     Applicability: x86
 
@@ -283,6 +283,8 @@ CET is incompatible with 32bit PV guests.  If any CET sub-options are active,
 they will override the `pv=32` boolean to `false`.  Backwards compatibility
 can be maintained with the pv-shim mechanism.
 
+*   An unqualified boolean is a shorthand for setting all suboptions at once.
+
 *   The `shstk=` boolean controls whether Xen uses Shadow Stacks for its own
     protection.
 
diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c
index 0a748e2c14..3d51c80626 100644
--- a/xen/arch/x86/setup.c
+++ b/xen/arch/x86/setup.c
@@ -121,7 +121,19 @@ static int __init cf_check parse_cet(const char *s)
         if ( !ss )
             ss = strchr(s, '\0');
 
-        if ( (val = parse_boolean("shstk", s, ss)) >= 0 )
+        if ( (val = parse_bool(s, ss)) >= 0 )
+        {
+#if !defined(CONFIG_XEN_SHSTK) && !defined(CONFIG_XEN_IBT)
+            no_config_param("XEN_{SHSTK,IBT}", "cet", s, ss);
+#endif
+#ifdef CONFIG_XEN_SHSTK
+            opt_xen_shstk = val;
+#endif
+#ifdef CONFIG_XEN_IBT
+            opt_xen_ibt = val;
+#endif
+        }
+        else if ( (val = parse_boolean("shstk", s, ss)) >= 0 )
         {
 #ifdef CONFIG_XEN_SHSTK
             opt_xen_shstk = val;
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Dec 18 14:22:19 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 18 Dec 2024 14:22:19 +0000
Received: from list by lists.xenproject.org with outflank-mailman.860463.1272480 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tNuwN-0003Fp-On; Wed, 18 Dec 2024 14:22:19 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 860463.1272480; Wed, 18 Dec 2024 14:22:19 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tNuwN-0003Fh-MB; Wed, 18 Dec 2024 14:22:19 +0000
Received: by outflank-mailman (input) for mailman id 860463;
 Wed, 18 Dec 2024 14:22:17 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tNuwL-0003FE-MD
 for xen-changelog@lists.xenproject.org; Wed, 18 Dec 2024 14:22:17 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tNuwL-009mXg-0w
 for xen-changelog@lists.xenproject.org;
 Wed, 18 Dec 2024 14:22:17 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tNuwL-00H9Qd-1j
 for xen-changelog@lists.xenproject.org;
 Wed, 18 Dec 2024 14:22:17 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=/KuhlhNwDnCo1fIozHoP2wZP/DZsqQ/Xmmu9dwoKpJ4=; b=C3JQo9TRAygcms51XPIaX3h6RR
	SYPDUAM45xfSJ9tu9oRwesOxTSYKkaCf1RLDLLKHW1wiUNdgQacAA9UoG+YZcjJwqYlhf3QAL+CnO
	UzlxRS9r1PFRcZnpAUG3i4oXEgkX/lzNgZtwmlSoStSN28d+c5D6EzcjRlZeRqi44ZzE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] tools: Fix regex syntax warnings with Python 3.12
Message-Id: <E1tNuwL-00H9Qd-1j@xenbits.xenproject.org>
Date: Wed, 18 Dec 2024 14:22:17 +0000

commit 826a9eb072d449cb777d71f52923e6f5f20cefbe
Author:     Ariel Otilibili <Ariel.Otilibili-Anieli@eurecom.fr>
AuthorDate: Tue Dec 17 00:07:20 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Wed Dec 18 13:18:19 2024 +0000

    tools: Fix regex syntax warnings with Python 3.12
    
    Since Python 3.12, invalid escape sequences generate SyntaxWarning.  In the
    future, these invalid sequences will raise a SyntaxError, so changed to using
    raw string notation.
    
    Link: https://docs.python.org/3/whatsnew/3.12.html#other-language-changes
    Fixes: d8f3a67bf98 ("pygrub: further improve grub2 support")
    Fixes: dd03048708a ("xen/pygrub: grub2/grub.cfg from RHEL 7 has new commands in menuentry")
    Fixes: d1b93ea2615 ("tools/pygrub: Make pygrub understand default entry in string format")
    Fixes: 622e368758b ("Add ZFS libfsimage support patch")
    Fixes: 02b26c02c7c ("xen/scripts: add cppcheck tool to the xen-analysis.py script")
    Fixes: 56c0063f4e7 ("xen/misra: xen-analysis.py: Improve the cppcheck version check")
    Signed-off-by: Ariel Otilibili <Ariel.Otilibili-Anieli@eurecom.fr>
    Reviewed-by: Luca Fancellu <luca.fancellu@arm.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 tools/pygrub/src/GrubConf.py                  | 4 ++--
 tools/pygrub/src/pygrub                       | 6 +++---
 xen/scripts/xen_analysis/cppcheck_analysis.py | 4 ++--
 3 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/tools/pygrub/src/GrubConf.py b/tools/pygrub/src/GrubConf.py
index 580c9628ca..904e7d5567 100644
--- a/tools/pygrub/src/GrubConf.py
+++ b/tools/pygrub/src/GrubConf.py
@@ -320,7 +320,7 @@ class GrubConfigFile(_GrubConfigFile):
 def grub2_handle_set(arg):
     (com,arg) = grub_split(arg,2)
     com="set:" + com
-    m = re.match("([\"\'])(.*)\\1", arg)
+    m = re.match(r"([\"\'])(.*)\1", arg)
     if m is not None:
         arg=m.group(2)
     return (com,arg)
@@ -402,7 +402,7 @@ class Grub2ConfigFile(_GrubConfigFile):
                 continue
 
             # new image
-            title_match = re.match('^menuentry ["\'](.*?)["\'] (.*){', l)
+            title_match = re.match(r'^menuentry ["\'](.*?)["\'] (.*){', l)
             if title_match:
                 if img is not None:
                     raise RuntimeError("syntax error: cannot nest menuentry (%d %s)" % (len(img),img))
diff --git a/tools/pygrub/src/pygrub b/tools/pygrub/src/pygrub
index 9d51f96070..e1657c494b 100755
--- a/tools/pygrub/src/pygrub
+++ b/tools/pygrub/src/pygrub
@@ -614,7 +614,7 @@ class Grub:
             title = self.cf.default
             while 1:
                 try:
-                    title = re.search('(\S)>(\S.+$)',title).group(2)
+                    title = re.search(r'(\S)>(\S.+$)',title).group(2)
                 except AttributeError:
                     break
 
@@ -1039,7 +1039,7 @@ if __name__ == "__main__":
 
     # if boot filesystem is set then pass to fsimage.open
     bootfsargs = '"%s"' % incfg["args"]
-    bootfsgroup = re.findall('zfs-bootfs=(.*?)[\s\,\"]', bootfsargs)
+    bootfsgroup = re.findall(r'zfs-bootfs=(.*?)[\s\,\"]', bootfsargs)
     if bootfsgroup:
         bootfsoptions = bootfsgroup[0]
     else:
@@ -1104,7 +1104,7 @@ if __name__ == "__main__":
     if chosencfg["args"]:
         zfsinfo = xenfsimage.getbootstring(fs)
         if zfsinfo is not None:
-            e = re.compile("zfs-bootfs=[\w\-\.\:@/]+" )
+            e = re.compile(r"zfs-bootfs=[\w\-.:@/]+" )
             (chosencfg["args"],count) = e.subn(zfsinfo, chosencfg["args"])
             if count == 0:
                chosencfg["args"] += " -B %s" % zfsinfo
diff --git a/xen/scripts/xen_analysis/cppcheck_analysis.py b/xen/scripts/xen_analysis/cppcheck_analysis.py
index 850335c998..ce7bda91b6 100644
--- a/xen/scripts/xen_analysis/cppcheck_analysis.py
+++ b/xen/scripts/xen_analysis/cppcheck_analysis.py
@@ -93,7 +93,7 @@ def __generate_suppression_list(out_file):
                         # 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)
+                        comment_line_stops = re.match(r'^.*\*/$', line)
                         if (not comment_section) and comment_line_starts:
                             comment_section = True
                         if (len(line.strip()) != 0) and (not comment_section):
@@ -157,7 +157,7 @@ def generate_cppcheck_deps():
             "Error occured retrieving cppcheck version:\n{}\n\n{}"
         )
 
-    version_regex = re.search('^Cppcheck (\d+)\.(\d+)(?:\.\d+)?$',
+    version_regex = re.search(r'^Cppcheck (\d+)\.(\d+)(?:\.\d+)?$',
                               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
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Dec 18 17:11:09 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 18 Dec 2024 17:11:09 +0000
Received: from list by lists.xenproject.org with outflank-mailman.860698.1272695 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tNxZf-00064Q-6K; Wed, 18 Dec 2024 17:11:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 860698.1272695; Wed, 18 Dec 2024 17: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 1tNxZf-00064J-3c; Wed, 18 Dec 2024 17:11:03 +0000
Received: by outflank-mailman (input) for mailman id 860698;
 Wed, 18 Dec 2024 17:11:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tNxZd-00064D-VZ
 for xen-changelog@lists.xenproject.org; Wed, 18 Dec 2024 17:11:01 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tNxZd-009qaK-1v
 for xen-changelog@lists.xenproject.org;
 Wed, 18 Dec 2024 17:11:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tNxZd-00HVR0-2d
 for xen-changelog@lists.xenproject.org;
 Wed, 18 Dec 2024 17:11:01 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=htGUrCllMCwzSgLvtdzIoPM7Ob9Ff+9vQ+fUJA/2ixw=; b=pOcv/bUaNAbp/RjgltbjFGJIFT
	MJR+CUD0Yb+cX4rptmp0QLfgoS67kbd+F+46LrX3iOraS9j5psLJ9db2iUqHrblI8WfE4rmM8PZEm
	DjjEFl3YQod4vg+EKT9vDwetjR2QXniZ6XC0NRunKrX+jtBQuM5oQ7rZctGVBkSdLRtY=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/CET: Support cet=<bool> on the command line
Message-Id: <E1tNxZd-00HVR0-2d@xenbits.xenproject.org>
Date: Wed, 18 Dec 2024 17:11:01 +0000

commit f9a2e86f21f7c72e8dc7a8939781ec1bc75e21cf
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu Apr 28 09:44:02 2022 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Wed Dec 18 13:18:19 2024 +0000

    x86/CET: Support cet=<bool> on the command line
    
    ... as a shorthand for setting both suboptions at once.  Currently, an admin
    needs to pass cet=no-shstk,no-ibt to turn both off, where cet=0 is a better
    option.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 docs/misc/xen-command-line.pandoc |  4 +++-
 xen/arch/x86/setup.c              | 14 +++++++++++++-
 2 files changed, 16 insertions(+), 2 deletions(-)

diff --git a/docs/misc/xen-command-line.pandoc b/docs/misc/xen-command-line.pandoc
index 293dbc1a95..67727f15e9 100644
--- a/docs/misc/xen-command-line.pandoc
+++ b/docs/misc/xen-command-line.pandoc
@@ -271,7 +271,7 @@ enough. Setting this to a high value may cause boot failure, particularly if
 the NMI watchdog is also enabled.
 
 ### cet
-    = List of [ shstk=<bool>, ibt=<bool> ]
+    = List of [ <bool>, shstk=<bool>, ibt=<bool> ]
 
     Applicability: x86
 
@@ -283,6 +283,8 @@ CET is incompatible with 32bit PV guests.  If any CET sub-options are active,
 they will override the `pv=32` boolean to `false`.  Backwards compatibility
 can be maintained with the pv-shim mechanism.
 
+*   An unqualified boolean is a shorthand for setting all suboptions at once.
+
 *   The `shstk=` boolean controls whether Xen uses Shadow Stacks for its own
     protection.
 
diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c
index 0a748e2c14..3d51c80626 100644
--- a/xen/arch/x86/setup.c
+++ b/xen/arch/x86/setup.c
@@ -121,7 +121,19 @@ static int __init cf_check parse_cet(const char *s)
         if ( !ss )
             ss = strchr(s, '\0');
 
-        if ( (val = parse_boolean("shstk", s, ss)) >= 0 )
+        if ( (val = parse_bool(s, ss)) >= 0 )
+        {
+#if !defined(CONFIG_XEN_SHSTK) && !defined(CONFIG_XEN_IBT)
+            no_config_param("XEN_{SHSTK,IBT}", "cet", s, ss);
+#endif
+#ifdef CONFIG_XEN_SHSTK
+            opt_xen_shstk = val;
+#endif
+#ifdef CONFIG_XEN_IBT
+            opt_xen_ibt = val;
+#endif
+        }
+        else if ( (val = parse_boolean("shstk", s, ss)) >= 0 )
         {
 #ifdef CONFIG_XEN_SHSTK
             opt_xen_shstk = val;
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Dec 18 17:11:13 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 18 Dec 2024 17:11:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.860699.1272698 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tNxZp-00066l-7P; Wed, 18 Dec 2024 17:11:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 860699.1272698; Wed, 18 Dec 2024 17: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 1tNxZp-00066e-51; Wed, 18 Dec 2024 17:11:13 +0000
Received: by outflank-mailman (input) for mailman id 860699;
 Wed, 18 Dec 2024 17:11:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tNxZo-00066S-2e
 for xen-changelog@lists.xenproject.org; Wed, 18 Dec 2024 17:11:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tNxZn-009qam-2J
 for xen-changelog@lists.xenproject.org;
 Wed, 18 Dec 2024 17:11:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tNxZn-00HVSB-35
 for xen-changelog@lists.xenproject.org;
 Wed, 18 Dec 2024 17:11:11 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=LHctBR7nX4/sJpSbieJqgdTYsQ+3J98zGjofOFbKgV0=; b=VmYnBjeEznGtq8lgbijiwBH1GF
	+GJSfiBIEJYZnIW24Mdxeb3kSzmrORNhPc3VHdvzGNyUz1yjWS3Lsh3jA41xDOZ2pdNG8ls095sjn
	GajLJf7d3OxmGo3208wz8Ud2gcBUXVmGh0mzcBy9wmDira8ZHoAkapynibwb+7+u4ITU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools: Fix regex syntax warnings with Python 3.12
Message-Id: <E1tNxZn-00HVSB-35@xenbits.xenproject.org>
Date: Wed, 18 Dec 2024 17:11:11 +0000

commit 826a9eb072d449cb777d71f52923e6f5f20cefbe
Author:     Ariel Otilibili <Ariel.Otilibili-Anieli@eurecom.fr>
AuthorDate: Tue Dec 17 00:07:20 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Wed Dec 18 13:18:19 2024 +0000

    tools: Fix regex syntax warnings with Python 3.12
    
    Since Python 3.12, invalid escape sequences generate SyntaxWarning.  In the
    future, these invalid sequences will raise a SyntaxError, so changed to using
    raw string notation.
    
    Link: https://docs.python.org/3/whatsnew/3.12.html#other-language-changes
    Fixes: d8f3a67bf98 ("pygrub: further improve grub2 support")
    Fixes: dd03048708a ("xen/pygrub: grub2/grub.cfg from RHEL 7 has new commands in menuentry")
    Fixes: d1b93ea2615 ("tools/pygrub: Make pygrub understand default entry in string format")
    Fixes: 622e368758b ("Add ZFS libfsimage support patch")
    Fixes: 02b26c02c7c ("xen/scripts: add cppcheck tool to the xen-analysis.py script")
    Fixes: 56c0063f4e7 ("xen/misra: xen-analysis.py: Improve the cppcheck version check")
    Signed-off-by: Ariel Otilibili <Ariel.Otilibili-Anieli@eurecom.fr>
    Reviewed-by: Luca Fancellu <luca.fancellu@arm.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 tools/pygrub/src/GrubConf.py                  | 4 ++--
 tools/pygrub/src/pygrub                       | 6 +++---
 xen/scripts/xen_analysis/cppcheck_analysis.py | 4 ++--
 3 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/tools/pygrub/src/GrubConf.py b/tools/pygrub/src/GrubConf.py
index 580c9628ca..904e7d5567 100644
--- a/tools/pygrub/src/GrubConf.py
+++ b/tools/pygrub/src/GrubConf.py
@@ -320,7 +320,7 @@ class GrubConfigFile(_GrubConfigFile):
 def grub2_handle_set(arg):
     (com,arg) = grub_split(arg,2)
     com="set:" + com
-    m = re.match("([\"\'])(.*)\\1", arg)
+    m = re.match(r"([\"\'])(.*)\1", arg)
     if m is not None:
         arg=m.group(2)
     return (com,arg)
@@ -402,7 +402,7 @@ class Grub2ConfigFile(_GrubConfigFile):
                 continue
 
             # new image
-            title_match = re.match('^menuentry ["\'](.*?)["\'] (.*){', l)
+            title_match = re.match(r'^menuentry ["\'](.*?)["\'] (.*){', l)
             if title_match:
                 if img is not None:
                     raise RuntimeError("syntax error: cannot nest menuentry (%d %s)" % (len(img),img))
diff --git a/tools/pygrub/src/pygrub b/tools/pygrub/src/pygrub
index 9d51f96070..e1657c494b 100755
--- a/tools/pygrub/src/pygrub
+++ b/tools/pygrub/src/pygrub
@@ -614,7 +614,7 @@ class Grub:
             title = self.cf.default
             while 1:
                 try:
-                    title = re.search('(\S)>(\S.+$)',title).group(2)
+                    title = re.search(r'(\S)>(\S.+$)',title).group(2)
                 except AttributeError:
                     break
 
@@ -1039,7 +1039,7 @@ if __name__ == "__main__":
 
     # if boot filesystem is set then pass to fsimage.open
     bootfsargs = '"%s"' % incfg["args"]
-    bootfsgroup = re.findall('zfs-bootfs=(.*?)[\s\,\"]', bootfsargs)
+    bootfsgroup = re.findall(r'zfs-bootfs=(.*?)[\s\,\"]', bootfsargs)
     if bootfsgroup:
         bootfsoptions = bootfsgroup[0]
     else:
@@ -1104,7 +1104,7 @@ if __name__ == "__main__":
     if chosencfg["args"]:
         zfsinfo = xenfsimage.getbootstring(fs)
         if zfsinfo is not None:
-            e = re.compile("zfs-bootfs=[\w\-\.\:@/]+" )
+            e = re.compile(r"zfs-bootfs=[\w\-.:@/]+" )
             (chosencfg["args"],count) = e.subn(zfsinfo, chosencfg["args"])
             if count == 0:
                chosencfg["args"] += " -B %s" % zfsinfo
diff --git a/xen/scripts/xen_analysis/cppcheck_analysis.py b/xen/scripts/xen_analysis/cppcheck_analysis.py
index 850335c998..ce7bda91b6 100644
--- a/xen/scripts/xen_analysis/cppcheck_analysis.py
+++ b/xen/scripts/xen_analysis/cppcheck_analysis.py
@@ -93,7 +93,7 @@ def __generate_suppression_list(out_file):
                         # 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)
+                        comment_line_stops = re.match(r'^.*\*/$', line)
                         if (not comment_section) and comment_line_starts:
                             comment_section = True
                         if (len(line.strip()) != 0) and (not comment_section):
@@ -157,7 +157,7 @@ def generate_cppcheck_deps():
             "Error occured retrieving cppcheck version:\n{}\n\n{}"
         )
 
-    version_regex = re.search('^Cppcheck (\d+)\.(\d+)(?:\.\d+)?$',
+    version_regex = re.search(r'^Cppcheck (\d+)\.(\d+)(?:\.\d+)?$',
                               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
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Dec 19 08:11:16 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 19 Dec 2024 08:11:16 +0000
Received: from list by lists.xenproject.org with outflank-mailman.860841.1272814 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tOBcj-0002Xs-8D; Thu, 19 Dec 2024 08:11:09 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 860841.1272814; Thu, 19 Dec 2024 08:11:09 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tOBcj-0002Xi-4p; Thu, 19 Dec 2024 08:11:09 +0000
Received: by outflank-mailman (input) for mailman id 860841;
 Thu, 19 Dec 2024 08:11:08 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tOBci-0002XZ-Fy
 for xen-changelog@lists.xenproject.org; Thu, 19 Dec 2024 08:11:08 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tOBci-00BNSx-0H
 for xen-changelog@lists.xenproject.org;
 Thu, 19 Dec 2024 08:11:08 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tOBci-002jHv-12
 for xen-changelog@lists.xenproject.org;
 Thu, 19 Dec 2024 08:11:08 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=xvVDTXw8HDdI8Sa3REC807DpEiiJZ+tnsbet3ZOECWo=; b=wkd/CoG6ms0RsA9QtP5zZWzM3h
	y4QY2gWSZSwft5lUApZfQs8YCzOcY7qkFrmhgReFMgWTyqE26fHN8VmUQryyFs/H4cCT0f6crQQku
	5Dq2kaGT0yuSBrEDt21l7y3nipWnujXnb8VN7c0ZmfUwWxUqQn++lNsr5qxqVyj0YDps=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.18] update Xen version to 4.18.4
Message-Id: <E1tOBci-002jHv-12@xenbits.xenproject.org>
Date: Thu, 19 Dec 2024 08:11:08 +0000

commit e77ff547385861c72108aa380ab279e35d0f4735
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Dec 19 09:04:30 2024 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Dec 19 09:04:30 2024 +0100

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

diff --git a/Config.mk b/Config.mk
index 39fe4cef1f..6190b31358 100644
--- a/Config.mk
+++ b/Config.mk
@@ -221,10 +221,10 @@ OVMF_UPSTREAM_URL ?= https://xenbits.xen.org/git-http/ovmf.git
 OVMF_UPSTREAM_REVISION ?= ba91d0292e593df8528b66f99c1b0b14fadc8e16
 
 QEMU_UPSTREAM_URL ?= https://xenbits.xen.org/git-http/qemu-xen.git
-QEMU_UPSTREAM_REVISION ?= qemu-xen-4.18.1
+QEMU_UPSTREAM_REVISION ?= qemu-xen-4.18.4
 
 MINIOS_UPSTREAM_URL ?= https://xenbits.xen.org/git-http/mini-os.git
-MINIOS_UPSTREAM_REVISION ?= ff13dabd3099687921145a5e3e960ba8337e7488
+MINIOS_UPSTREAM_REVISION ?= xen-RELEASE-4.18.4
 
 SEABIOS_UPSTREAM_URL ?= https://xenbits.xen.org/git-http/seabios.git
 SEABIOS_UPSTREAM_REVISION ?= rel-1.16.2
diff --git a/xen/Makefile b/xen/Makefile
index 68b14fb356..a4e7a2f6d1 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    = 18
-export XEN_EXTRAVERSION ?= .4-pre$(XEN_VENDORVERSION)
+export XEN_EXTRAVERSION ?= .4$(XEN_VENDORVERSION)
 export XEN_FULLVERSION   = $(XEN_VERSION).$(XEN_SUBVERSION)$(XEN_EXTRAVERSION)
 -include xen-version
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.18


From xen-changelog-bounces@lists.xenproject.org Thu Dec 19 09:11:15 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 19 Dec 2024 09:11:15 +0000
Received: from list by lists.xenproject.org with outflank-mailman.860946.1272927 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tOCYn-0008Nv-SK; Thu, 19 Dec 2024 09:11:09 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 860946.1272927; Thu, 19 Dec 2024 09:11:09 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tOCYn-0008Nn-PY; Thu, 19 Dec 2024 09:11:09 +0000
Received: by outflank-mailman (input) for mailman id 860946;
 Thu, 19 Dec 2024 09:11:08 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tOCYl-0008Kl-VQ
 for xen-changelog@lists.xenproject.org; Thu, 19 Dec 2024 09:11:07 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tOCYl-00BOh5-1o
 for xen-changelog@lists.xenproject.org;
 Thu, 19 Dec 2024 09:11:07 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tOCYl-002qaX-2P
 for xen-changelog@lists.xenproject.org;
 Thu, 19 Dec 2024 09:11:07 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=hNPF0glnuCSVTCJZ0KsjuIJuEJIYTxKf6316wM3gUv4=; b=JQ4C5KGPSnxC2uzanu3gI6RMEg
	AHBrLCtMYXshf7eAwC2EF1TqD/UbtLdw/A9bxNeuXt0UBJitYlTeBzA2efQmC+4PUFAbceplwJIyE
	nDdF6SVxJIFCsF+ghCNynHCIvTN6vVIvypA5tQYILtVsDO1hcVZXwLRbdgxIoMqeLBGY=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] tools: add a dedicated header file for barrier definitions
Message-Id: <E1tOCYl-002qaX-2P@xenbits.xenproject.org>
Date: Thu, 19 Dec 2024 09:11:07 +0000

commit b359d3801389aebf9b3be6f5b5aed45e4fa6635f
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Thu Dec 19 10:04:45 2024 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Dec 19 10:04:45 2024 +0100

    tools: add a dedicated header file for barrier definitions
    
    Instead of having to include xenctrl.h for getting definitions of cpu
    barriers, add a dedicated header for that purpose.
    
    Switch the xen-9pfsd daemon to use the new header instead of xenctrl.h.
    
    This is in preparation of making Xenstore independent from libxenctrl.
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Anthony PERARD <anthony.perard@vates.tech>
---
 tools/9pfsd/io.c            |  5 ++++-
 tools/include/xen-barrier.h | 39 +++++++++++++++++++++++++++++++++++++++
 tools/include/xenctrl.h     | 28 +---------------------------
 tools/libs/ctrl/Makefile    |  2 +-
 4 files changed, 45 insertions(+), 29 deletions(-)

diff --git a/tools/9pfsd/io.c b/tools/9pfsd/io.c
index 468e0241f5..14cfcaf568 100644
--- a/tools/9pfsd/io.c
+++ b/tools/9pfsd/io.c
@@ -13,15 +13,18 @@
 
 #include <assert.h>
 #include <errno.h>
+#include <stdarg.h>
 #include <stdbool.h>
+#include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
 #include <syslog.h>
+#include <unistd.h>
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <dirent.h>
 #include <fcntl.h>
-#include <xenctrl.h>           /* For cpu barriers. */
+#include <xen-barrier.h>
 #include <xen-tools/common-macros.h>
 
 #include "xen-9pfsd.h"
diff --git a/tools/include/xen-barrier.h b/tools/include/xen-barrier.h
new file mode 100644
index 0000000000..5c22ee112c
--- /dev/null
+++ b/tools/include/xen-barrier.h
@@ -0,0 +1,39 @@
+/* SPDX-License-Identifier: LGPL-2.1-only */
+/******************************************************************************
+ * xen-barrier.h
+ *
+ * Definition of CPU barriers, part of libxenctrl.
+ *
+ * Copyright (c) 2003-2004, K A Fraser.
+ */
+
+#ifndef XEN_BARRIER_H
+#define XEN_BARRIER_H
+
+/*
+ *  DEFINITIONS FOR CPU BARRIERS
+ */
+
+#define xen_barrier() asm volatile ( "" : : : "memory")
+
+#if defined(__i386__)
+#define xen_mb()  asm volatile ( "lock addl $0, -4(%%esp)" ::: "memory" )
+#define xen_rmb() xen_barrier()
+#define xen_wmb() xen_barrier()
+#elif defined(__x86_64__)
+#define xen_mb()  asm volatile ( "lock addl $0, -32(%%rsp)" ::: "memory" )
+#define xen_rmb() xen_barrier()
+#define xen_wmb() xen_barrier()
+#elif defined(__arm__)
+#define xen_mb()   asm volatile ("dmb" : : : "memory")
+#define xen_rmb()  asm volatile ("dmb" : : : "memory")
+#define xen_wmb()  asm volatile ("dmb" : : : "memory")
+#elif defined(__aarch64__)
+#define xen_mb()   asm volatile ("dmb sy" : : : "memory")
+#define xen_rmb()  asm volatile ("dmb sy" : : : "memory")
+#define xen_wmb()  asm volatile ("dmb sy" : : : "memory")
+#else
+#error "Define barriers"
+#endif
+
+#endif /* XEN_BARRIER_H */
diff --git a/tools/include/xenctrl.h b/tools/include/xenctrl.h
index 29617585c5..ea57e9dbb9 100644
--- a/tools/include/xenctrl.h
+++ b/tools/include/xenctrl.h
@@ -48,6 +48,7 @@
 #include <xen/platform.h>
 
 #include "xentoollog.h"
+#include "xen-barrier.h"
 
 #if defined(__i386__) || defined(__x86_64__)
 #include <xen/foreign/x86_32.h>
@@ -61,33 +62,6 @@
 
 #define INVALID_MFN  (~0UL)
 
-/*
- *  DEFINITIONS FOR CPU BARRIERS
- */
-
-#define xen_barrier() asm volatile ( "" : : : "memory")
-
-#if defined(__i386__)
-#define xen_mb()  asm volatile ( "lock addl $0, -4(%%esp)" ::: "memory" )
-#define xen_rmb() xen_barrier()
-#define xen_wmb() xen_barrier()
-#elif defined(__x86_64__)
-#define xen_mb()  asm volatile ( "lock addl $0, -32(%%rsp)" ::: "memory" )
-#define xen_rmb() xen_barrier()
-#define xen_wmb() xen_barrier()
-#elif defined(__arm__)
-#define xen_mb()   asm volatile ("dmb" : : : "memory")
-#define xen_rmb()  asm volatile ("dmb" : : : "memory")
-#define xen_wmb()  asm volatile ("dmb" : : : "memory")
-#elif defined(__aarch64__)
-#define xen_mb()   asm volatile ("dmb sy" : : : "memory")
-#define xen_rmb()  asm volatile ("dmb sy" : : : "memory")
-#define xen_wmb()  asm volatile ("dmb sy" : : : "memory")
-#else
-#error "Define barriers"
-#endif
-
-
 #define XENCTRL_HAS_XC_INTERFACE 1
 /* In Xen 4.0 and earlier, xc_interface_open and xc_evtchn_open would
  * both return ints being the file descriptor.  In 4.1 and later, they
diff --git a/tools/libs/ctrl/Makefile b/tools/libs/ctrl/Makefile
index 5fe0bfad0c..acce8639d3 100644
--- a/tools/libs/ctrl/Makefile
+++ b/tools/libs/ctrl/Makefile
@@ -3,7 +3,7 @@ include $(XEN_ROOT)/tools/Rules.mk
 
 include Makefile.common
 
-LIBHEADER := xenctrl.h xenctrl_compat.h
+LIBHEADER := xenctrl.h xenctrl_compat.h xen-barrier.h
 PKG_CONFIG_FILE := xencontrol.pc
 PKG_CONFIG_NAME := Xencontrol
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Dec 19 09:11:20 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 19 Dec 2024 09:11:20 +0000
Received: from list by lists.xenproject.org with outflank-mailman.860948.1272931 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tOCYx-0008T1-TY; Thu, 19 Dec 2024 09:11:19 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 860948.1272931; Thu, 19 Dec 2024 09:11:19 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tOCYx-0008St-R2; Thu, 19 Dec 2024 09:11:19 +0000
Received: by outflank-mailman (input) for mailman id 860948;
 Thu, 19 Dec 2024 09:11:18 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tOCYw-0008Sa-0r
 for xen-changelog@lists.xenproject.org; Thu, 19 Dec 2024 09:11:18 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tOCYv-00BOhO-2F
 for xen-changelog@lists.xenproject.org;
 Thu, 19 Dec 2024 09:11:18 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tOCYv-002qb8-2x
 for xen-changelog@lists.xenproject.org;
 Thu, 19 Dec 2024 09:11:17 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=OlIy+vOxLe6JNmZK2QDZABA5m8Re1u9CWr+YXzB0nUo=; b=6jaxlDmGpBru2on+zWpqPXwOpi
	+IxIj0ZIRKNlclKlB9htNoCiOswfQ6+fqJa6siYBx1UONEXdS9CwUUgiNbQYRFCU3jksYRyEu7uYL
	2PUIiYKTXQfECw4n4WcycpzL3wt2dk9dH4tKhfTKibrW4V/5piAc3BLCq2wx+28V+oGg=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/page_alloc: introduce preserved page flags macro
Message-Id: <E1tOCYv-002qb8-2x@xenbits.xenproject.org>
Date: Thu, 19 Dec 2024 09:11:17 +0000

commit b527a27e17886328ef26a856cb0a50a606330c29
Author:     Carlo Nonato <carlo.nonato@minervasys.tech>
AuthorDate: Thu Dec 19 10:05:14 2024 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Dec 19 10:05:14 2024 +0100

    xen/page_alloc: introduce preserved page flags macro
    
    PGC_static and PGC_extra need to be preserved when assigning a page.
    Define a new macro that groups those flags and use it instead of or'ing
    every time.
    
    Signed-off-by: Carlo Nonato <carlo.nonato@minervasys.tech>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/common/page_alloc.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/xen/common/page_alloc.c b/xen/common/page_alloc.c
index 1f424333db..b76a03fd73 100644
--- a/xen/common/page_alloc.c
+++ b/xen/common/page_alloc.c
@@ -160,6 +160,10 @@
 #endif
 
 #define PGC_no_buddy_merge PGC_static
+/*
+ * Flags that are preserved in assign_pages() (and only there)
+ */
+#define PGC_preserved (PGC_extra | PGC_static)
 
 #ifndef PGT_TYPE_INFO_INITIALIZER
 #define PGT_TYPE_INFO_INITIALIZER 0
@@ -2384,7 +2388,7 @@ int assign_pages(
 
         for ( i = 0; i < nr; i++ )
         {
-            ASSERT(!(pg[i].count_info & ~(PGC_extra | PGC_static)));
+            ASSERT(!(pg[i].count_info & ~PGC_preserved));
             if ( pg[i].count_info & PGC_extra )
                 extra_pages++;
         }
@@ -2444,7 +2448,7 @@ int assign_pages(
         page_set_owner(&pg[i], d);
         smp_wmb(); /* Domain pointer must be visible before updating refcnt. */
         pg[i].count_info =
-            (pg[i].count_info & (PGC_extra | PGC_static)) | PGC_allocated | 1;
+            (pg[i].count_info & PGC_preserved) | PGC_allocated | 1;
 
         page_list_add_tail(&pg[i], page_to_list(d, &pg[i]));
     }
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Dec 19 09:33:12 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 19 Dec 2024 09:33:12 +0000
Received: from list by lists.xenproject.org with outflank-mailman.860993.1272975 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tOCu5-0005R6-9f; Thu, 19 Dec 2024 09:33:09 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 860993.1272975; Thu, 19 Dec 2024 09:33:09 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tOCu5-0005Qy-76; Thu, 19 Dec 2024 09:33:09 +0000
Received: by outflank-mailman (input) for mailman id 860993;
 Thu, 19 Dec 2024 09:33:08 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tOCu3-0005Qs-WA
 for xen-changelog@lists.xenproject.org; Thu, 19 Dec 2024 09:33:07 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tOCu3-00BPCD-1H
 for xen-changelog@lists.xenproject.org;
 Thu, 19 Dec 2024 09:33:07 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tOCu3-002t4R-23
 for xen-changelog@lists.xenproject.org;
 Thu, 19 Dec 2024 09:33:07 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=cZR6Z/ZXgRN7md3uOfVpjF7s6y1k2qgS13KeEDigViY=; b=CR3QMJ1DzPX4fPL95RVHPiL1CM
	f+dsaWshiCx4WES0wp55WdJjN94u0JdSiB1rKeWvYf2YQzB+dIsm1CGSUEe+wFLWszmHzCZg1VDG0
	WB6YyaoOqGmhFX0/E3TeTB1YdlwUOdxN0UOMJyaJuwH0tAD9/rheNtZ74a4rgqjZ77/A=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/riscv: update layout table in config.h
Message-Id: <E1tOCu3-002t4R-23@xenbits.xenproject.org>
Date: Thu, 19 Dec 2024 09:33:07 +0000

commit ec0ed39265b177abc9313c95ca4ec5986b4d2927
Author:     Oleksii Kurochko <oleksii.kurochko@gmail.com>
AuthorDate: Thu Dec 19 10:21:11 2024 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Dec 19 10:21:11 2024 +0100

    xen/riscv: update layout table in config.h
    
    Make all upper bounds (end addresses) for areas inclusive to align
    with the corresponding definitions.
    
    For the Direct map region, the upper bound was calculated incorrectly
    in efadb18dd58aba ("xen/riscv: add VM space layout"). It should be
    0x7f80000000 (considering that the value is exclusive, instead of
    0x7f40000000). Therefore, the inclusive upper bound for that region
    is 0x7f80000000 - 1.
    
    Signed-off-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/riscv/include/asm/config.h | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/xen/arch/riscv/include/asm/config.h b/xen/arch/riscv/include/asm/config.h
index 4954677aff..826e5c7172 100644
--- a/xen/arch/riscv/include/asm/config.h
+++ b/xen/arch/riscv/include/asm/config.h
@@ -41,17 +41,17 @@
  * Start addr          | End addr         | Slot       | area description
  * ============================================================================
  *                   .....                 L2 511          Unused
- *  0xffffffffc0a00000  0xffffffffc0c00000 L2 511          Fixmap
+ *  0xffffffffc0a00000  0xffffffffc0bfffff L2 511          Fixmap
  *                   ..... ( 2 MB gap )
- *  0xffffffffc0400000  0xffffffffc0800000 L2 511          FDT
+ *  0xffffffffc0400000  0xffffffffc07fffff L2 511          FDT
  *                   ..... ( 2 MB gap )
- *  0xffffffffc0000000  0xffffffffc0200000 L2 511          Xen
+ *  0xffffffffc0000000  0xffffffffc01fffff L2 511          Xen
  *                   .....                 L2 510          Unused
- *  0x3200000000        0x7f40000000       L2 200-509      Direct map
+ *  0x3200000000        0x7f7fffffff       L2 200-509      Direct map
  *                   .....                 L2 199          Unused
- *  0x30c0000000        0x31c0000000       L2 195-198      Frametable
+ *  0x30c0000000        0x31bfffffff       L2 195-198      Frametable
  *                   .....                 L2 194          Unused
- *  0x3040000000        0x3080000000       L2 193          VMAP
+ *  0x3040000000        0x307fffffff       L2 193          VMAP
  *                   .....                 L2 0-192        Unused
 #elif RV_STAGE1_MODE == SATP_MODE_SV48
  * Memory layout is the same as for SV39 in terms of slots, so only start and
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Dec 19 09:33:19 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 19 Dec 2024 09:33:19 +0000
Received: from list by lists.xenproject.org with outflank-mailman.860994.1272979 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tOCuF-0005TF-Ay; Thu, 19 Dec 2024 09:33:19 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 860994.1272979; Thu, 19 Dec 2024 09:33:19 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tOCuF-0005T7-8S; Thu, 19 Dec 2024 09:33:19 +0000
Received: by outflank-mailman (input) for mailman id 860994;
 Thu, 19 Dec 2024 09:33:17 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tOCuD-0005Sx-R0
 for xen-changelog@lists.xenproject.org; Thu, 19 Dec 2024 09:33:17 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tOCuD-00BPCH-1d
 for xen-changelog@lists.xenproject.org;
 Thu, 19 Dec 2024 09:33:17 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tOCuD-002t5l-2Q
 for xen-changelog@lists.xenproject.org;
 Thu, 19 Dec 2024 09:33:17 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=92UpjLTHUWwWV2EGQwxse5BvbVOVNSxe+k1tQcQz8Nk=; b=P+ysU6C7owxGjbeCvc+4HomKBm
	ea71Z5LKNipqwMcovy35YQAoL05i/btFWKqLjH0i4QMr25sFQJL+pVzfVCfgf+OVLATPNduhwjeKN
	OWmXTCkpLBjTiaIueJwqcaftXlvHVUecwmBuG8Sw6J9FptkVd1rSG7PmiXQg5D860iMo=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/riscv: implement data and instruction cache operations
Message-Id: <E1tOCuD-002t5l-2Q@xenbits.xenproject.org>
Date: Thu, 19 Dec 2024 09:33:17 +0000

commit 81d80f44ef728d9dbd60c96ade92c7b9d98076b0
Author:     Oleksii Kurochko <oleksii.kurochko@gmail.com>
AuthorDate: Thu Dec 19 10:22:46 2024 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Dec 19 10:22:46 2024 +0100

    xen/riscv: implement data and instruction cache operations
    
    Implement following cache operations:
    - clean_and_invalidate_dcache_va_range()
    - clean_dcache_va_range()
    - invalidate_icache()
    
    The first two functions may require support for the CMO (Cache Management
    Operations) extension and/or hardware-specific instructions.
    Currently, only QEMU is supported, which does not model cache behavior.
    Therefore, clean_and_invalidate_dcache_va_range() and clean_dcache_va_range()
    are implemented to simply return 0. For other cases, generate compilation error
    so a user won't miss to update this function if necessery.
    If hardware supports CMO or hardware-specific instructions, these functions
    should be updated accordingly. To support current implementation of these
    function CONFIG_QEMU_PLATFORM is introduced.
    
    invalidate_icache() is implemented using fence.i instruction as
    mentioned in the unpriv spec:
      The FENCE.I instruction was designed to support a wide variety of
      implementations. A simple implementation can flush the local instruction
      cache and the instruction pipeline when the FENCE.I is executed.
      A more complex implementation might snoop the instruction (data) cache
      on every data (instruction) cache miss, or use an inclusive unified
      private L2 cache to invalidate lines from the primary instruction cache
      when they are being written by a local store instruction.
      If instruction and data caches are kept coherent in this way, or if the
      memory system consists of only uncached RAMs, then just the fetch pipeline
      needs to be flushed at a FENCE.I.
    The FENCE.I instruction requires the presence of the Zifencei extension,
    which might not always be available. However, Xen uses the RV64G ISA, which
    guarantees the presence of the Zifencei extension. According to the
    unprivileged ISA specification (version 20240411):
      One goal of the RISC-V project is that it be used as a stable software
      development target. For this purpose, we define a combination of a base ISA
      (RV32I or RV64I) plus selected standard extensions (IMAFD, Zicsr, Zifencei)
      as a "general-purpose" ISA, and we use the abbreviation G for the
      IMAFDZicsr_Zifencei combination of instruction-set extensions.
    
    Set CONFIG_QEMU_PLATFORM=y in tiny64_defconfig to have proper implemtation of
    clean_and_invalidate_dcache_va_range() and clean_dcache_va_range() for CI.
    
    Signed-off-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/riscv/Kconfig                  |  2 ++
 xen/arch/riscv/configs/tiny64_defconfig |  1 +
 xen/arch/riscv/include/asm/page.h       | 22 +++++++++++++++++++++-
 xen/arch/riscv/platforms/Kconfig        |  5 +++++
 4 files changed, 29 insertions(+), 1 deletion(-)

diff --git a/xen/arch/riscv/Kconfig b/xen/arch/riscv/Kconfig
index 1858004676..00f329054c 100644
--- a/xen/arch/riscv/Kconfig
+++ b/xen/arch/riscv/Kconfig
@@ -52,6 +52,8 @@ config RISCV_ISA_C
 
 endmenu
 
+source "arch/riscv/platforms/Kconfig"
+
 source "common/Kconfig"
 
 source "drivers/Kconfig"
diff --git a/xen/arch/riscv/configs/tiny64_defconfig b/xen/arch/riscv/configs/tiny64_defconfig
index fc7a04872f..6af563bd73 100644
--- a/xen/arch/riscv/configs/tiny64_defconfig
+++ b/xen/arch/riscv/configs/tiny64_defconfig
@@ -10,3 +10,4 @@ CONFIG_RISCV_64=y
 CONFIG_DEBUG=y
 CONFIG_DEBUG_INFO=y
 CONFIG_EXPERT=y
+CONFIG_QEMU_PLATFORM=y
diff --git a/xen/arch/riscv/include/asm/page.h b/xen/arch/riscv/include/asm/page.h
index bf3f75e85d..06f3effcbe 100644
--- a/xen/arch/riscv/include/asm/page.h
+++ b/xen/arch/riscv/include/asm/page.h
@@ -7,6 +7,7 @@
 
 #include <xen/bug.h>
 #include <xen/const.h>
+#include <xen/errno.h>
 #include <xen/types.h>
 
 #include <asm/atomic.h>
@@ -148,9 +149,28 @@ static inline bool pte_is_mapping(pte_t p)
     return (p.pte & PTE_VALID) && (p.pte & PTE_ACCESS_MASK);
 }
 
+static inline int clean_and_invalidate_dcache_va_range(const void *p,
+                                                       unsigned long size)
+{
+#ifndef CONFIG_QEMU_PLATFORM
+# error "should clean_and_invalidate_dcache_va_range() be updated?"
+#endif
+
+    return 0;
+}
+
+static inline int clean_dcache_va_range(const void *p, unsigned long size)
+{
+#ifndef CONFIG_QEMU_PLATFORM
+# error "should clean_dcache_va_range() be updated?"
+#endif
+
+    return 0;
+}
+
 static inline void invalidate_icache(void)
 {
-    BUG_ON("unimplemented");
+    asm volatile ( "fence.i" ::: "memory" );
 }
 
 #define clear_page(page) memset((void *)(page), 0, PAGE_SIZE)
diff --git a/xen/arch/riscv/platforms/Kconfig b/xen/arch/riscv/platforms/Kconfig
new file mode 100644
index 0000000000..710423a59a
--- /dev/null
+++ b/xen/arch/riscv/platforms/Kconfig
@@ -0,0 +1,5 @@
+config QEMU_PLATFORM
+	bool "QEMU based platform support"
+	help
+	  Enable all the required drivers for QEMU riscv64
+	  virt emulated machine.
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Dec 19 09:33:29 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 19 Dec 2024 09:33:29 +0000
Received: from list by lists.xenproject.org with outflank-mailman.860995.1272983 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tOCuP-0005XJ-CZ; Thu, 19 Dec 2024 09:33:29 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 860995.1272983; Thu, 19 Dec 2024 09:33:29 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tOCuP-0005XC-9p; Thu, 19 Dec 2024 09:33:29 +0000
Received: by outflank-mailman (input) for mailman id 860995;
 Thu, 19 Dec 2024 09:33:28 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tOCuN-0005Wt-Ve
 for xen-changelog@lists.xenproject.org; Thu, 19 Dec 2024 09:33:27 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tOCuN-00BPCg-22
 for xen-changelog@lists.xenproject.org;
 Thu, 19 Dec 2024 09:33:27 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tOCuN-002t7A-2m
 for xen-changelog@lists.xenproject.org;
 Thu, 19 Dec 2024 09:33:27 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=sdjgJ7Nkrq2c5/fm4TeIhi2oQwrk13KThDHGMVpkJpw=; b=0aNTVxgO+KyU3tvn1216F52T2b
	jAC8QWxKoSoQuy2wOcchLQkUzgg+tOtP4qXz79qsirpXGUhJknPZgziWVdKBWG2A2jeeqDRFynjnx
	uC5LIsLx6liXY0Adj1FImiJzSnUVq2TOsZUgAES6uuLok/wBQttOjBDa0tb+pQ7Flvg0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/riscv: implement prereq for DTB relocation
Message-Id: <E1tOCuN-002t7A-2m@xenbits.xenproject.org>
Date: Thu, 19 Dec 2024 09:33:27 +0000

commit 0a510b8f8107896dad5e38a274ae238a6bbe3a1a
Author:     Oleksii Kurochko <oleksii.kurochko@gmail.com>
AuthorDate: Thu Dec 19 10:23:28 2024 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Dec 19 10:23:28 2024 +0100

    xen/riscv: implement prereq for DTB relocation
    
    DTB relocatin in Xen heap requires the following functions which are
    introduced in current patch:
    - xvmalloc_array()
    - copy_from_paddr()
    
    For internal use of xvmalloc, the functions flush_page_to_ram() and
    virt_to_page() are introduced. virt_to_page() is also required for
    free_xenheap_pages().
    
    Signed-off-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/riscv/include/asm/mm.h    |  8 ++++++--
 xen/arch/riscv/include/asm/page.h  | 12 ++++++++++--
 xen/arch/riscv/include/asm/setup.h |  4 ++++
 xen/arch/riscv/setup.c             | 26 ++++++++++++++++++++++++++
 4 files changed, 46 insertions(+), 4 deletions(-)

diff --git a/xen/arch/riscv/include/asm/mm.h b/xen/arch/riscv/include/asm/mm.h
index 699ed23f0d..292aa48fc1 100644
--- a/xen/arch/riscv/include/asm/mm.h
+++ b/xen/arch/riscv/include/asm/mm.h
@@ -8,6 +8,7 @@
 #include <xen/const.h>
 #include <xen/mm-frame.h>
 #include <xen/pdx.h>
+#include <xen/pfn.h>
 #include <xen/types.h>
 
 #include <asm/page-bits.h>
@@ -148,8 +149,11 @@ static inline void *page_to_virt(const struct page_info *pg)
 /* Convert between Xen-heap virtual addresses and page-info structures. */
 static inline struct page_info *virt_to_page(const void *v)
 {
-    BUG_ON("unimplemented");
-    return NULL;
+    unsigned long va = (unsigned long)v;
+
+    ASSERT((va >= DIRECTMAP_VIRT_START) && (va <= DIRECTMAP_VIRT_END));
+
+    return frametable_virt_start + PFN_DOWN(va - directmap_virt_start);
 }
 
 /*
diff --git a/xen/arch/riscv/include/asm/page.h b/xen/arch/riscv/include/asm/page.h
index 06f3effcbe..7a6174a109 100644
--- a/xen/arch/riscv/include/asm/page.h
+++ b/xen/arch/riscv/include/asm/page.h
@@ -7,6 +7,7 @@
 
 #include <xen/bug.h>
 #include <xen/const.h>
+#include <xen/domain_page.h>
 #include <xen/errno.h>
 #include <xen/types.h>
 
@@ -176,10 +177,17 @@ static inline void invalidate_icache(void)
 #define clear_page(page) memset((void *)(page), 0, PAGE_SIZE)
 #define copy_page(dp, sp) memcpy(dp, sp, PAGE_SIZE)
 
-/* TODO: Flush the dcache for an entire page. */
 static inline void flush_page_to_ram(unsigned long mfn, bool sync_icache)
 {
-    BUG_ON("unimplemented");
+    const void *v = map_domain_page(_mfn(mfn));
+
+    if ( clean_and_invalidate_dcache_va_range(v, PAGE_SIZE) )
+        BUG();
+
+    unmap_domain_page(v);
+
+    if ( sync_icache )
+        invalidate_icache();
 }
 
 /* Write a pagetable entry. */
diff --git a/xen/arch/riscv/include/asm/setup.h b/xen/arch/riscv/include/asm/setup.h
index 844a2f0ef1..c9d69cdf51 100644
--- a/xen/arch/riscv/include/asm/setup.h
+++ b/xen/arch/riscv/include/asm/setup.h
@@ -3,10 +3,14 @@
 #ifndef ASM__RISCV__SETUP_H
 #define ASM__RISCV__SETUP_H
 
+#include <xen/types.h>
+
 #define max_init_domid (0)
 
 void setup_mm(void);
 
+void copy_from_paddr(void *dst, paddr_t paddr, unsigned long len);
+
 #endif /* ASM__RISCV__SETUP_H */
 
 /*
diff --git a/xen/arch/riscv/setup.c b/xen/arch/riscv/setup.c
index 9680332fee..bea3f27c4d 100644
--- a/xen/arch/riscv/setup.c
+++ b/xen/arch/riscv/setup.c
@@ -12,6 +12,7 @@
 #include <public/version.h>
 
 #include <asm/early_printk.h>
+#include <asm/fixmap.h>
 #include <asm/sbi.h>
 #include <asm/setup.h>
 #include <asm/smp.h>
@@ -26,6 +27,31 @@ void arch_get_xen_caps(xen_capabilities_info_t *info)
 unsigned char __initdata cpu0_boot_stack[STACK_SIZE]
     __aligned(STACK_SIZE);
 
+/**
+ * copy_from_paddr - copy data from a physical address
+ * @dst: destination virtual address
+ * @paddr: source physical address
+ * @len: length to copy
+ */
+void __init copy_from_paddr(void *dst, paddr_t paddr, unsigned long len)
+{
+    const void *src = (void *)FIXMAP_ADDR(FIX_MISC);
+
+    while ( len )
+    {
+        unsigned long s = paddr & (PAGE_SIZE - 1);
+        unsigned long l = min(PAGE_SIZE - s, len);
+
+        set_fixmap(FIX_MISC, maddr_to_mfn(paddr), PAGE_HYPERVISOR_RW);
+        memcpy(dst, src + s, l);
+        clear_fixmap(FIX_MISC);
+
+        paddr += l;
+        dst += l;
+        len -= l;
+    }
+}
+
 void __init noreturn start_xen(unsigned long bootcpu_id,
                                paddr_t dtb_addr)
 {
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Dec 19 09:33:39 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 19 Dec 2024 09:33:39 +0000
Received: from list by lists.xenproject.org with outflank-mailman.860996.1272986 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tOCuZ-0005Zu-De; Thu, 19 Dec 2024 09:33:39 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 860996.1272986; Thu, 19 Dec 2024 09:33:39 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tOCuZ-0005Zn-BD; Thu, 19 Dec 2024 09:33:39 +0000
Received: by outflank-mailman (input) for mailman id 860996;
 Thu, 19 Dec 2024 09:33:38 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tOCuY-0005ZT-1K
 for xen-changelog@lists.xenproject.org; Thu, 19 Dec 2024 09:33:38 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tOCuX-00BPCk-2J
 for xen-changelog@lists.xenproject.org;
 Thu, 19 Dec 2024 09:33:38 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tOCuX-002t8k-3A
 for xen-changelog@lists.xenproject.org;
 Thu, 19 Dec 2024 09:33:37 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=fWLfH6octRPxA3BJoQvFvId5kvDj70NAhhMkmcIIecI=; b=EIp9tT2wpKwsek1iODWxD3J6NI
	fqhV9Xzlk1mQOojbU6r5Mdg7FrE+sr0ktOa/tmq2wGp+MJANGa0xvQ0ISADXESV86mKdVTuYRwyit
	8lkfYH//nMMBSsKMp/j/wdmu9DLrhF6/CTZC/NQUak5b+1brf1oJHCBlobIjvcdnKXbM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/riscv: relocating and unflattening host device tree
Message-Id: <E1tOCuX-002t8k-3A@xenbits.xenproject.org>
Date: Thu, 19 Dec 2024 09:33:37 +0000

commit 9a17d5c7c953536652e259c6359502cf9c25ac7d
Author:     Oleksii Kurochko <oleksii.kurochko@gmail.com>
AuthorDate: Thu Dec 19 10:23:48 2024 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Dec 19 10:23:48 2024 +0100

    xen/riscv: relocating and unflattening host device tree
    
    Introduce relocate_fdt() and call it to relocate FDT to Xen heap
    instead of using early mapping as it is expected that discard_initial_modules()
    ( is supposed to call in the future ) discards the FDT boot module and
    remove_early_mappings() destroys the early mapping.
    
    Unflatten a device tree, creating the tree of struct device_node.
    It also fills the "name" and "type" pointers of the nodes so the normal
    device-tree walking functions can be used.
    
    Set device_tree_flattened to NULL in the case when acpi_disabled is
    equal to false.
    
    Signed-off-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/riscv/setup.c | 31 +++++++++++++++++++++++++++++--
 1 file changed, 29 insertions(+), 2 deletions(-)

diff --git a/xen/arch/riscv/setup.c b/xen/arch/riscv/setup.c
index bea3f27c4d..fb6bbba684 100644
--- a/xen/arch/riscv/setup.c
+++ b/xen/arch/riscv/setup.c
@@ -1,5 +1,6 @@
 /* SPDX-License-Identifier: GPL-2.0-only */
 
+#include <xen/acpi.h>
 #include <xen/bug.h>
 #include <xen/bootfdt.h>
 #include <xen/compile.h>
@@ -8,6 +9,7 @@
 #include <xen/mm.h>
 #include <xen/shutdown.h>
 #include <xen/vmap.h>
+#include <xen/xvmalloc.h>
 
 #include <public/version.h>
 
@@ -52,10 +54,24 @@ void __init copy_from_paddr(void *dst, paddr_t paddr, unsigned long len)
     }
 }
 
+/* Relocate the FDT in Xen heap */
+static void * __init relocate_fdt(paddr_t dtb_paddr, size_t dtb_size)
+{
+    void *fdt = xvmalloc_array(uint8_t, dtb_size);
+
+    if ( !fdt )
+        panic("Unable to allocate memory for relocating the Device-Tree.\n");
+
+    copy_from_paddr(fdt, dtb_paddr, dtb_size);
+
+    return fdt;
+}
+
 void __init noreturn start_xen(unsigned long bootcpu_id,
                                paddr_t dtb_addr)
 {
     const char *cmdline;
+    size_t fdt_size;
 
     remove_identity_mapping();
 
@@ -80,8 +96,7 @@ void __init noreturn start_xen(unsigned long bootcpu_id,
                           _end - _start, false) )
         panic("Failed to add BOOTMOD_XEN\n");
 
-    if ( !boot_fdt_info(device_tree_flattened, dtb_addr) )
-        BUG();
+    fdt_size = boot_fdt_info(device_tree_flattened, dtb_addr);
 
     cmdline = boot_fdt_cmdline(device_tree_flattened);
     printk("Command line: %s\n", cmdline);
@@ -99,6 +114,18 @@ void __init noreturn start_xen(unsigned long bootcpu_id,
      */
     system_state = SYS_STATE_boot;
 
+    if ( acpi_disabled )
+    {
+        printk("Booting using Device Tree\n");
+        device_tree_flattened = relocate_fdt(dtb_addr, fdt_size);
+        dt_unflatten_host_device_tree();
+    }
+    else
+    {
+        device_tree_flattened = NULL;
+        panic("Booting using ACPI isn't supported\n");
+    }
+
     printk("All set up\n");
 
     machine_halt();
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Dec 19 09:44:05 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 19 Dec 2024 09:44:05 +0000
Received: from list by lists.xenproject.org with outflank-mailman.861011.1273011 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tOD4c-00080o-Np; Thu, 19 Dec 2024 09:44:02 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 861011.1273011; Thu, 19 Dec 2024 09:44:02 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tOD4c-00080i-L9; Thu, 19 Dec 2024 09:44:02 +0000
Received: by outflank-mailman (input) for mailman id 861011;
 Thu, 19 Dec 2024 09:44:01 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tOD4b-00080D-JI
 for xen-changelog@lists.xenproject.org; Thu, 19 Dec 2024 09:44:01 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tOD4b-00BPRA-0d
 for xen-changelog@lists.xenproject.org;
 Thu, 19 Dec 2024 09:44:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tOD4b-002tw8-1P
 for xen-changelog@lists.xenproject.org;
 Thu, 19 Dec 2024 09:44:01 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=d6Pwf7PsqHXmf1oZEGuSbUhow6ZrPB1qSpcL4WB+n80=; b=Vf3rUDkSv7Uqdkr3nh666ElMvS
	xjIXyFRn5q9wa5vqp7jfvMtDq2u1aSwGLVoGNSMPEa6EoZmneTI7r29GTOwSkVzUEi3a4w8ncYvb3
	AvNVl0tGcDBNaMLOIIi4xsiklnIFKXVV/GCqRA4moHFRcTzv7HqTq//Vb26ajlFbacQI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.18] update Xen version to 4.18.4
Message-Id: <E1tOD4b-002tw8-1P@xenbits.xenproject.org>
Date: Thu, 19 Dec 2024 09:44:01 +0000

commit e77ff547385861c72108aa380ab279e35d0f4735
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Dec 19 09:04:30 2024 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Dec 19 09:04:30 2024 +0100

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

diff --git a/Config.mk b/Config.mk
index 39fe4cef1f..6190b31358 100644
--- a/Config.mk
+++ b/Config.mk
@@ -221,10 +221,10 @@ OVMF_UPSTREAM_URL ?= https://xenbits.xen.org/git-http/ovmf.git
 OVMF_UPSTREAM_REVISION ?= ba91d0292e593df8528b66f99c1b0b14fadc8e16
 
 QEMU_UPSTREAM_URL ?= https://xenbits.xen.org/git-http/qemu-xen.git
-QEMU_UPSTREAM_REVISION ?= qemu-xen-4.18.1
+QEMU_UPSTREAM_REVISION ?= qemu-xen-4.18.4
 
 MINIOS_UPSTREAM_URL ?= https://xenbits.xen.org/git-http/mini-os.git
-MINIOS_UPSTREAM_REVISION ?= ff13dabd3099687921145a5e3e960ba8337e7488
+MINIOS_UPSTREAM_REVISION ?= xen-RELEASE-4.18.4
 
 SEABIOS_UPSTREAM_URL ?= https://xenbits.xen.org/git-http/seabios.git
 SEABIOS_UPSTREAM_REVISION ?= rel-1.16.2
diff --git a/xen/Makefile b/xen/Makefile
index 68b14fb356..a4e7a2f6d1 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    = 18
-export XEN_EXTRAVERSION ?= .4-pre$(XEN_VENDORVERSION)
+export XEN_EXTRAVERSION ?= .4$(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.18


From xen-changelog-bounces@lists.xenproject.org Thu Dec 19 10:44:12 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 19 Dec 2024 10:44:12 +0000
Received: from list by lists.xenproject.org with outflank-mailman.861060.1273045 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tOE0h-0000vf-HF; Thu, 19 Dec 2024 10:44:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 861060.1273045; Thu, 19 Dec 2024 10:44:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tOE0h-0000vY-Eh; Thu, 19 Dec 2024 10:44:03 +0000
Received: by outflank-mailman (input) for mailman id 861060;
 Thu, 19 Dec 2024 10:44:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tOE0g-0000vS-Ad
 for xen-changelog@lists.xenproject.org; Thu, 19 Dec 2024 10:44:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tOE0f-00BQja-2H
 for xen-changelog@lists.xenproject.org;
 Thu, 19 Dec 2024 10:44:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tOE0f-00316C-34
 for xen-changelog@lists.xenproject.org;
 Thu, 19 Dec 2024 10:44:01 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=WHBZtwPH8DcIv0rpQnrdp+WNSH3/AAIQ2btbfL8nja8=; b=PhtqsFpdAyixwPdwRGZhWWDZ7I
	dAV4QHmnJ/FUiU0IfPSozKVOYVbqm80f7GY8ZQfgxKgEmu4mRrwGfc9Cr8tshht0JD+v7HZ4nQ/5i
	PkWKh1IzghJ09yN25jeyip95o//mLs0H4rPmB3M5OrYKnP8QA6FK5jGy3qkK1rljSHS4=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools: add a dedicated header file for barrier definitions
Message-Id: <E1tOE0f-00316C-34@xenbits.xenproject.org>
Date: Thu, 19 Dec 2024 10:44:01 +0000

commit b359d3801389aebf9b3be6f5b5aed45e4fa6635f
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Thu Dec 19 10:04:45 2024 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Dec 19 10:04:45 2024 +0100

    tools: add a dedicated header file for barrier definitions
    
    Instead of having to include xenctrl.h for getting definitions of cpu
    barriers, add a dedicated header for that purpose.
    
    Switch the xen-9pfsd daemon to use the new header instead of xenctrl.h.
    
    This is in preparation of making Xenstore independent from libxenctrl.
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Anthony PERARD <anthony.perard@vates.tech>
---
 tools/9pfsd/io.c            |  5 ++++-
 tools/include/xen-barrier.h | 39 +++++++++++++++++++++++++++++++++++++++
 tools/include/xenctrl.h     | 28 +---------------------------
 tools/libs/ctrl/Makefile    |  2 +-
 4 files changed, 45 insertions(+), 29 deletions(-)

diff --git a/tools/9pfsd/io.c b/tools/9pfsd/io.c
index 468e0241f5..14cfcaf568 100644
--- a/tools/9pfsd/io.c
+++ b/tools/9pfsd/io.c
@@ -13,15 +13,18 @@
 
 #include <assert.h>
 #include <errno.h>
+#include <stdarg.h>
 #include <stdbool.h>
+#include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
 #include <syslog.h>
+#include <unistd.h>
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <dirent.h>
 #include <fcntl.h>
-#include <xenctrl.h>           /* For cpu barriers. */
+#include <xen-barrier.h>
 #include <xen-tools/common-macros.h>
 
 #include "xen-9pfsd.h"
diff --git a/tools/include/xen-barrier.h b/tools/include/xen-barrier.h
new file mode 100644
index 0000000000..5c22ee112c
--- /dev/null
+++ b/tools/include/xen-barrier.h
@@ -0,0 +1,39 @@
+/* SPDX-License-Identifier: LGPL-2.1-only */
+/******************************************************************************
+ * xen-barrier.h
+ *
+ * Definition of CPU barriers, part of libxenctrl.
+ *
+ * Copyright (c) 2003-2004, K A Fraser.
+ */
+
+#ifndef XEN_BARRIER_H
+#define XEN_BARRIER_H
+
+/*
+ *  DEFINITIONS FOR CPU BARRIERS
+ */
+
+#define xen_barrier() asm volatile ( "" : : : "memory")
+
+#if defined(__i386__)
+#define xen_mb()  asm volatile ( "lock addl $0, -4(%%esp)" ::: "memory" )
+#define xen_rmb() xen_barrier()
+#define xen_wmb() xen_barrier()
+#elif defined(__x86_64__)
+#define xen_mb()  asm volatile ( "lock addl $0, -32(%%rsp)" ::: "memory" )
+#define xen_rmb() xen_barrier()
+#define xen_wmb() xen_barrier()
+#elif defined(__arm__)
+#define xen_mb()   asm volatile ("dmb" : : : "memory")
+#define xen_rmb()  asm volatile ("dmb" : : : "memory")
+#define xen_wmb()  asm volatile ("dmb" : : : "memory")
+#elif defined(__aarch64__)
+#define xen_mb()   asm volatile ("dmb sy" : : : "memory")
+#define xen_rmb()  asm volatile ("dmb sy" : : : "memory")
+#define xen_wmb()  asm volatile ("dmb sy" : : : "memory")
+#else
+#error "Define barriers"
+#endif
+
+#endif /* XEN_BARRIER_H */
diff --git a/tools/include/xenctrl.h b/tools/include/xenctrl.h
index 29617585c5..ea57e9dbb9 100644
--- a/tools/include/xenctrl.h
+++ b/tools/include/xenctrl.h
@@ -48,6 +48,7 @@
 #include <xen/platform.h>
 
 #include "xentoollog.h"
+#include "xen-barrier.h"
 
 #if defined(__i386__) || defined(__x86_64__)
 #include <xen/foreign/x86_32.h>
@@ -61,33 +62,6 @@
 
 #define INVALID_MFN  (~0UL)
 
-/*
- *  DEFINITIONS FOR CPU BARRIERS
- */
-
-#define xen_barrier() asm volatile ( "" : : : "memory")
-
-#if defined(__i386__)
-#define xen_mb()  asm volatile ( "lock addl $0, -4(%%esp)" ::: "memory" )
-#define xen_rmb() xen_barrier()
-#define xen_wmb() xen_barrier()
-#elif defined(__x86_64__)
-#define xen_mb()  asm volatile ( "lock addl $0, -32(%%rsp)" ::: "memory" )
-#define xen_rmb() xen_barrier()
-#define xen_wmb() xen_barrier()
-#elif defined(__arm__)
-#define xen_mb()   asm volatile ("dmb" : : : "memory")
-#define xen_rmb()  asm volatile ("dmb" : : : "memory")
-#define xen_wmb()  asm volatile ("dmb" : : : "memory")
-#elif defined(__aarch64__)
-#define xen_mb()   asm volatile ("dmb sy" : : : "memory")
-#define xen_rmb()  asm volatile ("dmb sy" : : : "memory")
-#define xen_wmb()  asm volatile ("dmb sy" : : : "memory")
-#else
-#error "Define barriers"
-#endif
-
-
 #define XENCTRL_HAS_XC_INTERFACE 1
 /* In Xen 4.0 and earlier, xc_interface_open and xc_evtchn_open would
  * both return ints being the file descriptor.  In 4.1 and later, they
diff --git a/tools/libs/ctrl/Makefile b/tools/libs/ctrl/Makefile
index 5fe0bfad0c..acce8639d3 100644
--- a/tools/libs/ctrl/Makefile
+++ b/tools/libs/ctrl/Makefile
@@ -3,7 +3,7 @@ include $(XEN_ROOT)/tools/Rules.mk
 
 include Makefile.common
 
-LIBHEADER := xenctrl.h xenctrl_compat.h
+LIBHEADER := xenctrl.h xenctrl_compat.h xen-barrier.h
 PKG_CONFIG_FILE := xencontrol.pc
 PKG_CONFIG_NAME := Xencontrol
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Dec 19 10:44:13 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 19 Dec 2024 10:44:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.861061.1273048 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tOE0r-0000x9-Iv; Thu, 19 Dec 2024 10:44:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 861061.1273048; Thu, 19 Dec 2024 10:44:13 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tOE0r-0000x1-GA; Thu, 19 Dec 2024 10:44:13 +0000
Received: by outflank-mailman (input) for mailman id 861061;
 Thu, 19 Dec 2024 10:44:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tOE0q-0000wt-7q
 for xen-changelog@lists.xenproject.org; Thu, 19 Dec 2024 10:44:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tOE0p-00BQje-2s
 for xen-changelog@lists.xenproject.org;
 Thu, 19 Dec 2024 10:44:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tOE0q-00318D-0C
 for xen-changelog@lists.xenproject.org;
 Thu, 19 Dec 2024 10:44:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=qh3dBVyyAKXHn9tdbbVAcXAqTQE0yjMYpl2Juy8WRk8=; b=KrwccNZprN17UpMNnRzl2ooGOz
	21Tkg6JZfntzbcHEP5d7TRktUJMEnE5zuBLPOBpoajupZvmn/uJenTgMlPis/mg4ys/a1mRJbY8n8
	ulT/aQ79K3HPjoWI85RhmWl0LQa39Fe+bIyzizngtJvXGx17bywbj3XJm2voStr5VOIQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/page_alloc: introduce preserved page flags macro
Message-Id: <E1tOE0q-00318D-0C@xenbits.xenproject.org>
Date: Thu, 19 Dec 2024 10:44:12 +0000

commit b527a27e17886328ef26a856cb0a50a606330c29
Author:     Carlo Nonato <carlo.nonato@minervasys.tech>
AuthorDate: Thu Dec 19 10:05:14 2024 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Dec 19 10:05:14 2024 +0100

    xen/page_alloc: introduce preserved page flags macro
    
    PGC_static and PGC_extra need to be preserved when assigning a page.
    Define a new macro that groups those flags and use it instead of or'ing
    every time.
    
    Signed-off-by: Carlo Nonato <carlo.nonato@minervasys.tech>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/common/page_alloc.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/xen/common/page_alloc.c b/xen/common/page_alloc.c
index 1f424333db..b76a03fd73 100644
--- a/xen/common/page_alloc.c
+++ b/xen/common/page_alloc.c
@@ -160,6 +160,10 @@
 #endif
 
 #define PGC_no_buddy_merge PGC_static
+/*
+ * Flags that are preserved in assign_pages() (and only there)
+ */
+#define PGC_preserved (PGC_extra | PGC_static)
 
 #ifndef PGT_TYPE_INFO_INITIALIZER
 #define PGT_TYPE_INFO_INITIALIZER 0
@@ -2384,7 +2388,7 @@ int assign_pages(
 
         for ( i = 0; i < nr; i++ )
         {
-            ASSERT(!(pg[i].count_info & ~(PGC_extra | PGC_static)));
+            ASSERT(!(pg[i].count_info & ~PGC_preserved));
             if ( pg[i].count_info & PGC_extra )
                 extra_pages++;
         }
@@ -2444,7 +2448,7 @@ int assign_pages(
         page_set_owner(&pg[i], d);
         smp_wmb(); /* Domain pointer must be visible before updating refcnt. */
         pg[i].count_info =
-            (pg[i].count_info & (PGC_extra | PGC_static)) | PGC_allocated | 1;
+            (pg[i].count_info & PGC_preserved) | PGC_allocated | 1;
 
         page_list_add_tail(&pg[i], page_to_list(d, &pg[i]));
     }
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Dec 19 17:44:17 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 19 Dec 2024 17:44:17 +0000
Received: from list by lists.xenproject.org with outflank-mailman.861405.1273326 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tOKZF-0002aC-Nj; Thu, 19 Dec 2024 17:44:09 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 861405.1273326; Thu, 19 Dec 2024 17:44:09 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tOKZF-0002a4-L4; Thu, 19 Dec 2024 17:44:09 +0000
Received: by outflank-mailman (input) for mailman id 861405;
 Thu, 19 Dec 2024 17:44:08 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tOKZE-0002Zy-97
 for xen-changelog@lists.xenproject.org; Thu, 19 Dec 2024 17:44:08 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tOKZD-00BZre-1a
 for xen-changelog@lists.xenproject.org;
 Thu, 19 Dec 2024 17:44:07 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tOKZD-003wTG-2K
 for xen-changelog@lists.xenproject.org;
 Thu, 19 Dec 2024 17:44:07 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=OAB4IzDLBjNVG9JvQ8N6sTXHmJ0z6CbYLTXPss5I4o0=; b=pJ93T5WBakEqPSHgTGApuUwHqv
	r+Hy/yVRD1pgYmGquC89VhxhVAt2ghgob8qgyCqKqxYO4BNFaq06Lrad2Dqu9EzmybTUeTt/gTrhr
	jI5g3EBilzsDWSec4MPqOQA4jLbCSO/fRA9aDyduJ9SlrqhymmbvPTFf6YDZljFZHSXE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/sched: Untangle credit2 vs cpu_nr_siblings()
Message-Id: <E1tOKZD-003wTG-2K@xenbits.xenproject.org>
Date: Thu, 19 Dec 2024 17:44:07 +0000

commit 188d568db8ca941d8f001bb81a716d7a74dc7b73
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu Sep 12 02:18:40 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Dec 19 17:33:54 2024 +0000

    xen/sched: Untangle credit2 vs cpu_nr_siblings()
    
    Credit2 has no buisness including asm/cpufeature.h or asm/processor.h.
    
    This was caused by a bad original abstraction, and an even less wise attempt
    to fix the build on my behalf.  It is also the sole reason why PPC and RISC-V
    need cpufeature.h header.
    
    Worst of all, cpu_data[cpu].x86_num_siblings doesn't even have the same
    meaning between vendors on x86 CPUS.
    
    Implement cpu_nr_siblings() locally in credit2.c, leaving behind a TODO.  Drop
    the stub from each architecture.
    
    Fixes: 8e2aa76dc167 ("xen: credit2: limit the max number of CPUs in a runqueue")
    Fixes: ad33a573c009 ("xen/credit2: Fix build following c/s 8e2aa76dc (take 2)")
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
    Acked-by: Shawn Anastasio <sanastasio@raptorengineering.com>
---
 xen/arch/arm/include/asm/cpufeature.h   |  5 -----
 xen/arch/ppc/include/asm/cpufeature.h   | 10 ----------
 xen/arch/riscv/include/asm/cpufeature.h | 23 -----------------------
 xen/arch/x86/include/asm/processor.h    |  5 -----
 xen/common/sched/credit2.c              | 15 +++++++++++++--
 5 files changed, 13 insertions(+), 45 deletions(-)

diff --git a/xen/arch/arm/include/asm/cpufeature.h b/xen/arch/arm/include/asm/cpufeature.h
index 969e043f5b..50297e53d9 100644
--- a/xen/arch/arm/include/asm/cpufeature.h
+++ b/xen/arch/arm/include/asm/cpufeature.h
@@ -98,11 +98,6 @@ static inline bool cpus_have_cap(unsigned int num)
     return test_bit(num, cpu_hwcaps);
 }
 
-static inline int cpu_nr_siblings(unsigned int cpu)
-{
-    return 1;
-}
-
 /* System capability check for constant cap */
 #define cpus_have_const_cap(num) ({                 \
         register_t __ret;                           \
diff --git a/xen/arch/ppc/include/asm/cpufeature.h b/xen/arch/ppc/include/asm/cpufeature.h
deleted file mode 100644
index 1c5946512b..0000000000
--- a/xen/arch/ppc/include/asm/cpufeature.h
+++ /dev/null
@@ -1,10 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0-only */
-#ifndef __ASM_PPC_CPUFEATURE_H__
-#define __ASM_PPC_CPUFEATURE_H__
-
-static inline int cpu_nr_siblings(unsigned int cpu)
-{
-    return 1;
-}
-
-#endif /* __ASM_PPC_CPUFEATURE_H__ */
diff --git a/xen/arch/riscv/include/asm/cpufeature.h b/xen/arch/riscv/include/asm/cpufeature.h
deleted file mode 100644
index 41a792b0b2..0000000000
--- a/xen/arch/riscv/include/asm/cpufeature.h
+++ /dev/null
@@ -1,23 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0-only */
-#ifndef ASM__RISCV__CPUFEATURE_H
-#define ASM__RISCV__CPUFEATURE_H
-
-#ifndef __ASSEMBLY__
-
-static inline unsigned int cpu_nr_siblings(unsigned int cpu)
-{
-    return 1;
-}
-
-#endif /* __ASSEMBLY__ */
-
-#endif /* ASM__RISCV__CPUFEATURE_H */
-
-/*
- * Local variables:
- * mode: C
- * c-file-style: "BSD"
- * c-basic-offset: 4
- * indent-tabs-mode: nil
- * End:
- */
diff --git a/xen/arch/x86/include/asm/processor.h b/xen/arch/x86/include/asm/processor.h
index 8776512122..d247ef8dd2 100644
--- a/xen/arch/x86/include/asm/processor.h
+++ b/xen/arch/x86/include/asm/processor.h
@@ -118,11 +118,6 @@ extern void init_intel_cacheinfo(struct cpuinfo_x86 *c);
 
 unsigned int apicid_to_socket(unsigned int apicid);
 
-static inline int cpu_nr_siblings(unsigned int cpu)
-{
-    return cpu_data[cpu].x86_num_siblings;
-}
-
 /* Some CPUID calls want 'count' to be placed in ecx */
 static inline void cpuid_count(
     unsigned int op,
diff --git a/xen/common/sched/credit2.c b/xen/common/sched/credit2.c
index 76a273d4f6..4b2ef034ca 100644
--- a/xen/common/sched/credit2.c
+++ b/xen/common/sched/credit2.c
@@ -26,8 +26,6 @@
 #include <xen/trace.h>
 #include <xen/cpu.h>
 #include <xen/keyhandler.h>
-#include <asm/cpufeature.h>
-#include <asm/processor.h>
 
 #include "private.h"
 
@@ -35,6 +33,19 @@
 /* #define d2printk printk */
 #define d2printk(x...)
 
+/*
+ * TODO: Abstract this properly, and figure out what Credit2 wants to do with
+ *       the fact that x86_num_siblings doesn't even have the same meaning
+ *       between x86 vendors.
+ */
+static unsigned int cpu_nr_siblings(unsigned int cpu)
+{
+#ifdef CONFIG_X86
+    return cpu_data[cpu].x86_num_siblings;
+#else
+    return 1;
+#endif
+}
 
 /*
  * Credit2 tracing events ("only" 512 available!). Check
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Dec 19 17:44:19 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 19 Dec 2024 17:44:19 +0000
Received: from list by lists.xenproject.org with outflank-mailman.861406.1273331 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tOKZP-0002bf-PW; Thu, 19 Dec 2024 17:44:19 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 861406.1273331; Thu, 19 Dec 2024 17:44:19 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tOKZP-0002bX-MW; Thu, 19 Dec 2024 17:44:19 +0000
Received: by outflank-mailman (input) for mailman id 861406;
 Thu, 19 Dec 2024 17:44:18 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tOKZN-0002bP-VE
 for xen-changelog@lists.xenproject.org; Thu, 19 Dec 2024 17:44:17 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tOKZN-00BZri-21
 for xen-changelog@lists.xenproject.org;
 Thu, 19 Dec 2024 17:44:17 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tOKZN-003wUc-2j
 for xen-changelog@lists.xenproject.org;
 Thu, 19 Dec 2024 17:44:17 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=c44YKiu02uiSGhQ8CWk1pKxX0vXSX7DVjWuoAxFOrXc=; b=ajTtJ4JLTuCOxBFCcGyudAv0PU
	B8lWXwVIklUMuset48293SZnW0z2K2CNnNYiM9io4xFf3v7x+bBb2jbFTspjJLalf9kvdaBCh3a7a
	ywvLCt8g8wrwaYzbU4eXfPM6cBJu+WTZ49TDTm2MbCuxaKMLNqiSPNT4IvapdPnA8Fm8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/sched: Drop unused includes from credit2.c
Message-Id: <E1tOKZN-003wUc-2j@xenbits.xenproject.org>
Date: Thu, 19 Dec 2024 17:44:17 +0000

commit 63ebfcca04e71ed750f3451e62b1423581feb44a
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu Sep 12 03:02:37 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Dec 19 17:33:54 2024 +0000

    x86/sched: Drop unused includes from credit2.c
    
    Sort the remaining includes.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Juergen Gross <jgross@suse.com>
---
 xen/common/sched/credit2.c | 14 +++++---------
 1 file changed, 5 insertions(+), 9 deletions(-)

diff --git a/xen/common/sched/credit2.c b/xen/common/sched/credit2.c
index 4b2ef034ca..0a83f23725 100644
--- a/xen/common/sched/credit2.c
+++ b/xen/common/sched/credit2.c
@@ -10,22 +10,18 @@
  * Based on an earlier verson by Emmanuel Ackaouy.
  */
 
+#include <xen/errno.h>
 #include <xen/init.h>
 #include <xen/lib.h>
 #include <xen/param.h>
+#include <xen/perfc.h>
 #include <xen/sched.h>
 #include <xen/sections.h>
-#include <xen/domain.h>
-#include <xen/delay.h>
-#include <xen/event.h>
-#include <xen/time.h>
-#include <xen/perfc.h>
 #include <xen/softirq.h>
-#include <asm/div64.h>
-#include <xen/errno.h>
+#include <xen/time.h>
 #include <xen/trace.h>
-#include <xen/cpu.h>
-#include <xen/keyhandler.h>
+
+#include <asm/div64.h>
 
 #include "private.h"
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Dec 19 17:44:29 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 19 Dec 2024 17:44:29 +0000
Received: from list by lists.xenproject.org with outflank-mailman.861407.1273334 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tOKZZ-0002eF-QQ; Thu, 19 Dec 2024 17:44:29 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 861407.1273334; Thu, 19 Dec 2024 17:44:29 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tOKZZ-0002e7-Nu; Thu, 19 Dec 2024 17:44:29 +0000
Received: by outflank-mailman (input) for mailman id 861407;
 Thu, 19 Dec 2024 17:44:28 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tOKZY-0002dt-35
 for xen-changelog@lists.xenproject.org; Thu, 19 Dec 2024 17:44:28 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tOKZX-00BZrt-2Q
 for xen-changelog@lists.xenproject.org;
 Thu, 19 Dec 2024 17:44:28 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tOKZX-003wVI-39
 for xen-changelog@lists.xenproject.org;
 Thu, 19 Dec 2024 17:44:27 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=id6hpYwvcj8LaXs/4UIbOI7vJGXawKKK/CkTmorQRKg=; b=dnw/8UdX62aZlIpoKRRwNF1O/m
	gI/XF6wUfayPPXdVUukfThoT2YgE9tXbdkawgv9cjFmPMRKwR+mHK9dvPV5zRqNa5a/gv/4Kqk/Ln
	mEb+IaYkgIKAIVOj27RRm54Oe3KRkPUdgZjVTeIb/WxFkdd757Bn3L8d+458iURKSUeg=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/boot: Use printk_once() instead of opencoding it
Message-Id: <E1tOKZX-003wVI-39@xenbits.xenproject.org>
Date: Thu, 19 Dec 2024 17:44:27 +0000

commit 2e22a8ba29a5f8677888d9d85cbe131ea5546865
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Wed Sep 4 00:14:24 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Dec 19 17:33:54 2024 +0000

    x86/boot: Use printk_once() instead of opencoding it
    
    Adjust the message for brevity.  No functional change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jason Andryuk <jason.andryuk@amd.com>
---
 xen/arch/x86/setup.c | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c
index 3d51c80626..397347bea4 100644
--- a/xen/arch/x86/setup.c
+++ b/xen/arch/x86/setup.c
@@ -1072,7 +1072,7 @@ void asmlinkage __init noreturn __start_xen(void)
     unsigned int initrdidx, num_parked = 0;
     struct boot_info *bi;
     unsigned long nr_pages, raw_max_page;
-    int i, j, e820_warn = 0, bytes = 0;
+    int i, j, bytes = 0;
     unsigned long eb_start, eb_end;
     bool acpi_boot_table_init_done = false, relocated = false;
     bool vm_init_done = false;
@@ -1309,12 +1309,8 @@ void asmlinkage __init noreturn __start_xen(void)
              */
             if ( (map->base_addr_high == 0) && (map->length_high != 0) )
             {
-                if ( !e820_warn )
-                {
-                    printk("WARNING: Buggy e820 map detected and fixed "
-                           "(truncated length fields).\n");
-                    e820_warn = 1;
-                }
+                printk_once(XENLOG_WARNING
+                            "WARNING: Buggy e820 map detected; truncated length\n");
                 map->length_high = 0;
             }
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Dec 19 17:44:39 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 19 Dec 2024 17:44:39 +0000
Received: from list by lists.xenproject.org with outflank-mailman.861408.1273340 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tOKZj-0002gf-SK; Thu, 19 Dec 2024 17:44:39 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 861408.1273340; Thu, 19 Dec 2024 17:44:39 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tOKZj-0002gX-PG; Thu, 19 Dec 2024 17:44:39 +0000
Received: by outflank-mailman (input) for mailman id 861408;
 Thu, 19 Dec 2024 17:44:38 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tOKZi-0002gJ-6Q
 for xen-changelog@lists.xenproject.org; Thu, 19 Dec 2024 17:44:38 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tOKZh-00BZsD-2o
 for xen-changelog@lists.xenproject.org;
 Thu, 19 Dec 2024 17:44:38 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tOKZi-003wWU-0L
 for xen-changelog@lists.xenproject.org;
 Thu, 19 Dec 2024 17:44:38 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=jPJMnkOVorAUmtokzpn0eL1QQcK3a8o+QEwAZ5zYxGE=; b=q76u3yNAPGafU0CeP/Vml0V51q
	08lgTa7C+RY5qQAbZH3LkT/hEO9oxe+AH3F2QZ+eBEFIoZNSl1Gob0z5GM9FBFYY5cMKCKHd/1uW6
	Ux7UlG7Z3eXJLJLNA6IRgjojHL2G1u1NIx2FK7J6Kso/k8GopCBbP6WfeRTqDW/kqOlA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] tools/libxg: Don't gunzip the guests initrd
Message-Id: <E1tOKZi-003wWU-0L@xenbits.xenproject.org>
Date: Thu, 19 Dec 2024 17:44:38 +0000

commit d17b7562d4ef7ab32fdac9b59fe66055db4b6271
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu Jun 27 13:55:51 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Dec 19 17:33:54 2024 +0000

    tools/libxg: Don't gunzip the guests initrd
    
    Decompressing the kernel is necessary to inspect the ELF notes, but the
    dombuilder will gunzip() secondary modules too.  Specifically gunzip(), no
    other decompression algorithms.
    
    This may have been necessary in the dim and distant past, but it is broken
    today.  Linux specifically supports concatenating CPIO fragments of differing
    compressions, and any attempt to interpret it with a single algorithm may
    corrupt later parts.
    
    This was an unexpected discovery while trying to test Xen's gunzip()
    logic (Xen as a PVH guest, with a gzipped XTF kernel as dom0).
    
    Interpreting secondary modules should be left as an exercise to the guest.
    This reduces work done in dom0.
    
    This is not expected to cause a practical difference to guests these days.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
---
 CHANGELOG.md                   |  2 ++
 tools/libs/guest/xg_dom_core.c | 40 +++++++---------------------------------
 2 files changed, 9 insertions(+), 33 deletions(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 15f681459f..61510e6a11 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -8,6 +8,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
 
 ### Changed
  - Fixed blkif protocol specification for sector sizes different than 512b.
+ - The dombuilder in libxenguest no longer un-gzips secondary modules, instead
+   leaving this to the guest kernel to do in guest context.
  - On x86:
    - Prefer ACPI reboot over UEFI ResetSystem() run time service call.
    - Switched the xAPIC flat driver to use physical destination mode for external
diff --git a/tools/libs/guest/xg_dom_core.c b/tools/libs/guest/xg_dom_core.c
index f5521d528b..595b0a667c 100644
--- a/tools/libs/guest/xg_dom_core.c
+++ b/tools/libs/guest/xg_dom_core.c
@@ -980,37 +980,24 @@ int xc_dom_mem_init(struct xc_dom_image *dom, unsigned int mem_mb)
 
 static int xc_dom_build_module(struct xc_dom_image *dom, unsigned int mod)
 {
-    size_t unziplen, modulelen;
+    size_t modulelen;
     void *modulemap;
     char name[10];
 
-    if ( !dom->modules[mod].seg.vstart )
-        unziplen = xc_dom_check_gzip(dom->xch,
-                                     dom->modules[mod].blob, dom->modules[mod].size);
-    else
-        unziplen = 0;
+    modulelen = dom->modules[mod].size;
 
-    modulelen = max(unziplen, dom->modules[mod].size);
-    if ( dom->max_module_size )
+    if ( dom->max_module_size && modulelen > dom->max_module_size )
     {
-        if ( unziplen && modulelen > dom->max_module_size )
-        {
-            modulelen = min(unziplen, dom->modules[mod].size);
-            if ( unziplen > modulelen )
-                unziplen = 0;
-        }
-        if ( modulelen > dom->max_module_size )
-        {
-            xc_dom_panic(dom->xch, XC_INVALID_KERNEL,
-                         "module %u image too large", mod);
-            goto err;
-        }
+        xc_dom_panic(dom->xch, XC_INVALID_KERNEL,
+                     "module %u image too large", mod);
+        goto err;
     }
 
     snprintf(name, sizeof(name), "module%u", mod);
     if ( xc_dom_alloc_segment(dom, &dom->modules[mod].seg, name,
                               dom->modules[mod].seg.vstart, modulelen) != 0 )
         goto err;
+
     modulemap = xc_dom_seg_to_ptr(dom, &dom->modules[mod].seg);
     if ( modulemap == NULL )
     {
@@ -1018,21 +1005,8 @@ static int xc_dom_build_module(struct xc_dom_image *dom, unsigned int mod)
                   __FUNCTION__, mod);
         goto err;
     }
-    if ( unziplen )
-    {
-        if ( xc_dom_do_gunzip(dom->xch, dom->modules[mod].blob, dom->modules[mod].size,
-                              modulemap, unziplen) != -1 )
-            return 0;
-        if ( dom->modules[mod].size > modulelen )
-            goto err;
-    }
 
-    /* Fall back to handing over the raw blob. */
     memcpy(modulemap, dom->modules[mod].blob, dom->modules[mod].size);
-    /* If an unzip attempt was made, the buffer may no longer be all zero. */
-    if ( unziplen > dom->modules[mod].size )
-        memset(modulemap + dom->modules[mod].size, 0,
-               unziplen - dom->modules[mod].size);
 
     return 0;
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Dec 19 17:44:50 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 19 Dec 2024 17:44:50 +0000
Received: from list by lists.xenproject.org with outflank-mailman.861409.1273345 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tOKZt-0002jZ-VN; Thu, 19 Dec 2024 17:44:49 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 861409.1273345; Thu, 19 Dec 2024 17:44:49 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tOKZt-0002jR-Qe; Thu, 19 Dec 2024 17:44:49 +0000
Received: by outflank-mailman (input) for mailman id 861409;
 Thu, 19 Dec 2024 17:44:48 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tOKZs-0002jC-AJ
 for xen-changelog@lists.xenproject.org; Thu, 19 Dec 2024 17:44:48 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tOKZr-00BZsJ-3A
 for xen-changelog@lists.xenproject.org;
 Thu, 19 Dec 2024 17:44:48 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tOKZs-003wXu-0o
 for xen-changelog@lists.xenproject.org;
 Thu, 19 Dec 2024 17:44:48 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=h/Zy0jh2X3eS2ra42qiWhe5bae0FSudS4cFoHP3FFeQ=; b=x93EGS3RZBdl6pwgftuKVgNOXl
	ZVAzod3OYcNw8t39+LoPrZmmgwbgLOyHrWARKrm7V4TX4xg3ov6Ym9V2FaNbUPKDSFzyniyaoir/8
	pth0vm/PU24GwsgJ1fSw3PfCaPUkHUhSMkPKz5R4+WoPs9gaU0J5Nuu+KzQvu+bVOKB8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/hvm: Use constants for x86 modes
Message-Id: <E1tOKZs-003wXu-0o@xenbits.xenproject.org>
Date: Thu, 19 Dec 2024 17:44:48 +0000

commit dd05f7c8dd6729b094c10e15c7ac6c4c33640cec
Author:     Teddy Astie <teddy.astie@vates.tech>
AuthorDate: Mon Dec 2 09:49:14 2024 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Dec 19 17:33:54 2024 +0000

    x86/hvm: Use constants for x86 modes
    
    In many places of x86 HVM code, constants integer are used to indicate in what mode is
    running the CPU (real, vm86, 16-bits, 32-bits, 64-bits). However, these constants are
    are written directly as integer which hides the actual meaning of these modes.
    
    This patch introduces X86_MODE_* macros and replace those occurences with it.
    
    Signed-off-by: Teddy Astie <teddy.astie@vates.tech>
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Teddy Astie <teddy.astie@vates.tech>
---
 xen/arch/x86/hvm/emulate.c           | 18 ++++++++++--------
 xen/arch/x86/hvm/hvm.c               |  4 +++-
 xen/arch/x86/hvm/hypercall.c         | 17 +++++++++--------
 xen/arch/x86/hvm/svm/svm.c           |  8 ++++----
 xen/arch/x86/hvm/viridian/viridian.c |  8 ++++----
 xen/arch/x86/hvm/vmx/vmx.c           |  9 +++++----
 xen/arch/x86/hvm/vmx/vvmx.c          |  5 +++--
 xen/arch/x86/include/asm/hvm/hvm.h   | 14 ++++++++++++++
 xen/arch/x86/oprofile/xenoprof.c     |  6 +++---
 9 files changed, 55 insertions(+), 34 deletions(-)

diff --git a/xen/arch/x86/hvm/emulate.c b/xen/arch/x86/hvm/emulate.c
index d3006f094a..a1935a1748 100644
--- a/xen/arch/x86/hvm/emulate.c
+++ b/xen/arch/x86/hvm/emulate.c
@@ -2433,14 +2433,15 @@ static void cf_check hvmemul_put_fpu(
 
         switch ( mode )
         {
-        case 8:
+        case X86_MODE_64BIT:
             fpu_ctxt->fip.addr = aux->ip;
             if ( dval )
                 fpu_ctxt->fdp.addr = aux->dp;
             fpu_ctxt->x[FPU_WORD_SIZE_OFFSET] = 8;
             break;
 
-        case 4: case 2:
+        case X86_MODE_32BIT:
+        case X86_MODE_16BIT:
             fpu_ctxt->fip.offs = aux->ip;
             fpu_ctxt->fip.sel  = aux->cs;
             if ( dval )
@@ -2451,7 +2452,8 @@ static void cf_check hvmemul_put_fpu(
             fpu_ctxt->x[FPU_WORD_SIZE_OFFSET] = mode;
             break;
 
-        case 0: case 1:
+        case X86_MODE_REAL:
+        case X86_MODE_VM86:
             fpu_ctxt->fip.addr = aux->ip | (aux->cs << 4);
             if ( dval )
                 fpu_ctxt->fdp.addr = aux->dp | (aux->ds << 4);
@@ -2952,11 +2954,11 @@ static const char *guest_x86_mode_to_str(int mode)
 {
     switch ( mode )
     {
-    case 0:  return "Real";
-    case 1:  return "v86";
-    case 2:  return "16bit";
-    case 4:  return "32bit";
-    case 8:  return "64bit";
+    case X86_MODE_REAL:   return "Real";
+    case X86_MODE_VM86:   return "vm86";
+    case X86_MODE_16BIT:  return "16bit";
+    case X86_MODE_32BIT:  return "32bit";
+    case X86_MODE_64BIT:  return "64bit";
     default: return "Unknown";
     }
 }
diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c
index 74e58c653e..922c9b3af6 100644
--- a/xen/arch/x86/hvm/hvm.c
+++ b/xen/arch/x86/hvm/hvm.c
@@ -3974,7 +3974,9 @@ static void hvm_latch_shinfo_size(struct domain *d)
      */
     if ( current->domain == d )
     {
-        d->arch.has_32bit_shinfo = (hvm_guest_x86_mode(current) != 8);
+        d->arch.has_32bit_shinfo =
+            hvm_guest_x86_mode(current) != X86_MODE_64BIT;
+
         /*
          * Make sure that the timebase in the shared info structure is correct.
          *
diff --git a/xen/arch/x86/hvm/hypercall.c b/xen/arch/x86/hvm/hypercall.c
index 81883c8d4f..6f8dfdff4a 100644
--- a/xen/arch/x86/hvm/hypercall.c
+++ b/xen/arch/x86/hvm/hypercall.c
@@ -112,23 +112,24 @@ int hvm_hypercall(struct cpu_user_regs *regs)
 
     switch ( mode )
     {
-    case 8:
+    case X86_MODE_64BIT:
         eax = regs->rax;
         fallthrough;
-    case 4:
-    case 2:
+    case X86_MODE_32BIT:
+    case X86_MODE_16BIT:
         if ( currd->arch.monitor.guest_request_userspace_enabled &&
-            eax == __HYPERVISOR_hvm_op &&
-            (mode == 8 ? regs->rdi : regs->ebx) == HVMOP_guest_request_vm_event )
+             eax == __HYPERVISOR_hvm_op &&
+             (mode == X86_MODE_64BIT ? regs->rdi : regs->ebx) ==
+             HVMOP_guest_request_vm_event )
             break;
 
         if ( likely(!hvm_get_cpl(curr)) )
             break;
         fallthrough;
-    default:
+    case X86_MODE_VM86:
         regs->rax = -EPERM;
         return HVM_HCALL_completed;
-    case 0:
+    case X86_MODE_REAL:
         break;
     }
 
@@ -198,7 +199,7 @@ enum mc_disposition hvm_do_multicall_call(struct mc_state *state)
 {
     struct vcpu *curr = current;
 
-    if ( hvm_guest_x86_mode(curr) == 8 )
+    if ( hvm_guest_x86_mode(curr) == X86_MODE_64BIT )
     {
         struct multicall_entry *call = &state->call;
 
diff --git a/xen/arch/x86/hvm/svm/svm.c b/xen/arch/x86/hvm/svm/svm.c
index b8f87aa1ed..62905c2c7a 100644
--- a/xen/arch/x86/hvm/svm/svm.c
+++ b/xen/arch/x86/hvm/svm/svm.c
@@ -571,12 +571,12 @@ static int cf_check svm_guest_x86_mode(struct vcpu *v)
     struct vmcb_struct *vmcb = v->arch.hvm.svm.vmcb;
 
     if ( unlikely(!(v->arch.hvm.guest_cr[0] & X86_CR0_PE)) )
-        return 0;
+        return X86_MODE_REAL;
     if ( unlikely(guest_cpu_user_regs()->eflags & X86_EFLAGS_VM) )
-        return 1;
+        return X86_MODE_VM86;
     if ( hvm_long_mode_active(v) && likely(vmcb->cs.l) )
-        return 8;
-    return likely(vmcb->cs.db) ? 4 : 2;
+        return X86_MODE_64BIT;
+    return vmcb->cs.db ? X86_MODE_32BIT : X86_MODE_16BIT;
 }
 
 static void cf_check svm_cpuid_policy_changed(struct vcpu *v)
diff --git a/xen/arch/x86/hvm/viridian/viridian.c b/xen/arch/x86/hvm/viridian/viridian.c
index 21480d9ee7..33d54e587e 100644
--- a/xen/arch/x86/hvm/viridian/viridian.c
+++ b/xen/arch/x86/hvm/viridian/viridian.c
@@ -933,13 +933,13 @@ int viridian_hypercall(struct cpu_user_regs *regs)
 
     switch ( mode )
     {
-    case 8:
+    case X86_MODE_64BIT:
         input.raw = regs->rcx;
         input_params_gpa = regs->rdx;
         output_params_gpa = regs->r8;
         break;
 
-    case 4:
+    case X86_MODE_32BIT:
         input.raw = (regs->rdx << 32) | regs->eax;
         input_params_gpa = (regs->rbx << 32) | regs->ecx;
         output_params_gpa = (regs->rdi << 32) | regs->esi;
@@ -1038,11 +1038,11 @@ int viridian_hypercall(struct cpu_user_regs *regs)
 
     switch ( mode )
     {
-    case 8:
+    case X86_MODE_64BIT:
         regs->rax = output.raw;
         break;
 
-    case 4:
+    case X86_MODE_32BIT:
         regs->rdx = output.raw >> 32;
         regs->rax = (uint32_t)output.raw;
         break;
diff --git a/xen/arch/x86/hvm/vmx/vmx.c b/xen/arch/x86/hvm/vmx/vmx.c
index b6885d0e27..eee1d4b47a 100644
--- a/xen/arch/x86/hvm/vmx/vmx.c
+++ b/xen/arch/x86/hvm/vmx/vmx.c
@@ -886,14 +886,15 @@ int cf_check vmx_guest_x86_mode(struct vcpu *v)
     unsigned long cs_ar_bytes;
 
     if ( unlikely(!(v->arch.hvm.guest_cr[0] & X86_CR0_PE)) )
-        return 0;
+        return X86_MODE_REAL;
     if ( unlikely(guest_cpu_user_regs()->eflags & X86_EFLAGS_VM) )
-        return 1;
+        return X86_MODE_VM86;
     __vmread(GUEST_CS_AR_BYTES, &cs_ar_bytes);
     if ( hvm_long_mode_active(v) &&
          likely(cs_ar_bytes & X86_SEG_AR_CS_LM_ACTIVE) )
-        return 8;
-    return (likely(cs_ar_bytes & X86_SEG_AR_DEF_OP_SIZE) ? 4 : 2);
+        return X86_MODE_64BIT;
+    return (likely(cs_ar_bytes & X86_SEG_AR_DEF_OP_SIZE)
+            ? X86_MODE_32BIT : X86_MODE_16BIT);
 }
 
 static void vmx_save_dr(struct vcpu *v)
diff --git a/xen/arch/x86/hvm/vmx/vvmx.c b/xen/arch/x86/hvm/vmx/vvmx.c
index 78135ca23b..cf47d61b14 100644
--- a/xen/arch/x86/hvm/vmx/vvmx.c
+++ b/xen/arch/x86/hvm/vmx/vvmx.c
@@ -411,7 +411,7 @@ static int decode_vmx_inst(struct cpu_user_regs *regs,
     }
     else
     {
-        bool mode_64bit = (vmx_guest_x86_mode(v) == 8);
+        bool mode_64bit = vmx_guest_x86_mode(v) == X86_MODE_64BIT;
 
         decode->type = VMX_INST_MEMREG_TYPE_MEMORY;
 
@@ -2073,7 +2073,8 @@ int nvmx_handle_vmx_insn(struct cpu_user_regs *regs, unsigned int exit_reason)
 
     if ( !(curr->arch.hvm.guest_cr[4] & X86_CR4_VMXE) ||
          !nestedhvm_enabled(curr->domain) ||
-         (vmx_guest_x86_mode(curr) < (hvm_long_mode_active(curr) ? 8 : 2)) ||
+         (vmx_guest_x86_mode(curr) <
+          (hvm_long_mode_active(curr) ? X86_MODE_64BIT : X86_MODE_16BIT)) ||
          (exit_reason != EXIT_REASON_VMXON && !nvmx_vcpu_in_vmx(curr)) )
     {
         hvm_inject_hw_exception(X86_EXC_UD, X86_EVENT_NO_EC);
diff --git a/xen/arch/x86/include/asm/hvm/hvm.h b/xen/arch/x86/include/asm/hvm/hvm.h
index 02de18c7d4..cad3a94278 100644
--- a/xen/arch/x86/include/asm/hvm/hvm.h
+++ b/xen/arch/x86/include/asm/hvm/hvm.h
@@ -26,6 +26,20 @@ extern bool opt_hvm_fep;
 #define opt_hvm_fep 0
 #endif
 
+/*
+ * Results for hvm_guest_x86_mode().
+ *
+ * Note, some callers depend on the order of these constants.
+ *
+ * TODO: Rework hvm_guest_x86_mode() to avoid mixing the architectural
+ * concepts of mode and operand size.
+ */
+#define X86_MODE_REAL  0
+#define X86_MODE_VM86  1
+#define X86_MODE_16BIT 2
+#define X86_MODE_32BIT 4
+#define X86_MODE_64BIT 8
+
 /* Interrupt acknowledgement sources. */
 enum hvm_intsrc {
     hvm_intsrc_none,
diff --git a/xen/arch/x86/oprofile/xenoprof.c b/xen/arch/x86/oprofile/xenoprof.c
index 247a0deca8..7f2525bfb4 100644
--- a/xen/arch/x86/oprofile/xenoprof.c
+++ b/xen/arch/x86/oprofile/xenoprof.c
@@ -86,11 +86,11 @@ int xenoprofile_get_mode(struct vcpu *curr, const struct cpu_user_regs *regs)
 
     switch ( hvm_guest_x86_mode(curr) )
     {
-    case 0: /* real mode */
+    case X86_MODE_REAL:
         return 1;
-    case 1: /* vm86 mode */
+    case X86_MODE_VM86:
         return 0;
-    default:
+    default: /* 16BIT | 32BIT | 64BIT */
         return hvm_get_cpl(curr) != 3;
     }
 }
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Dec 19 17:44:59 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 19 Dec 2024 17:44:59 +0000
Received: from list by lists.xenproject.org with outflank-mailman.861410.1273347 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tOKa3-0002mq-0G; Thu, 19 Dec 2024 17:44:59 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 861410.1273347; Thu, 19 Dec 2024 17:44:58 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tOKa2-0002mi-Tu; Thu, 19 Dec 2024 17:44:58 +0000
Received: by outflank-mailman (input) for mailman id 861410;
 Thu, 19 Dec 2024 17:44:58 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tOKa2-0002ma-CZ
 for xen-changelog@lists.xenproject.org; Thu, 19 Dec 2024 17:44:58 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tOKa2-00BZsS-0C
 for xen-changelog@lists.xenproject.org;
 Thu, 19 Dec 2024 17:44:58 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tOKa2-003wYt-14
 for xen-changelog@lists.xenproject.org;
 Thu, 19 Dec 2024 17:44:58 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=x5hk4wF6P16cERERJ4/JG0j9l5A1F5keSqrVUwLvYJU=; b=R1SVubtHDGEIYvCDE1YmnWBK3n
	zuuMfbPAwnlTxMH4IpWC0UBC9VgT4gvvlDQ8DuIh5miaAUuTjzzA4a9QRb8gazJsNR80YZyMZR5ed
	8W8PJ7gebPhWRBHfihdyFcWy1ed9+xwXTbKwmTwbNDkV4gXVXlY963VuRKm59g+loytY=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] tools/xg: increase LZMA_BLOCK_SIZE for uncompressing the kernel
Message-Id: <E1tOKa2-003wYt-14@xenbits.xenproject.org>
Date: Thu, 19 Dec 2024 17:44:58 +0000

commit e6472d46680ccd2b804ad73c19042a5811d036f0
Author:     Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
AuthorDate: Tue Oct 8 23:32:23 2024 +0200
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Dec 19 17:33:54 2024 +0000

    tools/xg: increase LZMA_BLOCK_SIZE for uncompressing the kernel
    
    Linux 6.12-rc2 fails to decompress with the current 128MiB, contrary to
    the code comment. It results in a failure like this:
    
        domainbuilder: detail: xc_dom_kernel_file: filename="/var/lib/qubes/vm-kernels/6.12-rc2-1.1.fc37/vmlinuz"
        domainbuilder: detail: xc_dom_malloc_filemap    : 12104 kB
        domainbuilder: detail: xc_dom_module_file: filename="/var/lib/qubes/vm-kernels/6.12-rc2-1.1.fc37/initramfs"
        domainbuilder: detail: xc_dom_malloc_filemap    : 7711 kB
        domainbuilder: detail: xc_dom_boot_xen_init: ver 4.19, caps xen-3.0-x86_64 hvm-3.0-x86_32 hvm-3.0-x86_32p hvm-3.0-x86_64
        domainbuilder: detail: xc_dom_parse_image: called
        domainbuilder: detail: xc_dom_find_loader: trying multiboot-binary loader ...
        domainbuilder: detail: loader probe failed
        domainbuilder: detail: xc_dom_find_loader: trying HVM-generic loader ...
        domainbuilder: detail: loader probe failed
        domainbuilder: detail: xc_dom_find_loader: trying Linux bzImage loader ...
        domainbuilder: detail: _xc_try_lzma_decode: XZ decompression error: Memory usage limit reached
        xc: error: panic: xg_dom_bzimageloader.c:761: xc_dom_probe_bzimage_kernel unable to XZ decompress kernel: Invalid kernel
        domainbuilder: detail: loader probe failed
        domainbuilder: detail: xc_dom_find_loader: trying ELF-generic loader ...
        domainbuilder: detail: loader probe failed
        xc: error: panic: xg_dom_core.c:689: xc_dom_find_loader: no loader found: Invalid kernel
        libxl: error: libxl_dom.c:566:libxl__build_dom: xc_dom_parse_image failed
    
    The important part: XZ decompression error: Memory usage limit reached
    
    This looks to be related to the following change in Linux:
    8653c909922743bceb4800e5cc26087208c9e0e6 ("xz: use 128 MiB dictionary and force single-threaded mode")
    
    Fix this by increasing the block size to 256MiB. And remove the
    misleading comment (from lack of better ideas).
    
    Signed-off-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    Acked-by: Anthony PERARD <anthony.perard@vates.tech>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 tools/libs/guest/xg_dom_bzimageloader.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/tools/libs/guest/xg_dom_bzimageloader.c b/tools/libs/guest/xg_dom_bzimageloader.c
index c6ee6d83e7..1fb4e5a1f7 100644
--- a/tools/libs/guest/xg_dom_bzimageloader.c
+++ b/tools/libs/guest/xg_dom_bzimageloader.c
@@ -272,8 +272,7 @@ static int _xc_try_lzma_decode(
     return retval;
 }
 
-/* 128 Mb is the minimum size (half-way) documented to work for all inputs. */
-#define LZMA_BLOCK_SIZE (128*1024*1024)
+#define LZMA_BLOCK_SIZE (256*1024*1024)
 
 static int xc_try_xz_decode(
     struct xc_dom_image *dom, void **blob, size_t *size)
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Dec 19 17:45:09 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 19 Dec 2024 17:45:09 +0000
Received: from list by lists.xenproject.org with outflank-mailman.861411.1273351 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tOKaD-0002pP-1q; Thu, 19 Dec 2024 17:45:09 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 861411.1273351; Thu, 19 Dec 2024 17:45:09 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tOKaC-0002pI-VJ; Thu, 19 Dec 2024 17:45:08 +0000
Received: by outflank-mailman (input) for mailman id 861411;
 Thu, 19 Dec 2024 17:45:08 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tOKaC-0002p7-Fu
 for xen-changelog@lists.xenproject.org; Thu, 19 Dec 2024 17:45:08 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tOKaC-00BZss-0X
 for xen-changelog@lists.xenproject.org;
 Thu, 19 Dec 2024 17:45:08 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tOKaC-003wa7-1K
 for xen-changelog@lists.xenproject.org;
 Thu, 19 Dec 2024 17:45:08 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=MiWUJ16H4N645w85acoWcSfkrAecsz6W2mfO9+BC8CA=; b=weRwVCwaeT241TbiiRyZjdi4Wi
	dVldfXK4BDg77IDZnadzlu/vjjOw7NzaTQWIgIWmkHnriCL8Gm6vclWrNaFO6JM66gLoNfOLWSTw8
	rhYehhhypu0Rp4cxyx0EIAdL6PG50EEFPKahv2wevqEP4KwxCIo9fTDAtS7Ueihn04/E=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/ioreq: Fix check for CONFIG_ARCH_VCPU_IOREQ_COMPLETION
Message-Id: <E1tOKaC-003wa7-1K@xenbits.xenproject.org>
Date: Thu, 19 Dec 2024 17:45:08 +0000

commit e547f730e89e026a3d6e034988c555562581342a
Author:     Sergiy Kibrik <Sergiy_Kibrik@epam.com>
AuthorDate: Thu Dec 19 13:13:26 2024 +0200
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Dec 19 17:33:54 2024 +0000

    xen/ioreq: Fix check for CONFIG_ARCH_VCPU_IOREQ_COMPLETION
    
    It should be CONFIG_ARCH_VCPU_IOREQ_COMPLETION (as in Kconfig) and not
    misspelled CONFIG_VCPU_ARCH_IOREQ_COMPLETION.
    
    Fixes: 979cfdd3e58c ("ioreq: do not build arch_vcpu_ioreq_completion() for non-VMX configurations")
    Signed-off-by: Sergiy Kibrik <Sergiy_Kibrik@epam.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/hvm/ioreq.c | 2 +-
 xen/include/xen/ioreq.h  | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/hvm/ioreq.c b/xen/arch/x86/hvm/ioreq.c
index 5c3d0c69aa..d6491df8e7 100644
--- a/xen/arch/x86/hvm/ioreq.c
+++ b/xen/arch/x86/hvm/ioreq.c
@@ -29,7 +29,7 @@ bool arch_ioreq_complete_mmio(void)
     return handle_mmio();
 }
 
-#ifdef CONFIG_VCPU_ARCH_IOREQ_COMPLETION
+#ifdef CONFIG_ARCH_VCPU_IOREQ_COMPLETION
 bool arch_vcpu_ioreq_completion(enum vio_completion completion)
 {
     switch ( completion )
diff --git a/xen/include/xen/ioreq.h b/xen/include/xen/ioreq.h
index 29a17e8ff5..4f3c6b598d 100644
--- a/xen/include/xen/ioreq.h
+++ b/xen/include/xen/ioreq.h
@@ -112,7 +112,7 @@ int ioreq_server_dm_op(struct xen_dm_op *op, struct domain *d, bool *const_op);
 
 bool arch_ioreq_complete_mmio(void);
 
-#ifdef CONFIG_VCPU_ARCH_IOREQ_COMPLETION
+#ifdef CONFIG_ARCH_VCPU_IOREQ_COMPLETION
 bool arch_vcpu_ioreq_completion(enum vio_completion completion);
 #else
 static inline bool arch_vcpu_ioreq_completion(enum vio_completion completion)
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Dec 19 17:45:19 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 19 Dec 2024 17:45:19 +0000
Received: from list by lists.xenproject.org with outflank-mailman.861412.1273354 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tOKaN-0002s7-30; Thu, 19 Dec 2024 17:45:19 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 861412.1273354; Thu, 19 Dec 2024 17:45:19 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tOKaN-0002s0-0U; Thu, 19 Dec 2024 17:45:19 +0000
Received: by outflank-mailman (input) for mailman id 861412;
 Thu, 19 Dec 2024 17:45:18 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tOKaM-0002rt-JE
 for xen-changelog@lists.xenproject.org; Thu, 19 Dec 2024 17:45:18 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tOKaM-00BZsx-0n
 for xen-changelog@lists.xenproject.org;
 Thu, 19 Dec 2024 17:45:18 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tOKaM-003war-1f
 for xen-changelog@lists.xenproject.org;
 Thu, 19 Dec 2024 17:45:18 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=a+K7USli40IyHTzo47uoSckkuOdzVBs66No/RwEaVns=; b=dHvDkx2Bw76wG2iczuxAfWTbsF
	BTRMPdF8Qh5RNI089c6WChurpLKExsL2UMtL40nZh6FXhPzikg5qiSMMDlw/XBjyEPi2uOIBnt5j7
	JjLsu+fRIcGd2aq6YXDffBUAWUH0Sz0wf56pWwdyHvQ1R492WvgIwcamsHaqfBjskSN8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] automation: Pin down CONFIG_QEMU_PLATFORM for RISC-V's randconfig job
Message-Id: <E1tOKaM-003war-1f@xenbits.xenproject.org>
Date: Thu, 19 Dec 2024 17:45:18 +0000

commit 8089e4ba4424eea952d15da78c5b03d106ab9cb9
Author:     Oleksii Kurochko <oleksii.kurochko@gmail.com>
AuthorDate: Thu Dec 19 12:18:31 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Dec 19 17:33:54 2024 +0000

    automation: Pin down CONFIG_QEMU_PLATFORM for RISC-V's randconfig job
    
    Except setting CONFIG_QEMU_PLATFORM=y in tiny64_defconfig,
    CONFIG_QEMU_PLATFORM should be fixed for RISC-V's randconfig job.
    Otherwise, an expected compilation error for RISC-V's randconfig job
    will occur since clean_and_invalidate_dcache_va_range() and
    clean_dcache_va_range() are currently implemented only for the QEMU
    platform.
    
    Additionally, sort the EXTRA_FIXED_RANDCONFIG list alphabetically.
    
    Reported-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Fixes: f92e2709bd ("xen/riscv: implement data and instruction cache operations")
    Signed-off-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 automation/gitlab-ci/build.yaml | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/automation/gitlab-ci/build.yaml b/automation/gitlab-ci/build.yaml
index 1ca6764225..1b884cc81c 100644
--- a/automation/gitlab-ci/build.yaml
+++ b/automation/gitlab-ci/build.yaml
@@ -732,9 +732,10 @@ debian-12-riscv64-gcc:
       CONFIG_COVERAGE=n
       CONFIG_EXPERT=y
       CONFIG_GRANT_TABLE=n
+      CONFIG_LIVEPATCH=n
       CONFIG_MEM_ACCESS=n
       CONFIG_PERF_COUNTERS=n
-      CONFIG_LIVEPATCH=n
+      CONFIG_QEMU_PLATFORM=y
       CONFIG_XSM=n
 
 debian-12-riscv64-gcc-randconfig:
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Dec 19 19:44:11 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 19 Dec 2024 19:44:11 +0000
Received: from list by lists.xenproject.org with outflank-mailman.861477.1273418 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tOMRH-0003zT-Hn; Thu, 19 Dec 2024 19:44:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 861477.1273418; Thu, 19 Dec 2024 19: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 1tOMRH-0003zM-FG; Thu, 19 Dec 2024 19:44:03 +0000
Received: by outflank-mailman (input) for mailman id 861477;
 Thu, 19 Dec 2024 19:44:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tOMRG-0003zG-C5
 for xen-changelog@lists.xenproject.org; Thu, 19 Dec 2024 19:44:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tOMRF-00BcLC-2R
 for xen-changelog@lists.xenproject.org;
 Thu, 19 Dec 2024 19:44:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tOMRF-0049A4-3C
 for xen-changelog@lists.xenproject.org;
 Thu, 19 Dec 2024 19:44:01 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=K9UF7FjvPUnIIn4iOQMx+2Zi/ealWLDSjum6HP4mdV4=; b=lHP1aZZftyrCWETaFpBUtZHXgX
	+o0plQfRdXjueWtEMNqmUopobOhktSQ4EIU7BavyPC/Dcqp9Y2R3kVJyoZ/BvszmpiwT9ZEQsZPg0
	cMOPNp3pEqJ3/FfqX84heiT9WjFKWD63d6layyvr3hebJT5+lhCzbjlCW/3UznKa7WzY=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/riscv: update layout table in config.h
Message-Id: <E1tOMRF-0049A4-3C@xenbits.xenproject.org>
Date: Thu, 19 Dec 2024 19:44:01 +0000

commit ec0ed39265b177abc9313c95ca4ec5986b4d2927
Author:     Oleksii Kurochko <oleksii.kurochko@gmail.com>
AuthorDate: Thu Dec 19 10:21:11 2024 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Dec 19 10:21:11 2024 +0100

    xen/riscv: update layout table in config.h
    
    Make all upper bounds (end addresses) for areas inclusive to align
    with the corresponding definitions.
    
    For the Direct map region, the upper bound was calculated incorrectly
    in efadb18dd58aba ("xen/riscv: add VM space layout"). It should be
    0x7f80000000 (considering that the value is exclusive, instead of
    0x7f40000000). Therefore, the inclusive upper bound for that region
    is 0x7f80000000 - 1.
    
    Signed-off-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/riscv/include/asm/config.h | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/xen/arch/riscv/include/asm/config.h b/xen/arch/riscv/include/asm/config.h
index 4954677aff..826e5c7172 100644
--- a/xen/arch/riscv/include/asm/config.h
+++ b/xen/arch/riscv/include/asm/config.h
@@ -41,17 +41,17 @@
  * Start addr          | End addr         | Slot       | area description
  * ============================================================================
  *                   .....                 L2 511          Unused
- *  0xffffffffc0a00000  0xffffffffc0c00000 L2 511          Fixmap
+ *  0xffffffffc0a00000  0xffffffffc0bfffff L2 511          Fixmap
  *                   ..... ( 2 MB gap )
- *  0xffffffffc0400000  0xffffffffc0800000 L2 511          FDT
+ *  0xffffffffc0400000  0xffffffffc07fffff L2 511          FDT
  *                   ..... ( 2 MB gap )
- *  0xffffffffc0000000  0xffffffffc0200000 L2 511          Xen
+ *  0xffffffffc0000000  0xffffffffc01fffff L2 511          Xen
  *                   .....                 L2 510          Unused
- *  0x3200000000        0x7f40000000       L2 200-509      Direct map
+ *  0x3200000000        0x7f7fffffff       L2 200-509      Direct map
  *                   .....                 L2 199          Unused
- *  0x30c0000000        0x31c0000000       L2 195-198      Frametable
+ *  0x30c0000000        0x31bfffffff       L2 195-198      Frametable
  *                   .....                 L2 194          Unused
- *  0x3040000000        0x3080000000       L2 193          VMAP
+ *  0x3040000000        0x307fffffff       L2 193          VMAP
  *                   .....                 L2 0-192        Unused
 #elif RV_STAGE1_MODE == SATP_MODE_SV48
  * Memory layout is the same as for SV39 in terms of slots, so only start and
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Dec 19 19:44:13 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 19 Dec 2024 19:44:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.861478.1273423 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tOMRR-00040v-JT; Thu, 19 Dec 2024 19:44:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 861478.1273423; Thu, 19 Dec 2024 19: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 1tOMRR-00040o-Gk; Thu, 19 Dec 2024 19:44:13 +0000
Received: by outflank-mailman (input) for mailman id 861478;
 Thu, 19 Dec 2024 19:44:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tOMRQ-00040e-8E
 for xen-changelog@lists.xenproject.org; Thu, 19 Dec 2024 19:44:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tOMRP-00BcLI-2t
 for xen-changelog@lists.xenproject.org;
 Thu, 19 Dec 2024 19:44:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tOMRQ-0049Ar-0M
 for xen-changelog@lists.xenproject.org;
 Thu, 19 Dec 2024 19:44:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=e1EGpMJ8gitMmNEr3r6Cxm55QNovwLqqqk31P09M5kk=; b=gg5Rg+spU50C+CZIUGUglglBQL
	kzaL6inQpC4FQOFLRbsa5IY7u8y7KWQLhRenMZrJvwxBnNUhqM+C9S3O617NXVExOUAxUNUy8Lg2L
	q5sa50yVDQREWFkBw+20BeKu2sT8A/Blf75P47DPNUC6W5U+xxDwsOqUs46b36woH2/s=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/riscv: implement data and instruction cache operations
Message-Id: <E1tOMRQ-0049Ar-0M@xenbits.xenproject.org>
Date: Thu, 19 Dec 2024 19:44:12 +0000

commit 81d80f44ef728d9dbd60c96ade92c7b9d98076b0
Author:     Oleksii Kurochko <oleksii.kurochko@gmail.com>
AuthorDate: Thu Dec 19 10:22:46 2024 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Dec 19 10:22:46 2024 +0100

    xen/riscv: implement data and instruction cache operations
    
    Implement following cache operations:
    - clean_and_invalidate_dcache_va_range()
    - clean_dcache_va_range()
    - invalidate_icache()
    
    The first two functions may require support for the CMO (Cache Management
    Operations) extension and/or hardware-specific instructions.
    Currently, only QEMU is supported, which does not model cache behavior.
    Therefore, clean_and_invalidate_dcache_va_range() and clean_dcache_va_range()
    are implemented to simply return 0. For other cases, generate compilation error
    so a user won't miss to update this function if necessery.
    If hardware supports CMO or hardware-specific instructions, these functions
    should be updated accordingly. To support current implementation of these
    function CONFIG_QEMU_PLATFORM is introduced.
    
    invalidate_icache() is implemented using fence.i instruction as
    mentioned in the unpriv spec:
      The FENCE.I instruction was designed to support a wide variety of
      implementations. A simple implementation can flush the local instruction
      cache and the instruction pipeline when the FENCE.I is executed.
      A more complex implementation might snoop the instruction (data) cache
      on every data (instruction) cache miss, or use an inclusive unified
      private L2 cache to invalidate lines from the primary instruction cache
      when they are being written by a local store instruction.
      If instruction and data caches are kept coherent in this way, or if the
      memory system consists of only uncached RAMs, then just the fetch pipeline
      needs to be flushed at a FENCE.I.
    The FENCE.I instruction requires the presence of the Zifencei extension,
    which might not always be available. However, Xen uses the RV64G ISA, which
    guarantees the presence of the Zifencei extension. According to the
    unprivileged ISA specification (version 20240411):
      One goal of the RISC-V project is that it be used as a stable software
      development target. For this purpose, we define a combination of a base ISA
      (RV32I or RV64I) plus selected standard extensions (IMAFD, Zicsr, Zifencei)
      as a "general-purpose" ISA, and we use the abbreviation G for the
      IMAFDZicsr_Zifencei combination of instruction-set extensions.
    
    Set CONFIG_QEMU_PLATFORM=y in tiny64_defconfig to have proper implemtation of
    clean_and_invalidate_dcache_va_range() and clean_dcache_va_range() for CI.
    
    Signed-off-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/riscv/Kconfig                  |  2 ++
 xen/arch/riscv/configs/tiny64_defconfig |  1 +
 xen/arch/riscv/include/asm/page.h       | 22 +++++++++++++++++++++-
 xen/arch/riscv/platforms/Kconfig        |  5 +++++
 4 files changed, 29 insertions(+), 1 deletion(-)

diff --git a/xen/arch/riscv/Kconfig b/xen/arch/riscv/Kconfig
index 1858004676..00f329054c 100644
--- a/xen/arch/riscv/Kconfig
+++ b/xen/arch/riscv/Kconfig
@@ -52,6 +52,8 @@ config RISCV_ISA_C
 
 endmenu
 
+source "arch/riscv/platforms/Kconfig"
+
 source "common/Kconfig"
 
 source "drivers/Kconfig"
diff --git a/xen/arch/riscv/configs/tiny64_defconfig b/xen/arch/riscv/configs/tiny64_defconfig
index fc7a04872f..6af563bd73 100644
--- a/xen/arch/riscv/configs/tiny64_defconfig
+++ b/xen/arch/riscv/configs/tiny64_defconfig
@@ -10,3 +10,4 @@ CONFIG_RISCV_64=y
 CONFIG_DEBUG=y
 CONFIG_DEBUG_INFO=y
 CONFIG_EXPERT=y
+CONFIG_QEMU_PLATFORM=y
diff --git a/xen/arch/riscv/include/asm/page.h b/xen/arch/riscv/include/asm/page.h
index bf3f75e85d..06f3effcbe 100644
--- a/xen/arch/riscv/include/asm/page.h
+++ b/xen/arch/riscv/include/asm/page.h
@@ -7,6 +7,7 @@
 
 #include <xen/bug.h>
 #include <xen/const.h>
+#include <xen/errno.h>
 #include <xen/types.h>
 
 #include <asm/atomic.h>
@@ -148,9 +149,28 @@ static inline bool pte_is_mapping(pte_t p)
     return (p.pte & PTE_VALID) && (p.pte & PTE_ACCESS_MASK);
 }
 
+static inline int clean_and_invalidate_dcache_va_range(const void *p,
+                                                       unsigned long size)
+{
+#ifndef CONFIG_QEMU_PLATFORM
+# error "should clean_and_invalidate_dcache_va_range() be updated?"
+#endif
+
+    return 0;
+}
+
+static inline int clean_dcache_va_range(const void *p, unsigned long size)
+{
+#ifndef CONFIG_QEMU_PLATFORM
+# error "should clean_dcache_va_range() be updated?"
+#endif
+
+    return 0;
+}
+
 static inline void invalidate_icache(void)
 {
-    BUG_ON("unimplemented");
+    asm volatile ( "fence.i" ::: "memory" );
 }
 
 #define clear_page(page) memset((void *)(page), 0, PAGE_SIZE)
diff --git a/xen/arch/riscv/platforms/Kconfig b/xen/arch/riscv/platforms/Kconfig
new file mode 100644
index 0000000000..710423a59a
--- /dev/null
+++ b/xen/arch/riscv/platforms/Kconfig
@@ -0,0 +1,5 @@
+config QEMU_PLATFORM
+	bool "QEMU based platform support"
+	help
+	  Enable all the required drivers for QEMU riscv64
+	  virt emulated machine.
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Dec 19 19:44:23 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 19 Dec 2024 19:44:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.861479.1273427 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tOMRb-00043R-LD; Thu, 19 Dec 2024 19:44:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 861479.1273427; Thu, 19 Dec 2024 19: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 1tOMRb-00043J-IF; Thu, 19 Dec 2024 19:44:23 +0000
Received: by outflank-mailman (input) for mailman id 861479;
 Thu, 19 Dec 2024 19:44:22 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tOMRa-00042r-Ax
 for xen-changelog@lists.xenproject.org; Thu, 19 Dec 2024 19:44:22 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tOMRa-00BcLP-02
 for xen-changelog@lists.xenproject.org;
 Thu, 19 Dec 2024 19:44:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tOMRa-0049BV-0o
 for xen-changelog@lists.xenproject.org;
 Thu, 19 Dec 2024 19:44:22 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=NyxHxcf76NwZe338rESgc9Dxo/jb18CbMuCg061i7tQ=; b=frTEddyxlvuXBrsy+p+/re7jNA
	cwMEpdJhyM4vlvrFX2Y88o4qF20Zv/tpHR/1L8AEbC6I3FqN9wU3o/PborRjgo08lNSx+lCWyk/Ef
	o+dHKdmCBqRD6oEY9UomCnHlTsIE7JWZvzvgW8qVaO2UVvZe/oTsTyrrHsceWiuMCUks=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/riscv: implement prereq for DTB relocation
Message-Id: <E1tOMRa-0049BV-0o@xenbits.xenproject.org>
Date: Thu, 19 Dec 2024 19:44:22 +0000

commit 0a510b8f8107896dad5e38a274ae238a6bbe3a1a
Author:     Oleksii Kurochko <oleksii.kurochko@gmail.com>
AuthorDate: Thu Dec 19 10:23:28 2024 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Dec 19 10:23:28 2024 +0100

    xen/riscv: implement prereq for DTB relocation
    
    DTB relocatin in Xen heap requires the following functions which are
    introduced in current patch:
    - xvmalloc_array()
    - copy_from_paddr()
    
    For internal use of xvmalloc, the functions flush_page_to_ram() and
    virt_to_page() are introduced. virt_to_page() is also required for
    free_xenheap_pages().
    
    Signed-off-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/riscv/include/asm/mm.h    |  8 ++++++--
 xen/arch/riscv/include/asm/page.h  | 12 ++++++++++--
 xen/arch/riscv/include/asm/setup.h |  4 ++++
 xen/arch/riscv/setup.c             | 26 ++++++++++++++++++++++++++
 4 files changed, 46 insertions(+), 4 deletions(-)

diff --git a/xen/arch/riscv/include/asm/mm.h b/xen/arch/riscv/include/asm/mm.h
index 699ed23f0d..292aa48fc1 100644
--- a/xen/arch/riscv/include/asm/mm.h
+++ b/xen/arch/riscv/include/asm/mm.h
@@ -8,6 +8,7 @@
 #include <xen/const.h>
 #include <xen/mm-frame.h>
 #include <xen/pdx.h>
+#include <xen/pfn.h>
 #include <xen/types.h>
 
 #include <asm/page-bits.h>
@@ -148,8 +149,11 @@ static inline void *page_to_virt(const struct page_info *pg)
 /* Convert between Xen-heap virtual addresses and page-info structures. */
 static inline struct page_info *virt_to_page(const void *v)
 {
-    BUG_ON("unimplemented");
-    return NULL;
+    unsigned long va = (unsigned long)v;
+
+    ASSERT((va >= DIRECTMAP_VIRT_START) && (va <= DIRECTMAP_VIRT_END));
+
+    return frametable_virt_start + PFN_DOWN(va - directmap_virt_start);
 }
 
 /*
diff --git a/xen/arch/riscv/include/asm/page.h b/xen/arch/riscv/include/asm/page.h
index 06f3effcbe..7a6174a109 100644
--- a/xen/arch/riscv/include/asm/page.h
+++ b/xen/arch/riscv/include/asm/page.h
@@ -7,6 +7,7 @@
 
 #include <xen/bug.h>
 #include <xen/const.h>
+#include <xen/domain_page.h>
 #include <xen/errno.h>
 #include <xen/types.h>
 
@@ -176,10 +177,17 @@ static inline void invalidate_icache(void)
 #define clear_page(page) memset((void *)(page), 0, PAGE_SIZE)
 #define copy_page(dp, sp) memcpy(dp, sp, PAGE_SIZE)
 
-/* TODO: Flush the dcache for an entire page. */
 static inline void flush_page_to_ram(unsigned long mfn, bool sync_icache)
 {
-    BUG_ON("unimplemented");
+    const void *v = map_domain_page(_mfn(mfn));
+
+    if ( clean_and_invalidate_dcache_va_range(v, PAGE_SIZE) )
+        BUG();
+
+    unmap_domain_page(v);
+
+    if ( sync_icache )
+        invalidate_icache();
 }
 
 /* Write a pagetable entry. */
diff --git a/xen/arch/riscv/include/asm/setup.h b/xen/arch/riscv/include/asm/setup.h
index 844a2f0ef1..c9d69cdf51 100644
--- a/xen/arch/riscv/include/asm/setup.h
+++ b/xen/arch/riscv/include/asm/setup.h
@@ -3,10 +3,14 @@
 #ifndef ASM__RISCV__SETUP_H
 #define ASM__RISCV__SETUP_H
 
+#include <xen/types.h>
+
 #define max_init_domid (0)
 
 void setup_mm(void);
 
+void copy_from_paddr(void *dst, paddr_t paddr, unsigned long len);
+
 #endif /* ASM__RISCV__SETUP_H */
 
 /*
diff --git a/xen/arch/riscv/setup.c b/xen/arch/riscv/setup.c
index 9680332fee..bea3f27c4d 100644
--- a/xen/arch/riscv/setup.c
+++ b/xen/arch/riscv/setup.c
@@ -12,6 +12,7 @@
 #include <public/version.h>
 
 #include <asm/early_printk.h>
+#include <asm/fixmap.h>
 #include <asm/sbi.h>
 #include <asm/setup.h>
 #include <asm/smp.h>
@@ -26,6 +27,31 @@ void arch_get_xen_caps(xen_capabilities_info_t *info)
 unsigned char __initdata cpu0_boot_stack[STACK_SIZE]
     __aligned(STACK_SIZE);
 
+/**
+ * copy_from_paddr - copy data from a physical address
+ * @dst: destination virtual address
+ * @paddr: source physical address
+ * @len: length to copy
+ */
+void __init copy_from_paddr(void *dst, paddr_t paddr, unsigned long len)
+{
+    const void *src = (void *)FIXMAP_ADDR(FIX_MISC);
+
+    while ( len )
+    {
+        unsigned long s = paddr & (PAGE_SIZE - 1);
+        unsigned long l = min(PAGE_SIZE - s, len);
+
+        set_fixmap(FIX_MISC, maddr_to_mfn(paddr), PAGE_HYPERVISOR_RW);
+        memcpy(dst, src + s, l);
+        clear_fixmap(FIX_MISC);
+
+        paddr += l;
+        dst += l;
+        len -= l;
+    }
+}
+
 void __init noreturn start_xen(unsigned long bootcpu_id,
                                paddr_t dtb_addr)
 {
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Dec 19 19:44:33 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 19 Dec 2024 19:44:33 +0000
Received: from list by lists.xenproject.org with outflank-mailman.861480.1273431 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tOMRl-000462-Nw; Thu, 19 Dec 2024 19:44:33 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 861480.1273431; Thu, 19 Dec 2024 19: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 1tOMRl-00045t-L1; Thu, 19 Dec 2024 19:44:33 +0000
Received: by outflank-mailman (input) for mailman id 861480;
 Thu, 19 Dec 2024 19:44:32 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tOMRk-00045l-Di
 for xen-changelog@lists.xenproject.org; Thu, 19 Dec 2024 19:44:32 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tOMRk-00BcLa-0I
 for xen-changelog@lists.xenproject.org;
 Thu, 19 Dec 2024 19:44:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tOMRk-0049Ch-1A
 for xen-changelog@lists.xenproject.org;
 Thu, 19 Dec 2024 19:44:32 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=YudyeJnv89tr0r63ru/ERLJ7owFOW49vMkaXnLaZQ7M=; b=cI4znkWP2Y2bOYI/weJAdyj7LI
	2nbEmTi5EM/6/0H9HlBQJxgxeAOJlco/BKsNSP7xScqrUWI8JFJLFvoov1vUIV4gr6Gs7EINPY7LR
	rC9uAAZht0790m+f9Mos3TTLjix+r0isTyf4flP9ASgfnWcowZq27HtQphK8Lebl1r1k=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/riscv: relocating and unflattening host device tree
Message-Id: <E1tOMRk-0049Ch-1A@xenbits.xenproject.org>
Date: Thu, 19 Dec 2024 19:44:32 +0000

commit 9a17d5c7c953536652e259c6359502cf9c25ac7d
Author:     Oleksii Kurochko <oleksii.kurochko@gmail.com>
AuthorDate: Thu Dec 19 10:23:48 2024 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Dec 19 10:23:48 2024 +0100

    xen/riscv: relocating and unflattening host device tree
    
    Introduce relocate_fdt() and call it to relocate FDT to Xen heap
    instead of using early mapping as it is expected that discard_initial_modules()
    ( is supposed to call in the future ) discards the FDT boot module and
    remove_early_mappings() destroys the early mapping.
    
    Unflatten a device tree, creating the tree of struct device_node.
    It also fills the "name" and "type" pointers of the nodes so the normal
    device-tree walking functions can be used.
    
    Set device_tree_flattened to NULL in the case when acpi_disabled is
    equal to false.
    
    Signed-off-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/riscv/setup.c | 31 +++++++++++++++++++++++++++++--
 1 file changed, 29 insertions(+), 2 deletions(-)

diff --git a/xen/arch/riscv/setup.c b/xen/arch/riscv/setup.c
index bea3f27c4d..fb6bbba684 100644
--- a/xen/arch/riscv/setup.c
+++ b/xen/arch/riscv/setup.c
@@ -1,5 +1,6 @@
 /* SPDX-License-Identifier: GPL-2.0-only */
 
+#include <xen/acpi.h>
 #include <xen/bug.h>
 #include <xen/bootfdt.h>
 #include <xen/compile.h>
@@ -8,6 +9,7 @@
 #include <xen/mm.h>
 #include <xen/shutdown.h>
 #include <xen/vmap.h>
+#include <xen/xvmalloc.h>
 
 #include <public/version.h>
 
@@ -52,10 +54,24 @@ void __init copy_from_paddr(void *dst, paddr_t paddr, unsigned long len)
     }
 }
 
+/* Relocate the FDT in Xen heap */
+static void * __init relocate_fdt(paddr_t dtb_paddr, size_t dtb_size)
+{
+    void *fdt = xvmalloc_array(uint8_t, dtb_size);
+
+    if ( !fdt )
+        panic("Unable to allocate memory for relocating the Device-Tree.\n");
+
+    copy_from_paddr(fdt, dtb_paddr, dtb_size);
+
+    return fdt;
+}
+
 void __init noreturn start_xen(unsigned long bootcpu_id,
                                paddr_t dtb_addr)
 {
     const char *cmdline;
+    size_t fdt_size;
 
     remove_identity_mapping();
 
@@ -80,8 +96,7 @@ void __init noreturn start_xen(unsigned long bootcpu_id,
                           _end - _start, false) )
         panic("Failed to add BOOTMOD_XEN\n");
 
-    if ( !boot_fdt_info(device_tree_flattened, dtb_addr) )
-        BUG();
+    fdt_size = boot_fdt_info(device_tree_flattened, dtb_addr);
 
     cmdline = boot_fdt_cmdline(device_tree_flattened);
     printk("Command line: %s\n", cmdline);
@@ -99,6 +114,18 @@ void __init noreturn start_xen(unsigned long bootcpu_id,
      */
     system_state = SYS_STATE_boot;
 
+    if ( acpi_disabled )
+    {
+        printk("Booting using Device Tree\n");
+        device_tree_flattened = relocate_fdt(dtb_addr, fdt_size);
+        dt_unflatten_host_device_tree();
+    }
+    else
+    {
+        device_tree_flattened = NULL;
+        panic("Booting using ACPI isn't supported\n");
+    }
+
     printk("All set up\n");
 
     machine_halt();
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Dec 19 19:44:43 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 19 Dec 2024 19:44:43 +0000
Received: from list by lists.xenproject.org with outflank-mailman.861481.1273435 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tOMRv-00048e-P8; Thu, 19 Dec 2024 19:44:43 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 861481.1273435; Thu, 19 Dec 2024 19: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 1tOMRv-00048W-MQ; Thu, 19 Dec 2024 19:44:43 +0000
Received: by outflank-mailman (input) for mailman id 861481;
 Thu, 19 Dec 2024 19:44:42 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tOMRu-00048E-Ha
 for xen-changelog@lists.xenproject.org; Thu, 19 Dec 2024 19:44:42 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tOMRu-00BcLu-0f
 for xen-changelog@lists.xenproject.org;
 Thu, 19 Dec 2024 19:44:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tOMRu-0049DU-1T
 for xen-changelog@lists.xenproject.org;
 Thu, 19 Dec 2024 19:44:42 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=BOYtrqUeC/8yo2/CH+sw+kwGHggbfHio2LN5kbm5y4A=; b=cl8UejcOa0fvP29WL1Ze/peTXM
	MKJRmzLSScXqh4e+SFjMlYCaKC76vlKisRq1Q+x88By9V0VpBmvkFqmVnHu8zHhSVN9lHOJ6Z3TS4
	M9uHgaMjymHDrLGRVmncj+SESU8ibSWu1mkIeretwCF5W1O1qDt6PEyX1prr8yIMkcIk=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/sched: Untangle credit2 vs cpu_nr_siblings()
Message-Id: <E1tOMRu-0049DU-1T@xenbits.xenproject.org>
Date: Thu, 19 Dec 2024 19:44:42 +0000

commit 188d568db8ca941d8f001bb81a716d7a74dc7b73
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu Sep 12 02:18:40 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Dec 19 17:33:54 2024 +0000

    xen/sched: Untangle credit2 vs cpu_nr_siblings()
    
    Credit2 has no buisness including asm/cpufeature.h or asm/processor.h.
    
    This was caused by a bad original abstraction, and an even less wise attempt
    to fix the build on my behalf.  It is also the sole reason why PPC and RISC-V
    need cpufeature.h header.
    
    Worst of all, cpu_data[cpu].x86_num_siblings doesn't even have the same
    meaning between vendors on x86 CPUS.
    
    Implement cpu_nr_siblings() locally in credit2.c, leaving behind a TODO.  Drop
    the stub from each architecture.
    
    Fixes: 8e2aa76dc167 ("xen: credit2: limit the max number of CPUs in a runqueue")
    Fixes: ad33a573c009 ("xen/credit2: Fix build following c/s 8e2aa76dc (take 2)")
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
    Acked-by: Shawn Anastasio <sanastasio@raptorengineering.com>
---
 xen/arch/arm/include/asm/cpufeature.h   |  5 -----
 xen/arch/ppc/include/asm/cpufeature.h   | 10 ----------
 xen/arch/riscv/include/asm/cpufeature.h | 23 -----------------------
 xen/arch/x86/include/asm/processor.h    |  5 -----
 xen/common/sched/credit2.c              | 15 +++++++++++++--
 5 files changed, 13 insertions(+), 45 deletions(-)

diff --git a/xen/arch/arm/include/asm/cpufeature.h b/xen/arch/arm/include/asm/cpufeature.h
index 969e043f5b..50297e53d9 100644
--- a/xen/arch/arm/include/asm/cpufeature.h
+++ b/xen/arch/arm/include/asm/cpufeature.h
@@ -98,11 +98,6 @@ static inline bool cpus_have_cap(unsigned int num)
     return test_bit(num, cpu_hwcaps);
 }
 
-static inline int cpu_nr_siblings(unsigned int cpu)
-{
-    return 1;
-}
-
 /* System capability check for constant cap */
 #define cpus_have_const_cap(num) ({                 \
         register_t __ret;                           \
diff --git a/xen/arch/ppc/include/asm/cpufeature.h b/xen/arch/ppc/include/asm/cpufeature.h
deleted file mode 100644
index 1c5946512b..0000000000
--- a/xen/arch/ppc/include/asm/cpufeature.h
+++ /dev/null
@@ -1,10 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0-only */
-#ifndef __ASM_PPC_CPUFEATURE_H__
-#define __ASM_PPC_CPUFEATURE_H__
-
-static inline int cpu_nr_siblings(unsigned int cpu)
-{
-    return 1;
-}
-
-#endif /* __ASM_PPC_CPUFEATURE_H__ */
diff --git a/xen/arch/riscv/include/asm/cpufeature.h b/xen/arch/riscv/include/asm/cpufeature.h
deleted file mode 100644
index 41a792b0b2..0000000000
--- a/xen/arch/riscv/include/asm/cpufeature.h
+++ /dev/null
@@ -1,23 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0-only */
-#ifndef ASM__RISCV__CPUFEATURE_H
-#define ASM__RISCV__CPUFEATURE_H
-
-#ifndef __ASSEMBLY__
-
-static inline unsigned int cpu_nr_siblings(unsigned int cpu)
-{
-    return 1;
-}
-
-#endif /* __ASSEMBLY__ */
-
-#endif /* ASM__RISCV__CPUFEATURE_H */
-
-/*
- * Local variables:
- * mode: C
- * c-file-style: "BSD"
- * c-basic-offset: 4
- * indent-tabs-mode: nil
- * End:
- */
diff --git a/xen/arch/x86/include/asm/processor.h b/xen/arch/x86/include/asm/processor.h
index 8776512122..d247ef8dd2 100644
--- a/xen/arch/x86/include/asm/processor.h
+++ b/xen/arch/x86/include/asm/processor.h
@@ -118,11 +118,6 @@ extern void init_intel_cacheinfo(struct cpuinfo_x86 *c);
 
 unsigned int apicid_to_socket(unsigned int apicid);
 
-static inline int cpu_nr_siblings(unsigned int cpu)
-{
-    return cpu_data[cpu].x86_num_siblings;
-}
-
 /* Some CPUID calls want 'count' to be placed in ecx */
 static inline void cpuid_count(
     unsigned int op,
diff --git a/xen/common/sched/credit2.c b/xen/common/sched/credit2.c
index 76a273d4f6..4b2ef034ca 100644
--- a/xen/common/sched/credit2.c
+++ b/xen/common/sched/credit2.c
@@ -26,8 +26,6 @@
 #include <xen/trace.h>
 #include <xen/cpu.h>
 #include <xen/keyhandler.h>
-#include <asm/cpufeature.h>
-#include <asm/processor.h>
 
 #include "private.h"
 
@@ -35,6 +33,19 @@
 /* #define d2printk printk */
 #define d2printk(x...)
 
+/*
+ * TODO: Abstract this properly, and figure out what Credit2 wants to do with
+ *       the fact that x86_num_siblings doesn't even have the same meaning
+ *       between x86 vendors.
+ */
+static unsigned int cpu_nr_siblings(unsigned int cpu)
+{
+#ifdef CONFIG_X86
+    return cpu_data[cpu].x86_num_siblings;
+#else
+    return 1;
+#endif
+}
 
 /*
  * Credit2 tracing events ("only" 512 available!). Check
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Dec 19 19:44:53 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 19 Dec 2024 19:44:53 +0000
Received: from list by lists.xenproject.org with outflank-mailman.861482.1273438 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tOMS5-0004B4-Qb; Thu, 19 Dec 2024 19:44:53 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 861482.1273438; Thu, 19 Dec 2024 19: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 1tOMS5-0004Av-Nu; Thu, 19 Dec 2024 19:44:53 +0000
Received: by outflank-mailman (input) for mailman id 861482;
 Thu, 19 Dec 2024 19:44:52 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tOMS4-0004Am-Ll
 for xen-changelog@lists.xenproject.org; Thu, 19 Dec 2024 19:44:52 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tOMS4-00BcM3-13
 for xen-changelog@lists.xenproject.org;
 Thu, 19 Dec 2024 19:44:52 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tOMS4-0049EI-1o
 for xen-changelog@lists.xenproject.org;
 Thu, 19 Dec 2024 19:44:52 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=VTV2AGPY91VBtHywJTVDeveYrFhpYeM5wdMWW04q57M=; b=pt5Gu9Sal5GysLyGCZiNYMNuvU
	goKchu7OD6zSMHsoidBHwnTnCYli83wSkZjuZw1/bJ0ArTs394sveydNiccPpcI7stjkTEH9l/FRJ
	40y76cWRDpK/wHG8ZIr/ApEjacB6OPzggx76O/gKPR1uOBjF6JydkCYOn7uri4GuEyhE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/sched: Drop unused includes from credit2.c
Message-Id: <E1tOMS4-0049EI-1o@xenbits.xenproject.org>
Date: Thu, 19 Dec 2024 19:44:52 +0000

commit 63ebfcca04e71ed750f3451e62b1423581feb44a
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu Sep 12 03:02:37 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Dec 19 17:33:54 2024 +0000

    x86/sched: Drop unused includes from credit2.c
    
    Sort the remaining includes.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Juergen Gross <jgross@suse.com>
---
 xen/common/sched/credit2.c | 14 +++++---------
 1 file changed, 5 insertions(+), 9 deletions(-)

diff --git a/xen/common/sched/credit2.c b/xen/common/sched/credit2.c
index 4b2ef034ca..0a83f23725 100644
--- a/xen/common/sched/credit2.c
+++ b/xen/common/sched/credit2.c
@@ -10,22 +10,18 @@
  * Based on an earlier verson by Emmanuel Ackaouy.
  */
 
+#include <xen/errno.h>
 #include <xen/init.h>
 #include <xen/lib.h>
 #include <xen/param.h>
+#include <xen/perfc.h>
 #include <xen/sched.h>
 #include <xen/sections.h>
-#include <xen/domain.h>
-#include <xen/delay.h>
-#include <xen/event.h>
-#include <xen/time.h>
-#include <xen/perfc.h>
 #include <xen/softirq.h>
-#include <asm/div64.h>
-#include <xen/errno.h>
+#include <xen/time.h>
 #include <xen/trace.h>
-#include <xen/cpu.h>
-#include <xen/keyhandler.h>
+
+#include <asm/div64.h>
 
 #include "private.h"
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Dec 19 19:45:03 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 19 Dec 2024 19:45:03 +0000
Received: from list by lists.xenproject.org with outflank-mailman.861483.1273443 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tOMSF-0004Cx-Rn; Thu, 19 Dec 2024 19:45:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 861483.1273443; Thu, 19 Dec 2024 19: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 1tOMSF-0004Cp-PI; Thu, 19 Dec 2024 19:45:03 +0000
Received: by outflank-mailman (input) for mailman id 861483;
 Thu, 19 Dec 2024 19:45:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tOMSE-0004Ch-Oc
 for xen-changelog@lists.xenproject.org; Thu, 19 Dec 2024 19:45:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tOMSE-00BcMU-1O
 for xen-changelog@lists.xenproject.org;
 Thu, 19 Dec 2024 19:45:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tOMSE-0049GG-2B
 for xen-changelog@lists.xenproject.org;
 Thu, 19 Dec 2024 19:45:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=KO1cq9Vg9JIAQ6zBrYkZ6WBmWGRrs5WLTwxvYzcjMbU=; b=aLcWAPOgXAYfqrgXpYfOZQLlOv
	2aaYpTto8BhH9/zHELpHbo6DRN232WAElUm8x1SzzohxAkKYsNUqr71gew91/lvTamHNGXnBEZVy5
	x1q77DYBoO3lmj7V12GMdfWQuIBwkGuXirJXdgLP4KqlQFxPKu7UQXte8sDU92xNu0e0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/boot: Use printk_once() instead of opencoding it
Message-Id: <E1tOMSE-0049GG-2B@xenbits.xenproject.org>
Date: Thu, 19 Dec 2024 19:45:02 +0000

commit 2e22a8ba29a5f8677888d9d85cbe131ea5546865
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Wed Sep 4 00:14:24 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Dec 19 17:33:54 2024 +0000

    x86/boot: Use printk_once() instead of opencoding it
    
    Adjust the message for brevity.  No functional change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jason Andryuk <jason.andryuk@amd.com>
---
 xen/arch/x86/setup.c | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c
index 3d51c80626..397347bea4 100644
--- a/xen/arch/x86/setup.c
+++ b/xen/arch/x86/setup.c
@@ -1072,7 +1072,7 @@ void asmlinkage __init noreturn __start_xen(void)
     unsigned int initrdidx, num_parked = 0;
     struct boot_info *bi;
     unsigned long nr_pages, raw_max_page;
-    int i, j, e820_warn = 0, bytes = 0;
+    int i, j, bytes = 0;
     unsigned long eb_start, eb_end;
     bool acpi_boot_table_init_done = false, relocated = false;
     bool vm_init_done = false;
@@ -1309,12 +1309,8 @@ void asmlinkage __init noreturn __start_xen(void)
              */
             if ( (map->base_addr_high == 0) && (map->length_high != 0) )
             {
-                if ( !e820_warn )
-                {
-                    printk("WARNING: Buggy e820 map detected and fixed "
-                           "(truncated length fields).\n");
-                    e820_warn = 1;
-                }
+                printk_once(XENLOG_WARNING
+                            "WARNING: Buggy e820 map detected; truncated length\n");
                 map->length_high = 0;
             }
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Dec 19 19:45:13 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 19 Dec 2024 19:45:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.861484.1273446 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tOMSP-0004FO-TA; Thu, 19 Dec 2024 19:45:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 861484.1273446; Thu, 19 Dec 2024 19: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 1tOMSP-0004FH-Qh; Thu, 19 Dec 2024 19:45:13 +0000
Received: by outflank-mailman (input) for mailman id 861484;
 Thu, 19 Dec 2024 19:45:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tOMSO-0004F2-Rs
 for xen-changelog@lists.xenproject.org; Thu, 19 Dec 2024 19:45:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tOMSO-00BcMY-1j
 for xen-changelog@lists.xenproject.org;
 Thu, 19 Dec 2024 19:45:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tOMSO-0049HR-2X
 for xen-changelog@lists.xenproject.org;
 Thu, 19 Dec 2024 19:45:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=eKkKGBLQ1LPb31Sqidh9/G87N4XjSbbPBuPZUj10S6k=; b=g/jZ3B7gyxsqKDWHUXWGpNtOIi
	CkFNlIYMSLoPyiiynqqFmOmWvd5RK2JJqKSMIVpKmZQAw5bc7mbH9RLk4xZVnw9oJ+8AYNiMNDCSP
	f+JOtWZzwQ8QdcSGhhdQ/VjQ9iPTtFlUXpjSPWkFmCSgweB2bzMVDnS5lmSBYv5THxao=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools/libxg: Don't gunzip the guests initrd
Message-Id: <E1tOMSO-0049HR-2X@xenbits.xenproject.org>
Date: Thu, 19 Dec 2024 19:45:12 +0000

commit d17b7562d4ef7ab32fdac9b59fe66055db4b6271
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu Jun 27 13:55:51 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Dec 19 17:33:54 2024 +0000

    tools/libxg: Don't gunzip the guests initrd
    
    Decompressing the kernel is necessary to inspect the ELF notes, but the
    dombuilder will gunzip() secondary modules too.  Specifically gunzip(), no
    other decompression algorithms.
    
    This may have been necessary in the dim and distant past, but it is broken
    today.  Linux specifically supports concatenating CPIO fragments of differing
    compressions, and any attempt to interpret it with a single algorithm may
    corrupt later parts.
    
    This was an unexpected discovery while trying to test Xen's gunzip()
    logic (Xen as a PVH guest, with a gzipped XTF kernel as dom0).
    
    Interpreting secondary modules should be left as an exercise to the guest.
    This reduces work done in dom0.
    
    This is not expected to cause a practical difference to guests these days.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
---
 CHANGELOG.md                   |  2 ++
 tools/libs/guest/xg_dom_core.c | 40 +++++++---------------------------------
 2 files changed, 9 insertions(+), 33 deletions(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 15f681459f..61510e6a11 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -8,6 +8,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
 
 ### Changed
  - Fixed blkif protocol specification for sector sizes different than 512b.
+ - The dombuilder in libxenguest no longer un-gzips secondary modules, instead
+   leaving this to the guest kernel to do in guest context.
  - On x86:
    - Prefer ACPI reboot over UEFI ResetSystem() run time service call.
    - Switched the xAPIC flat driver to use physical destination mode for external
diff --git a/tools/libs/guest/xg_dom_core.c b/tools/libs/guest/xg_dom_core.c
index f5521d528b..595b0a667c 100644
--- a/tools/libs/guest/xg_dom_core.c
+++ b/tools/libs/guest/xg_dom_core.c
@@ -980,37 +980,24 @@ int xc_dom_mem_init(struct xc_dom_image *dom, unsigned int mem_mb)
 
 static int xc_dom_build_module(struct xc_dom_image *dom, unsigned int mod)
 {
-    size_t unziplen, modulelen;
+    size_t modulelen;
     void *modulemap;
     char name[10];
 
-    if ( !dom->modules[mod].seg.vstart )
-        unziplen = xc_dom_check_gzip(dom->xch,
-                                     dom->modules[mod].blob, dom->modules[mod].size);
-    else
-        unziplen = 0;
+    modulelen = dom->modules[mod].size;
 
-    modulelen = max(unziplen, dom->modules[mod].size);
-    if ( dom->max_module_size )
+    if ( dom->max_module_size && modulelen > dom->max_module_size )
     {
-        if ( unziplen && modulelen > dom->max_module_size )
-        {
-            modulelen = min(unziplen, dom->modules[mod].size);
-            if ( unziplen > modulelen )
-                unziplen = 0;
-        }
-        if ( modulelen > dom->max_module_size )
-        {
-            xc_dom_panic(dom->xch, XC_INVALID_KERNEL,
-                         "module %u image too large", mod);
-            goto err;
-        }
+        xc_dom_panic(dom->xch, XC_INVALID_KERNEL,
+                     "module %u image too large", mod);
+        goto err;
     }
 
     snprintf(name, sizeof(name), "module%u", mod);
     if ( xc_dom_alloc_segment(dom, &dom->modules[mod].seg, name,
                               dom->modules[mod].seg.vstart, modulelen) != 0 )
         goto err;
+
     modulemap = xc_dom_seg_to_ptr(dom, &dom->modules[mod].seg);
     if ( modulemap == NULL )
     {
@@ -1018,21 +1005,8 @@ static int xc_dom_build_module(struct xc_dom_image *dom, unsigned int mod)
                   __FUNCTION__, mod);
         goto err;
     }
-    if ( unziplen )
-    {
-        if ( xc_dom_do_gunzip(dom->xch, dom->modules[mod].blob, dom->modules[mod].size,
-                              modulemap, unziplen) != -1 )
-            return 0;
-        if ( dom->modules[mod].size > modulelen )
-            goto err;
-    }
 
-    /* Fall back to handing over the raw blob. */
     memcpy(modulemap, dom->modules[mod].blob, dom->modules[mod].size);
-    /* If an unzip attempt was made, the buffer may no longer be all zero. */
-    if ( unziplen > dom->modules[mod].size )
-        memset(modulemap + dom->modules[mod].size, 0,
-               unziplen - dom->modules[mod].size);
 
     return 0;
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Dec 19 19:45:24 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 19 Dec 2024 19:45:24 +0000
Received: from list by lists.xenproject.org with outflank-mailman.861485.1273450 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tOMSZ-0004Hu-Uw; Thu, 19 Dec 2024 19:45:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 861485.1273450; Thu, 19 Dec 2024 19: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 1tOMSZ-0004Hm-SA; Thu, 19 Dec 2024 19:45:23 +0000
Received: by outflank-mailman (input) for mailman id 861485;
 Thu, 19 Dec 2024 19:45:23 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tOMSZ-0004He-0I
 for xen-changelog@lists.xenproject.org; Thu, 19 Dec 2024 19:45:23 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tOMSY-00BcMc-2C
 for xen-changelog@lists.xenproject.org;
 Thu, 19 Dec 2024 19:45:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tOMSY-0049IG-2w
 for xen-changelog@lists.xenproject.org;
 Thu, 19 Dec 2024 19:45:22 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=ovlE4SEEeoVYnhGRsC57RBbUkGehvC6jG7um7orn0Mg=; b=cPFS28DQDdGxNDi5KTSw5LN52c
	WUFFtifGBBc4tVvgRiXpUALr0shBtzbTM9dSQjOY4lzEekICX2KSuziVmlLXvAzbDql0suji1X+FI
	RxCW4554MP5TjSQjEy77GAUppAvCKN3XvR6mN+wvYJJIVubuumrc3XOCKPdWKwccpSEE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/hvm: Use constants for x86 modes
Message-Id: <E1tOMSY-0049IG-2w@xenbits.xenproject.org>
Date: Thu, 19 Dec 2024 19:45:22 +0000

commit dd05f7c8dd6729b094c10e15c7ac6c4c33640cec
Author:     Teddy Astie <teddy.astie@vates.tech>
AuthorDate: Mon Dec 2 09:49:14 2024 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Dec 19 17:33:54 2024 +0000

    x86/hvm: Use constants for x86 modes
    
    In many places of x86 HVM code, constants integer are used to indicate in what mode is
    running the CPU (real, vm86, 16-bits, 32-bits, 64-bits). However, these constants are
    are written directly as integer which hides the actual meaning of these modes.
    
    This patch introduces X86_MODE_* macros and replace those occurences with it.
    
    Signed-off-by: Teddy Astie <teddy.astie@vates.tech>
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Teddy Astie <teddy.astie@vates.tech>
---
 xen/arch/x86/hvm/emulate.c           | 18 ++++++++++--------
 xen/arch/x86/hvm/hvm.c               |  4 +++-
 xen/arch/x86/hvm/hypercall.c         | 17 +++++++++--------
 xen/arch/x86/hvm/svm/svm.c           |  8 ++++----
 xen/arch/x86/hvm/viridian/viridian.c |  8 ++++----
 xen/arch/x86/hvm/vmx/vmx.c           |  9 +++++----
 xen/arch/x86/hvm/vmx/vvmx.c          |  5 +++--
 xen/arch/x86/include/asm/hvm/hvm.h   | 14 ++++++++++++++
 xen/arch/x86/oprofile/xenoprof.c     |  6 +++---
 9 files changed, 55 insertions(+), 34 deletions(-)

diff --git a/xen/arch/x86/hvm/emulate.c b/xen/arch/x86/hvm/emulate.c
index d3006f094a..a1935a1748 100644
--- a/xen/arch/x86/hvm/emulate.c
+++ b/xen/arch/x86/hvm/emulate.c
@@ -2433,14 +2433,15 @@ static void cf_check hvmemul_put_fpu(
 
         switch ( mode )
         {
-        case 8:
+        case X86_MODE_64BIT:
             fpu_ctxt->fip.addr = aux->ip;
             if ( dval )
                 fpu_ctxt->fdp.addr = aux->dp;
             fpu_ctxt->x[FPU_WORD_SIZE_OFFSET] = 8;
             break;
 
-        case 4: case 2:
+        case X86_MODE_32BIT:
+        case X86_MODE_16BIT:
             fpu_ctxt->fip.offs = aux->ip;
             fpu_ctxt->fip.sel  = aux->cs;
             if ( dval )
@@ -2451,7 +2452,8 @@ static void cf_check hvmemul_put_fpu(
             fpu_ctxt->x[FPU_WORD_SIZE_OFFSET] = mode;
             break;
 
-        case 0: case 1:
+        case X86_MODE_REAL:
+        case X86_MODE_VM86:
             fpu_ctxt->fip.addr = aux->ip | (aux->cs << 4);
             if ( dval )
                 fpu_ctxt->fdp.addr = aux->dp | (aux->ds << 4);
@@ -2952,11 +2954,11 @@ static const char *guest_x86_mode_to_str(int mode)
 {
     switch ( mode )
     {
-    case 0:  return "Real";
-    case 1:  return "v86";
-    case 2:  return "16bit";
-    case 4:  return "32bit";
-    case 8:  return "64bit";
+    case X86_MODE_REAL:   return "Real";
+    case X86_MODE_VM86:   return "vm86";
+    case X86_MODE_16BIT:  return "16bit";
+    case X86_MODE_32BIT:  return "32bit";
+    case X86_MODE_64BIT:  return "64bit";
     default: return "Unknown";
     }
 }
diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c
index 74e58c653e..922c9b3af6 100644
--- a/xen/arch/x86/hvm/hvm.c
+++ b/xen/arch/x86/hvm/hvm.c
@@ -3974,7 +3974,9 @@ static void hvm_latch_shinfo_size(struct domain *d)
      */
     if ( current->domain == d )
     {
-        d->arch.has_32bit_shinfo = (hvm_guest_x86_mode(current) != 8);
+        d->arch.has_32bit_shinfo =
+            hvm_guest_x86_mode(current) != X86_MODE_64BIT;
+
         /*
          * Make sure that the timebase in the shared info structure is correct.
          *
diff --git a/xen/arch/x86/hvm/hypercall.c b/xen/arch/x86/hvm/hypercall.c
index 81883c8d4f..6f8dfdff4a 100644
--- a/xen/arch/x86/hvm/hypercall.c
+++ b/xen/arch/x86/hvm/hypercall.c
@@ -112,23 +112,24 @@ int hvm_hypercall(struct cpu_user_regs *regs)
 
     switch ( mode )
     {
-    case 8:
+    case X86_MODE_64BIT:
         eax = regs->rax;
         fallthrough;
-    case 4:
-    case 2:
+    case X86_MODE_32BIT:
+    case X86_MODE_16BIT:
         if ( currd->arch.monitor.guest_request_userspace_enabled &&
-            eax == __HYPERVISOR_hvm_op &&
-            (mode == 8 ? regs->rdi : regs->ebx) == HVMOP_guest_request_vm_event )
+             eax == __HYPERVISOR_hvm_op &&
+             (mode == X86_MODE_64BIT ? regs->rdi : regs->ebx) ==
+             HVMOP_guest_request_vm_event )
             break;
 
         if ( likely(!hvm_get_cpl(curr)) )
             break;
         fallthrough;
-    default:
+    case X86_MODE_VM86:
         regs->rax = -EPERM;
         return HVM_HCALL_completed;
-    case 0:
+    case X86_MODE_REAL:
         break;
     }
 
@@ -198,7 +199,7 @@ enum mc_disposition hvm_do_multicall_call(struct mc_state *state)
 {
     struct vcpu *curr = current;
 
-    if ( hvm_guest_x86_mode(curr) == 8 )
+    if ( hvm_guest_x86_mode(curr) == X86_MODE_64BIT )
     {
         struct multicall_entry *call = &state->call;
 
diff --git a/xen/arch/x86/hvm/svm/svm.c b/xen/arch/x86/hvm/svm/svm.c
index b8f87aa1ed..62905c2c7a 100644
--- a/xen/arch/x86/hvm/svm/svm.c
+++ b/xen/arch/x86/hvm/svm/svm.c
@@ -571,12 +571,12 @@ static int cf_check svm_guest_x86_mode(struct vcpu *v)
     struct vmcb_struct *vmcb = v->arch.hvm.svm.vmcb;
 
     if ( unlikely(!(v->arch.hvm.guest_cr[0] & X86_CR0_PE)) )
-        return 0;
+        return X86_MODE_REAL;
     if ( unlikely(guest_cpu_user_regs()->eflags & X86_EFLAGS_VM) )
-        return 1;
+        return X86_MODE_VM86;
     if ( hvm_long_mode_active(v) && likely(vmcb->cs.l) )
-        return 8;
-    return likely(vmcb->cs.db) ? 4 : 2;
+        return X86_MODE_64BIT;
+    return vmcb->cs.db ? X86_MODE_32BIT : X86_MODE_16BIT;
 }
 
 static void cf_check svm_cpuid_policy_changed(struct vcpu *v)
diff --git a/xen/arch/x86/hvm/viridian/viridian.c b/xen/arch/x86/hvm/viridian/viridian.c
index 21480d9ee7..33d54e587e 100644
--- a/xen/arch/x86/hvm/viridian/viridian.c
+++ b/xen/arch/x86/hvm/viridian/viridian.c
@@ -933,13 +933,13 @@ int viridian_hypercall(struct cpu_user_regs *regs)
 
     switch ( mode )
     {
-    case 8:
+    case X86_MODE_64BIT:
         input.raw = regs->rcx;
         input_params_gpa = regs->rdx;
         output_params_gpa = regs->r8;
         break;
 
-    case 4:
+    case X86_MODE_32BIT:
         input.raw = (regs->rdx << 32) | regs->eax;
         input_params_gpa = (regs->rbx << 32) | regs->ecx;
         output_params_gpa = (regs->rdi << 32) | regs->esi;
@@ -1038,11 +1038,11 @@ int viridian_hypercall(struct cpu_user_regs *regs)
 
     switch ( mode )
     {
-    case 8:
+    case X86_MODE_64BIT:
         regs->rax = output.raw;
         break;
 
-    case 4:
+    case X86_MODE_32BIT:
         regs->rdx = output.raw >> 32;
         regs->rax = (uint32_t)output.raw;
         break;
diff --git a/xen/arch/x86/hvm/vmx/vmx.c b/xen/arch/x86/hvm/vmx/vmx.c
index b6885d0e27..eee1d4b47a 100644
--- a/xen/arch/x86/hvm/vmx/vmx.c
+++ b/xen/arch/x86/hvm/vmx/vmx.c
@@ -886,14 +886,15 @@ int cf_check vmx_guest_x86_mode(struct vcpu *v)
     unsigned long cs_ar_bytes;
 
     if ( unlikely(!(v->arch.hvm.guest_cr[0] & X86_CR0_PE)) )
-        return 0;
+        return X86_MODE_REAL;
     if ( unlikely(guest_cpu_user_regs()->eflags & X86_EFLAGS_VM) )
-        return 1;
+        return X86_MODE_VM86;
     __vmread(GUEST_CS_AR_BYTES, &cs_ar_bytes);
     if ( hvm_long_mode_active(v) &&
          likely(cs_ar_bytes & X86_SEG_AR_CS_LM_ACTIVE) )
-        return 8;
-    return (likely(cs_ar_bytes & X86_SEG_AR_DEF_OP_SIZE) ? 4 : 2);
+        return X86_MODE_64BIT;
+    return (likely(cs_ar_bytes & X86_SEG_AR_DEF_OP_SIZE)
+            ? X86_MODE_32BIT : X86_MODE_16BIT);
 }
 
 static void vmx_save_dr(struct vcpu *v)
diff --git a/xen/arch/x86/hvm/vmx/vvmx.c b/xen/arch/x86/hvm/vmx/vvmx.c
index 78135ca23b..cf47d61b14 100644
--- a/xen/arch/x86/hvm/vmx/vvmx.c
+++ b/xen/arch/x86/hvm/vmx/vvmx.c
@@ -411,7 +411,7 @@ static int decode_vmx_inst(struct cpu_user_regs *regs,
     }
     else
     {
-        bool mode_64bit = (vmx_guest_x86_mode(v) == 8);
+        bool mode_64bit = vmx_guest_x86_mode(v) == X86_MODE_64BIT;
 
         decode->type = VMX_INST_MEMREG_TYPE_MEMORY;
 
@@ -2073,7 +2073,8 @@ int nvmx_handle_vmx_insn(struct cpu_user_regs *regs, unsigned int exit_reason)
 
     if ( !(curr->arch.hvm.guest_cr[4] & X86_CR4_VMXE) ||
          !nestedhvm_enabled(curr->domain) ||
-         (vmx_guest_x86_mode(curr) < (hvm_long_mode_active(curr) ? 8 : 2)) ||
+         (vmx_guest_x86_mode(curr) <
+          (hvm_long_mode_active(curr) ? X86_MODE_64BIT : X86_MODE_16BIT)) ||
          (exit_reason != EXIT_REASON_VMXON && !nvmx_vcpu_in_vmx(curr)) )
     {
         hvm_inject_hw_exception(X86_EXC_UD, X86_EVENT_NO_EC);
diff --git a/xen/arch/x86/include/asm/hvm/hvm.h b/xen/arch/x86/include/asm/hvm/hvm.h
index 02de18c7d4..cad3a94278 100644
--- a/xen/arch/x86/include/asm/hvm/hvm.h
+++ b/xen/arch/x86/include/asm/hvm/hvm.h
@@ -26,6 +26,20 @@ extern bool opt_hvm_fep;
 #define opt_hvm_fep 0
 #endif
 
+/*
+ * Results for hvm_guest_x86_mode().
+ *
+ * Note, some callers depend on the order of these constants.
+ *
+ * TODO: Rework hvm_guest_x86_mode() to avoid mixing the architectural
+ * concepts of mode and operand size.
+ */
+#define X86_MODE_REAL  0
+#define X86_MODE_VM86  1
+#define X86_MODE_16BIT 2
+#define X86_MODE_32BIT 4
+#define X86_MODE_64BIT 8
+
 /* Interrupt acknowledgement sources. */
 enum hvm_intsrc {
     hvm_intsrc_none,
diff --git a/xen/arch/x86/oprofile/xenoprof.c b/xen/arch/x86/oprofile/xenoprof.c
index 247a0deca8..7f2525bfb4 100644
--- a/xen/arch/x86/oprofile/xenoprof.c
+++ b/xen/arch/x86/oprofile/xenoprof.c
@@ -86,11 +86,11 @@ int xenoprofile_get_mode(struct vcpu *curr, const struct cpu_user_regs *regs)
 
     switch ( hvm_guest_x86_mode(curr) )
     {
-    case 0: /* real mode */
+    case X86_MODE_REAL:
         return 1;
-    case 1: /* vm86 mode */
+    case X86_MODE_VM86:
         return 0;
-    default:
+    default: /* 16BIT | 32BIT | 64BIT */
         return hvm_get_cpl(curr) != 3;
     }
 }
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Dec 19 19:45:34 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 19 Dec 2024 19:45:34 +0000
Received: from list by lists.xenproject.org with outflank-mailman.861486.1273454 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tOMSk-0004Kj-1k; Thu, 19 Dec 2024 19:45:34 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 861486.1273454; Thu, 19 Dec 2024 19: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 1tOMSj-0004Kc-VZ; Thu, 19 Dec 2024 19:45:33 +0000
Received: by outflank-mailman (input) for mailman id 861486;
 Thu, 19 Dec 2024 19:45:33 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tOMSj-0004KV-2l
 for xen-changelog@lists.xenproject.org; Thu, 19 Dec 2024 19:45:33 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tOMSi-00BcMg-2S
 for xen-changelog@lists.xenproject.org;
 Thu, 19 Dec 2024 19:45:33 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tOMSj-0049Ii-06
 for xen-changelog@lists.xenproject.org;
 Thu, 19 Dec 2024 19:45:33 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=hyuOehU/g7xap+vbQKOPd3/tsz0UEjEg8ZWUyu5FXDE=; b=aksHj4CpFzC9sv9MVrqxMUEG/y
	lR/oYb9Yx5yCzPGLBI41WQFNkUbYknsSHmjfTrnmk9m43Iihc+JlV53wfIjyfMx0/m/tzfGym2eNp
	3BZU8uqg4e993coGa2mtnC3cTnXd33uia8r+k9qqcDjHe4CiCUgEboO0TvSJ03wLgv9E=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools/xg: increase LZMA_BLOCK_SIZE for uncompressing the kernel
Message-Id: <E1tOMSj-0049Ii-06@xenbits.xenproject.org>
Date: Thu, 19 Dec 2024 19:45:33 +0000

commit e6472d46680ccd2b804ad73c19042a5811d036f0
Author:     Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
AuthorDate: Tue Oct 8 23:32:23 2024 +0200
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Dec 19 17:33:54 2024 +0000

    tools/xg: increase LZMA_BLOCK_SIZE for uncompressing the kernel
    
    Linux 6.12-rc2 fails to decompress with the current 128MiB, contrary to
    the code comment. It results in a failure like this:
    
        domainbuilder: detail: xc_dom_kernel_file: filename="/var/lib/qubes/vm-kernels/6.12-rc2-1.1.fc37/vmlinuz"
        domainbuilder: detail: xc_dom_malloc_filemap    : 12104 kB
        domainbuilder: detail: xc_dom_module_file: filename="/var/lib/qubes/vm-kernels/6.12-rc2-1.1.fc37/initramfs"
        domainbuilder: detail: xc_dom_malloc_filemap    : 7711 kB
        domainbuilder: detail: xc_dom_boot_xen_init: ver 4.19, caps xen-3.0-x86_64 hvm-3.0-x86_32 hvm-3.0-x86_32p hvm-3.0-x86_64
        domainbuilder: detail: xc_dom_parse_image: called
        domainbuilder: detail: xc_dom_find_loader: trying multiboot-binary loader ...
        domainbuilder: detail: loader probe failed
        domainbuilder: detail: xc_dom_find_loader: trying HVM-generic loader ...
        domainbuilder: detail: loader probe failed
        domainbuilder: detail: xc_dom_find_loader: trying Linux bzImage loader ...
        domainbuilder: detail: _xc_try_lzma_decode: XZ decompression error: Memory usage limit reached
        xc: error: panic: xg_dom_bzimageloader.c:761: xc_dom_probe_bzimage_kernel unable to XZ decompress kernel: Invalid kernel
        domainbuilder: detail: loader probe failed
        domainbuilder: detail: xc_dom_find_loader: trying ELF-generic loader ...
        domainbuilder: detail: loader probe failed
        xc: error: panic: xg_dom_core.c:689: xc_dom_find_loader: no loader found: Invalid kernel
        libxl: error: libxl_dom.c:566:libxl__build_dom: xc_dom_parse_image failed
    
    The important part: XZ decompression error: Memory usage limit reached
    
    This looks to be related to the following change in Linux:
    8653c909922743bceb4800e5cc26087208c9e0e6 ("xz: use 128 MiB dictionary and force single-threaded mode")
    
    Fix this by increasing the block size to 256MiB. And remove the
    misleading comment (from lack of better ideas).
    
    Signed-off-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    Acked-by: Anthony PERARD <anthony.perard@vates.tech>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 tools/libs/guest/xg_dom_bzimageloader.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/tools/libs/guest/xg_dom_bzimageloader.c b/tools/libs/guest/xg_dom_bzimageloader.c
index c6ee6d83e7..1fb4e5a1f7 100644
--- a/tools/libs/guest/xg_dom_bzimageloader.c
+++ b/tools/libs/guest/xg_dom_bzimageloader.c
@@ -272,8 +272,7 @@ static int _xc_try_lzma_decode(
     return retval;
 }
 
-/* 128 Mb is the minimum size (half-way) documented to work for all inputs. */
-#define LZMA_BLOCK_SIZE (128*1024*1024)
+#define LZMA_BLOCK_SIZE (256*1024*1024)
 
 static int xc_try_xz_decode(
     struct xc_dom_image *dom, void **blob, size_t *size)
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Dec 19 19:45:44 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 19 Dec 2024 19:45:44 +0000
Received: from list by lists.xenproject.org with outflank-mailman.861487.1273458 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tOMSu-0004My-3K; Thu, 19 Dec 2024 19:45:44 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 861487.1273458; Thu, 19 Dec 2024 19: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 1tOMSu-0004Mr-0o; Thu, 19 Dec 2024 19:45:44 +0000
Received: by outflank-mailman (input) for mailman id 861487;
 Thu, 19 Dec 2024 19:45:43 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tOMSt-0004Ml-5s
 for xen-changelog@lists.xenproject.org; Thu, 19 Dec 2024 19:45:43 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tOMSs-00BcNB-2l
 for xen-changelog@lists.xenproject.org;
 Thu, 19 Dec 2024 19:45:43 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tOMSt-0049JP-0M
 for xen-changelog@lists.xenproject.org;
 Thu, 19 Dec 2024 19:45:43 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=q6OisV56uQc4SEd/JM8kHXqa5QSbC5qWKcz/r+x2xbM=; b=IpcEsZWEOau3znJzvQ0me/6DKt
	H20XDgtpgqL0ta2cEEoOVYmPmaaIrppdk7JlIjJiwsH8uo//J3VP4V/so8KdeitldlhSU/IUo3IwG
	8S/fHyCM576cpF5g+4myCw4/ug3seBKVRfbr6FNOZSadqy1INBc7ZEv4gdjGFAEvt0mI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/ioreq: Fix check for CONFIG_ARCH_VCPU_IOREQ_COMPLETION
Message-Id: <E1tOMSt-0049JP-0M@xenbits.xenproject.org>
Date: Thu, 19 Dec 2024 19:45:43 +0000

commit e547f730e89e026a3d6e034988c555562581342a
Author:     Sergiy Kibrik <Sergiy_Kibrik@epam.com>
AuthorDate: Thu Dec 19 13:13:26 2024 +0200
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Dec 19 17:33:54 2024 +0000

    xen/ioreq: Fix check for CONFIG_ARCH_VCPU_IOREQ_COMPLETION
    
    It should be CONFIG_ARCH_VCPU_IOREQ_COMPLETION (as in Kconfig) and not
    misspelled CONFIG_VCPU_ARCH_IOREQ_COMPLETION.
    
    Fixes: 979cfdd3e58c ("ioreq: do not build arch_vcpu_ioreq_completion() for non-VMX configurations")
    Signed-off-by: Sergiy Kibrik <Sergiy_Kibrik@epam.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/hvm/ioreq.c | 2 +-
 xen/include/xen/ioreq.h  | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/hvm/ioreq.c b/xen/arch/x86/hvm/ioreq.c
index 5c3d0c69aa..d6491df8e7 100644
--- a/xen/arch/x86/hvm/ioreq.c
+++ b/xen/arch/x86/hvm/ioreq.c
@@ -29,7 +29,7 @@ bool arch_ioreq_complete_mmio(void)
     return handle_mmio();
 }
 
-#ifdef CONFIG_VCPU_ARCH_IOREQ_COMPLETION
+#ifdef CONFIG_ARCH_VCPU_IOREQ_COMPLETION
 bool arch_vcpu_ioreq_completion(enum vio_completion completion)
 {
     switch ( completion )
diff --git a/xen/include/xen/ioreq.h b/xen/include/xen/ioreq.h
index 29a17e8ff5..4f3c6b598d 100644
--- a/xen/include/xen/ioreq.h
+++ b/xen/include/xen/ioreq.h
@@ -112,7 +112,7 @@ int ioreq_server_dm_op(struct xen_dm_op *op, struct domain *d, bool *const_op);
 
 bool arch_ioreq_complete_mmio(void);
 
-#ifdef CONFIG_VCPU_ARCH_IOREQ_COMPLETION
+#ifdef CONFIG_ARCH_VCPU_IOREQ_COMPLETION
 bool arch_vcpu_ioreq_completion(enum vio_completion completion);
 #else
 static inline bool arch_vcpu_ioreq_completion(enum vio_completion completion)
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Dec 19 19:45:55 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 19 Dec 2024 19:45:55 +0000
Received: from list by lists.xenproject.org with outflank-mailman.861488.1273462 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tOMT5-0004PQ-4p; Thu, 19 Dec 2024 19:45:55 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 861488.1273462; Thu, 19 Dec 2024 19: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 1tOMT5-0004PJ-2G; Thu, 19 Dec 2024 19:45:55 +0000
Received: by outflank-mailman (input) for mailman id 861488;
 Thu, 19 Dec 2024 19:45:53 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tOMT3-0004PB-8Y
 for xen-changelog@lists.xenproject.org; Thu, 19 Dec 2024 19:45:53 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tOMT2-00BcNH-31
 for xen-changelog@lists.xenproject.org;
 Thu, 19 Dec 2024 19:45:53 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tOMT3-0049KJ-0f
 for xen-changelog@lists.xenproject.org;
 Thu, 19 Dec 2024 19:45:53 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=zpYqg0PWpafVL09QuB+Fj4LLFkJB9exgiCaveGFNHKM=; b=VDQmFGzbIH1Cw4CzuREbqwStjM
	smKlVuMKia0rJ3urne9jKOjHBYqmfRb94Cv2weI6nvMHiRUBXI3zMeV/rGDi38sXPO0ruHBALYJwA
	31MDMY9MD2JwMyXlXGPiJ58xgX3/KGiCtWUhui7dQhrsTyQarkTkY1BIrGiwo/JqKAX4=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] automation: Pin down CONFIG_QEMU_PLATFORM for RISC-V's randconfig job
Message-Id: <E1tOMT3-0049KJ-0f@xenbits.xenproject.org>
Date: Thu, 19 Dec 2024 19:45:53 +0000

commit 8089e4ba4424eea952d15da78c5b03d106ab9cb9
Author:     Oleksii Kurochko <oleksii.kurochko@gmail.com>
AuthorDate: Thu Dec 19 12:18:31 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Dec 19 17:33:54 2024 +0000

    automation: Pin down CONFIG_QEMU_PLATFORM for RISC-V's randconfig job
    
    Except setting CONFIG_QEMU_PLATFORM=y in tiny64_defconfig,
    CONFIG_QEMU_PLATFORM should be fixed for RISC-V's randconfig job.
    Otherwise, an expected compilation error for RISC-V's randconfig job
    will occur since clean_and_invalidate_dcache_va_range() and
    clean_dcache_va_range() are currently implemented only for the QEMU
    platform.
    
    Additionally, sort the EXTRA_FIXED_RANDCONFIG list alphabetically.
    
    Reported-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Fixes: f92e2709bd ("xen/riscv: implement data and instruction cache operations")
    Signed-off-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 automation/gitlab-ci/build.yaml | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/automation/gitlab-ci/build.yaml b/automation/gitlab-ci/build.yaml
index 1ca6764225..1b884cc81c 100644
--- a/automation/gitlab-ci/build.yaml
+++ b/automation/gitlab-ci/build.yaml
@@ -732,9 +732,10 @@ debian-12-riscv64-gcc:
       CONFIG_COVERAGE=n
       CONFIG_EXPERT=y
       CONFIG_GRANT_TABLE=n
+      CONFIG_LIVEPATCH=n
       CONFIG_MEM_ACCESS=n
       CONFIG_PERF_COUNTERS=n
-      CONFIG_LIVEPATCH=n
+      CONFIG_QEMU_PLATFORM=y
       CONFIG_XSM=n
 
 debian-12-riscv64-gcc-randconfig:
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Dec 20 07:33:14 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 20 Dec 2024 07:33:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.861632.1273608 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tOXVU-0006tv-4E; Fri, 20 Dec 2024 07:33:08 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 861632.1273608; Fri, 20 Dec 2024 07:33:08 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tOXVU-0006th-0b; Fri, 20 Dec 2024 07:33:08 +0000
Received: by outflank-mailman (input) for mailman id 861632;
 Fri, 20 Dec 2024 07:33:07 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tOXVT-0006tR-IE
 for xen-changelog@lists.xenproject.org; Fri, 20 Dec 2024 07:33:07 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tOXVT-00D3TJ-0S
 for xen-changelog@lists.xenproject.org;
 Fri, 20 Dec 2024 07:33:07 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tOXVT-005N7L-17
 for xen-changelog@lists.xenproject.org;
 Fri, 20 Dec 2024 07:33:07 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=BNZ4Ej1PSZep5J18ptwJ4dfYzrSd2D0UlMQjYMdp2KY=; b=zecgVXPhVbSGhFs0gRJjI/9xpc
	tAvyDLdLlMf8PbxxHWB32uHKlReIj31LMoGh1XpuqcshGVkwmcxu+QQ7CJwLFtL/OO2Y79aK6Uux0
	aZ4z/hxdLMsFOIFbhqsNJXCclfxgv+W1sgPEIFo5jdiepa67VHakZh0mgSHCwL8GzNA4=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/common: add cache coloring common code
Message-Id: <E1tOXVT-005N7L-17@xenbits.xenproject.org>
Date: Fri, 20 Dec 2024 07:33:07 +0000

commit 44dd6d4a124a33e44eeb7157b05a3ad3d9cf46c3
Author:     Carlo Nonato <carlo.nonato@minervasys.tech>
AuthorDate: Tue Dec 17 18:06:26 2024 +0100
Commit:     Michal Orzel <michal.orzel@amd.com>
CommitDate: Thu Dec 19 19:24:31 2024 +0100

    xen/common: add cache coloring common code
    
    Last Level Cache (LLC) coloring allows to partition the cache in smaller
    chunks called cache colors.
    
    Since not all architectures can actually implement it, add a HAS_LLC_COLORING
    Kconfig option.
    LLC_COLORS_ORDER Kconfig option has a range maximum of 10 (2^10 = 1024)
    because that's the number of colors that fit in a 4 KiB page when integers
    are 4 bytes long.
    
    LLC colors are a property of the domain, so struct domain has to be extended.
    
    Based on original work from: Luca Miccio <lucmiccio@gmail.com>
    
    Signed-off-by: Carlo Nonato <carlo.nonato@minervasys.tech>
    Signed-off-by: Marco Solieri <marco.solieri@minervasys.tech>
    Acked-by: Michal Orzel <michal.orzel@amd.com>
---
 SUPPORT.md                        |   7 +++
 docs/index.rst                    |   1 +
 docs/misc/cache-coloring.rst      | 118 ++++++++++++++++++++++++++++++++++++
 docs/misc/xen-command-line.pandoc |  39 ++++++++++++
 xen/common/Kconfig                |  21 +++++++
 xen/common/Makefile               |   1 +
 xen/common/keyhandler.c           |   3 +
 xen/common/llc-coloring.c         | 124 ++++++++++++++++++++++++++++++++++++++
 xen/common/page_alloc.c           |   3 +
 xen/include/xen/llc-coloring.h    |  36 +++++++++++
 xen/include/xen/sched.h           |   5 ++
 11 files changed, 358 insertions(+)

diff --git a/SUPPORT.md b/SUPPORT.md
index 82239d0294..998faf5635 100644
--- a/SUPPORT.md
+++ b/SUPPORT.md
@@ -401,6 +401,13 @@ by maintaining multiple physical to machine (p2m) memory mappings.
     Status, x86 HVM: Tech Preview
     Status, ARM: Tech Preview
 
+### Cache coloring
+
+Allows to reserve Last Level Cache (LLC) partitions for Dom0, DomUs and Xen
+itself.
+
+    Status, Arm64: Experimental
+
 ## Resource Management
 
 ### CPU Pools
diff --git a/docs/index.rst b/docs/index.rst
index 1d44796d72..1bb8d02ea3 100644
--- a/docs/index.rst
+++ b/docs/index.rst
@@ -66,6 +66,7 @@ Documents in need of some rearranging.
    misc/xen-makefiles/makefiles
    misra/index
    fusa/index
+   misc/cache-coloring
 
 
 Miscellanea
diff --git a/docs/misc/cache-coloring.rst b/docs/misc/cache-coloring.rst
new file mode 100644
index 0000000000..371f21a0e7
--- /dev/null
+++ b/docs/misc/cache-coloring.rst
@@ -0,0 +1,118 @@
+.. SPDX-License-Identifier: CC-BY-4.0
+
+Xen cache coloring user guide
+=============================
+
+The cache coloring support in Xen allows to reserve Last Level Cache (LLC)
+partitions for Dom0, DomUs and Xen itself. Currently only ARM64 is supported.
+Cache coloring realizes per-set cache partitioning in software and is applicable
+to shared LLCs as implemented in Cortex-A53, Cortex-A72 and similar CPUs.
+
+To compile LLC coloring support set ``CONFIG_LLC_COLORING=y``.
+
+If needed, change the maximum number of colors with
+``CONFIG_LLC_COLORS_ORDER=<n>``.
+
+Runtime configuration is done via `Command line parameters`_.
+
+Background
+**********
+
+Cache hierarchy of a modern multi-core CPU typically has first levels dedicated
+to each core (hence using multiple cache units), while the last level is shared
+among all of them. Such configuration implies that memory operations on one
+core (e.g. running a DomU) are able to generate interference on another core
+(e.g. hosting another DomU). Cache coloring realizes per-set cache-partitioning
+in software and mitigates this, guaranteeing more predictable performances for
+memory accesses.
+Software-based cache coloring is particularly useful in those situations where
+no hardware mechanisms (e.g., DSU-based way partitioning) are available to
+partition caches. This is the case for e.g., Cortex-A53, A57 and A72 CPUs that
+feature a L2 LLC cache shared among all cores.
+
+The key concept underlying cache coloring is a fragmentation of the memory
+space into a set of sub-spaces called colors that are mapped to disjoint cache
+partitions. Technically, the whole memory space is first divided into a number
+of subsequent regions. Then each region is in turn divided into a number of
+subsequent sub-colors. The generic i-th color is then obtained by all the
+i-th sub-colors in each region.
+
+::
+
+                            Region j            Region j+1
+                .....................   ............
+                .                     . .
+                .                       .
+            _ _ _______________ _ _____________________ _ _
+                |     |     |     |     |     |     |
+                | c_0 | c_1 |     | c_n | c_0 | c_1 |
+           _ _ _|_____|_____|_ _ _|_____|_____|_____|_ _ _
+                    :                       :
+                    :                       :...         ... .
+                    :                            color 0
+                    :...........................         ... .
+                                                :
+          . . ..................................:
+
+How colors are actually defined depends on the function that maps memory to
+cache lines. In case of physically-indexed, physically-tagged caches with linear
+mapping, the set index is found by extracting some contiguous bits from the
+physical address. This allows colors to be defined as shown in figure: they
+appear in memory as subsequent blocks of equal size and repeats themselves after
+``n`` different colors, where ``n`` is the total number of colors.
+
+If some kind of bit shuffling appears in the mapping function, then colors
+assume a different layout in memory. Those kind of caches aren't supported by
+the current implementation.
+
+**Note**: Finding the exact cache mapping function can be a really difficult
+task since it's not always documented in the CPU manual. As said Cortex-A53, A57
+and A72 are known to work with the current implementation.
+
+How to compute the number of colors
+###################################
+
+Given the linear mapping from physical memory to cache lines for granted, the
+number of available colors for a specific platform is computed using three
+parameters:
+
+- the size of the LLC.
+- the number of the LLC ways.
+- the page size used by Xen.
+
+The first two parameters can be found in the processor manual, while the third
+one is the minimum mapping granularity. Dividing the cache size by the number of
+its ways we obtain the size of a way. Dividing this number by the page size,
+the number of total cache colors is found. So for example an Arm Cortex-A53
+with a 16-ways associative 1 MiB LLC can isolate up to 16 colors when pages are
+4 KiB in size.
+
+Effective colors assignment
+###########################
+
+When assigning colors, if one wants to avoid cache interference between two
+domains, different colors needs to be used for their memory.
+
+Command line parameters
+***********************
+
+Specific documentation is available at `docs/misc/xen-command-line.pandoc`.
+
++----------------------+-------------------------------+
+| **Parameter**        | **Description**               |
++----------------------+-------------------------------+
+| ``llc-coloring``     | Enable coloring at runtime    |
++----------------------+-------------------------------+
+| ``llc-size``         | Set the LLC size              |
++----------------------+-------------------------------+
+| ``llc-nr-ways``      | Set the LLC number of ways    |
++----------------------+-------------------------------+
+
+Auto-probing of LLC specs
+#########################
+
+LLC size and number of ways are probed automatically by default.
+
+LLC specs can be manually set via the above command line parameters. This
+bypasses any auto-probing and it's used to overcome failing situations, such as
+flawed probing logic, or for debugging/testing purposes.
diff --git a/docs/misc/xen-command-line.pandoc b/docs/misc/xen-command-line.pandoc
index 67727f15e9..d75903b84c 100644
--- a/docs/misc/xen-command-line.pandoc
+++ b/docs/misc/xen-command-line.pandoc
@@ -1710,6 +1710,45 @@ 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.
 
+### llc-coloring (arm64)
+> `= <boolean>`
+
+> Default: `false`
+
+Flag to enable or disable LLC coloring support at runtime. This option is
+available only when `CONFIG_LLC_COLORING` is enabled. See the general
+cache coloring documentation for more info.
+
+### llc-nr-ways (arm64)
+> `= <integer>`
+
+> Default: `Obtained from hardware`
+
+Specify the number of ways of the Last Level Cache. This option is available
+only when `CONFIG_LLC_COLORING` is enabled. LLC size and number of ways are used
+to find the number of supported cache colors. By default the value is
+automatically computed by probing the hardware, but in case of specific needs,
+it can be manually set. Those include failing probing and debugging/testing
+purposes so that it's possible to emulate platforms with different number of
+supported colors. If set, also "llc-size" must be set, otherwise the default
+will be used. Note that using both options implies "llc-coloring=on" unless an
+earlier "llc-coloring=off" is there.
+
+### llc-size (arm64)
+> `= <size>`
+
+> Default: `Obtained from hardware`
+
+Specify the size of the Last Level Cache. This option is available only when
+`CONFIG_LLC_COLORING` is enabled. LLC size and number of ways are used to find
+the number of supported cache colors. By default the value is automatically
+computed by probing the hardware, but in case of specific needs, it can be
+manually set. Those include failing probing and debugging/testing purposes so
+that it's possible to emulate platforms with different number of supported
+colors. If set, also "llc-nr-ways" must be set, otherwise the default will be
+used. Note that using both options implies "llc-coloring=on" unless an
+earlier "llc-coloring=off" is there.
+
 ### lock-depth-size
 > `= <integer>`
 
diff --git a/xen/common/Kconfig b/xen/common/Kconfig
index 90268d9249..b4ec6893be 100644
--- a/xen/common/Kconfig
+++ b/xen/common/Kconfig
@@ -71,6 +71,9 @@ config HAS_IOPORTS
 config HAS_KEXEC
 	bool
 
+config HAS_LLC_COLORING
+	bool
+
 config HAS_PIRQ
 	bool
 
@@ -516,4 +519,22 @@ config TRACEBUFFER
 	  to be collected at run time for debugging or performance analysis.
 	  Memory and execution overhead when not active is minimal.
 
+config LLC_COLORING
+	bool "Last Level Cache (LLC) coloring" if EXPERT
+	depends on HAS_LLC_COLORING
+
+config LLC_COLORS_ORDER
+	int "Maximum number of LLC colors (base-2 exponent)"
+	range 1 10
+	default 7
+	depends on LLC_COLORING
+	help
+	  Controls the build-time size of various arrays associated with LLC
+	  coloring. The value is a base-2 exponent. Refer to cache coloring
+	  documentation for how to compute the number of colors supported by the
+	  platform. This is only an upper bound. The runtime value is autocomputed
+	  or manually set via cmdline parameters.
+	  The default value corresponds to an 8 MiB 16-ways LLC, which should be
+	  more than what's needed in the general case.
+
 endmenu
diff --git a/xen/common/Makefile b/xen/common/Makefile
index b279b09bfb..cba3b32733 100644
--- a/xen/common/Makefile
+++ b/xen/common/Makefile
@@ -25,6 +25,7 @@ obj-y += keyhandler.o
 obj-$(CONFIG_KEXEC) += kexec.o
 obj-$(CONFIG_KEXEC) += kimage.o
 obj-$(CONFIG_LIVEPATCH) += livepatch.o livepatch_elf.o
+obj-$(CONFIG_LLC_COLORING) += llc-coloring.o
 obj-$(CONFIG_MEM_ACCESS) += mem_access.o
 obj-y += memory.o
 obj-y += multicall.o
diff --git a/xen/common/keyhandler.c b/xen/common/keyhandler.c
index 6da291b34e..6ea54838d4 100644
--- a/xen/common/keyhandler.c
+++ b/xen/common/keyhandler.c
@@ -5,6 +5,7 @@
 #include <asm/regs.h>
 #include <xen/delay.h>
 #include <xen/keyhandler.h>
+#include <xen/llc-coloring.h>
 #include <xen/param.h>
 #include <xen/sections.h>
 #include <xen/shutdown.h>
@@ -304,6 +305,8 @@ static void cf_check dump_domains(unsigned char key)
 
         arch_dump_domain_info(d);
 
+        domain_dump_llc_colors(d);
+
         rangeset_domain_printk(d);
 
         dump_pageframe_info(d);
diff --git a/xen/common/llc-coloring.c b/xen/common/llc-coloring.c
new file mode 100644
index 0000000000..335a907296
--- /dev/null
+++ b/xen/common/llc-coloring.c
@@ -0,0 +1,124 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+/*
+ * Last Level Cache (LLC) coloring common code
+ *
+ * Copyright (C) 2024, Advanced Micro Devices, Inc.
+ * Copyright (C) 2024, Minerva Systems SRL
+ */
+#include <xen/keyhandler.h>
+#include <xen/llc-coloring.h>
+#include <xen/param.h>
+
+#define NR_LLC_COLORS          (1U << CONFIG_LLC_COLORS_ORDER)
+
+/*
+ * -1: not specified (disabled unless llc-size and llc-nr-ways present)
+ *  0: explicitly disabled through cmdline
+ *  1: explicitly enabled through cmdline
+ */
+static int8_t __initdata opt_llc_coloring = -1;
+boolean_param("llc-coloring", opt_llc_coloring);
+
+static bool __ro_after_init llc_coloring_enabled;
+
+static unsigned int __initdata llc_size;
+size_param("llc-size", llc_size);
+static unsigned int __initdata llc_nr_ways;
+integer_param("llc-nr-ways", llc_nr_ways);
+/* Number of colors available in the LLC */
+static unsigned int __ro_after_init max_nr_colors;
+
+static void print_colors(const unsigned int colors[], unsigned int num_colors)
+{
+    unsigned int i;
+
+    printk("{ ");
+    for ( i = 0; i < num_colors; i++ )
+    {
+        unsigned int start = colors[i], end = start;
+
+        printk("%u", start);
+
+        for ( ; i < num_colors - 1 && end + 1 == colors[i + 1]; i++, end++ )
+            ;
+
+        if ( start != end )
+            printk("-%u", end);
+
+        if ( i < num_colors - 1 )
+            printk(", ");
+    }
+    printk(" }\n");
+}
+
+void __init llc_coloring_init(void)
+{
+    unsigned int way_size;
+
+    llc_coloring_enabled = (opt_llc_coloring >= 1);
+    if ( (opt_llc_coloring != 0) && llc_size && llc_nr_ways )
+    {
+        llc_coloring_enabled = true;
+        way_size = llc_size / llc_nr_ways;
+    }
+    else if ( !llc_coloring_enabled )
+        return;
+    else
+    {
+        way_size = get_llc_way_size();
+        if ( !way_size )
+            panic("LLC probing failed and 'llc-size' or 'llc-nr-ways' missing\n");
+    }
+
+    if ( way_size & ~PAGE_MASK )
+        panic("LLC way size must be a multiple of PAGE_SIZE\n");
+
+    /*
+     * The maximum number of colors must be a power of 2 in order to correctly
+     * map them to bits of an address.
+     */
+    max_nr_colors = way_size >> PAGE_SHIFT;
+
+    if ( max_nr_colors & (max_nr_colors - 1) )
+        panic("Number of LLC colors (%u) isn't a power of 2\n", max_nr_colors);
+
+    if ( max_nr_colors > NR_LLC_COLORS )
+    {
+        printk(XENLOG_WARNING
+               "Number of LLC colors (%u) too big. Using configured max %u\n",
+               max_nr_colors, NR_LLC_COLORS);
+        max_nr_colors = NR_LLC_COLORS;
+    }
+    else if ( max_nr_colors < 2 )
+        panic("Number of LLC colors %u < 2\n", max_nr_colors);
+
+    arch_llc_coloring_init();
+}
+
+void dump_llc_coloring_info(void)
+{
+    if ( !llc_coloring_enabled )
+        return;
+
+    printk("LLC coloring info:\n");
+    printk("    Number of LLC colors supported: %u\n", max_nr_colors);
+}
+
+void domain_dump_llc_colors(const struct domain *d)
+{
+    if ( !llc_coloring_enabled )
+        return;
+
+    printk("%u LLC colors: ", d->num_llc_colors);
+    print_colors(d->llc_colors, d->num_llc_colors);
+}
+
+/*
+ * Local variables:
+ * mode: C
+ * c-file-style: "BSD"
+ * c-basic-offset: 4
+ * tab-width: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
diff --git a/xen/common/page_alloc.c b/xen/common/page_alloc.c
index b76a03fd73..6dc8e0d5c9 100644
--- a/xen/common/page_alloc.c
+++ b/xen/common/page_alloc.c
@@ -126,6 +126,7 @@
 #include <xen/irq.h>
 #include <xen/keyhandler.h>
 #include <xen/lib.h>
+#include <xen/llc-coloring.h>
 #include <xen/mm.h>
 #include <xen/nodemask.h>
 #include <xen/numa.h>
@@ -2651,6 +2652,8 @@ static void cf_check pagealloc_info(unsigned char key)
     }
 
     printk("    Dom heap: %lukB free\n", total << (PAGE_SHIFT-10));
+
+    dump_llc_coloring_info();
 }
 
 static __init int cf_check pagealloc_keyhandler_init(void)
diff --git a/xen/include/xen/llc-coloring.h b/xen/include/xen/llc-coloring.h
new file mode 100644
index 0000000000..0acd8d0ad6
--- /dev/null
+++ b/xen/include/xen/llc-coloring.h
@@ -0,0 +1,36 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+/*
+ * Last Level Cache (LLC) coloring common header
+ *
+ * Copyright (C) 2024, Advanced Micro Devices, Inc.
+ * Copyright (C) 2024, Minerva Systems SRL
+ */
+#ifndef __XEN_LLC_COLORING_H__
+#define __XEN_LLC_COLORING_H__
+
+struct domain;
+
+#ifdef CONFIG_LLC_COLORING
+void llc_coloring_init(void);
+void dump_llc_coloring_info(void);
+void domain_dump_llc_colors(const struct domain *d);
+#else
+static inline void llc_coloring_init(void) {}
+static inline void dump_llc_coloring_info(void) {}
+static inline void domain_dump_llc_colors(const struct domain *d) {}
+#endif
+
+unsigned int get_llc_way_size(void);
+void arch_llc_coloring_init(void);
+
+#endif /* __XEN_LLC_COLORING_H__ */
+
+/*
+ * Local variables:
+ * mode: C
+ * c-file-style: "BSD"
+ * c-basic-offset: 4
+ * tab-width: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
diff --git a/xen/include/xen/sched.h b/xen/include/xen/sched.h
index 711668e028..037c83fda2 100644
--- a/xen/include/xen/sched.h
+++ b/xen/include/xen/sched.h
@@ -640,6 +640,11 @@ struct domain
 
     /* Holding CDF_* constant. Internal flags for domain creation. */
     unsigned int cdf;
+
+#ifdef CONFIG_LLC_COLORING
+    unsigned int num_llc_colors;
+    const unsigned int *llc_colors;
+#endif
 };
 
 static inline struct page_list_head *page_to_list(
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Dec 20 07:33:18 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 20 Dec 2024 07:33:18 +0000
Received: from list by lists.xenproject.org with outflank-mailman.861637.1273610 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tOXVe-00075y-63; Fri, 20 Dec 2024 07:33:18 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 861637.1273610; Fri, 20 Dec 2024 07:33: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 1tOXVe-00075q-3Z; Fri, 20 Dec 2024 07:33:18 +0000
Received: by outflank-mailman (input) for mailman id 861637;
 Fri, 20 Dec 2024 07:33:17 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tOXVd-00075g-Jb
 for xen-changelog@lists.xenproject.org; Fri, 20 Dec 2024 07:33:17 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tOXVd-00D3TQ-0r
 for xen-changelog@lists.xenproject.org;
 Fri, 20 Dec 2024 07:33:17 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tOXVd-005N8F-1c
 for xen-changelog@lists.xenproject.org;
 Fri, 20 Dec 2024 07:33:17 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=5FrXCLxE4voXLzGDpJZbw77jSk/XI5/At5pn/4pY+jY=; b=GjNhPi3LbZa7lF7wKabgskgALR
	PIp/Egcbp4G5mUNgDeigkht0H8D+OKIkn/whM17FeTZbcTKtzzzsS73kH1wRWiUZfxLvwV1UjHBMs
	u4wXUbfA174wbaxnaCENoYBzA16DQitxK7TEFM8IWlFf5S2IBYMMZELvFrtwSxVV7XnE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/arm: add initial support for LLC coloring on arm64
Message-Id: <E1tOXVd-005N8F-1c@xenbits.xenproject.org>
Date: Fri, 20 Dec 2024 07:33:17 +0000

commit f4985fce6f0b2abd28875cdfbba95b37c00be548
Author:     Carlo Nonato <carlo.nonato@minervasys.tech>
AuthorDate: Tue Dec 17 18:06:27 2024 +0100
Commit:     Michal Orzel <michal.orzel@amd.com>
CommitDate: Thu Dec 19 19:24:31 2024 +0100

    xen/arm: add initial support for LLC coloring on arm64
    
    LLC coloring needs to know the last level cache layout in order to make the
    best use of it. This can be probed by inspecting the CLIDR_EL1 register,
    so the Last Level is defined as the last level visible by this register.
    Note that this excludes system caches in some platforms.
    
    Static memory allocation and cache coloring are incompatible because static
    memory can't be guaranteed to use only colors assigned to the domain.
    Panic during DomUs creation when both are enabled.
    
    Based on original work from: Luca Miccio <lucmiccio@gmail.com>
    
    Signed-off-by: Carlo Nonato <carlo.nonato@minervasys.tech>
    Signed-off-by: Marco Solieri <marco.solieri@minervasys.tech>
    Reviewed-by: Michal Orzel <michal.orzel@amd.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 docs/misc/cache-coloring.rst         | 14 +++++++
 xen/arch/arm/Kconfig                 |  1 +
 xen/arch/arm/Makefile                |  1 +
 xen/arch/arm/dom0less-build.c        |  6 +++
 xen/arch/arm/include/asm/processor.h | 15 +++++++
 xen/arch/arm/llc-coloring.c          | 79 ++++++++++++++++++++++++++++++++++++
 xen/arch/arm/setup.c                 |  3 ++
 xen/common/llc-coloring.c            |  4 +-
 xen/include/xen/llc-coloring.h       |  6 +++
 9 files changed, 128 insertions(+), 1 deletion(-)

diff --git a/docs/misc/cache-coloring.rst b/docs/misc/cache-coloring.rst
index 371f21a0e7..12972dbb2c 100644
--- a/docs/misc/cache-coloring.rst
+++ b/docs/misc/cache-coloring.rst
@@ -113,6 +113,20 @@ Auto-probing of LLC specs
 
 LLC size and number of ways are probed automatically by default.
 
+In the Arm implementation, this is done by inspecting the CLIDR_EL1 register.
+This means that other system caches that aren't visible there are ignored.
+
 LLC specs can be manually set via the above command line parameters. This
 bypasses any auto-probing and it's used to overcome failing situations, such as
 flawed probing logic, or for debugging/testing purposes.
+
+Known issues and limitations
+****************************
+
+"xen,static-mem" isn't supported when coloring is enabled
+#########################################################
+
+In the domain configuration, "xen,static-mem" allows memory to be statically
+allocated to the domain. This isn't possible when LLC coloring is enabled,
+because that memory can't be guaranteed to use only colors assigned to the
+domain.
diff --git a/xen/arch/arm/Kconfig b/xen/arch/arm/Kconfig
index 604aba4996..c5e7b74733 100644
--- a/xen/arch/arm/Kconfig
+++ b/xen/arch/arm/Kconfig
@@ -8,6 +8,7 @@ config ARM_64
 	depends on !ARM_32
 	select 64BIT
 	select HAS_FAST_MULTIPLY
+	select HAS_LLC_COLORING if !NUMA
 
 config ARM
 	def_bool y
diff --git a/xen/arch/arm/Makefile b/xen/arch/arm/Makefile
index e4ad1ce851..ccbfc61f88 100644
--- a/xen/arch/arm/Makefile
+++ b/xen/arch/arm/Makefile
@@ -35,6 +35,7 @@ obj-$(CONFIG_IOREQ_SERVER) += ioreq.o
 obj-y += irq.o
 obj-y += kernel.init.o
 obj-$(CONFIG_LIVEPATCH) += livepatch.o
+obj-$(CONFIG_LLC_COLORING) += llc-coloring.o
 obj-$(CONFIG_MEM_ACCESS) += mem_access.o
 obj-y += mm.o
 obj-y += monitor.o
diff --git a/xen/arch/arm/dom0less-build.c b/xen/arch/arm/dom0less-build.c
index f328a044e9..d93a85434e 100644
--- a/xen/arch/arm/dom0less-build.c
+++ b/xen/arch/arm/dom0less-build.c
@@ -5,6 +5,7 @@
 #include <xen/grant_table.h>
 #include <xen/iocap.h>
 #include <xen/libfdt/libfdt.h>
+#include <xen/llc-coloring.h>
 #include <xen/sched.h>
 #include <xen/serial.h>
 #include <xen/sizes.h>
@@ -890,7 +891,12 @@ void __init create_domUs(void)
             panic("No more domain IDs available\n");
 
         if ( dt_find_property(node, "xen,static-mem", NULL) )
+        {
+            if ( llc_coloring_enabled )
+                panic("LLC coloring and static memory are incompatible\n");
+
             flags |= CDF_staticmem;
+        }
 
         if ( dt_property_read_bool(node, "direct-map") )
         {
diff --git a/xen/arch/arm/include/asm/processor.h b/xen/arch/arm/include/asm/processor.h
index 8e02410465..60b587db69 100644
--- a/xen/arch/arm/include/asm/processor.h
+++ b/xen/arch/arm/include/asm/processor.h
@@ -18,6 +18,21 @@
 #define CTR_IDC_SHIFT       28
 #define CTR_DIC_SHIFT       29
 
+/* CCSIDR Current Cache Size ID Register */
+#define CCSIDR_LINESIZE_MASK            _AC(0x7, UL)
+#define CCSIDR_NUMSETS_SHIFT            13
+#define CCSIDR_NUMSETS_MASK             _AC(0x3fff, UL)
+#define CCSIDR_NUMSETS_SHIFT_FEAT_CCIDX 32
+#define CCSIDR_NUMSETS_MASK_FEAT_CCIDX  _AC(0xffffff, UL)
+
+/* CSSELR Cache Size Selection Register */
+#define CSSELR_LEVEL_SHIFT 1
+
+/* CLIDR Cache Level ID Register */
+#define CLIDR_CTYPEn_SHIFT(n) (3 * ((n) - 1))
+#define CLIDR_CTYPEn_MASK     _AC(0x7, UL)
+#define CLIDR_CTYPEn_LEVELS   7
+
 #define ICACHE_POLICY_VPIPT  0
 #define ICACHE_POLICY_AIVIVT 1
 #define ICACHE_POLICY_VIPT   2
diff --git a/xen/arch/arm/llc-coloring.c b/xen/arch/arm/llc-coloring.c
new file mode 100644
index 0000000000..1c7b92bc45
--- /dev/null
+++ b/xen/arch/arm/llc-coloring.c
@@ -0,0 +1,79 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+/*
+ * Last Level Cache (LLC) coloring support for ARM
+ *
+ * Copyright (C) 2024, Advanced Micro Devices, Inc.
+ * Copyright (C) 2024, Minerva Systems SRL
+ */
+#include <xen/init.h>
+#include <xen/llc-coloring.h>
+
+#include <asm/processor.h>
+#include <asm/sysregs.h>
+#include <asm/system.h>
+
+/* Return the LLC way size by probing the hardware */
+unsigned int __init get_llc_way_size(void)
+{
+    register_t ccsidr_el1;
+    register_t clidr_el1 = READ_SYSREG(CLIDR_EL1);
+    register_t csselr_el1 = READ_SYSREG(CSSELR_EL1);
+    register_t id_aa64mmfr2_el1 = READ_SYSREG(ID_AA64MMFR2_EL1);
+    uint32_t ccsidr_numsets_shift = CCSIDR_NUMSETS_SHIFT;
+    uint32_t ccsidr_numsets_mask = CCSIDR_NUMSETS_MASK;
+    unsigned int n, line_size, num_sets;
+
+    for ( n = CLIDR_CTYPEn_LEVELS; n != 0; n-- )
+    {
+        uint8_t ctype_n = (clidr_el1 >> CLIDR_CTYPEn_SHIFT(n)) &
+                           CLIDR_CTYPEn_MASK;
+
+        /* Unified cache (see Arm ARM DDI 0487J.a D19.2.27) */
+        if ( ctype_n == 0b100 )
+            break;
+    }
+
+    if ( n == 0 )
+        return 0;
+
+    WRITE_SYSREG((n - 1) << CSSELR_LEVEL_SHIFT, CSSELR_EL1);
+    isb();
+
+    ccsidr_el1 = READ_SYSREG(CCSIDR_EL1);
+
+    /* Arm ARM: (Log2(Number of bytes in cache line)) - 4 */
+    line_size = 1U << ((ccsidr_el1 & CCSIDR_LINESIZE_MASK) + 4);
+
+    /* If FEAT_CCIDX is enabled, CCSIDR_EL1 has a different bit layout */
+    if ( (id_aa64mmfr2_el1 >> ID_AA64MMFR2_CCIDX_SHIFT) & 0x7 )
+    {
+        ccsidr_numsets_shift = CCSIDR_NUMSETS_SHIFT_FEAT_CCIDX;
+        ccsidr_numsets_mask = CCSIDR_NUMSETS_MASK_FEAT_CCIDX;
+    }
+
+    /* Arm ARM: (Number of sets in cache) - 1 */
+    num_sets = ((ccsidr_el1 >> ccsidr_numsets_shift) & ccsidr_numsets_mask) + 1;
+
+    printk(XENLOG_INFO "LLC found: L%u (line size: %u bytes, sets num: %u)\n",
+           n, line_size, num_sets);
+
+    /* Restore value in CSSELR_EL1 */
+    WRITE_SYSREG(csselr_el1, CSSELR_EL1);
+    isb();
+
+    return line_size * num_sets;
+}
+
+void __init arch_llc_coloring_init(void)
+{
+}
+
+/*
+ * Local variables:
+ * mode: C
+ * c-file-style: "BSD"
+ * c-basic-offset: 4
+ * tab-width: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
diff --git a/xen/arch/arm/setup.c b/xen/arch/arm/setup.c
index 545702d8a3..5f1993ffed 100644
--- a/xen/arch/arm/setup.c
+++ b/xen/arch/arm/setup.c
@@ -12,6 +12,7 @@
 #include <xen/device_tree.h>
 #include <xen/domain_page.h>
 #include <xen/grant_table.h>
+#include <xen/llc-coloring.h>
 #include <xen/types.h>
 #include <xen/string.h>
 #include <xen/serial.h>
@@ -334,6 +335,8 @@ void asmlinkage __init start_xen(unsigned long fdt_paddr)
     printk("Command line: %s\n", cmdline);
     cmdline_parse(cmdline);
 
+    llc_coloring_init();
+
     setup_mm();
 
     vm_init();
diff --git a/xen/common/llc-coloring.c b/xen/common/llc-coloring.c
index 335a907296..b034c0169c 100644
--- a/xen/common/llc-coloring.c
+++ b/xen/common/llc-coloring.c
@@ -8,6 +8,8 @@
 #include <xen/keyhandler.h>
 #include <xen/llc-coloring.h>
 #include <xen/param.h>
+#include <xen/sched.h>
+#include <xen/types.h>
 
 #define NR_LLC_COLORS          (1U << CONFIG_LLC_COLORS_ORDER)
 
@@ -19,7 +21,7 @@
 static int8_t __initdata opt_llc_coloring = -1;
 boolean_param("llc-coloring", opt_llc_coloring);
 
-static bool __ro_after_init llc_coloring_enabled;
+bool __ro_after_init llc_coloring_enabled;
 
 static unsigned int __initdata llc_size;
 size_param("llc-size", llc_size);
diff --git a/xen/include/xen/llc-coloring.h b/xen/include/xen/llc-coloring.h
index 0acd8d0ad6..a3ebb17186 100644
--- a/xen/include/xen/llc-coloring.h
+++ b/xen/include/xen/llc-coloring.h
@@ -8,13 +8,19 @@
 #ifndef __XEN_LLC_COLORING_H__
 #define __XEN_LLC_COLORING_H__
 
+#include <xen/types.h>
+
 struct domain;
 
 #ifdef CONFIG_LLC_COLORING
+extern bool llc_coloring_enabled;
+
 void llc_coloring_init(void);
 void dump_llc_coloring_info(void);
 void domain_dump_llc_colors(const struct domain *d);
 #else
+#define llc_coloring_enabled false
+
 static inline void llc_coloring_init(void) {}
 static inline void dump_llc_coloring_info(void) {}
 static inline void domain_dump_llc_colors(const struct domain *d) {}
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Dec 20 07:33:28 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 20 Dec 2024 07:33:28 +0000
Received: from list by lists.xenproject.org with outflank-mailman.861639.1273615 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tOXVo-0007DM-7p; Fri, 20 Dec 2024 07:33:28 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 861639.1273615; Fri, 20 Dec 2024 07:33: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 1tOXVo-0007DE-53; Fri, 20 Dec 2024 07:33:28 +0000
Received: by outflank-mailman (input) for mailman id 861639;
 Fri, 20 Dec 2024 07:33:27 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tOXVn-0007Cq-Mp
 for xen-changelog@lists.xenproject.org; Fri, 20 Dec 2024 07:33:27 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tOXVn-00D3TW-1E
 for xen-changelog@lists.xenproject.org;
 Fri, 20 Dec 2024 07:33:27 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tOXVn-005N9H-20
 for xen-changelog@lists.xenproject.org;
 Fri, 20 Dec 2024 07:33:27 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=ltcwoQZuyFb1ntX2iZ071uf6XY5i+5BArjO62Qm2+8E=; b=SrTblNfiIw96DjpLJ2q4v8Lnx3
	f8fHq+1zvlNIBjp3Bdhv7qFS8FKCST47kBWAT8SROqYrjHxlLFXzsZiLyzBYYSi70kp0G1a+QShox
	U1xmpVL3dR7FI5VAboBt183UV40GNc9nqtEZN78zPLQ0ZERrLs/ZGmC2kVKCaxUVgUO4=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/arm: permit non direct-mapped Dom0 construction
Message-Id: <E1tOXVn-005N9H-20@xenbits.xenproject.org>
Date: Fri, 20 Dec 2024 07:33:27 +0000

commit 02975cc383895d8b2484fce144b2cfec8df93707
Author:     Carlo Nonato <carlo.nonato@minervasys.tech>
AuthorDate: Tue Dec 17 18:06:28 2024 +0100
Commit:     Michal Orzel <michal.orzel@amd.com>
CommitDate: Thu Dec 19 19:24:31 2024 +0100

    xen/arm: permit non direct-mapped Dom0 construction
    
    Cache coloring requires Dom0 not to be direct-mapped because of its non
    contiguous mapping nature, so allocate_memory() is needed in this case.
    8d2c3ab18cc1 ("arm/dom0less: put dom0less feature code in a separate module")
    moved allocate_memory() in dom0less_build.c. In order to use it
    in Dom0 construction bring it back to domain_build.c and declare it in
    domain_build.h.
    
    Adapt the implementation of allocate_memory() so that it uses the host
    layout when called on the hwdom, via find_unallocated_memory().
    
    Since gnttab information are needed in the process, move find_gnttab_region()
    before allocate_memory() in construct_dom0().
    
    Introduce add_hwdom_free_regions() callback to add hwdom banks in descending
    order.
    
    Signed-off-by: Carlo Nonato <carlo.nonato@minervasys.tech>
    Reviewed-by: Michal Orzel <michal.orzel@amd.com>
---
 xen/arch/arm/dom0less-build.c           |  44 ---------
 xen/arch/arm/domain_build.c             | 156 +++++++++++++++++++++++++++++++-
 xen/arch/arm/include/asm/domain_build.h |   1 +
 3 files changed, 153 insertions(+), 48 deletions(-)

diff --git a/xen/arch/arm/dom0less-build.c b/xen/arch/arm/dom0less-build.c
index d93a85434e..67b1503647 100644
--- a/xen/arch/arm/dom0less-build.c
+++ b/xen/arch/arm/dom0less-build.c
@@ -49,50 +49,6 @@ bool __init is_dom0less_mode(void)
     return ( !dom0found && domUfound );
 }
 
-static void __init allocate_memory(struct domain *d, struct kernel_info *kinfo)
-{
-    struct membanks *mem = kernel_info_get_mem(kinfo);
-    unsigned int i;
-    paddr_t bank_size;
-
-    printk(XENLOG_INFO "Allocating mappings totalling %ldMB for %pd:\n",
-           /* Don't want format this as PRIpaddr (16 digit hex) */
-           (unsigned long)(kinfo->unassigned_mem >> 20), d);
-
-    mem->nr_banks = 0;
-    bank_size = MIN(GUEST_RAM0_SIZE, kinfo->unassigned_mem);
-    if ( !allocate_bank_memory(kinfo, gaddr_to_gfn(GUEST_RAM0_BASE),
-                               bank_size) )
-        goto fail;
-
-    bank_size = MIN(GUEST_RAM1_SIZE, kinfo->unassigned_mem);
-    if ( !allocate_bank_memory(kinfo, gaddr_to_gfn(GUEST_RAM1_BASE),
-                               bank_size) )
-        goto fail;
-
-    if ( kinfo->unassigned_mem )
-        goto fail;
-
-    for( i = 0; i < mem->nr_banks; i++ )
-    {
-        printk(XENLOG_INFO "%pd BANK[%d] %#"PRIpaddr"-%#"PRIpaddr" (%ldMB)\n",
-               d,
-               i,
-               mem->bank[i].start,
-               mem->bank[i].start + mem->bank[i].size,
-               /* Don't want format this as PRIpaddr (16 digit hex) */
-               (unsigned long)(mem->bank[i].size >> 20));
-    }
-
-    return;
-
-fail:
-    panic("Failed to allocate requested domain memory."
-          /* Don't want format this as PRIpaddr (16 digit hex) */
-          " %ldKB unallocated. Fix the VMs configurations.\n",
-          (unsigned long)kinfo->unassigned_mem >> 10);
-}
-
 #ifdef CONFIG_VGICV2
 static int __init make_gicv2_domU_node(struct kernel_info *kinfo)
 {
diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c
index adf26f2778..17cc76b6f2 100644
--- a/xen/arch/arm/domain_build.c
+++ b/xen/arch/arm/domain_build.c
@@ -2,6 +2,7 @@
 #include <xen/init.h>
 #include <xen/compile.h>
 #include <xen/lib.h>
+#include <xen/llc-coloring.h>
 #include <xen/mm.h>
 #include <xen/param.h>
 #include <xen/domain_page.h>
@@ -416,7 +417,6 @@ static void __init allocate_memory_11(struct domain *d,
     }
 }
 
-#ifdef CONFIG_DOM0LESS_BOOT
 bool __init allocate_domheap_memory(struct domain *d, paddr_t tot_size,
                                     alloc_domheap_mem_cb cb, void *extra)
 {
@@ -508,7 +508,6 @@ bool __init allocate_bank_memory(struct kernel_info *kinfo, gfn_t sgfn,
 
     return true;
 }
-#endif
 
 /*
  * When PCI passthrough is available we want to keep the
@@ -900,6 +899,52 @@ int __init add_ext_regions(unsigned long s_gfn, unsigned long e_gfn,
     return 0;
 }
 
+static int __init add_hwdom_free_regions(unsigned long s_gfn,
+                                         unsigned long e_gfn, void *data)
+{
+    struct membanks *free_regions = data;
+    paddr_t start, size;
+    paddr_t s = pfn_to_paddr(s_gfn);
+    paddr_t e = pfn_to_paddr(e_gfn);
+    unsigned int i, j;
+
+    if ( free_regions->nr_banks >= free_regions->max_banks )
+        return 0;
+
+    /*
+     * Both start and size of the free region should be 2MB aligned to
+     * potentially allow superpage mapping.
+     */
+    start = (s + SZ_2M - 1) & ~(SZ_2M - 1);
+    if ( start > e )
+        return 0;
+
+    /*
+     * e is actually "end-1" because it is called by rangeset functions
+     * which are inclusive of the last address.
+     */
+    e += 1;
+    size = (e - start) & ~(SZ_2M - 1);
+
+    /* Find the insert position (descending order). */
+    for ( i = 0; i < free_regions->nr_banks ; i++ )
+        if ( size > free_regions->bank[i].size )
+            break;
+
+    /* Move the other banks to make space. */
+    for ( j = free_regions->nr_banks; j > i ; j-- )
+    {
+        free_regions->bank[j].start = free_regions->bank[j - 1].start;
+        free_regions->bank[j].size = free_regions->bank[j - 1].size;
+    }
+
+    free_regions->bank[i].start = start;
+    free_regions->bank[i].size = size;
+    free_regions->nr_banks++;
+
+    return 0;
+}
+
 /*
  * Find unused regions of Host address space which can be exposed to domain
  * using the host memory layout. In order to calculate regions we exclude every
@@ -977,6 +1022,106 @@ out:
     return res;
 }
 
+void __init allocate_memory(struct domain *d, struct kernel_info *kinfo)
+{
+    struct membanks *mem = kernel_info_get_mem(kinfo);
+    unsigned int i, nr_banks = GUEST_RAM_BANKS;
+    struct membanks *hwdom_free_mem = NULL;
+
+    printk(XENLOG_INFO "Allocating mappings totalling %ldMB for %pd:\n",
+           /* Don't want format this as PRIpaddr (16 digit hex) */
+           (unsigned long)(kinfo->unassigned_mem >> 20), d);
+
+    mem->nr_banks = 0;
+    /*
+     * Use host memory layout for hwdom. Only case for this is when LLC coloring
+     * is enabled.
+     */
+    if ( is_hardware_domain(d) )
+    {
+        struct membanks *gnttab = xzalloc_flex_struct(struct membanks, bank, 1);
+        /*
+         * Exclude the following regions:
+         * 1) Remove reserved memory
+         * 2) Grant table assigned to hwdom
+         */
+        const struct membanks *mem_banks[] = {
+            bootinfo_get_reserved_mem(),
+            gnttab,
+        };
+
+        if ( !gnttab )
+            goto fail;
+
+        gnttab->nr_banks = 1;
+        gnttab->bank[0].start = kinfo->gnttab_start;
+        gnttab->bank[0].size = kinfo->gnttab_size;
+
+        hwdom_free_mem = xzalloc_flex_struct(struct membanks, bank,
+                                             NR_MEM_BANKS);
+        if ( !hwdom_free_mem )
+            goto fail;
+
+        hwdom_free_mem->max_banks = NR_MEM_BANKS;
+
+        if ( find_unallocated_memory(kinfo, mem_banks, ARRAY_SIZE(mem_banks),
+                                     hwdom_free_mem, add_hwdom_free_regions) )
+            goto fail;
+
+        nr_banks = hwdom_free_mem->nr_banks;
+        xfree(gnttab);
+    }
+
+    for ( i = 0; kinfo->unassigned_mem > 0 && nr_banks > 0; i++, nr_banks-- )
+    {
+        paddr_t bank_start, bank_size;
+
+        if ( is_hardware_domain(d) )
+        {
+            bank_start = hwdom_free_mem->bank[i].start;
+            bank_size = hwdom_free_mem->bank[i].size;
+        }
+        else
+        {
+            const uint64_t bankbase[] = GUEST_RAM_BANK_BASES;
+            const uint64_t banksize[] = GUEST_RAM_BANK_SIZES;
+
+            if ( i >= GUEST_RAM_BANKS )
+                goto fail;
+
+            bank_start = bankbase[i];
+            bank_size = banksize[i];
+        }
+
+        bank_size = MIN(bank_size, kinfo->unassigned_mem);
+        if ( !allocate_bank_memory(kinfo, gaddr_to_gfn(bank_start), bank_size) )
+            goto fail;
+    }
+
+    if ( kinfo->unassigned_mem )
+        goto fail;
+
+    for( i = 0; i < mem->nr_banks; i++ )
+    {
+        printk(XENLOG_INFO "%pd BANK[%d] %#"PRIpaddr"-%#"PRIpaddr" (%ldMB)\n",
+               d,
+               i,
+               mem->bank[i].start,
+               mem->bank[i].start + mem->bank[i].size,
+               /* Don't want format this as PRIpaddr (16 digit hex) */
+               (unsigned long)(mem->bank[i].size >> 20));
+    }
+
+    xfree(hwdom_free_mem);
+    return;
+
+  fail:
+    panic("Failed to allocate requested domain memory."
+          /* Don't want format this as PRIpaddr (16 digit hex) */
+          " %ldKB unallocated. Fix the VMs configurations.\n",
+          (unsigned long)kinfo->unassigned_mem >> 10);
+}
+
 static int __init handle_pci_range(const struct dt_device_node *dev,
                                    uint64_t addr, uint64_t len, void *data)
 {
@@ -1235,7 +1380,7 @@ int __init make_hypervisor_node(struct domain *d,
 
         ext_regions->max_banks = NR_MEM_BANKS;
 
-        if ( is_domain_direct_mapped(d) )
+        if ( domain_use_host_layout(d) )
         {
             if ( !is_iommu_enabled(d) )
                 res = find_host_extended_regions(kinfo, ext_regions);
@@ -2164,8 +2309,11 @@ static int __init construct_dom0(struct domain *d)
     /* type must be set before allocate_memory */
     d->arch.type = kinfo.type;
 #endif
-    allocate_memory_11(d, &kinfo);
     find_gnttab_region(d, &kinfo);
+    if ( is_domain_direct_mapped(d) )
+        allocate_memory_11(d, &kinfo);
+    else
+        allocate_memory(d, &kinfo);
 
     rc = process_shm_chosen(d, &kinfo);
     if ( rc < 0 )
diff --git a/xen/arch/arm/include/asm/domain_build.h b/xen/arch/arm/include/asm/domain_build.h
index e712afbc7f..5d77af2e8b 100644
--- a/xen/arch/arm/include/asm/domain_build.h
+++ b/xen/arch/arm/include/asm/domain_build.h
@@ -11,6 +11,7 @@ bool allocate_domheap_memory(struct domain *d, paddr_t tot_size,
                              alloc_domheap_mem_cb cb, void *extra);
 bool allocate_bank_memory(struct kernel_info *kinfo, gfn_t sgfn,
                           paddr_t tot_size);
+void allocate_memory(struct domain *d, struct kernel_info *kinfo);
 int construct_domain(struct domain *d, struct kernel_info *kinfo);
 int domain_fdt_begin_node(void *fdt, const char *name, uint64_t unit);
 int make_chosen_node(const struct kernel_info *kinfo);
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Dec 20 07:33:39 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 20 Dec 2024 07:33:39 +0000
Received: from list by lists.xenproject.org with outflank-mailman.861640.1273619 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tOXVz-0007Gm-9l; Fri, 20 Dec 2024 07:33:39 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 861640.1273619; Fri, 20 Dec 2024 07:33:39 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tOXVz-0007Gc-6c; Fri, 20 Dec 2024 07:33:39 +0000
Received: by outflank-mailman (input) for mailman id 861640;
 Fri, 20 Dec 2024 07:33:37 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tOXVx-0007GK-RE
 for xen-changelog@lists.xenproject.org; Fri, 20 Dec 2024 07:33:37 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tOXVx-00D3Tc-1e
 for xen-changelog@lists.xenproject.org;
 Fri, 20 Dec 2024 07:33:37 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tOXVx-005NAF-2O
 for xen-changelog@lists.xenproject.org;
 Fri, 20 Dec 2024 07:33:37 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=/uTUoOoEgDMgP49zKmdlt3h5ayDK4Rw3UI0whaPn3cQ=; b=bARAsFc0YUNlSZaZUeezNPmAqc
	bQIktM7Hg8ExkMVy2rQD1FjaJm6YhsWkF7JpFgHAi2Im3ZGG5QHz+x4vNUMESYH8E7xJJj9KWsYG4
	VkEVN2uhHhE6nMYPOLHIyGyXYZg6ITqjyP2hp8j8faSYFNs4br8Pm2ZcRs5iBLQ1PU7A=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/arm: add Dom0 cache coloring support
Message-Id: <E1tOXVx-005NAF-2O@xenbits.xenproject.org>
Date: Fri, 20 Dec 2024 07:33:37 +0000

commit 6cdea3444eafd6e4f293882ab3bf4dfb8bffaf64
Author:     Carlo Nonato <carlo.nonato@minervasys.tech>
AuthorDate: Tue Dec 17 18:06:29 2024 +0100
Commit:     Michal Orzel <michal.orzel@amd.com>
CommitDate: Thu Dec 19 19:24:31 2024 +0100

    xen/arm: add Dom0 cache coloring support
    
    Add a command line parameter to allow the user to set the coloring
    configuration for Dom0.
    A common configuration syntax for cache colors is introduced and
    documented.
    Take the opportunity to also add:
     - default configuration notion.
     - function to check well-formed configurations.
    
    Direct mapping Dom0 isn't possible when coloring is enabled, so
    CDF_directmap flag is removed when creating it.
    
    Based on original work from: Luca Miccio <lucmiccio@gmail.com>
    
    Signed-off-by: Carlo Nonato <carlo.nonato@minervasys.tech>
    Signed-off-by: Marco Solieri <marco.solieri@minervasys.tech>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Michal Orzel <michal.orzel@amd.com>
---
 docs/misc/cache-coloring.rst      |  29 +++++++++
 docs/misc/xen-command-line.pandoc |   9 +++
 xen/arch/arm/domain_build.c       |   9 ++-
 xen/common/llc-coloring.c         | 120 +++++++++++++++++++++++++++++++++++++-
 xen/include/xen/llc-coloring.h    |   1 +
 5 files changed, 166 insertions(+), 2 deletions(-)

diff --git a/docs/misc/cache-coloring.rst b/docs/misc/cache-coloring.rst
index 12972dbb2c..7b47d0ed92 100644
--- a/docs/misc/cache-coloring.rst
+++ b/docs/misc/cache-coloring.rst
@@ -107,6 +107,35 @@ Specific documentation is available at `docs/misc/xen-command-line.pandoc`.
 +----------------------+-------------------------------+
 | ``llc-nr-ways``      | Set the LLC number of ways    |
 +----------------------+-------------------------------+
+| ``dom0-llc-colors``  | Dom0 color configuration      |
++----------------------+-------------------------------+
+
+Colors selection format
+***********************
+
+Regardless of the memory pool that has to be colored (Xen, Dom0/DomUs),
+the color selection can be expressed using the same syntax. In particular a
+comma-separated list of colors or ranges of colors is used.
+Ranges are hyphen-separated intervals (such as `0-4`) and are inclusive on both
+sides.
+
+Note that:
+
+- no spaces are allowed between values.
+- no overlapping ranges or duplicated colors are allowed.
+- values must be written in ascending order.
+
+Examples:
+
++-------------------+-----------------------------+
+| **Configuration** | **Actual selection**        |
++-------------------+-----------------------------+
+| 1-2,5-8           | [1, 2, 5, 6, 7, 8]          |
++-------------------+-----------------------------+
+| 4-8,10,11,12      | [4, 5, 6, 7, 8, 10, 11, 12] |
++-------------------+-----------------------------+
+| 0                 | [0]                         |
++-------------------+-----------------------------+
 
 Auto-probing of LLC specs
 #########################
diff --git a/docs/misc/xen-command-line.pandoc b/docs/misc/xen-command-line.pandoc
index d75903b84c..2e8c9dab25 100644
--- a/docs/misc/xen-command-line.pandoc
+++ b/docs/misc/xen-command-line.pandoc
@@ -965,6 +965,15 @@ Controls for the dom0 IOMMU setup.
 
 Specify a list of IO ports to be excluded from dom0 access.
 
+### dom0-llc-colors (arm64)
+> `= List of [ <integer> | <integer>-<integer> ]`
+
+> Default: `All available LLC colors`
+
+Specify dom0 LLC color configuration. This option is available only when
+`CONFIG_LLC_COLORING` is enabled. If the parameter is not set, all available
+colors are used.
+
 ### dom0_max_vcpus
 
 Either:
diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c
index 17cc76b6f2..b072a16249 100644
--- a/xen/arch/arm/domain_build.c
+++ b/xen/arch/arm/domain_build.c
@@ -2356,6 +2356,7 @@ void __init create_dom0(void)
         .max_maptrack_frames = -1,
         .grant_opts = XEN_DOMCTL_GRANT_version(opt_gnttab_max_version),
     };
+    unsigned int flags = CDF_privileged;
     int rc;
 
     /* The vGIC for DOM0 is exactly emulating the hardware GIC */
@@ -2383,10 +2384,16 @@ void __init create_dom0(void)
             panic("SVE vector length error\n");
     }
 
-    dom0 = domain_create(0, &dom0_cfg, CDF_privileged | CDF_directmap);
+    if ( !llc_coloring_enabled )
+        flags |= CDF_directmap;
+
+    dom0 = domain_create(0, &dom0_cfg, flags);
     if ( IS_ERR(dom0) )
         panic("Error creating domain 0 (rc = %ld)\n", PTR_ERR(dom0));
 
+    if ( llc_coloring_enabled && (rc = dom0_set_llc_colors(dom0)) )
+        panic("Error initializing LLC coloring for domain 0 (rc = %d)\n", rc);
+
     if ( alloc_dom0_vcpu0(dom0) == NULL )
         panic("Error creating domain 0 vcpu0\n");
 
diff --git a/xen/common/llc-coloring.c b/xen/common/llc-coloring.c
index b034c0169c..5984ae82e7 100644
--- a/xen/common/llc-coloring.c
+++ b/xen/common/llc-coloring.c
@@ -29,6 +29,66 @@ static unsigned int __initdata llc_nr_ways;
 integer_param("llc-nr-ways", llc_nr_ways);
 /* Number of colors available in the LLC */
 static unsigned int __ro_after_init max_nr_colors;
+/* Default coloring configuration */
+static unsigned int __ro_after_init default_colors[NR_LLC_COLORS];
+
+static unsigned int __initdata dom0_colors[NR_LLC_COLORS];
+static unsigned int __initdata dom0_num_colors;
+
+/*
+ * Parse the coloring configuration given in the buf string, following the
+ * syntax below.
+ *
+ * COLOR_CONFIGURATION ::= COLOR | RANGE,...,COLOR | RANGE
+ * RANGE               ::= COLOR-COLOR
+ *
+ * Example: "0,2-6,15-16" represents the set of colors: 0,2,3,4,5,6,15,16.
+ */
+static int __init parse_color_config(const char *buf, unsigned int colors[],
+                                     unsigned int max_num_colors,
+                                     unsigned int *num_colors)
+{
+    const char *s = buf;
+
+    *num_colors = 0;
+
+    while ( *s != '\0' )
+    {
+        unsigned int color, start, end;
+
+        start = simple_strtoul(s, &s, 0);
+
+        if ( *s == '-' )    /* Range */
+        {
+            s++;
+            end = simple_strtoul(s, &s, 0);
+        }
+        else                /* Single value */
+            end = start;
+
+        if ( start > end || (end - start) > (UINT_MAX - *num_colors) ||
+             (*num_colors + (end - start)) >= max_num_colors )
+            return -EINVAL;
+
+        /* Colors are range checked in check_colors() */
+        for ( color = start; color <= end; color++ )
+            colors[(*num_colors)++] = color;
+
+        if ( *s == ',' )
+            s++;
+        else if ( *s != '\0' )
+            break;
+    }
+
+    return *s ? -EINVAL : 0;
+}
+
+static int __init parse_dom0_colors(const char *s)
+{
+    return parse_color_config(s, dom0_colors, ARRAY_SIZE(dom0_colors),
+                              &dom0_num_colors);
+}
+custom_param("dom0-llc-colors", parse_dom0_colors);
 
 static void print_colors(const unsigned int colors[], unsigned int num_colors)
 {
@@ -53,9 +113,27 @@ static void print_colors(const unsigned int colors[], unsigned int num_colors)
     printk(" }\n");
 }
 
+static bool __init check_colors(const unsigned int colors[],
+                                unsigned int num_colors)
+{
+    unsigned int i;
+
+    for ( i = 0; i < num_colors; i++ )
+    {
+        if ( colors[i] >= max_nr_colors )
+        {
+            printk(XENLOG_ERR "LLC color %u >= %u (max allowed)\n", colors[i],
+                   max_nr_colors);
+            return false;
+        }
+    }
+
+    return true;
+}
+
 void __init llc_coloring_init(void)
 {
-    unsigned int way_size;
+    unsigned int way_size, i;
 
     llc_coloring_enabled = (opt_llc_coloring >= 1);
     if ( (opt_llc_coloring != 0) && llc_size && llc_nr_ways )
@@ -94,6 +172,9 @@ void __init llc_coloring_init(void)
     else if ( max_nr_colors < 2 )
         panic("Number of LLC colors %u < 2\n", max_nr_colors);
 
+    for ( i = 0; i < max_nr_colors; i++ )
+        default_colors[i] = i;
+
     arch_llc_coloring_init();
 }
 
@@ -115,6 +196,43 @@ void domain_dump_llc_colors(const struct domain *d)
     print_colors(d->llc_colors, d->num_llc_colors);
 }
 
+static void __init domain_set_default_colors(struct domain *d)
+{
+    printk(XENLOG_WARNING
+           "LLC color config not found for %pd, using all colors\n", d);
+
+    d->llc_colors = default_colors;
+    d->num_llc_colors = max_nr_colors;
+}
+
+int __init dom0_set_llc_colors(struct domain *d)
+{
+    typeof(*dom0_colors) *colors;
+
+    if ( !dom0_num_colors )
+    {
+        domain_set_default_colors(d);
+        return 0;
+    }
+
+    if ( (dom0_num_colors > max_nr_colors) ||
+         !check_colors(dom0_colors, dom0_num_colors) )
+    {
+        printk(XENLOG_ERR "%pd:  bad LLC color config\n", d);
+        return -EINVAL;
+    }
+
+    colors = xmalloc_array(typeof(*dom0_colors), dom0_num_colors);
+    if ( !colors )
+        return -ENOMEM;
+
+    memcpy(colors, dom0_colors, sizeof(*colors) * dom0_num_colors);
+    d->llc_colors = colors;
+    d->num_llc_colors = dom0_num_colors;
+
+    return 0;
+}
+
 /*
  * Local variables:
  * mode: C
diff --git a/xen/include/xen/llc-coloring.h b/xen/include/xen/llc-coloring.h
index a3ebb17186..d29ebeb4c5 100644
--- a/xen/include/xen/llc-coloring.h
+++ b/xen/include/xen/llc-coloring.h
@@ -28,6 +28,7 @@ static inline void domain_dump_llc_colors(const struct domain *d) {}
 
 unsigned int get_llc_way_size(void);
 void arch_llc_coloring_init(void);
+int dom0_set_llc_colors(struct domain *d);
 
 #endif /* __XEN_LLC_COLORING_H__ */
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Dec 20 07:33:49 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 20 Dec 2024 07:33:49 +0000
Received: from list by lists.xenproject.org with outflank-mailman.861643.1273623 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tOXW9-0007Kl-Dv; Fri, 20 Dec 2024 07:33:49 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 861643.1273623; Fri, 20 Dec 2024 07:33:49 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tOXW9-0007Kd-BA; Fri, 20 Dec 2024 07:33:49 +0000
Received: by outflank-mailman (input) for mailman id 861643;
 Fri, 20 Dec 2024 07:33:48 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tOXW7-0007KN-Uw
 for xen-changelog@lists.xenproject.org; Fri, 20 Dec 2024 07:33:47 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tOXW7-00D3Tz-22
 for xen-changelog@lists.xenproject.org;
 Fri, 20 Dec 2024 07:33:47 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tOXW7-005NB7-2o
 for xen-changelog@lists.xenproject.org;
 Fri, 20 Dec 2024 07:33:47 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=1Q4ATy8fjHvR+s7AHHkHtAXMQM15ggjUOOI0w7/M1kQ=; b=bj/d0ELVudJ2VDRZxG/nR2l/8M
	aXo1XgXb2y5kXc+d3QbbMMlYog9GeI81vKXafxxsOzWzH5jx5hVjZAupe6t2AZM+hpPQfnIQPBM1h
	SL4IT5wYWbM0xL/pFxT3jCD2HBM2oF6IdZ9GTGMw8WwA+coRPap0jpnpcVSsaep6A+M8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen: extend domctl interface for cache coloring
Message-Id: <E1tOXW7-005NB7-2o@xenbits.xenproject.org>
Date: Fri, 20 Dec 2024 07:33:47 +0000

commit 6985aa5e0c3c3872a976b340dc31c1075203d9aa
Author:     Carlo Nonato <carlo.nonato@minervasys.tech>
AuthorDate: Tue Dec 17 18:06:30 2024 +0100
Commit:     Michal Orzel <michal.orzel@amd.com>
CommitDate: Thu Dec 19 19:24:31 2024 +0100

    xen: extend domctl interface for cache coloring
    
    Add a new domctl hypercall to allow the user to set LLC coloring
    configurations. Colors can be set only once, just after domain creation,
    since recoloring isn't supported.
    
    Based on original work from: Luca Miccio <lucmiccio@gmail.com>
    
    Signed-off-by: Carlo Nonato <carlo.nonato@minervasys.tech>
    Signed-off-by: Marco Solieri <marco.solieri@minervasys.tech>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/common/domain.c            |  3 +++
 xen/common/domctl.c            | 10 ++++++++
 xen/common/llc-coloring.c      | 55 +++++++++++++++++++++++++++++++++++++++---
 xen/include/public/domctl.h    |  9 +++++++
 xen/include/xen/llc-coloring.h |  5 ++++
 5 files changed, 79 insertions(+), 3 deletions(-)

diff --git a/xen/common/domain.c b/xen/common/domain.c
index e33a0a5a21..0c4cc77111 100644
--- a/xen/common/domain.c
+++ b/xen/common/domain.c
@@ -34,6 +34,7 @@
 #include <xen/xenoprof.h>
 #include <xen/irq.h>
 #include <xen/argo.h>
+#include <xen/llc-coloring.h>
 #include <asm/p2m.h>
 #include <asm/processor.h>
 #include <public/sched.h>
@@ -1303,6 +1304,8 @@ void domain_destroy(struct domain *d)
 {
     BUG_ON(!d->is_dying);
 
+    domain_llc_coloring_free(d);
+
     /* May be already destroyed, or get_domain() can race us. */
     if ( atomic_cmpxchg(&d->refcnt, 0, DOMAIN_DESTROYED) != 0 )
         return;
diff --git a/xen/common/domctl.c b/xen/common/domctl.c
index 444e072fdc..05abb581a0 100644
--- a/xen/common/domctl.c
+++ b/xen/common/domctl.c
@@ -8,6 +8,7 @@
 
 #include <xen/types.h>
 #include <xen/lib.h>
+#include <xen/llc-coloring.h>
 #include <xen/err.h>
 #include <xen/mm.h>
 #include <xen/sched.h>
@@ -866,6 +867,15 @@ long do_domctl(XEN_GUEST_HANDLE_PARAM(xen_domctl_t) u_domctl)
                 __HYPERVISOR_domctl, "h", u_domctl);
         break;
 
+    case XEN_DOMCTL_set_llc_colors:
+        if ( op->u.set_llc_colors.pad )
+            ret = -EINVAL;
+        else if ( llc_coloring_enabled )
+            ret = domain_set_llc_colors(d, &op->u.set_llc_colors);
+        else
+            ret = -EOPNOTSUPP;
+        break;
+
     default:
         ret = arch_do_domctl(op, d, u_domctl);
         break;
diff --git a/xen/common/llc-coloring.c b/xen/common/llc-coloring.c
index 5984ae82e7..3dd1aaa4df 100644
--- a/xen/common/llc-coloring.c
+++ b/xen/common/llc-coloring.c
@@ -5,6 +5,7 @@
  * Copyright (C) 2024, Advanced Micro Devices, Inc.
  * Copyright (C) 2024, Minerva Systems SRL
  */
+#include <xen/guest_access.h>
 #include <xen/keyhandler.h>
 #include <xen/llc-coloring.h>
 #include <xen/param.h>
@@ -113,8 +114,7 @@ static void print_colors(const unsigned int colors[], unsigned int num_colors)
     printk(" }\n");
 }
 
-static bool __init check_colors(const unsigned int colors[],
-                                unsigned int num_colors)
+static bool check_colors(const unsigned int colors[], unsigned int num_colors)
 {
     unsigned int i;
 
@@ -196,7 +196,7 @@ void domain_dump_llc_colors(const struct domain *d)
     print_colors(d->llc_colors, d->num_llc_colors);
 }
 
-static void __init domain_set_default_colors(struct domain *d)
+static void domain_set_default_colors(struct domain *d)
 {
     printk(XENLOG_WARNING
            "LLC color config not found for %pd, using all colors\n", d);
@@ -233,6 +233,55 @@ int __init dom0_set_llc_colors(struct domain *d)
     return 0;
 }
 
+int domain_set_llc_colors(struct domain *d,
+                          const struct xen_domctl_set_llc_colors *config)
+{
+    unsigned int *colors;
+
+    if ( d->num_llc_colors )
+        return -EEXIST;
+
+    if ( !config->num_llc_colors )
+    {
+        domain_set_default_colors(d);
+        return 0;
+    }
+
+    if ( config->num_llc_colors > max_nr_colors )
+        return -EINVAL;
+
+    colors = xmalloc_array(unsigned int, config->num_llc_colors);
+    if ( !colors )
+        return -ENOMEM;
+
+    if ( copy_from_guest(colors, config->llc_colors, config->num_llc_colors) )
+    {
+        xfree(colors);
+        return -EFAULT;
+    }
+
+    if ( !check_colors(colors, config->num_llc_colors) )
+    {
+        printk(XENLOG_ERR "%pd: bad LLC color config\n", d);
+        xfree(colors);
+        return -EINVAL;
+    }
+
+    d->llc_colors = colors;
+    d->num_llc_colors = config->num_llc_colors;
+
+    return 0;
+}
+
+void domain_llc_coloring_free(struct domain *d)
+{
+    if ( !llc_coloring_enabled || d->llc_colors == default_colors )
+        return;
+
+    /* free pointer-to-const using __va(__pa()) */
+    xfree(__va(__pa(d->llc_colors)));
+}
+
 /*
  * Local variables:
  * mode: C
diff --git a/xen/include/public/domctl.h b/xen/include/public/domctl.h
index 353f831e40..e2d392d1e5 100644
--- a/xen/include/public/domctl.h
+++ b/xen/include/public/domctl.h
@@ -1236,6 +1236,13 @@ struct xen_domctl_dt_overlay {
 };
 #endif
 
+struct xen_domctl_set_llc_colors {
+    /* IN LLC coloring parameters */
+    uint32_t num_llc_colors;
+    uint32_t pad;
+    XEN_GUEST_HANDLE_64(uint32) llc_colors;
+};
+
 struct xen_domctl {
     uint32_t cmd;
 #define XEN_DOMCTL_createdomain                   1
@@ -1325,6 +1332,7 @@ struct xen_domctl {
 #define XEN_DOMCTL_set_paging_mempool_size       86
 #define XEN_DOMCTL_dt_overlay                    87
 #define XEN_DOMCTL_gsi_permission                88
+#define XEN_DOMCTL_set_llc_colors                89
 #define XEN_DOMCTL_gdbsx_guestmemio            1000
 #define XEN_DOMCTL_gdbsx_pausevcpu             1001
 #define XEN_DOMCTL_gdbsx_unpausevcpu           1002
@@ -1391,6 +1399,7 @@ struct xen_domctl {
 #if defined(__arm__) || defined(__aarch64__)
         struct xen_domctl_dt_overlay        dt_overlay;
 #endif
+        struct xen_domctl_set_llc_colors    set_llc_colors;
         uint8_t                             pad[128];
     } u;
 };
diff --git a/xen/include/xen/llc-coloring.h b/xen/include/xen/llc-coloring.h
index d29ebeb4c5..26353c808a 100644
--- a/xen/include/xen/llc-coloring.h
+++ b/xen/include/xen/llc-coloring.h
@@ -11,6 +11,7 @@
 #include <xen/types.h>
 
 struct domain;
+struct xen_domctl_set_llc_colors;
 
 #ifdef CONFIG_LLC_COLORING
 extern bool llc_coloring_enabled;
@@ -18,17 +19,21 @@ extern bool llc_coloring_enabled;
 void llc_coloring_init(void);
 void dump_llc_coloring_info(void);
 void domain_dump_llc_colors(const struct domain *d);
+void domain_llc_coloring_free(struct domain *d);
 #else
 #define llc_coloring_enabled false
 
 static inline void llc_coloring_init(void) {}
 static inline void dump_llc_coloring_info(void) {}
 static inline void domain_dump_llc_colors(const struct domain *d) {}
+static inline void domain_llc_coloring_free(struct domain *d) {}
 #endif
 
 unsigned int get_llc_way_size(void);
 void arch_llc_coloring_init(void);
 int dom0_set_llc_colors(struct domain *d);
+int domain_set_llc_colors(struct domain *d,
+                          const struct xen_domctl_set_llc_colors *config);
 
 #endif /* __XEN_LLC_COLORING_H__ */
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Dec 20 07:33:59 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 20 Dec 2024 07:33:59 +0000
Received: from list by lists.xenproject.org with outflank-mailman.861645.1273627 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tOXWJ-0007Nl-FJ; Fri, 20 Dec 2024 07:33:59 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 861645.1273627; Fri, 20 Dec 2024 07:33:59 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tOXWJ-0007Nd-Cd; Fri, 20 Dec 2024 07:33:59 +0000
Received: by outflank-mailman (input) for mailman id 861645;
 Fri, 20 Dec 2024 07:33:58 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tOXWI-0007NU-40
 for xen-changelog@lists.xenproject.org; Fri, 20 Dec 2024 07:33:58 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tOXWH-00D3U3-2W
 for xen-changelog@lists.xenproject.org;
 Fri, 20 Dec 2024 07:33:58 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tOXWI-005NCC-04
 for xen-changelog@lists.xenproject.org;
 Fri, 20 Dec 2024 07:33:58 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=+1IELAh3fVo0LdSSvJWCunLgL9w7eJpQbMdW6/rcmR8=; b=S7+Loua044OXNuGsyiXblU1SDX
	yf7YFaRInrY/l5TDZX4Qu9FwEx0ivxBk6Lregezl5lnEqKPbFBg972gPSup0FhCAH5/uJ0Oo8Oql1
	ec1rOKWtQZ8qUY9ZKHQqd673mEg4SEjQJbIvKvOgB1WCdokLMa6tD1abLeknDQv0D0s8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] tools: add support for cache coloring configuration
Message-Id: <E1tOXWI-005NCC-04@xenbits.xenproject.org>
Date: Fri, 20 Dec 2024 07:33:58 +0000

commit 748bd725fbeca1c412a17cf5e5d02d5ce5204209
Author:     Carlo Nonato <carlo.nonato@minervasys.tech>
AuthorDate: Tue Dec 17 18:06:31 2024 +0100
Commit:     Michal Orzel <michal.orzel@amd.com>
CommitDate: Thu Dec 19 19:24:31 2024 +0100

    tools: add support for cache coloring configuration
    
    Add a new "llc_colors" parameter that defines the LLC color assignment for
    a domain. The user can specify one or more color ranges using the same
    syntax used everywhere else for color config described in the
    documentation.
    The parameter is defined as a list of strings that represent the color
    ranges.
    
    Documentation is also added.
    Golang bindings are regenerated.
    
    Based on original work from: Luca Miccio <lucmiccio@gmail.com>
    
    Signed-off-by: Carlo Nonato <carlo.nonato@minervasys.tech>
    Signed-off-by: Marco Solieri <marco.solieri@minervasys.tech>
    Reviewed-by: Anthony PERARD <anthony.perard@vates.tech>
---
 docs/man/xl.cfg.5.pod.in             |  6 ++++++
 tools/golang/xenlight/helpers.gen.go | 16 +++++++++++++++
 tools/golang/xenlight/types.gen.go   |  1 +
 tools/include/libxl.h                |  5 +++++
 tools/include/xenctrl.h              |  9 +++++++++
 tools/libs/ctrl/xc_domain.c          | 34 ++++++++++++++++++++++++++++++++
 tools/libs/light/libxl_create.c      | 18 +++++++++++++++++
 tools/libs/light/libxl_types.idl     |  1 +
 tools/xl/xl_parse.c                  | 38 +++++++++++++++++++++++++++++++++++-
 9 files changed, 127 insertions(+), 1 deletion(-)

diff --git a/docs/man/xl.cfg.5.pod.in b/docs/man/xl.cfg.5.pod.in
index ac3f88fd57..8e1422104e 100644
--- a/docs/man/xl.cfg.5.pod.in
+++ b/docs/man/xl.cfg.5.pod.in
@@ -3074,6 +3074,12 @@ raised.
 
 =over 4
 
+=item B<llc_colors=[ "RANGE", "RANGE", ...]>
+
+Specify the Last Level Cache (LLC) color configuration for the guest.
+B<RANGE> can be either a single color value or a hypen-separated closed
+interval of colors (such as "0-4").
+
 =item B<nr_spis="NR_SPIS">
 
 An optional integer parameter specifying the number of SPIs (Shared
diff --git a/tools/golang/xenlight/helpers.gen.go b/tools/golang/xenlight/helpers.gen.go
index fe5110474d..90846ea8e8 100644
--- a/tools/golang/xenlight/helpers.gen.go
+++ b/tools/golang/xenlight/helpers.gen.go
@@ -1097,6 +1097,14 @@ if err := x.Iomem[i].fromC(&v); err != nil {
 return fmt.Errorf("converting field Iomem: %v", err) }
 }
 }
+x.LlcColors = nil
+if n := int(xc.num_llc_colors); n > 0 {
+cLlcColors := (*[1<<28]C.uint32_t)(unsafe.Pointer(xc.llc_colors))[:n:n]
+x.LlcColors = make([]uint32, n)
+for i, v := range cLlcColors {
+x.LlcColors[i] = uint32(v)
+}
+}
 if err := x.ClaimMode.fromC(&xc.claim_mode);err != nil {
 return fmt.Errorf("converting field ClaimMode: %v", err)
 }
@@ -1453,6 +1461,14 @@ return fmt.Errorf("converting field Iomem: %v", err)
 }
 }
 }
+if numLlcColors := len(x.LlcColors); numLlcColors > 0 {
+xc.llc_colors = (*C.uint32_t)(C.malloc(C.size_t(numLlcColors*numLlcColors)))
+xc.num_llc_colors = C.int(numLlcColors)
+cLlcColors := (*[1<<28]C.uint32_t)(unsafe.Pointer(xc.llc_colors))[:numLlcColors:numLlcColors]
+for i,v := range x.LlcColors {
+cLlcColors[i] = C.uint32_t(v)
+}
+}
 if err := x.ClaimMode.toC(&xc.claim_mode); err != nil {
 return fmt.Errorf("converting field ClaimMode: %v", err)
 }
diff --git a/tools/golang/xenlight/types.gen.go b/tools/golang/xenlight/types.gen.go
index c9e45b306f..e7667f1ce3 100644
--- a/tools/golang/xenlight/types.gen.go
+++ b/tools/golang/xenlight/types.gen.go
@@ -575,6 +575,7 @@ SchedParams DomainSchedParams
 Ioports []IoportRange
 Irqs []uint32
 Iomem []IomemRange
+LlcColors []uint32
 ClaimMode Defbool
 EventChannels uint32
 Kernel string
diff --git a/tools/include/libxl.h b/tools/include/libxl.h
index 8d32428ea9..f8fe4afd7d 100644
--- a/tools/include/libxl.h
+++ b/tools/include/libxl.h
@@ -1379,6 +1379,11 @@ void libxl_mac_copy(libxl_ctx *ctx, libxl_mac *dst, const libxl_mac *src);
  */
 #define LIBXL_HAVE_BUILDINFO_HVM_SYSTEM_FIRMWARE
 
+/*
+ * The libxl_domain_build_info has the llc_colors array.
+ */
+#define LIBXL_HAVE_BUILDINFO_LLC_COLORS 1
+
 /*
  * ERROR_REMUS_XXX error code only exists from Xen 4.5, Xen 4.6 and it
  * is changed to ERROR_CHECKPOINT_XXX in Xen 4.7
diff --git a/tools/include/xenctrl.h b/tools/include/xenctrl.h
index ea57e9dbb9..b08e438ea8 100644
--- a/tools/include/xenctrl.h
+++ b/tools/include/xenctrl.h
@@ -2641,6 +2641,15 @@ int xc_livepatch_replace(xc_interface *xch, char *name, uint32_t timeout, uint32
 int xc_domain_cacheflush(xc_interface *xch, uint32_t domid,
                          xen_pfn_t start_pfn, xen_pfn_t nr_pfns);
 
+/*
+ * Set LLC colors for a domain.
+ * It can only be used directly after domain creation. An attempt to use it
+ * afterwards will result in an error.
+ */
+int xc_domain_set_llc_colors(xc_interface *xch, uint32_t domid,
+                             const uint32_t *llc_colors,
+                             uint32_t num_llc_colors);
+
 #if defined(__arm__) || defined(__aarch64__)
 int xc_dt_overlay(xc_interface *xch, void *overlay_fdt,
                   uint32_t overlay_fdt_size, uint8_t overlay_op);
diff --git a/tools/libs/ctrl/xc_domain.c b/tools/libs/ctrl/xc_domain.c
index e3538ec0ba..2ddc3f4f42 100644
--- a/tools/libs/ctrl/xc_domain.c
+++ b/tools/libs/ctrl/xc_domain.c
@@ -2195,6 +2195,40 @@ int xc_domain_soft_reset(xc_interface *xch,
     domctl.domain = domid;
     return do_domctl(xch, &domctl);
 }
+
+int xc_domain_set_llc_colors(xc_interface *xch, uint32_t domid,
+                             const uint32_t *llc_colors,
+                             uint32_t num_llc_colors)
+{
+    struct xen_domctl domctl = {};
+    DECLARE_HYPERCALL_BUFFER(uint32_t, local);
+    int ret = -1;
+
+    if ( num_llc_colors )
+    {
+        size_t bytes = sizeof(uint32_t) * num_llc_colors;
+
+        local = xc_hypercall_buffer_alloc(xch, local, bytes);
+        if ( local == NULL )
+        {
+            PERROR("Could not allocate LLC colors for set_llc_colors");
+            goto out;
+        }
+        memcpy(local, llc_colors, bytes);
+        set_xen_guest_handle(domctl.u.set_llc_colors.llc_colors, local);
+    }
+
+    domctl.cmd = XEN_DOMCTL_set_llc_colors;
+    domctl.domain = domid;
+    domctl.u.set_llc_colors.num_llc_colors = num_llc_colors;
+
+    ret = do_domctl(xch, &domctl);
+
+out:
+    xc_hypercall_buffer_free(xch, local);
+
+    return ret;
+}
 /*
  * Local variables:
  * mode: C
diff --git a/tools/libs/light/libxl_create.c b/tools/libs/light/libxl_create.c
index edeadd57ef..e03599ea99 100644
--- a/tools/libs/light/libxl_create.c
+++ b/tools/libs/light/libxl_create.c
@@ -747,6 +747,24 @@ int libxl__domain_make(libxl__gc *gc, libxl_domain_config *d_config,
             /* A new domain now exists */
             *domid = local_domid;
 
+            ret = xc_domain_set_llc_colors(ctx->xch, local_domid,
+                                           b_info->llc_colors,
+                                           b_info->num_llc_colors);
+            if (ret < 0) {
+                if (errno == EOPNOTSUPP) {
+                    if (b_info->num_llc_colors > 0) {
+                        LOGED(ERROR, local_domid,
+                            "LLC coloring not enabled in the hypervisor");
+                        rc = ERROR_FAIL;
+                        goto out;
+                    }
+                } else {
+                    LOGED(ERROR, local_domid, "LLC colors allocation failed");
+                    rc = ERROR_FAIL;
+                    goto out;
+                }
+            }
+
             rc = libxl__is_domid_recent(gc, local_domid, &recent);
             if (rc)
                 goto out;
diff --git a/tools/libs/light/libxl_types.idl b/tools/libs/light/libxl_types.idl
index 4e65e6fda5..bd4b8721ff 100644
--- a/tools/libs/light/libxl_types.idl
+++ b/tools/libs/light/libxl_types.idl
@@ -616,6 +616,7 @@ libxl_domain_build_info = Struct("domain_build_info",[
     ("ioports",          Array(libxl_ioport_range, "num_ioports")),
     ("irqs",             Array(uint32, "num_irqs")),
     ("iomem",            Array(libxl_iomem_range, "num_iomem")),
+    ("llc_colors",       Array(uint32, "num_llc_colors")),
     ("claim_mode",	     libxl_defbool),
     ("event_channels",   uint32),
     ("kernel",           string),
diff --git a/tools/xl/xl_parse.c b/tools/xl/xl_parse.c
index e3a4800f6e..3d85be7dd4 100644
--- a/tools/xl/xl_parse.c
+++ b/tools/xl/xl_parse.c
@@ -1296,7 +1296,7 @@ void parse_config_data(const char *config_source,
     XLU_ConfigList *cpus, *vbds, *nics, *pcis, *cvfbs, *cpuids, *vtpms,
                    *usbctrls, *usbdevs, *p9devs, *vdispls, *pvcallsifs_devs;
     XLU_ConfigList *channels, *ioports, *irqs, *iomem, *viridian, *dtdevs,
-                   *mca_caps, *smbios;
+                   *mca_caps, *smbios, *llc_colors;
     int num_ioports, num_irqs, num_iomem, num_cpus, num_viridian, num_mca_caps;
     int num_smbios;
     int pci_power_mgmt = 0;
@@ -1304,6 +1304,7 @@ void parse_config_data(const char *config_source,
     int pci_permissive = 0;
     int pci_seize = 0;
     int i, e;
+    int num_llc_colors;
     char *kernel_basename;
 
     libxl_domain_create_info *c_info = &d_config->c_info;
@@ -1447,6 +1448,41 @@ void parse_config_data(const char *config_source,
     if (!xlu_cfg_get_long (config, "maxmem", &l, 0))
         b_info->max_memkb = l * 1024;
 
+    if (!xlu_cfg_get_list(config, "llc_colors", &llc_colors, &num_llc_colors, 0)) {
+        int cur_index = 0;
+
+        b_info->num_llc_colors = 0;
+        for (i = 0; i < num_llc_colors; i++) {
+            uint32_t start = 0, end = 0, k;
+
+            buf = xlu_cfg_get_listitem(llc_colors, i);
+            if (!buf) {
+                fprintf(stderr,
+                        "xl: Can't get element %d in LLC color list\n", i);
+                exit(1);
+            }
+
+            if (sscanf(buf, "%" SCNu32 "-%" SCNu32, &start, &end) != 2) {
+                if (sscanf(buf, "%" SCNu32, &start) != 1) {
+                    fprintf(stderr, "xl: Invalid LLC color range: %s\n", buf);
+                    exit(1);
+                }
+                end = start;
+            } else if (start > end) {
+                fprintf(stderr,
+                        "xl: Start LLC color is greater than end: %s\n", buf);
+                exit(1);
+            }
+
+            b_info->num_llc_colors += (end - start) + 1;
+            b_info->llc_colors = (uint32_t *)realloc(b_info->llc_colors,
+                        sizeof(*b_info->llc_colors) * b_info->num_llc_colors);
+
+            for (k = start; k <= end; k++)
+                b_info->llc_colors[cur_index++] = k;
+        }
+    }
+
     if (!xlu_cfg_get_long (config, "vcpus", &l, 0)) {
         vcpus = l;
         if (libxl_cpu_bitmap_alloc(ctx, &b_info->avail_vcpus, l)) {
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Dec 20 07:34:09 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 20 Dec 2024 07:34:09 +0000
Received: from list by lists.xenproject.org with outflank-mailman.861646.1273631 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tOXWT-0007Qr-Gm; Fri, 20 Dec 2024 07:34:09 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 861646.1273631; Fri, 20 Dec 2024 07:34:09 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tOXWT-0007Qj-E1; Fri, 20 Dec 2024 07:34:09 +0000
Received: by outflank-mailman (input) for mailman id 861646;
 Fri, 20 Dec 2024 07:34:08 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tOXWS-0007QV-6g
 for xen-changelog@lists.xenproject.org; Fri, 20 Dec 2024 07:34:08 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tOXWR-00D3UT-2n
 for xen-changelog@lists.xenproject.org;
 Fri, 20 Dec 2024 07:34:08 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tOXWS-005NDa-0S
 for xen-changelog@lists.xenproject.org;
 Fri, 20 Dec 2024 07:34:08 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=5zYgLye0yBljiG+FTVMHEBbraucrsH+gRZqmEXkCZ98=; b=cSWldnnBS9xleX3AABYqAUFaCG
	Cl24WHceLMwmmgVdMo3glYoUMfoarcuWrLpH6rLDzUMc57RvQcRD4cTH4PIpAzOG93E6tpCKBDs/m
	5MI37gumiIaTsg0jvJFNIlcLd9WrBTpHgeRDYKW3pIzpn8PrE8MsPAkkZNoSTyvO351M=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/arm: add support for cache coloring configuration via device-tree
Message-Id: <E1tOXWS-005NDa-0S@xenbits.xenproject.org>
Date: Fri, 20 Dec 2024 07:34:08 +0000

commit 5948dc16759c215810968bcb5ba6921e48bcf96e
Author:     Carlo Nonato <carlo.nonato@minervasys.tech>
AuthorDate: Tue Dec 17 18:06:32 2024 +0100
Commit:     Michal Orzel <michal.orzel@amd.com>
CommitDate: Thu Dec 19 19:24:31 2024 +0100

    xen/arm: add support for cache coloring configuration via device-tree
    
    Add the "llc-colors" Device Tree property to express DomUs and Dom0less
    color configurations.
    
    Based on original work from: Luca Miccio <lucmiccio@gmail.com>
    
    Signed-off-by: Carlo Nonato <carlo.nonato@minervasys.tech>
    Signed-off-by: Marco Solieri <marco.solieri@minervasys.tech>
    Reviewed-by: Jan Beulich <jbeulich@suse.com> # non-Arm
    Reviewed-by: Michal Orzel <michal.orzel@amd.com>
---
 docs/misc/arm/device-tree/booting.txt |  5 ++++
 docs/misc/cache-coloring.rst          | 48 +++++++++++++++++++++++++++++++++++
 xen/arch/arm/dom0less-build.c         | 10 ++++++++
 xen/common/llc-coloring.c             | 40 +++++++++++++++++++++++++++++
 xen/include/xen/llc-coloring.h        |  1 +
 xen/include/xen/xmalloc.h             | 12 +++++++++
 6 files changed, 116 insertions(+)

diff --git a/docs/misc/arm/device-tree/booting.txt b/docs/misc/arm/device-tree/booting.txt
index 3a04f5c57f..9c881baccc 100644
--- a/docs/misc/arm/device-tree/booting.txt
+++ b/docs/misc/arm/device-tree/booting.txt
@@ -162,6 +162,11 @@ with the following properties:
 
     An integer specifying the number of vcpus to allocate to the guest.
 
+- llc-colors
+    A string specifying the LLC color configuration for the guest.
+    Refer to docs/misc/cache_coloring.rst for syntax. This option is applicable
+    only to Arm64 guests.
+
 - vpl011
 
     An empty property to enable/disable a virtual pl011 for the guest to
diff --git a/docs/misc/cache-coloring.rst b/docs/misc/cache-coloring.rst
index 7b47d0ed92..e097e74032 100644
--- a/docs/misc/cache-coloring.rst
+++ b/docs/misc/cache-coloring.rst
@@ -14,6 +14,7 @@ If needed, change the maximum number of colors with
 ``CONFIG_LLC_COLORS_ORDER=<n>``.
 
 Runtime configuration is done via `Command line parameters`_.
+For DomUs follow `DomUs configuration`_.
 
 Background
 **********
@@ -149,6 +150,53 @@ LLC specs can be manually set via the above command line parameters. This
 bypasses any auto-probing and it's used to overcome failing situations, such as
 flawed probing logic, or for debugging/testing purposes.
 
+DomUs configuration
+*******************
+
+DomUs colors can be set either in the ``xl`` configuration file (documentation
+at `docs/man/xl.cfg.pod.5.in`) or via Device Tree (documentation at
+`docs/misc/arm/device-tree/booting.txt`) using the ``llc-colors`` option.
+For example:
+
+::
+
+    xen,xen-bootargs = "console=dtuart dtuart=serial0 dom0_mem=1G dom0_max_vcpus=1 sched=null llc-coloring=on dom0-llc-colors=2-6";
+    xen,dom0-bootargs "console=hvc0 earlycon=xen earlyprintk=xen root=/dev/ram0"
+
+    dom0 {
+        compatible = "xen,linux-zimage" "xen,multiboot-module";
+        reg = <0x0 0x1000000 0x0 15858176>;
+    };
+
+    dom0-ramdisk {
+        compatible = "xen,linux-initrd" "xen,multiboot-module";
+        reg = <0x0 0x2000000 0x0 20638062>;
+    };
+
+    domU0 {
+        #address-cells = <0x1>;
+        #size-cells = <0x1>;
+        compatible = "xen,domain";
+        memory = <0x0 0x40000>;
+        llc-colors = "4-8,10,11,12";
+        cpus = <0x1>;
+        vpl011 = <0x1>;
+
+        module@2000000 {
+            compatible = "multiboot,kernel", "multiboot,module";
+            reg = <0x2000000 0xffffff>;
+            bootargs = "console=ttyAMA0";
+        };
+
+        module@30000000 {
+            compatible = "multiboot,ramdisk", "multiboot,module";
+            reg = <0x3000000 0xffffff>;
+        };
+    };
+
+**Note:** If no color configuration is provided for a domain, the default one,
+which corresponds to all available colors is used instead.
+
 Known issues and limitations
 ****************************
 
diff --git a/xen/arch/arm/dom0less-build.c b/xen/arch/arm/dom0less-build.c
index 67b1503647..49d1f14d65 100644
--- a/xen/arch/arm/dom0less-build.c
+++ b/xen/arch/arm/dom0less-build.c
@@ -817,6 +817,7 @@ void __init create_domUs(void)
     bool iommu = false;
     const struct dt_device_node *cpupool_node,
                                 *chosen = dt_find_node_by_path("/chosen");
+    const char *llc_colors_str = NULL;
 
     BUG_ON(chosen == NULL);
     dt_for_each_child_node(chosen, node)
@@ -965,6 +966,10 @@ void __init create_domUs(void)
 #endif
         }
 
+        dt_property_read_string(node, "llc-colors", &llc_colors_str);
+        if ( !llc_coloring_enabled && llc_colors_str )
+            panic("'llc-colors' found, but LLC coloring is disabled\n");
+
         /*
          * The variable max_init_domid is initialized with zero, so here it's
          * very important to use the pre-increment operator to call
@@ -975,6 +980,11 @@ void __init create_domUs(void)
             panic("Error creating domain %s (rc = %ld)\n",
                   dt_node_name(node), PTR_ERR(d));
 
+        if ( llc_coloring_enabled &&
+             (rc = domain_set_llc_colors_from_str(d, llc_colors_str)) )
+            panic("Error initializing LLC coloring for domain %s (rc = %d)\n",
+                  dt_node_name(node), rc);
+
         d->is_console = true;
         dt_device_set_used_by(node, d->domain_id);
 
diff --git a/xen/common/llc-coloring.c b/xen/common/llc-coloring.c
index 3dd1aaa4df..5a0e3bac59 100644
--- a/xen/common/llc-coloring.c
+++ b/xen/common/llc-coloring.c
@@ -282,6 +282,46 @@ void domain_llc_coloring_free(struct domain *d)
     xfree(__va(__pa(d->llc_colors)));
 }
 
+int __init domain_set_llc_colors_from_str(struct domain *d, const char *str)
+{
+    int err;
+    unsigned int *colors, num_colors;
+
+    if ( !str )
+    {
+        domain_set_default_colors(d);
+        return 0;
+    }
+
+    colors = xmalloc_array(unsigned int, max_nr_colors);
+    if ( !colors )
+        return -ENOMEM;
+
+    err = parse_color_config(str, colors, max_nr_colors, &num_colors);
+    if ( err )
+    {
+        printk(XENLOG_ERR "Error parsing LLC color configuration");
+        xfree(colors);
+        return err;
+    }
+
+    if ( !check_colors(colors, num_colors) )
+    {
+        printk(XENLOG_ERR "%pd: bad LLC color config\n", d);
+        xfree(colors);
+        return -EINVAL;
+    }
+
+    /* Adjust the size cause it was initially set to max_nr_colors */
+    d->llc_colors = xrealloc_array(colors, num_colors);
+    if ( !d->llc_colors )
+        d->llc_colors = colors;
+
+    d->num_llc_colors = num_colors;
+
+    return 0;
+}
+
 /*
  * Local variables:
  * mode: C
diff --git a/xen/include/xen/llc-coloring.h b/xen/include/xen/llc-coloring.h
index 26353c808a..5d1355b3c9 100644
--- a/xen/include/xen/llc-coloring.h
+++ b/xen/include/xen/llc-coloring.h
@@ -34,6 +34,7 @@ void arch_llc_coloring_init(void);
 int dom0_set_llc_colors(struct domain *d);
 int domain_set_llc_colors(struct domain *d,
                           const struct xen_domctl_set_llc_colors *config);
+int domain_set_llc_colors_from_str(struct domain *d, const char *str);
 
 #endif /* __XEN_LLC_COLORING_H__ */
 
diff --git a/xen/include/xen/xmalloc.h b/xen/include/xen/xmalloc.h
index b903fa2e26..f0412fb4e0 100644
--- a/xen/include/xen/xmalloc.h
+++ b/xen/include/xen/xmalloc.h
@@ -37,6 +37,9 @@
     ((_type *)_xmalloc_array(sizeof(_type), __alignof__(_type), _num))
 #define xzalloc_array(_type, _num) \
     ((_type *)_xzalloc_array(sizeof(_type), __alignof__(_type), _num))
+#define xrealloc_array(_ptr, _num)                                  \
+    ((typeof(_ptr))_xrealloc_array(_ptr, sizeof(typeof(*(_ptr))),   \
+                                   __alignof__(typeof(*(_ptr))), _num))
 
 /* Allocate space for a structure with a flexible array of typed objects. */
 #define xzalloc_flex_struct(type, field, nr) \
@@ -98,6 +101,15 @@ static inline void *_xzalloc_array(
     return _xzalloc(size * num, align);
 }
 
+static inline void *_xrealloc_array(
+    void *ptr, unsigned long size, unsigned long align, unsigned long num)
+{
+    /* Check for overflow. */
+    if ( size && num > UINT_MAX / size )
+        return NULL;
+    return _xrealloc(ptr, size * num, align);
+}
+
 /*
  * Pooled allocator interface.
  */
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Dec 20 07:34:19 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 20 Dec 2024 07:34:19 +0000
Received: from list by lists.xenproject.org with outflank-mailman.861648.1273635 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tOXWd-0007Tu-K4; Fri, 20 Dec 2024 07:34:19 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 861648.1273635; Fri, 20 Dec 2024 07:34:19 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tOXWd-0007Tk-H7; Fri, 20 Dec 2024 07:34:19 +0000
Received: by outflank-mailman (input) for mailman id 861648;
 Fri, 20 Dec 2024 07:34:18 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tOXWc-0007TY-Aa
 for xen-changelog@lists.xenproject.org; Fri, 20 Dec 2024 07:34:18 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tOXWc-00D3Ub-00
 for xen-changelog@lists.xenproject.org;
 Fri, 20 Dec 2024 07:34:18 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tOXWc-005NFM-0k
 for xen-changelog@lists.xenproject.org;
 Fri, 20 Dec 2024 07:34:18 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=G+Tm6KS4k8M40DKMmFi+R/Uc0USwOZ9Sh0d/Jvp4WCM=; b=U6g3+1clWDM2wKFLk6Yzhbko7j
	nh5MBlClhVSC8G56khhKMh6nMAqHcpy6lkFJtJYLFTlMExnqgJvDr9WU7bJjeL7/cb8Kl840/+7z7
	Gvx1p+/nz5tz1obKAzw+rek0d1E7VlcJM/Qg9PDbUnYuTe8r0DXcNsdnWxSj+xLOxYJY=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen: add cache coloring allocator for domains
Message-Id: <E1tOXWc-005NFM-0k@xenbits.xenproject.org>
Date: Fri, 20 Dec 2024 07:34:18 +0000

commit 95debe51a936276cdfe8e16f89b8f6ef07d381f3
Author:     Carlo Nonato <carlo.nonato@minervasys.tech>
AuthorDate: Tue Dec 17 18:06:34 2024 +0100
Commit:     Michal Orzel <michal.orzel@amd.com>
CommitDate: Thu Dec 19 19:24:31 2024 +0100

    xen: add cache coloring allocator for domains
    
    Add a new memory page allocator that implements the cache coloring mechanism.
    The allocation algorithm enforces equal frequency distribution of cache
    partitions, following the coloring configuration of a domain. This allows
    for an even utilization of cache sets for every domain.
    
    Pages are stored in a color-indexed array of lists. Those lists are filled
    by a simple init function which computes the color of each page.
    When a domain requests a page, the allocator extracts the page from the list
    with the maximum number of free pages among those that the domain can access,
    given its coloring configuration.
    
    The allocator can only handle requests of order-0 pages. This allows for
    easier implementation and since cache coloring targets only embedded systems,
    it's assumed not to be a major problem.
    
    The buddy allocator must coexist with the colored one because the Xen heap
    isn't colored. For this reason a new Kconfig option and a command line
    parameter are added to let the user set the amount of memory reserved for
    the buddy allocator. Even when cache coloring is enabled, this memory
    isn't managed by the colored allocator.
    
    Colored heap information is dumped in the dump_heap() debug-key function.
    
    Based on original work from: Luca Miccio <lucmiccio@gmail.com>
    
    Signed-off-by: Marco Solieri <marco.solieri@minervasys.tech>
    Signed-off-by: Carlo Nonato <carlo.nonato@minervasys.tech>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Michal Orzel <michal.orzel@amd.com>
---
 docs/misc/cache-coloring.rst      |  37 ++++++++
 docs/misc/xen-command-line.pandoc |  14 +++
 xen/arch/arm/include/asm/mm.h     |   5 +
 xen/common/Kconfig                |   8 ++
 xen/common/llc-coloring.c         |  13 +++
 xen/common/page_alloc.c           | 191 +++++++++++++++++++++++++++++++++++++-
 xen/include/xen/llc-coloring.h    |   3 +
 7 files changed, 267 insertions(+), 4 deletions(-)

diff --git a/docs/misc/cache-coloring.rst b/docs/misc/cache-coloring.rst
index e097e74032..5224b27afe 100644
--- a/docs/misc/cache-coloring.rst
+++ b/docs/misc/cache-coloring.rst
@@ -13,6 +13,9 @@ To compile LLC coloring support set ``CONFIG_LLC_COLORING=y``.
 If needed, change the maximum number of colors with
 ``CONFIG_LLC_COLORS_ORDER=<n>``.
 
+If needed, change the buddy allocator reserved size with
+``CONFIG_BUDDY_ALLOCATOR_SIZE=<n>``.
+
 Runtime configuration is done via `Command line parameters`_.
 For DomUs follow `DomUs configuration`_.
 
@@ -110,6 +113,8 @@ Specific documentation is available at `docs/misc/xen-command-line.pandoc`.
 +----------------------+-------------------------------+
 | ``dom0-llc-colors``  | Dom0 color configuration      |
 +----------------------+-------------------------------+
+| ``buddy-alloc-size`` | Buddy allocator reserved size |
++----------------------+-------------------------------+
 
 Colors selection format
 ***********************
@@ -197,6 +202,17 @@ For example:
 **Note:** If no color configuration is provided for a domain, the default one,
 which corresponds to all available colors is used instead.
 
+Colored allocator and buddy allocator
+*************************************
+
+The colored allocator distributes pages based on color configurations of
+domains so that each domains only gets pages of its own colors.
+The colored allocator is meant as an alternative to the buddy allocator because
+its allocation policy is by definition incompatible with the generic one. Since
+the Xen heap is not colored yet, we need to support the coexistence of the two
+allocators and some memory must be left for the buddy one. Buddy memory
+reservation is configured via Kconfig or via command-line.
+
 Known issues and limitations
 ****************************
 
@@ -207,3 +223,24 @@ In the domain configuration, "xen,static-mem" allows memory to be statically
 allocated to the domain. This isn't possible when LLC coloring is enabled,
 because that memory can't be guaranteed to use only colors assigned to the
 domain.
+
+Cache coloring is intended only for embedded systems
+####################################################
+
+The current implementation aims to satisfy the need of predictability in
+embedded systems with small amount of memory to be managed in a colored way.
+Given that, some shortcuts are taken in the development. Expect worse
+performances on larger systems.
+
+Colored allocator can only make use of order-0 pages
+####################################################
+
+The cache coloring technique relies on memory mappings and on the smallest
+mapping granularity to achieve the maximum number of colors (cache partitions)
+possible. This granularity is what is normally called a page and, in Xen
+terminology, the order-0 page is the smallest one. The fairly simple
+colored allocator currently implemented, makes use only of such pages.
+It must be said that a more complex one could, in theory, adopt higher order
+pages if the colors selection contained adjacent colors. Two subsequent colors,
+for example, can be represented by an order-1 page, four colors correspond to
+an order-2 page, etc.
diff --git a/docs/misc/xen-command-line.pandoc b/docs/misc/xen-command-line.pandoc
index 2e8c9dab25..cd43eccc5d 100644
--- a/docs/misc/xen-command-line.pandoc
+++ b/docs/misc/xen-command-line.pandoc
@@ -270,6 +270,20 @@ and not running softirqs. Reduce this if softirqs are not being run frequently
 enough. Setting this to a high value may cause boot failure, particularly if
 the NMI watchdog is also enabled.
 
+### buddy-alloc-size (arm64)
+> `= <size>`
+
+> Default: `64M`
+
+Amount of memory reserved for the buddy allocator when colored allocator is
+active. This option is available only when `CONFIG_LLC_COLORING` is enabled.
+The colored allocator is meant as an alternative to the buddy allocator,
+because its allocation policy is by definition incompatible with the generic
+one. Since the Xen heap systems is not colored yet, we need to support the
+coexistence of the two allocators for now. This parameter, which is optional
+and for expert only, it's used to set the amount of memory reserved to the
+buddy allocator.
+
 ### cet
     = List of [ <bool>, shstk=<bool>, ibt=<bool> ]
 
diff --git a/xen/arch/arm/include/asm/mm.h b/xen/arch/arm/include/asm/mm.h
index 59b774b7b8..f91ff088f6 100644
--- a/xen/arch/arm/include/asm/mm.h
+++ b/xen/arch/arm/include/asm/mm.h
@@ -145,6 +145,11 @@ struct page_info
 #else
 #define PGC_static     0
 #endif
+#ifdef CONFIG_LLC_COLORING
+/* Page is cache colored */
+#define _PGC_colored      PG_shift(4)
+#define PGC_colored       PG_mask(1, 4)
+#endif
 /* ... */
 /* Page is broken? */
 #define _PGC_broken       PG_shift(7)
diff --git a/xen/common/Kconfig b/xen/common/Kconfig
index b4ec6893be..6166327f4d 100644
--- a/xen/common/Kconfig
+++ b/xen/common/Kconfig
@@ -537,4 +537,12 @@ config LLC_COLORS_ORDER
 	  The default value corresponds to an 8 MiB 16-ways LLC, which should be
 	  more than what's needed in the general case.
 
+config BUDDY_ALLOCATOR_SIZE
+	int "Buddy allocator reserved memory size (MiB)"
+	default "64"
+	depends on LLC_COLORING
+	help
+	  Amount of memory reserved for the buddy allocator to serve Xen heap,
+	  working alongside the colored one.
+
 endmenu
diff --git a/xen/common/llc-coloring.c b/xen/common/llc-coloring.c
index 5a0e3bac59..bebd6e2056 100644
--- a/xen/common/llc-coloring.c
+++ b/xen/common/llc-coloring.c
@@ -36,6 +36,9 @@ static unsigned int __ro_after_init default_colors[NR_LLC_COLORS];
 static unsigned int __initdata dom0_colors[NR_LLC_COLORS];
 static unsigned int __initdata dom0_num_colors;
 
+#define mfn_color_mask              (max_nr_colors - 1)
+#define mfn_to_color(mfn)           (mfn_x(mfn) & mfn_color_mask)
+
 /*
  * Parse the coloring configuration given in the buf string, following the
  * syntax below.
@@ -322,6 +325,16 @@ int __init domain_set_llc_colors_from_str(struct domain *d, const char *str)
     return 0;
 }
 
+unsigned int page_to_llc_color(const struct page_info *pg)
+{
+    return mfn_to_color(page_to_mfn(pg));
+}
+
+unsigned int get_max_nr_llc_colors(void)
+{
+    return max_nr_colors;
+}
+
 /*
  * Local variables:
  * mode: C
diff --git a/xen/common/page_alloc.c b/xen/common/page_alloc.c
index 6dc8e0d5c9..1bf070c8c5 100644
--- a/xen/common/page_alloc.c
+++ b/xen/common/page_alloc.c
@@ -139,6 +139,7 @@
 #include <xen/softirq.h>
 #include <xen/spinlock.h>
 #include <xen/vm_event.h>
+#include <xen/xvmalloc.h>
 
 #include <asm/flushtlb.h>
 #include <asm/page.h>
@@ -160,11 +161,15 @@
 #define PGC_static 0
 #endif
 
-#define PGC_no_buddy_merge PGC_static
+#ifndef PGC_colored
+#define PGC_colored 0
+#endif
+
+#define PGC_no_buddy_merge (PGC_static | PGC_colored)
 /*
  * Flags that are preserved in assign_pages() (and only there)
  */
-#define PGC_preserved (PGC_extra | PGC_static)
+#define PGC_preserved (PGC_extra | PGC_static | PGC_colored)
 
 #ifndef PGT_TYPE_INFO_INITIALIZER
 #define PGT_TYPE_INFO_INITIALIZER 0
@@ -1480,6 +1485,8 @@ static bool mark_page_free(struct page_info *pg, mfn_t mfn)
     return pg_offlined;
 }
 
+static void free_color_heap_page(struct page_info *pg, bool need_scrub);
+
 /* Free 2^@order set of pages. */
 static void free_heap_pages(
     struct page_info *pg, unsigned int order, bool need_scrub)
@@ -1504,6 +1511,15 @@ static void free_heap_pages(
             pg[i].count_info |= PGC_need_scrub;
             poison_one_page(&pg[i]);
         }
+
+        if ( pg->count_info & PGC_colored )
+        {
+            ASSERT(order == 0);
+
+            free_color_heap_page(pg, need_scrub);
+            spin_unlock(&heap_lock);
+            return;
+        }
     }
 
     avail[node][zone] += 1 << order;
@@ -1968,6 +1984,157 @@ static unsigned long avail_heap_pages(
     return free_pages;
 }
 
+/*************************
+ * COLORED SIDE-ALLOCATOR
+ *
+ * Pages are grouped by LLC color in lists which are globally referred to as the
+ * color heap. Lists are populated in end_boot_allocator().
+ * After initialization there will be N lists where N is the number of
+ * available colors on the platform.
+ */
+static struct page_list_head *__ro_after_init _color_heap;
+#define color_heap(color) (&_color_heap[color])
+
+static unsigned long *__ro_after_init free_colored_pages;
+
+#ifdef CONFIG_LLC_COLORING
+#define domain_num_llc_colors(d) ((d)->num_llc_colors)
+#define domain_llc_color(d, i)   ((d)->llc_colors[i])
+
+/* Memory required for buddy allocator to work with colored one */
+static unsigned long __initdata buddy_alloc_size =
+    MB(CONFIG_BUDDY_ALLOCATOR_SIZE);
+size_param("buddy-alloc-size", buddy_alloc_size);
+#else
+#define domain_num_llc_colors(d) 0
+#define domain_llc_color(d, i)   0
+#endif
+
+static void free_color_heap_page(struct page_info *pg, bool need_scrub)
+{
+    unsigned int color;
+
+    color = page_to_llc_color(pg);
+    free_colored_pages[color]++;
+    /*
+     * Head insertion allows re-using cache-hot pages in configurations without
+     * sharing of colors.
+     */
+    page_list_add(pg, color_heap(color));
+}
+
+static struct page_info *alloc_color_heap_page(unsigned int memflags,
+                                               const struct domain *d)
+{
+    struct page_info *pg = NULL;
+    unsigned int i, color = 0;
+    unsigned long max = 0;
+    bool need_tlbflush = false;
+    uint32_t tlbflush_timestamp = 0;
+    bool need_scrub;
+
+    if ( memflags & ~(MEMF_no_refcount | MEMF_no_owner | MEMF_no_tlbflush |
+                      MEMF_no_icache_flush | MEMF_no_scrub) )
+        return NULL;
+
+    spin_lock(&heap_lock);
+
+    for ( i = 0; i < domain_num_llc_colors(d); i++ )
+    {
+        unsigned long free = free_colored_pages[domain_llc_color(d, i)];
+
+        if ( free > max )
+        {
+            color = domain_llc_color(d, i);
+            pg = page_list_first(color_heap(color));
+            max = free;
+        }
+    }
+
+    if ( !pg )
+    {
+        spin_unlock(&heap_lock);
+        return NULL;
+    }
+
+    need_scrub = pg->count_info & PGC_need_scrub;
+    pg->count_info = PGC_state_inuse | (pg->count_info & PGC_colored);
+    free_colored_pages[color]--;
+    page_list_del(pg, color_heap(color));
+
+    if ( !(memflags & MEMF_no_tlbflush) )
+        accumulate_tlbflush(&need_tlbflush, pg, &tlbflush_timestamp);
+
+    init_free_page_fields(pg);
+
+    spin_unlock(&heap_lock);
+
+    if ( !(memflags & MEMF_no_scrub) )
+    {
+        if ( need_scrub )
+            scrub_one_page(pg);
+        else
+            check_one_page(pg);
+    }
+
+    if ( need_tlbflush )
+        filtered_flush_tlb_mask(tlbflush_timestamp);
+
+    flush_page_to_ram(mfn_x(page_to_mfn(pg)),
+                      !(memflags & MEMF_no_icache_flush));
+
+    return pg;
+}
+
+static void __init init_color_heap_pages(struct page_info *pg,
+                                         unsigned long nr_pages)
+{
+    unsigned long i;
+    bool need_scrub = opt_bootscrub == BOOTSCRUB_IDLE;
+
+#ifdef CONFIG_LLC_COLORING
+    if ( buddy_alloc_size >= PAGE_SIZE )
+    {
+        unsigned long buddy_pages = min(PFN_DOWN(buddy_alloc_size), nr_pages);
+
+        init_heap_pages(pg, buddy_pages);
+        nr_pages -= buddy_pages;
+        buddy_alloc_size -= buddy_pages << PAGE_SHIFT;
+        pg += buddy_pages;
+    }
+#endif
+
+    if ( !_color_heap )
+    {
+        unsigned int max_nr_colors = get_max_nr_llc_colors();
+
+        _color_heap = xvmalloc_array(struct page_list_head, max_nr_colors);
+        free_colored_pages = xvzalloc_array(unsigned long, max_nr_colors);
+        if ( !_color_heap || !free_colored_pages )
+            panic("Can't allocate colored heap. Buddy reserved size is too low");
+
+        for ( i = 0; i < max_nr_colors; i++ )
+            INIT_PAGE_LIST_HEAD(color_heap(i));
+    }
+
+    for ( i = 0; i < nr_pages; i++ )
+    {
+        pg[i].count_info = PGC_colored;
+        free_color_heap_page(&pg[i], need_scrub);
+    }
+}
+
+static void dump_color_heap(void)
+{
+    unsigned int color;
+
+    printk("Dumping color heap info\n");
+    for ( color = 0; color < get_max_nr_llc_colors(); color++ )
+        if ( free_colored_pages[color] > 0 )
+            printk("Color heap[%u]: %lu pages\n",
+                   color, free_colored_pages[color]);
+}
+
 void __init end_boot_allocator(void)
 {
     unsigned int i;
@@ -1987,7 +2154,13 @@ void __init end_boot_allocator(void)
     for ( i = nr_bootmem_regions; i-- > 0; )
     {
         struct bootmem_region *r = &bootmem_region_list[i];
-        if ( r->s < r->e )
+
+        if ( r->s >= r->e )
+            continue;
+
+        if ( llc_coloring_enabled )
+            init_color_heap_pages(mfn_to_page(_mfn(r->s)), r->e - r->s);
+        else
             init_heap_pages(mfn_to_page(_mfn(r->s)), r->e - r->s);
     }
     nr_bootmem_regions = 0;
@@ -2483,7 +2656,14 @@ struct page_info *alloc_domheap_pages(
     if ( memflags & MEMF_no_owner )
         memflags |= MEMF_no_refcount;
 
-    if ( !dma_bitsize )
+    /* Only domains are supported for coloring */
+    if ( d && llc_coloring_enabled )
+    {
+        /* Colored allocation must be done on 0 order */
+        if ( order || (pg = alloc_color_heap_page(memflags, d)) == NULL )
+            return NULL;
+    }
+    else if ( !dma_bitsize )
         memflags &= ~MEMF_no_dma;
     else if ( (dma_zone = bits_to_zone(dma_bitsize)) < zone_hi )
         pg = alloc_heap_pages(dma_zone + 1, zone_hi, order, memflags, d);
@@ -2686,6 +2866,9 @@ static void cf_check dump_heap(unsigned char key)
             continue;
         printk("Node %d has %lu unscrubbed pages\n", i, node_need_scrub[i]);
     }
+
+    if ( llc_coloring_enabled )
+        dump_color_heap();
 }
 
 static __init int cf_check register_heap_trigger(void)
diff --git a/xen/include/xen/llc-coloring.h b/xen/include/xen/llc-coloring.h
index 5d1355b3c9..1216d1fbd4 100644
--- a/xen/include/xen/llc-coloring.h
+++ b/xen/include/xen/llc-coloring.h
@@ -11,6 +11,7 @@
 #include <xen/types.h>
 
 struct domain;
+struct page_info;
 struct xen_domctl_set_llc_colors;
 
 #ifdef CONFIG_LLC_COLORING
@@ -35,6 +36,8 @@ int dom0_set_llc_colors(struct domain *d);
 int domain_set_llc_colors(struct domain *d,
                           const struct xen_domctl_set_llc_colors *config);
 int domain_set_llc_colors_from_str(struct domain *d, const char *str);
+unsigned int page_to_llc_color(const struct page_info *pg);
+unsigned int get_max_nr_llc_colors(void);
 
 #endif /* __XEN_LLC_COLORING_H__ */
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Dec 20 07:34:29 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 20 Dec 2024 07:34:29 +0000
Received: from list by lists.xenproject.org with outflank-mailman.861649.1273639 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tOXWn-0007Wm-LE; Fri, 20 Dec 2024 07:34:29 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 861649.1273639; Fri, 20 Dec 2024 07:34:29 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tOXWn-0007We-Id; Fri, 20 Dec 2024 07:34:29 +0000
Received: by outflank-mailman (input) for mailman id 861649;
 Fri, 20 Dec 2024 07:34:28 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tOXWm-0007WR-EN
 for xen-changelog@lists.xenproject.org; Fri, 20 Dec 2024 07:34:28 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tOXWm-00D3Uq-0N
 for xen-changelog@lists.xenproject.org;
 Fri, 20 Dec 2024 07:34:28 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tOXWm-005NGV-1A
 for xen-changelog@lists.xenproject.org;
 Fri, 20 Dec 2024 07:34:28 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=tzuUUb8bSu9q+GAVRKUr//UDeKDDHyYsTLvNdUSJ5yE=; b=UseBz4CFN1gW1UQcryMAxY5ujU
	p+po1WBa61o98PWOoUYCcZJC/lwH2jyb1xDxLYoEAaNIgSclrZ0KhsosdKNZMfWgsxKOy4JlBw3Dy
	rBHmCgtTeMlCCV7Pw4qSwsI2dAkjJJW9EVIy4EITWzWOCX2IhwBRZgM7wUPPQ6TzVEOc=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/arm: add Xen cache colors command line parameter
Message-Id: <E1tOXWm-005NGV-1A@xenbits.xenproject.org>
Date: Fri, 20 Dec 2024 07:34:28 +0000

commit 0975bab5ea9dcd52d5dc9431d2c77d4a6f1b690f
Author:     Luca Miccio <lucmiccio@gmail.com>
AuthorDate: Tue Dec 17 18:06:35 2024 +0100
Commit:     Michal Orzel <michal.orzel@amd.com>
CommitDate: Thu Dec 19 19:24:31 2024 +0100

    xen/arm: add Xen cache colors command line parameter
    
    Add a new command line parameter to configure Xen cache colors.
    These colors are dumped together with other coloring info.
    
    Benchmarking the VM interrupt response time provides an estimation of
    LLC usage by Xen's most latency-critical runtime task. Results on Arm
    Cortex-A53 on Xilinx Zynq UltraScale+ XCZU9EG show that one color, which
    reserves 64 KiB of L2, is enough to attain best responsiveness:
    - Xen 1 color latency:  3.1 us
    - Xen 2 color latency:  3.1 us
    
    Since this is the most common target for Arm cache coloring, the default
    amount of Xen colors is set to one.
    
    More colors are instead very likely to be needed on processors whose L1
    cache is physically-indexed and physically-tagged, such as Cortex-A57.
    In such cases, coloring applies to L1 also, and there typically are two
    distinct L1-colors. Therefore, reserving only one color for Xen would
    senselessly partitions a cache memory that is already private, i.e.
    underutilize it.
    
    Signed-off-by: Luca Miccio <lucmiccio@gmail.com>
    Signed-off-by: Marco Solieri <marco.solieri@minervasys.tech>
    Signed-off-by: Carlo Nonato <carlo.nonato@minervasys.tech>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 docs/misc/cache-coloring.rst      |  2 ++
 docs/misc/xen-command-line.pandoc | 10 ++++++++++
 xen/common/llc-coloring.c         | 29 +++++++++++++++++++++++++++++
 3 files changed, 41 insertions(+)

diff --git a/docs/misc/cache-coloring.rst b/docs/misc/cache-coloring.rst
index 5224b27afe..e156062aa2 100644
--- a/docs/misc/cache-coloring.rst
+++ b/docs/misc/cache-coloring.rst
@@ -115,6 +115,8 @@ Specific documentation is available at `docs/misc/xen-command-line.pandoc`.
 +----------------------+-------------------------------+
 | ``buddy-alloc-size`` | Buddy allocator reserved size |
 +----------------------+-------------------------------+
+| ``xen-llc-colors``   | Xen color configuration       |
++----------------------+-------------------------------+
 
 Colors selection format
 ***********************
diff --git a/docs/misc/xen-command-line.pandoc b/docs/misc/xen-command-line.pandoc
index cd43eccc5d..1dd8f714d3 100644
--- a/docs/misc/xen-command-line.pandoc
+++ b/docs/misc/xen-command-line.pandoc
@@ -2927,6 +2927,16 @@ mode.
 **WARNING: `x2apic_phys` is deprecated and superseded by `x2apic-mode`.
 The latter takes precedence if both are set.**
 
+### xen-llc-colors (arm64)
+> `= List of [ <integer> | <integer>-<integer> ]`
+
+> Default: `0: the lowermost color`
+
+Specify Xen LLC color configuration. This options is available only when
+`CONFIG_LLC_COLORING` is enabled.
+Two colors are most likely needed on platforms where private caches are
+physically indexed, e.g. the L1 instruction cache of the Arm Cortex-A57.
+
 ### xenheap_megabytes (arm32)
 > `= <size>`
 
diff --git a/xen/common/llc-coloring.c b/xen/common/llc-coloring.c
index bebd6e2056..0cfaa77a2b 100644
--- a/xen/common/llc-coloring.c
+++ b/xen/common/llc-coloring.c
@@ -13,6 +13,7 @@
 #include <xen/types.h>
 
 #define NR_LLC_COLORS          (1U << CONFIG_LLC_COLORS_ORDER)
+#define XEN_DEFAULT_NUM_COLORS 1
 
 /*
  * -1: not specified (disabled unless llc-size and llc-nr-ways present)
@@ -36,6 +37,9 @@ static unsigned int __ro_after_init default_colors[NR_LLC_COLORS];
 static unsigned int __initdata dom0_colors[NR_LLC_COLORS];
 static unsigned int __initdata dom0_num_colors;
 
+static unsigned int __ro_after_init xen_colors[NR_LLC_COLORS];
+static unsigned int __ro_after_init xen_num_colors;
+
 #define mfn_color_mask              (max_nr_colors - 1)
 #define mfn_to_color(mfn)           (mfn_x(mfn) & mfn_color_mask)
 
@@ -94,6 +98,13 @@ static int __init parse_dom0_colors(const char *s)
 }
 custom_param("dom0-llc-colors", parse_dom0_colors);
 
+static int __init parse_xen_colors(const char *s)
+{
+    return parse_color_config(s, xen_colors, ARRAY_SIZE(xen_colors),
+                              &xen_num_colors);
+}
+custom_param("xen-llc-colors", parse_xen_colors);
+
 static void print_colors(const unsigned int colors[], unsigned int num_colors)
 {
     unsigned int i;
@@ -178,6 +189,22 @@ void __init llc_coloring_init(void)
     for ( i = 0; i < max_nr_colors; i++ )
         default_colors[i] = i;
 
+    if ( !xen_num_colors )
+    {
+        unsigned int i;
+
+        xen_num_colors = MIN(XEN_DEFAULT_NUM_COLORS, max_nr_colors);
+
+        printk(XENLOG_WARNING
+               "Xen LLC color config not found. Using first %u colors\n",
+               xen_num_colors);
+        for ( i = 0; i < xen_num_colors; i++ )
+            xen_colors[i] = i;
+    }
+    else if ( xen_num_colors > max_nr_colors ||
+              !check_colors(xen_colors, xen_num_colors) )
+        panic("Bad LLC color config for Xen\n");
+
     arch_llc_coloring_init();
 }
 
@@ -188,6 +215,8 @@ void dump_llc_coloring_info(void)
 
     printk("LLC coloring info:\n");
     printk("    Number of LLC colors supported: %u\n", max_nr_colors);
+    printk("    Xen LLC colors (%u): ", xen_num_colors);
+    print_colors(xen_colors, xen_num_colors);
 }
 
 void domain_dump_llc_colors(const struct domain *d)
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Dec 20 07:34:39 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 20 Dec 2024 07:34:39 +0000
Received: from list by lists.xenproject.org with outflank-mailman.861650.1273643 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tOXWx-0007Zy-My; Fri, 20 Dec 2024 07:34:39 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 861650.1273643; Fri, 20 Dec 2024 07:34:39 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tOXWx-0007Zo-K5; Fri, 20 Dec 2024 07:34:39 +0000
Received: by outflank-mailman (input) for mailman id 861650;
 Fri, 20 Dec 2024 07:34:38 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tOXWw-0007Za-HI
 for xen-changelog@lists.xenproject.org; Fri, 20 Dec 2024 07:34:38 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tOXWw-00D3Uw-0f
 for xen-changelog@lists.xenproject.org;
 Fri, 20 Dec 2024 07:34:38 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tOXWw-005NH8-1W
 for xen-changelog@lists.xenproject.org;
 Fri, 20 Dec 2024 07:34:38 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=ZTMAnVy68DWlGV6Nd9Rent0Jv8EiS91Qw61eWyJNv04=; b=zjfQOR/+b7k3QCc0AivOk4Wnut
	XPbcMZg50lLgzTQe8fenXPdS6T4aexQ88PC9SCNV8FFynMzMaWG1IT0d9TkIZe+GH4LrEqT+kj0gL
	xWQJy+H1yGYlv+wTKsye5yX2q758otlHIOrnBDuCtlOe9gAoJ7+3JUTnyvDBBLhviSgU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/arm: make consider_modules() available for xen relocation
Message-Id: <E1tOXWw-005NH8-1W@xenbits.xenproject.org>
Date: Fri, 20 Dec 2024 07:34:38 +0000

commit f376ff0e4fc642281c49243c4895e31122db6bd2
Author:     Carlo Nonato <carlo.nonato@minervasys.tech>
AuthorDate: Tue Dec 17 18:06:36 2024 +0100
Commit:     Michal Orzel <michal.orzel@amd.com>
CommitDate: Thu Dec 19 19:24:31 2024 +0100

    xen/arm: make consider_modules() available for xen relocation
    
    Cache coloring must physically relocate Xen in order to color the hypervisor
    and consider_modules() is a key function that is needed to find a new
    available physical address.
    
    672d67f339c0 ("xen/arm: Split MMU-specific setup_mm() and related code out")
    moved consider_modules() under arm32. Move it to mmu/setup.c and make it
    non-static so that it can be used outside.
    
    Signed-off-by: Carlo Nonato <carlo.nonato@minervasys.tech>
    Reviewed-by: Michal Orzel <michal.orzel@amd.com>
---
 xen/arch/arm/arm32/mmu/mm.c      | 95 +---------------------------------------
 xen/arch/arm/include/asm/setup.h |  3 ++
 xen/arch/arm/mmu/setup.c         | 94 +++++++++++++++++++++++++++++++++++++++
 3 files changed, 98 insertions(+), 94 deletions(-)

diff --git a/xen/arch/arm/arm32/mmu/mm.c b/xen/arch/arm/arm32/mmu/mm.c
index 0824d61323..956693232a 100644
--- a/xen/arch/arm/arm32/mmu/mm.c
+++ b/xen/arch/arm/arm32/mmu/mm.c
@@ -7,6 +7,7 @@
 #include <xen/param.h>
 #include <xen/pfn.h>
 #include <asm/fixmap.h>
+#include <asm/setup.h>
 #include <asm/static-memory.h>
 #include <asm/static-shmem.h>
 
@@ -31,100 +32,6 @@ static void __init setup_directmap_mappings(unsigned long base_mfn,
     directmap_virt_end = XENHEAP_VIRT_START + nr_mfns * PAGE_SIZE;
 }
 
-/*
- * Returns the end address of the highest region in the range s..e
- * with required size and alignment that does not conflict with the
- * modules from first_mod to nr_modules.
- *
- * For non-recursive callers first_mod should normally be 0 (all
- * modules and Xen itself) or 1 (all modules but not Xen).
- */
-static paddr_t __init consider_modules(paddr_t s, paddr_t e,
-                                       uint32_t size, paddr_t align,
-                                       int first_mod)
-{
-    const struct membanks *reserved_mem = bootinfo_get_reserved_mem();
-#ifdef CONFIG_STATIC_SHM
-    const struct membanks *shmem = bootinfo_get_shmem();
-#endif
-    const struct bootmodules *mi = &bootinfo.modules;
-    int i;
-    int nr;
-
-    s = (s+align-1) & ~(align-1);
-    e = e & ~(align-1);
-
-    if ( s > e ||  e - s < size )
-        return 0;
-
-    /* First check the boot modules */
-    for ( i = first_mod; i < mi->nr_mods; i++ )
-    {
-        paddr_t mod_s = mi->module[i].start;
-        paddr_t mod_e = mod_s + mi->module[i].size;
-
-        if ( s < mod_e && mod_s < e )
-        {
-            mod_e = consider_modules(mod_e, e, size, align, i+1);
-            if ( mod_e )
-                return mod_e;
-
-            return consider_modules(s, mod_s, size, align, i+1);
-        }
-    }
-
-    /*
-     * i is the current bootmodule we are evaluating, across all
-     * possible kinds of bootmodules.
-     *
-     * When retrieving the corresponding reserved-memory addresses, we
-     * need to index the reserved_mem bank starting from 0, and only counting
-     * the reserved-memory modules. Hence, we need to use i - nr.
-     */
-    nr = mi->nr_mods;
-    for ( ; i - nr < reserved_mem->nr_banks; i++ )
-    {
-        paddr_t r_s = reserved_mem->bank[i - nr].start;
-        paddr_t r_e = r_s + reserved_mem->bank[i - nr].size;
-
-        if ( s < r_e && r_s < e )
-        {
-            r_e = consider_modules(r_e, e, size, align, i + 1);
-            if ( r_e )
-                return r_e;
-
-            return consider_modules(s, r_s, size, align, i + 1);
-        }
-    }
-
-#ifdef CONFIG_STATIC_SHM
-    nr += reserved_mem->nr_banks;
-    for ( ; i - nr < shmem->nr_banks; i++ )
-    {
-        paddr_t r_s, r_e;
-
-        r_s = shmem->bank[i - nr].start;
-
-        /* Shared memory banks can contain INVALID_PADDR as start */
-        if ( INVALID_PADDR == r_s )
-            continue;
-
-        r_e = r_s + shmem->bank[i - nr].size;
-
-        if ( s < r_e && r_s < e )
-        {
-            r_e = consider_modules(r_e, e, size, align, i + 1);
-            if ( r_e )
-                return r_e;
-
-            return consider_modules(s, r_s, size, align, i + 1);
-        }
-    }
-#endif
-
-    return e;
-}
-
 /*
  * Find a contiguous region that fits in the static heap region with
  * required size and alignment, and return the end address of the region
diff --git a/xen/arch/arm/include/asm/setup.h b/xen/arch/arm/include/asm/setup.h
index a5a80d9b47..6cf272c160 100644
--- a/xen/arch/arm/include/asm/setup.h
+++ b/xen/arch/arm/include/asm/setup.h
@@ -81,6 +81,9 @@ struct init_info
     unsigned int cpuid;
 };
 
+paddr_t consider_modules(paddr_t s, paddr_t e, uint32_t size, paddr_t align,
+                         int first_mod);
+
 #endif
 /*
  * Local variables:
diff --git a/xen/arch/arm/mmu/setup.c b/xen/arch/arm/mmu/setup.c
index 8c87649bc8..041e3fc1b6 100644
--- a/xen/arch/arm/mmu/setup.c
+++ b/xen/arch/arm/mmu/setup.c
@@ -222,6 +222,100 @@ static void xen_pt_enforce_wnx(void)
     flush_xen_tlb_local();
 }
 
+/*
+ * Returns the end address of the highest region in the range s..e
+ * with required size and alignment that does not conflict with the
+ * modules from first_mod to nr_modules.
+ *
+ * For non-recursive callers first_mod should normally be 0 (all
+ * modules and Xen itself) or 1 (all modules but not Xen).
+ */
+paddr_t __init consider_modules(paddr_t s, paddr_t e,
+                                uint32_t size, paddr_t align,
+                                int first_mod)
+{
+    const struct membanks *reserved_mem = bootinfo_get_reserved_mem();
+#ifdef CONFIG_STATIC_SHM
+    const struct membanks *shmem = bootinfo_get_shmem();
+#endif
+    const struct bootmodules *mi = &bootinfo.modules;
+    int i;
+    int nr;
+
+    s = (s+align-1) & ~(align-1);
+    e = e & ~(align-1);
+
+    if ( s > e ||  e - s < size )
+        return 0;
+
+    /* First check the boot modules */
+    for ( i = first_mod; i < mi->nr_mods; i++ )
+    {
+        paddr_t mod_s = mi->module[i].start;
+        paddr_t mod_e = mod_s + mi->module[i].size;
+
+        if ( s < mod_e && mod_s < e )
+        {
+            mod_e = consider_modules(mod_e, e, size, align, i+1);
+            if ( mod_e )
+                return mod_e;
+
+            return consider_modules(s, mod_s, size, align, i+1);
+        }
+    }
+
+    /*
+     * i is the current bootmodule we are evaluating, across all
+     * possible kinds of bootmodules.
+     *
+     * When retrieving the corresponding reserved-memory addresses, we
+     * need to index the reserved_mem bank starting from 0, and only counting
+     * the reserved-memory modules. Hence, we need to use i - nr.
+     */
+    nr = mi->nr_mods;
+    for ( ; i - nr < reserved_mem->nr_banks; i++ )
+    {
+        paddr_t r_s = reserved_mem->bank[i - nr].start;
+        paddr_t r_e = r_s + reserved_mem->bank[i - nr].size;
+
+        if ( s < r_e && r_s < e )
+        {
+            r_e = consider_modules(r_e, e, size, align, i + 1);
+            if ( r_e )
+                return r_e;
+
+            return consider_modules(s, r_s, size, align, i + 1);
+        }
+    }
+
+#ifdef CONFIG_STATIC_SHM
+    nr += reserved_mem->nr_banks;
+    for ( ; i - nr < shmem->nr_banks; i++ )
+    {
+        paddr_t r_s, r_e;
+
+        r_s = shmem->bank[i - nr].start;
+
+        /* Shared memory banks can contain INVALID_PADDR as start */
+        if ( INVALID_PADDR == r_s )
+            continue;
+
+        r_e = r_s + shmem->bank[i - nr].size;
+
+        if ( s < r_e && r_s < e )
+        {
+            r_e = consider_modules(r_e, e, size, align, i + 1);
+            if ( r_e )
+                return r_e;
+
+            return consider_modules(s, r_s, size, align, i + 1);
+        }
+    }
+#endif
+
+    return e;
+}
+
 /*
  * Boot-time pagetable setup.
  * Changes here may need matching changes in head.S
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Dec 20 07:34:49 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 20 Dec 2024 07:34:49 +0000
Received: from list by lists.xenproject.org with outflank-mailman.861651.1273647 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tOXX7-0007dA-PW; Fri, 20 Dec 2024 07:34:49 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 861651.1273647; Fri, 20 Dec 2024 07:34:49 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tOXX7-0007d3-Mz; Fri, 20 Dec 2024 07:34:49 +0000
Received: by outflank-mailman (input) for mailman id 861651;
 Fri, 20 Dec 2024 07:34:48 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tOXX6-0007co-Ks
 for xen-changelog@lists.xenproject.org; Fri, 20 Dec 2024 07:34:48 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tOXX6-00D3VK-11
 for xen-changelog@lists.xenproject.org;
 Fri, 20 Dec 2024 07:34:48 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tOXX6-005NHz-1p
 for xen-changelog@lists.xenproject.org;
 Fri, 20 Dec 2024 07:34:48 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=xtS97URl+wo6TpoOkt417YxfjOyICKGH+tprsMeTtr8=; b=f/w40j71f+IHwzXzAFxgsDDHr1
	CIe/xgffcFp3oPsaD+1Yh5RS7WtrSBmGLBIFsBrGgIOxJ0DnDc53U6MLaeWw+H94L24zNv4y/iwvS
	LGf3hrDb+yaav6EU8BisjSHi0woMh1/3x/nZn6nZLvnVEzCqPFRVH5EyBHTYXKQH3Qt8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/arm: add cache coloring support for Xen image
Message-Id: <E1tOXX6-005NHz-1p@xenbits.xenproject.org>
Date: Fri, 20 Dec 2024 07:34:48 +0000

commit e7a80636f16eb63299a6ffd6d41958e81c163991
Author:     Carlo Nonato <carlo.nonato@minervasys.tech>
AuthorDate: Tue Dec 17 18:06:37 2024 +0100
Commit:     Michal Orzel <michal.orzel@amd.com>
CommitDate: Thu Dec 19 19:24:31 2024 +0100

    xen/arm: add cache coloring support for Xen image
    
    Xen image is relocated to a new colored physical space. Some relocation
    functionalities must be brought back:
    - the virtual address of the new space is taken from 0c18fb76323b
      ("xen/arm: Remove unused BOOT_RELOC_VIRT_START").
    - relocate_xen() and get_xen_paddr() are taken from f60658c6ae47
      ("xen/arm: Stop relocating Xen").
    
    setup_pagetables() must be adapted for coloring and for relocation. Runtime
    page tables are used to map the colored space, but they are also linked in
    boot tables so that the new space is temporarily available for relocation.
    This implies that Xen protection must happen after the copy.
    
    Finally, since the alternative framework needs to remap the Xen text and
    inittext sections, this operation must be done in a coloring-aware way.
    The function xen_remap_colored() is introduced for that.
    
    Signed-off-by: Carlo Nonato <carlo.nonato@minervasys.tech>
    Signed-off-by: Marco Solieri <marco.solieri@minervasys.tech>
    Reviewed-by: Jan Beulich <jbeulich@suse.com> # common
    Reviewed-by: Michal Orzel <michal.orzel@amd.com>
---
 xen/arch/arm/alternative.c            |  26 ++++++++-
 xen/arch/arm/arm64/mmu/head.S         |  58 +++++++++++++++++-
 xen/arch/arm/arm64/mmu/mm.c           |  34 +++++++++++
 xen/arch/arm/include/asm/mmu/layout.h |   3 +
 xen/arch/arm/include/asm/mmu/mm.h     |   1 +
 xen/arch/arm/llc-coloring.c           |  63 ++++++++++++++++++++
 xen/arch/arm/mmu/setup.c              | 107 +++++++++++++++++++++++++++++-----
 xen/arch/arm/setup.c                  |  10 +++-
 xen/common/llc-coloring.c             |  18 ++++++
 xen/include/xen/llc-coloring.h        |  13 +++++
 10 files changed, 313 insertions(+), 20 deletions(-)

diff --git a/xen/arch/arm/alternative.c b/xen/arch/arm/alternative.c
index fec7dbd2cd..2c1af6e7e4 100644
--- a/xen/arch/arm/alternative.c
+++ b/xen/arch/arm/alternative.c
@@ -9,6 +9,7 @@
 #include <xen/init.h>
 #include <xen/types.h>
 #include <xen/kernel.h>
+#include <xen/llc-coloring.h>
 #include <xen/mm.h>
 #include <xen/vmap.h>
 #include <xen/smp.h>
@@ -191,6 +192,25 @@ static int __apply_alternatives_multi_stop(void *xenmap)
     return 0;
 }
 
+static void __init *xen_remap_colored(mfn_t xen_mfn, paddr_t xen_size)
+{
+    unsigned int i;
+    void *xenmap;
+    mfn_t *xen_colored_mfns, mfn;
+
+    xen_colored_mfns = xmalloc_array(mfn_t, xen_size >> PAGE_SHIFT);
+    if ( !xen_colored_mfns )
+        panic("Can't allocate LLC colored MFNs\n");
+
+    for_each_xen_colored_mfn ( xen_mfn, mfn, i )
+        xen_colored_mfns[i] = mfn;
+
+    xenmap = vmap(xen_colored_mfns, xen_size >> PAGE_SHIFT);
+    xfree(xen_colored_mfns);
+
+    return xenmap;
+}
+
 /*
  * This function should only be called during boot and before CPU0 jump
  * into the idle_loop.
@@ -209,7 +229,11 @@ void __init apply_alternatives_all(void)
      * The text and inittext section are read-only. So re-map Xen to
      * be able to patch the code.
      */
-    xenmap = vmap_contig(xen_mfn, 1U << xen_order);
+    if ( llc_coloring_enabled )
+        xenmap = xen_remap_colored(xen_mfn, xen_size);
+    else
+        xenmap = vmap_contig(xen_mfn, 1U << xen_order);
+
     /* Re-mapping Xen is not expected to fail during boot. */
     BUG_ON(!xenmap);
 
diff --git a/xen/arch/arm/arm64/mmu/head.S b/xen/arch/arm/arm64/mmu/head.S
index 665a51a337..634156f83d 100644
--- a/xen/arch/arm/arm64/mmu/head.S
+++ b/xen/arch/arm/arm64/mmu/head.S
@@ -428,6 +428,61 @@ FUNC_LOCAL(fail)
         b     1b
 END(fail)
 
+/*
+ * Copy Xen to new location and switch TTBR
+ * x0    ttbr
+ * x1    source address
+ * x2    destination address
+ * x3    length
+ *
+ * Source and destination must be word aligned, length is rounded up
+ * to a 16 byte boundary.
+ *
+ * MUST BE VERY CAREFUL when saving things to RAM over the copy
+ */
+FUNC(relocate_xen)
+        /*
+         * Copy 16 bytes at a time using:
+         *   x9: counter
+         *   x10: data
+         *   x11: data
+         *   x12: source
+         *   x13: destination
+         */
+        mov     x9, x3
+        mov     x12, x1
+        mov     x13, x2
+
+1:      ldp     x10, x11, [x12], #16
+        stp     x10, x11, [x13], #16
+
+        subs    x9, x9, #16
+        bgt     1b
+
+        /*
+         * Flush destination from dcache using:
+         *   x9: counter
+         *   x10: step
+         *   x11: vaddr
+         *
+         * This is to ensure data is visible to the instruction cache
+         */
+        dsb   sy
+
+        mov   x9, x3
+        ldr   x10, =dcache_line_bytes /* x10 := step */
+        ldr   x10, [x10]
+        mov   x11, x2
+
+1:      dc    cvau, x11
+
+        add   x11, x11, x10
+        subs  x9, x9, x10
+        bgt   1b
+
+        /* No need for dsb/isb because they are alredy done in switch_ttbr_id */
+        b switch_ttbr_id
+
 /*
  * Switch TTBR
  *
@@ -453,7 +508,8 @@ FUNC(switch_ttbr_id)
 
         /*
          * 5) Flush I-cache
-         * This should not be necessary but it is kept for safety.
+         * This should not be necessary in the general case, but it's needed
+         * for cache coloring because code is relocated in that case.
          */
         ic     iallu
         isb
diff --git a/xen/arch/arm/arm64/mmu/mm.c b/xen/arch/arm/arm64/mmu/mm.c
index 671eaadbc1..26361c4fe4 100644
--- a/xen/arch/arm/arm64/mmu/mm.c
+++ b/xen/arch/arm/arm64/mmu/mm.c
@@ -1,6 +1,7 @@
 /* SPDX-License-Identifier: GPL-2.0-only */
 
 #include <xen/init.h>
+#include <xen/llc-coloring.h>
 #include <xen/mm.h>
 #include <xen/pfn.h>
 
@@ -138,8 +139,41 @@ void update_boot_mapping(bool enable)
 }
 
 extern void switch_ttbr_id(uint64_t ttbr);
+extern void relocate_xen(uint64_t ttbr, void *src, void *dst, size_t len);
 
 typedef void (switch_ttbr_fn)(uint64_t ttbr);
+typedef void (relocate_xen_fn)(uint64_t ttbr, void *src, void *dst, size_t len);
+
+#ifdef CONFIG_LLC_COLORING
+void __init relocate_and_switch_ttbr(uint64_t ttbr)
+{
+    vaddr_t id_addr = virt_to_maddr(relocate_xen);
+    relocate_xen_fn *fn = (relocate_xen_fn *)id_addr;
+    lpae_t pte;
+
+    /* Enable the identity mapping in the boot page tables */
+    update_identity_mapping(true);
+
+    /* Enable the identity mapping in the runtime page tables */
+    pte = pte_of_xenaddr((vaddr_t)relocate_xen);
+    pte.pt.table = 1;
+    pte.pt.xn = 0;
+    pte.pt.ro = 1;
+    write_pte(&xen_third_id[third_table_offset(id_addr)], pte);
+
+    /* Relocate Xen and switch TTBR */
+    fn(ttbr, _start, (void *)BOOT_RELOC_VIRT_START, _end - _start);
+
+    /*
+     * Disable the identity mapping in the runtime page tables.
+     * Note it is not necessary to disable it in the boot page tables
+     * because they are not going to be used by this CPU anymore.
+     */
+    update_identity_mapping(false);
+}
+#else
+void __init relocate_and_switch_ttbr(uint64_t ttbr) {}
+#endif
 
 void __init switch_ttbr(uint64_t ttbr)
 {
diff --git a/xen/arch/arm/include/asm/mmu/layout.h b/xen/arch/arm/include/asm/mmu/layout.h
index a3b546465b..19c0ec63a5 100644
--- a/xen/arch/arm/include/asm/mmu/layout.h
+++ b/xen/arch/arm/include/asm/mmu/layout.h
@@ -30,6 +30,7 @@
  *  10M -  12M   Fixmap: special-purpose 4K mapping slots
  *  12M -  16M   Early boot mapping of FDT
  *  16M -  18M   Livepatch vmap (if compiled in)
+ *  16M -  24M   Cache-colored Xen text, data, bss (temporary, if compiled in)
  *
  *   1G -   2G   VMAP: ioremap and early_ioremap
  *
@@ -74,6 +75,8 @@
 #define BOOT_FDT_VIRT_START     (FIXMAP_VIRT_START + FIXMAP_VIRT_SIZE)
 #define BOOT_FDT_VIRT_SIZE      _AT(vaddr_t, MB(4))
 
+#define BOOT_RELOC_VIRT_START   (BOOT_FDT_VIRT_START + BOOT_FDT_VIRT_SIZE)
+
 #ifdef CONFIG_LIVEPATCH
 #define LIVEPATCH_VMAP_START    (BOOT_FDT_VIRT_START + BOOT_FDT_VIRT_SIZE)
 #define LIVEPATCH_VMAP_SIZE    _AT(vaddr_t, MB(2))
diff --git a/xen/arch/arm/include/asm/mmu/mm.h b/xen/arch/arm/include/asm/mmu/mm.h
index c5e03a66bf..f5a00558c4 100644
--- a/xen/arch/arm/include/asm/mmu/mm.h
+++ b/xen/arch/arm/include/asm/mmu/mm.h
@@ -31,6 +31,7 @@ void dump_pt_walk(paddr_t ttbr, paddr_t addr,
 
 /* Switch to a new root page-tables */
 extern void switch_ttbr(uint64_t ttbr);
+extern void relocate_and_switch_ttbr(uint64_t ttbr);
 
 #endif /* __ARM_MMU_MM_H__ */
 
diff --git a/xen/arch/arm/llc-coloring.c b/xen/arch/arm/llc-coloring.c
index 1c7b92bc45..99ac10b610 100644
--- a/xen/arch/arm/llc-coloring.c
+++ b/xen/arch/arm/llc-coloring.c
@@ -9,6 +9,7 @@
 #include <xen/llc-coloring.h>
 
 #include <asm/processor.h>
+#include <asm/setup.h>
 #include <asm/sysregs.h>
 #include <asm/system.h>
 
@@ -64,8 +65,70 @@ unsigned int __init get_llc_way_size(void)
     return line_size * num_sets;
 }
 
+/*
+ * get_xen_paddr - get physical address to relocate Xen to
+ *
+ * Xen is relocated to as near to the top of RAM as possible and
+ * aligned to a XEN_PADDR_ALIGN boundary.
+ */
+static paddr_t __init get_xen_paddr(paddr_t xen_size)
+{
+    const struct membanks *mem = bootinfo_get_mem();
+    paddr_t min_size, paddr = 0;
+    unsigned int i;
+
+    min_size = ROUNDUP(xen_size, XEN_PADDR_ALIGN);
+
+    /* Find the highest bank with enough space. */
+    for ( i = 0; i < mem->nr_banks; i++ )
+    {
+        const struct membank *bank = &mem->bank[i];
+        paddr_t s, e;
+
+        if ( bank->size >= min_size )
+        {
+            e = consider_modules(bank->start, bank->start + bank->size,
+                                 min_size, XEN_PADDR_ALIGN, 0);
+            if ( !e )
+                continue;
+
+#ifdef CONFIG_ARM_32
+            /* Xen must be under 4GB */
+            if ( e > GB(4) )
+                e = GB(4);
+            if ( e < bank->start )
+                continue;
+#endif
+
+            s = e - min_size;
+
+            if ( s > paddr )
+                paddr = s;
+        }
+    }
+
+    if ( !paddr )
+        panic("Not enough memory to relocate Xen\n");
+
+    printk("Placing Xen at 0x%"PRIpaddr"-0x%"PRIpaddr"\n",
+           paddr, paddr + min_size);
+
+    return paddr;
+}
+
+static paddr_t __init xen_colored_map_size(void)
+{
+    return ROUNDUP((_end - _start) * get_max_nr_llc_colors(), XEN_PADDR_ALIGN);
+}
+
 void __init arch_llc_coloring_init(void)
 {
+    struct bootmodule *xen_bootmodule = boot_module_find_by_kind(BOOTMOD_XEN);
+
+    BUG_ON(!xen_bootmodule);
+
+    xen_bootmodule->size = xen_colored_map_size();
+    xen_bootmodule->start = get_xen_paddr(xen_bootmodule->size);
 }
 
 /*
diff --git a/xen/arch/arm/mmu/setup.c b/xen/arch/arm/mmu/setup.c
index 041e3fc1b6..30afe97781 100644
--- a/xen/arch/arm/mmu/setup.c
+++ b/xen/arch/arm/mmu/setup.c
@@ -7,6 +7,7 @@
 
 #include <xen/init.h>
 #include <xen/libfdt/libfdt.h>
+#include <xen/llc-coloring.h>
 #include <xen/sections.h>
 #include <xen/sizes.h>
 #include <xen/vmap.h>
@@ -20,6 +21,9 @@
 #undef virt_to_mfn
 #define virt_to_mfn(va) _mfn(__virt_to_mfn(va))
 
+#define virt_to_reloc_virt(virt) \
+    (((vaddr_t)(virt)) - XEN_VIRT_START + BOOT_RELOC_VIRT_START)
+
 /* Main runtime page tables */
 
 /*
@@ -69,6 +73,7 @@ static void __init __maybe_unused build_assertions(void)
     /* 2MB aligned regions */
     BUILD_BUG_ON(XEN_VIRT_START & ~SECOND_MASK);
     BUILD_BUG_ON(FIXMAP_ADDR(0) & ~SECOND_MASK);
+    BUILD_BUG_ON(BOOT_RELOC_VIRT_START & ~SECOND_MASK);
     /* 1GB aligned regions */
 #ifdef CONFIG_ARM_32
     BUILD_BUG_ON(XENHEAP_VIRT_START & ~FIRST_MASK);
@@ -138,6 +143,9 @@ static void __init __maybe_unused build_assertions(void)
 
 lpae_t __init pte_of_xenaddr(vaddr_t va)
 {
+    if ( llc_coloring_enabled )
+        va = virt_to_reloc_virt(va);
+
     return mfn_to_xen_entry(virt_to_mfn(va), MT_NORMAL);
 }
 
@@ -316,6 +324,32 @@ paddr_t __init consider_modules(paddr_t s, paddr_t e,
     return e;
 }
 
+static void __init create_llc_coloring_mappings(void)
+{
+    lpae_t pte;
+    unsigned int i;
+    struct bootmodule *xen_bootmodule = boot_module_find_by_kind(BOOTMOD_XEN);
+    mfn_t start_mfn = maddr_to_mfn(xen_bootmodule->start), mfn;
+
+    for_each_xen_colored_mfn ( start_mfn, mfn, i )
+    {
+        pte = mfn_to_xen_entry(mfn, MT_NORMAL);
+        pte.pt.table = 1; /* level 3 mappings always have this bit set */
+        xen_xenmap[i] = pte;
+    }
+
+    for ( i = 0; i < XEN_NR_ENTRIES(2); i++ )
+    {
+        vaddr_t va = BOOT_RELOC_VIRT_START + (i << XEN_PT_LEVEL_SHIFT(2));
+
+        pte = mfn_to_xen_entry(virt_to_mfn(xen_xenmap +
+                                           i * XEN_PT_LPAE_ENTRIES),
+                               MT_NORMAL);
+        pte.pt.table = 1;
+        write_pte(&boot_second[second_table_offset(va)], pte);
+    }
+}
+
 /*
  * Boot-time pagetable setup.
  * Changes here may need matching changes in head.S
@@ -326,6 +360,14 @@ void __init setup_pagetables(void)
     lpae_t pte, *p;
     int i;
 
+    /*
+     * In case of cache coloring, map the new physical space in the boot page
+     * tables. From now on, pte_of_xenaddr() will translate addresses to this
+     * new space.
+     */
+    if ( llc_coloring_enabled )
+        create_llc_coloring_mappings();
+
     arch_setup_page_tables();
 
 #ifdef CONFIG_ARM_64
@@ -353,13 +395,7 @@ void __init setup_pagetables(void)
             break;
         pte = pte_of_xenaddr(va);
         pte.pt.table = 1; /* third level mappings always have this bit set */
-        if ( is_kernel_text(va) || is_kernel_inittext(va) )
-        {
-            pte.pt.xn = 0;
-            pte.pt.ro = 1;
-        }
-        if ( is_kernel_rodata(va) )
-            pte.pt.ro = 1;
+        pte.pt.xn = 0; /* Permissions will be enforced later. Allow execution */
         xen_xenmap[i] = pte;
     }
 
@@ -379,19 +415,58 @@ void __init setup_pagetables(void)
     pte.pt.table = 1;
     xen_second[second_table_offset(FIXMAP_ADDR(0))] = pte;
 
-#ifdef CONFIG_ARM_64
-    ttbr = virt_to_maddr(xen_pgtable);
-#else
-    ttbr = virt_to_maddr(cpu0_pgtable);
+#ifdef CONFIG_ARM_32
+    per_cpu(xen_pgtable, 0) = cpu0_pgtable;
 #endif
 
-    switch_ttbr(ttbr);
+    if ( llc_coloring_enabled )
+    {
+        ttbr = virt_to_maddr(virt_to_reloc_virt(THIS_CPU_PGTABLE));
+        relocate_and_switch_ttbr(ttbr);
+    }
+    else
+    {
+        ttbr = virt_to_maddr(THIS_CPU_PGTABLE);
+        switch_ttbr(ttbr);
+    }
 
-    xen_pt_enforce_wnx();
+    /* Protect Xen */
+    for ( i = 0; i < XEN_NR_ENTRIES(3); i++ )
+    {
+        vaddr_t va = XEN_VIRT_START + (i << PAGE_SHIFT);
+        lpae_t *entry = xen_xenmap + i;
 
-#ifdef CONFIG_ARM_32
-    per_cpu(xen_pgtable, 0) = cpu0_pgtable;
-#endif
+        if ( !is_kernel(va) )
+            break;
+
+        pte = read_atomic(entry);
+
+        if ( is_kernel_text(va) || is_kernel_inittext(va) )
+        {
+            pte.pt.xn = 0;
+            pte.pt.ro = 1;
+        }
+        else if ( is_kernel_rodata(va) )
+        {
+            pte.pt.ro = 1;
+            pte.pt.xn = 1;
+        }
+        else
+        {
+            pte.pt.xn = 1;
+            pte.pt.ro = 0;
+        }
+
+        write_pte(entry, pte);
+    }
+
+    /*
+     * We modified live page-tables. Ensure the TLBs are invalidated
+     * before setting enforcing the WnX permissions.
+     */
+    flush_xen_tlb_local();
+
+    xen_pt_enforce_wnx();
 }
 
 void *__init arch_vmap_virt_end(void)
diff --git a/xen/arch/arm/setup.c b/xen/arch/arm/setup.c
index 5f1993ffed..68c1f30920 100644
--- a/xen/arch/arm/setup.c
+++ b/xen/arch/arm/setup.c
@@ -312,8 +312,6 @@ void asmlinkage __init start_xen(unsigned long fdt_paddr)
     /* Initialize traps early allow us to get backtrace when an error occurred */
     init_traps();
 
-    setup_pagetables();
-
     smp_clear_cpu_maps();
 
     device_tree_flattened = early_fdt_map(fdt_paddr);
@@ -337,6 +335,14 @@ void asmlinkage __init start_xen(unsigned long fdt_paddr)
 
     llc_coloring_init();
 
+    /*
+     * Page tables must be setup after LLC coloring initialization because
+     * coloring info are required in order to create colored mappings
+     */
+    setup_pagetables();
+    /* Device-tree was mapped in boot page tables, remap it in the new tables */
+    device_tree_flattened = early_fdt_map(fdt_paddr);
+
     setup_mm();
 
     vm_init();
diff --git a/xen/common/llc-coloring.c b/xen/common/llc-coloring.c
index 0cfaa77a2b..a572f77a09 100644
--- a/xen/common/llc-coloring.c
+++ b/xen/common/llc-coloring.c
@@ -42,6 +42,8 @@ static unsigned int __ro_after_init xen_num_colors;
 
 #define mfn_color_mask              (max_nr_colors - 1)
 #define mfn_to_color(mfn)           (mfn_x(mfn) & mfn_color_mask)
+#define get_mfn_with_color(mfn, color) \
+    (_mfn((mfn_x(mfn) & ~mfn_color_mask) | (color)))
 
 /*
  * Parse the coloring configuration given in the buf string, following the
@@ -364,6 +366,22 @@ unsigned int get_max_nr_llc_colors(void)
     return max_nr_colors;
 }
 
+mfn_t __init xen_colored_mfn(mfn_t mfn)
+{
+    unsigned int i, color = mfn_to_color(mfn);
+
+    for ( i = 0; i < xen_num_colors; i++ )
+    {
+        if ( color == xen_colors[i] )
+            return mfn;
+        if ( color < xen_colors[i] )
+            return get_mfn_with_color(mfn, xen_colors[i]);
+    }
+
+    /* Jump to next color space (max_nr_colors mfns) and use the first color */
+    return get_mfn_with_color(mfn_add(mfn, max_nr_colors), xen_colors[0]);
+}
+
 /*
  * Local variables:
  * mode: C
diff --git a/xen/include/xen/llc-coloring.h b/xen/include/xen/llc-coloring.h
index 1216d1fbd4..45f250f9f3 100644
--- a/xen/include/xen/llc-coloring.h
+++ b/xen/include/xen/llc-coloring.h
@@ -8,6 +8,7 @@
 #ifndef __XEN_LLC_COLORING_H__
 #define __XEN_LLC_COLORING_H__
 
+#include <xen/mm-frame.h>
 #include <xen/types.h>
 
 struct domain;
@@ -30,6 +31,17 @@ static inline void domain_dump_llc_colors(const struct domain *d) {}
 static inline void domain_llc_coloring_free(struct domain *d) {}
 #endif
 
+/*
+ * Iterate over each Xen mfn in the colored space.
+ * @start_mfn:  the first mfn that needs to be colored.
+ * @mfn:        the current mfn.
+ * @i:          loop index.
+ */
+#define for_each_xen_colored_mfn(start_mfn, mfn, i) \
+    for ( (i) = 0, (mfn) = xen_colored_mfn(start_mfn);  \
+          (i) < (_end - _start) >> PAGE_SHIFT;        \
+          (i)++, (mfn) = xen_colored_mfn(mfn_add(mfn, 1)) )
+
 unsigned int get_llc_way_size(void);
 void arch_llc_coloring_init(void);
 int dom0_set_llc_colors(struct domain *d);
@@ -38,6 +50,7 @@ int domain_set_llc_colors(struct domain *d,
 int domain_set_llc_colors_from_str(struct domain *d, const char *str);
 unsigned int page_to_llc_color(const struct page_info *pg);
 unsigned int get_max_nr_llc_colors(void);
+mfn_t xen_colored_mfn(mfn_t mfn);
 
 #endif /* __XEN_LLC_COLORING_H__ */
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Dec 20 07:35:00 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 20 Dec 2024 07:35:00 +0000
Received: from list by lists.xenproject.org with outflank-mailman.861653.1273660 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tOXXI-0007vu-27; Fri, 20 Dec 2024 07:35:00 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 861653.1273660; Fri, 20 Dec 2024 07:35:00 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tOXXH-0007vn-Va; Fri, 20 Dec 2024 07:34:59 +0000
Received: by outflank-mailman (input) for mailman id 861653;
 Fri, 20 Dec 2024 07:34:58 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tOXXG-0007vA-NZ
 for xen-changelog@lists.xenproject.org; Fri, 20 Dec 2024 07:34:58 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tOXXG-00D3Vc-1I
 for xen-changelog@lists.xenproject.org;
 Fri, 20 Dec 2024 07:34:58 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tOXXG-005NJ0-2A
 for xen-changelog@lists.xenproject.org;
 Fri, 20 Dec 2024 07:34:58 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=peI5SJ+/5nBuBEKXMOKbTBc8qUEvvQWMDM2JoA6b0ic=; b=JJb0P0/4pMkTKJBCGyGpVxWJpQ
	UaWAIRHC1jTBowCIulZ7sXjeZg3PmF04DM5AGXrdPXOlPO20KdrN1e8+kcPiKeLeO+u/ySMptZwH4
	ZwWkRO3P95ri9gZh8oygeIbuNxmVSDIss+MXrodpHqhf7RA6qdbzKbA8mh+7YLlnWIxY=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/arm: firmware: Add SCMI over SMC calls handling layer
Message-Id: <E1tOXXG-005NJ0-2A@xenbits.xenproject.org>
Date: Fri, 20 Dec 2024 07:34:58 +0000

commit 3e322bef8bc0ac6ed699486550a29c553de22771
Author:     Andrei Cherechesu <andrei.cherechesu@nxp.com>
AuthorDate: Thu Dec 19 13:23:10 2024 +0200
Commit:     Michal Orzel <michal.orzel@amd.com>
CommitDate: Thu Dec 19 19:26:21 2024 +0100

    xen/arm: firmware: Add SCMI over SMC calls handling layer
    
    Introduce the SCMI-SMC layer to have some basic degree of
    awareness about SCMI calls that are based on the ARM System
    Control and Management Interface (SCMI) specification (DEN0056E).
    
    The SCMI specification includes various protocols for managing
    system-level resources, such as: clocks, pins, reset, system power,
    power domains, performance domains, etc. The clients are named
    "SCMI agents" and the server is named "SCMI platform".
    
    Only support the shared-memory based transport with SMCs as
    the doorbell mechanism for notifying the platform. Also, this
    implementation only handles the "arm,scmi-smc" compatible,
    requiring the following properties:
            - "arm,smc-id" (unique SMC ID)
            - "shmem" (one or more phandles pointing to shmem zones
            for each channel)
    
    The initialization is done as initcall, since we need
    SMCs, and PSCI should already probe EL3 FW for SMCCC support.
    If no "arm,scmi-smc" compatible node is found in the host
    DT, the initialization fails silently, as it's not mandatory.
    Otherwise, we get the 'arm,smc-id' DT property from the node,
    to know the SCMI SMC ID we handle. The 'shmem' memory ranges
    are not validated, as the SMC calls are only passed through
    to EL3 FW if coming from the hardware domain.
    
    Create a new 'firmware' folder to keep the SCMI code separate
    from the generic ARM code.
    
    Signed-off-by: Andrei Cherechesu <andrei.cherechesu@nxp.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
    Acked-by: Michal Orzel <michal.orzel@amd.com>
---
 xen/arch/arm/Kconfig                         |   2 +
 xen/arch/arm/Makefile                        |   1 +
 xen/arch/arm/firmware/Kconfig                |  13 +++
 xen/arch/arm/firmware/Makefile               |   1 +
 xen/arch/arm/firmware/scmi-smc.c             | 162 +++++++++++++++++++++++++++
 xen/arch/arm/include/asm/firmware/scmi-smc.h |  41 +++++++
 6 files changed, 220 insertions(+)

diff --git a/xen/arch/arm/Kconfig b/xen/arch/arm/Kconfig
index c5e7b74733..a26d3e1182 100644
--- a/xen/arch/arm/Kconfig
+++ b/xen/arch/arm/Kconfig
@@ -272,6 +272,8 @@ config PARTIAL_EMULATION
 	  not been emulated to their complete functionality. Enabling this might
 	  result in unwanted/non-spec compliant behavior.
 
+source "arch/arm/firmware/Kconfig"
+
 endmenu
 
 menu "ARM errata workaround via the alternative framework"
diff --git a/xen/arch/arm/Makefile b/xen/arch/arm/Makefile
index ccbfc61f88..43ab5e8f25 100644
--- a/xen/arch/arm/Makefile
+++ b/xen/arch/arm/Makefile
@@ -6,6 +6,7 @@ obj-$(CONFIG_HAS_PCI) += pci/
 ifneq ($(CONFIG_NO_PLAT),y)
 obj-y += platforms/
 endif
+obj-y += firmware/
 obj-$(CONFIG_TEE) += tee/
 obj-$(CONFIG_HAS_VPCI) += vpci.o
 
diff --git a/xen/arch/arm/firmware/Kconfig b/xen/arch/arm/firmware/Kconfig
new file mode 100644
index 0000000000..817da745fd
--- /dev/null
+++ b/xen/arch/arm/firmware/Kconfig
@@ -0,0 +1,13 @@
+menu "Firmware Drivers"
+
+config SCMI_SMC
+	bool "Forward SCMI over SMC calls from hwdom to EL3 firmware"
+	default y
+	help
+	  This option enables basic awareness for SCMI calls using SMC as
+	  doorbell mechanism and Shared Memory for transport ("arm,scmi-smc"
+	  compatible only). The value of "arm,smc-id" DT property from SCMI
+	  firmware node is used to trap and forward corresponding SCMI SMCs
+	  to firmware running at EL3, for calls coming from the hardware domain.
+
+endmenu
diff --git a/xen/arch/arm/firmware/Makefile b/xen/arch/arm/firmware/Makefile
new file mode 100644
index 0000000000..a5e4542666
--- /dev/null
+++ b/xen/arch/arm/firmware/Makefile
@@ -0,0 +1 @@
+obj-$(CONFIG_SCMI_SMC) += scmi-smc.o
diff --git a/xen/arch/arm/firmware/scmi-smc.c b/xen/arch/arm/firmware/scmi-smc.c
new file mode 100644
index 0000000000..33473c04b1
--- /dev/null
+++ b/xen/arch/arm/firmware/scmi-smc.c
@@ -0,0 +1,162 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+/*
+ * xen/arch/arm/firmware/scmi-smc.c
+ *
+ * ARM System Control and Management Interface (SCMI) over SMC
+ * Generic handling layer
+ *
+ * Andrei Cherechesu <andrei.cherechesu@nxp.com>
+ * Copyright 2024 NXP
+ */
+
+#include <xen/acpi.h>
+#include <xen/device_tree.h>
+#include <xen/errno.h>
+#include <xen/init.h>
+#include <xen/sched.h>
+#include <xen/types.h>
+
+#include <asm/smccc.h>
+#include <asm/firmware/scmi-smc.h>
+
+#define SCMI_SMC_ID_PROP   "arm,smc-id"
+
+static bool __ro_after_init scmi_enabled;
+static uint32_t __ro_after_init scmi_smc_id;
+
+/*
+ * Check if provided SMC Function Identifier matches the one known by the SCMI
+ * layer, as read from DT prop 'arm,smc-id' during initialiation.
+ */
+static bool scmi_is_valid_smc_id(uint32_t fid)
+{
+    return (fid == scmi_smc_id);
+}
+
+/*
+ * Generic handler for SCMI-SMC requests, currently only forwarding the
+ * request to FW running at EL3 if it came from the hardware domain.
+ * Called from the vSMC layer for SiP SMCs, since SCMI calls are usually
+ * provided this way.
+ *
+ * Returns true if SMC was handled (regardless of response), false otherwise.
+ */
+bool scmi_handle_smc(struct cpu_user_regs *regs)
+{
+    uint32_t fid = (uint32_t)get_user_reg(regs, 0);
+    struct arm_smccc_res res;
+
+    if ( !scmi_enabled )
+        return false;
+
+    if ( !scmi_is_valid_smc_id(fid) )
+        return false;
+
+    /* Only the hardware domain should use SCMI calls */
+    if ( !is_hardware_domain(current->domain) )
+    {
+        gdprintk(XENLOG_WARNING, "SCMI: Unprivileged access attempt\n");
+        return false;
+    }
+
+    /* For the moment, forward the SCMI Request to FW running at EL3 */
+    arm_smccc_1_1_smc(fid,
+                      get_user_reg(regs, 1),
+                      get_user_reg(regs, 2),
+                      get_user_reg(regs, 3),
+                      get_user_reg(regs, 4),
+                      get_user_reg(regs, 5),
+                      get_user_reg(regs, 6),
+                      get_user_reg(regs, 7),
+                      &res);
+
+    set_user_reg(regs, 0, res.a0);
+    set_user_reg(regs, 1, res.a1);
+    set_user_reg(regs, 2, res.a2);
+    set_user_reg(regs, 3, res.a3);
+
+    return true;
+}
+
+static int __init scmi_check_smccc_ver(void)
+{
+    if ( smccc_ver < ARM_SMCCC_VERSION_1_1 )
+    {
+        printk(XENLOG_WARNING
+               "SCMI: No SMCCC 1.1 support, SCMI calls forwarding disabled\n");
+        return -ENOSYS;
+    }
+
+    return 0;
+}
+
+static int __init scmi_dt_init_smccc(void)
+{
+    static const struct dt_device_match scmi_ids[] __initconst =
+    {
+        /* We only support "arm,scmi-smc" binding for now */
+        DT_MATCH_COMPATIBLE("arm,scmi-smc"),
+        { /* sentinel */ },
+    };
+    const struct dt_device_node *scmi_node;
+    int ret;
+
+    /* If no SCMI firmware node found, fail silently as it's not mandatory */
+    scmi_node = dt_find_matching_node(NULL, scmi_ids);
+    if ( !scmi_node )
+        return -EOPNOTSUPP;
+
+    ret = dt_property_read_u32(scmi_node, SCMI_SMC_ID_PROP, &scmi_smc_id);
+    if ( !ret )
+    {
+        printk(XENLOG_ERR "SCMI: No valid \"%s\" property in \"%s\" DT node\n",
+               SCMI_SMC_ID_PROP, scmi_node->full_name);
+        return -ENOENT;
+    }
+
+    scmi_enabled = true;
+
+    return 0;
+}
+
+/* Initialize the SCMI layer based on SMCs and Device-tree */
+static int __init scmi_init(void)
+{
+    int ret;
+
+    if ( !acpi_disabled )
+    {
+        printk(XENLOG_WARNING "SCMI is not supported when using ACPI\n");
+        return -EINVAL;
+    }
+
+    ret = scmi_check_smccc_ver();
+    if ( ret )
+        return ret;
+
+    ret = scmi_dt_init_smccc();
+    if ( ret == -EOPNOTSUPP )
+        return ret;
+    if ( ret )
+        goto err;
+
+    printk(XENLOG_INFO "Using SCMI with SMC ID: 0x%x\n", scmi_smc_id);
+
+    return 0;
+
+ err:
+    printk(XENLOG_ERR "SCMI: Initialization failed (ret = %d)\n", ret);
+    return ret;
+}
+
+__initcall(scmi_init);
+
+/*
+ * Local variables:
+ * mode: C
+ * c-file-style: "BSD"
+ * c-basic-offset: 4
+ * tab-width: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
diff --git a/xen/arch/arm/include/asm/firmware/scmi-smc.h b/xen/arch/arm/include/asm/firmware/scmi-smc.h
new file mode 100644
index 0000000000..6b1a164a40
--- /dev/null
+++ b/xen/arch/arm/include/asm/firmware/scmi-smc.h
@@ -0,0 +1,41 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+/*
+ * xen/arch/arm/include/asm/firmware/scmi-smc.h
+ *
+ * ARM System Control and Management Interface (SCMI) over SMC
+ * Generic handling layer
+ *
+ * Andrei Cherechesu <andrei.cherechesu@nxp.com>
+ * Copyright 2024 NXP
+ */
+
+#ifndef __ASM_SCMI_SMC_H__
+#define __ASM_SCMI_SMC_H__
+
+#include <xen/types.h>
+
+struct cpu_user_regs;
+
+#ifdef CONFIG_SCMI_SMC
+
+bool scmi_handle_smc(struct cpu_user_regs *regs);
+
+#else
+
+static inline bool scmi_handle_smc(struct cpu_user_regs *regs)
+{
+    return false;
+}
+
+#endif /* CONFIG_SCMI_SMC */
+
+#endif /* __ASM_SCMI_H__ */
+
+/*
+ * Local variables:
+ * mode: C
+ * c-file-style: "BSD"
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Dec 20 07:35:10 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 20 Dec 2024 07:35:10 +0000
Received: from list by lists.xenproject.org with outflank-mailman.861654.1273665 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tOXXS-000858-5G; Fri, 20 Dec 2024 07:35:10 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 861654.1273665; Fri, 20 Dec 2024 07:35:10 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tOXXS-000850-2T; Fri, 20 Dec 2024 07:35:10 +0000
Received: by outflank-mailman (input) for mailman id 861654;
 Fri, 20 Dec 2024 07:35:08 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tOXXQ-00083E-Qw
 for xen-changelog@lists.xenproject.org; Fri, 20 Dec 2024 07:35:08 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tOXXQ-00D3Vr-1X
 for xen-changelog@lists.xenproject.org;
 Fri, 20 Dec 2024 07:35:08 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tOXXQ-005NJz-2Q
 for xen-changelog@lists.xenproject.org;
 Fri, 20 Dec 2024 07:35:08 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=f232kGvVKiLJdinTHOOYkPQgf7n8Mrag5ktWyah7lr8=; b=qz4mk/jYoT4Im8uD661EdxOGQb
	SoqvkbYw1Y8HZyGAEYB0sPmAhY+OeuSAZoIJTvFMAQfeFWBVzEvmHfj1AXc+JrxOBtcf2udsmtBLV
	Dxclv88wN2eLETvBqbRucRs9h6y92FRctSJnqwvfGOS2z1TWBR9n+nMvx8KMAGZr+9xo=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/arm: vsmc: Enable handling SiP-owned SCMI SMC calls
Message-Id: <E1tOXXQ-005NJz-2Q@xenbits.xenproject.org>
Date: Fri, 20 Dec 2024 07:35:08 +0000

commit a767076c03a65eb67d5e59ccd23f418ce314a5bd
Author:     Andrei Cherechesu <andrei.cherechesu@nxp.com>
AuthorDate: Thu Dec 19 13:23:11 2024 +0200
Commit:     Michal Orzel <michal.orzel@amd.com>
CommitDate: Thu Dec 19 19:26:21 2024 +0100

    xen/arm: vsmc: Enable handling SiP-owned SCMI SMC calls
    
    Change the handling of SiP SMC calls to be more generic,
    instead of directly relying on the `platform_smc()` callback
    implementation.
    
    Try to handle the SiP SMC first through the `platform_smc()`
    callback (if implemented). Otherwise, try to handle it as SCMI
    message.
    
    Signed-off-by: Andrei Cherechesu <andrei.cherechesu@nxp.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
    Acked-by: Julien Grall <jgrall@amazon.com>
---
 xen/arch/arm/vsmc.c | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/xen/arch/arm/vsmc.c b/xen/arch/arm/vsmc.c
index f679cced7f..62d8117a12 100644
--- a/xen/arch/arm/vsmc.c
+++ b/xen/arch/arm/vsmc.c
@@ -20,6 +20,7 @@
 #include <asm/traps.h>
 #include <asm/vpsci.h>
 #include <asm/platform.h>
+#include <asm/firmware/scmi-smc.h>
 
 /* Number of functions currently supported by Hypervisor Service. */
 #define XEN_SMCCC_FUNCTION_COUNT 3
@@ -224,6 +225,16 @@ static bool handle_sssc(struct cpu_user_regs *regs)
     }
 }
 
+/* Secure Calls defined by the Silicon Provider (SiP) */
+static bool handle_sip(struct cpu_user_regs *regs)
+{
+    /* Firstly, let each platform define custom handling for these SMCs */
+    if ( platform_smc(regs) )
+        return true;
+
+    return scmi_handle_smc(regs);
+}
+
 /*
  * vsmccc_handle_call() - handle SMC/HVC call according to ARM SMCCC.
  * returns true if that was valid SMCCC call (even if function number
@@ -288,7 +299,7 @@ static bool vsmccc_handle_call(struct cpu_user_regs *regs)
             handled = handle_sssc(regs);
             break;
         case ARM_SMCCC_OWNER_SIP:
-            handled = platform_smc(regs);
+            handled = handle_sip(regs);
             break;
         case ARM_SMCCC_OWNER_TRUSTED_APP ... ARM_SMCCC_OWNER_TRUSTED_APP_END:
         case ARM_SMCCC_OWNER_TRUSTED_OS ... ARM_SMCCC_OWNER_TRUSTED_OS_END:
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Dec 20 07:35:20 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 20 Dec 2024 07:35:20 +0000
Received: from list by lists.xenproject.org with outflank-mailman.861659.1273668 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tOXXc-0008Dw-6Q; Fri, 20 Dec 2024 07:35:20 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 861659.1273668; Fri, 20 Dec 2024 07:35:20 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tOXXc-0008Do-3v; Fri, 20 Dec 2024 07:35:20 +0000
Received: by outflank-mailman (input) for mailman id 861659;
 Fri, 20 Dec 2024 07:35:18 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tOXXa-0008DY-T6
 for xen-changelog@lists.xenproject.org; Fri, 20 Dec 2024 07:35:18 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tOXXa-00D3Vv-1r
 for xen-changelog@lists.xenproject.org;
 Fri, 20 Dec 2024 07:35:18 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tOXXa-005NLN-2f
 for xen-changelog@lists.xenproject.org;
 Fri, 20 Dec 2024 07:35:18 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=/NFkp9C38ZkU670YWjdudUP+2X+E1sN9pjYEo4jFPTE=; b=2GOIuB4xixihv6xi9cWj4jqPos
	0T83neMjCmuf9174jON2+C1hKETJlDKD3OPRj+XFeCY5gTgzcsMlZeNd27o7ElxQcf0ej0C1Vvagt
	NgCS54CEGAfA5PlUz8sqNvFD/VVZoSIRqlb2yQkqfAlPOXbKdWJmppgagk068/e53kUU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/arm: platforms: Add NXP S32G3 Processors config
Message-Id: <E1tOXXa-005NLN-2f@xenbits.xenproject.org>
Date: Fri, 20 Dec 2024 07:35:18 +0000

commit 78b0b025be2fef0d19c466b2758bacc26ee2cbdc
Author:     Andrei Cherechesu <andrei.cherechesu@nxp.com>
AuthorDate: Thu Dec 19 13:23:12 2024 +0200
Commit:     Michal Orzel <michal.orzel@amd.com>
CommitDate: Thu Dec 19 19:26:21 2024 +0100

    xen/arm: platforms: Add NXP S32G3 Processors config
    
    Platforms based on NXP S32G3 processors use the NXP LINFlexD
    UART driver for console by default, and rely on Dom0 having
    access to SCMI services for system-level resources from
    firmware at EL3.
    
    Signed-off-by: Andrei Cherechesu <andrei.cherechesu@nxp.com>
    Reviewed-by: Bertrand Marquis <bertrand.marquis@arm.com>
---
 xen/arch/arm/platforms/Kconfig | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/xen/arch/arm/platforms/Kconfig b/xen/arch/arm/platforms/Kconfig
index 02322c259c..6dbf6ec87b 100644
--- a/xen/arch/arm/platforms/Kconfig
+++ b/xen/arch/arm/platforms/Kconfig
@@ -37,6 +37,14 @@ config MPSOC
 	help
 	Enable all the required drivers for Xilinx Ultrascale+ MPSoC
 
+config S32G3
+	bool "NXP S32G3 Processors support"
+	depends on ARM_64
+	select HAS_LINFLEX
+	select SCMI_SMC
+	help
+	Enable all the required drivers for NXP S32G3 Processors Family
+
 config NO_PLAT
 	bool "No Platforms"
 	help
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Dec 20 07:35:30 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 20 Dec 2024 07:35:30 +0000
Received: from list by lists.xenproject.org with outflank-mailman.861660.1273672 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tOXXm-0008I3-7t; Fri, 20 Dec 2024 07:35:30 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 861660.1273672; Fri, 20 Dec 2024 07:35:30 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tOXXm-0008Hw-5K; Fri, 20 Dec 2024 07:35:30 +0000
Received: by outflank-mailman (input) for mailman id 861660;
 Fri, 20 Dec 2024 07:35:29 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tOXXl-0008Hk-0U
 for xen-changelog@lists.xenproject.org; Fri, 20 Dec 2024 07:35:29 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tOXXk-00D3Vz-2D
 for xen-changelog@lists.xenproject.org;
 Fri, 20 Dec 2024 07:35:28 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tOXXk-005NMo-30
 for xen-changelog@lists.xenproject.org;
 Fri, 20 Dec 2024 07:35:28 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=vtB4WGcFRzuSjTy2ZbqNMchdrRV7syKM2Tm81IIxrJ4=; b=cyglspUxHNi04vk+njFojVTMbJ
	XrDtaXdwl4YYbK59rB5gyenZcs0n0x3bLEUNxF5MO57eZZPEfggwghxVR2YZFrHynqAudFFr44H/v
	7gM2oL7HmNTu9rUAOHYdylR0xmZSWpWW+HUVMjse8gtfFrK1oq5tGR/EmGE/QDGxmpfQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] CHANGELOG.md: Add NXP S32G3 and SCMI-SMC layer support mentions
Message-Id: <E1tOXXk-005NMo-30@xenbits.xenproject.org>
Date: Fri, 20 Dec 2024 07:35:28 +0000

commit f09ee5f55032a7fda0aefb89bf0fca5db0d37187
Author:     Andrei Cherechesu <andrei.cherechesu@nxp.com>
AuthorDate: Thu Dec 19 13:23:13 2024 +0200
Commit:     Michal Orzel <michal.orzel@amd.com>
CommitDate: Thu Dec 19 19:26:21 2024 +0100

    CHANGELOG.md: Add NXP S32G3 and SCMI-SMC layer support mentions
    
    Signed-off-by: Andrei Cherechesu <andrei.cherechesu@nxp.com>
    Reviewed-by: Bertrand Marquis <bertrand.marquis@arm.com>
    Acked-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
---
 CHANGELOG.md | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 61510e6a11..fe6c4cf943 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -18,6 +18,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
 ### Added
  - On Arm:
    - Experimental support for Armv8-R.
+   - Support for NXP S32G3 Processors Family and NXP LINFlexD UART driver.
+   - Basic handling for SCMI requests over SMC using Shared Memory, by allowing
+     forwarding the calls to EL3 FW if coming from hwdom.
  - On x86:
    - xl suspend/resume subcommands.
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Dec 20 07:35:40 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 20 Dec 2024 07:35:40 +0000
Received: from list by lists.xenproject.org with outflank-mailman.861661.1273676 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tOXXw-0008LU-9S; Fri, 20 Dec 2024 07:35:40 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 861661.1273676; Fri, 20 Dec 2024 07:35:40 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tOXXw-0008LM-6l; Fri, 20 Dec 2024 07:35:40 +0000
Received: by outflank-mailman (input) for mailman id 861661;
 Fri, 20 Dec 2024 07:35:39 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tOXXv-0008L4-51
 for xen-changelog@lists.xenproject.org; Fri, 20 Dec 2024 07:35:39 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tOXXu-00D3W9-2U
 for xen-changelog@lists.xenproject.org;
 Fri, 20 Dec 2024 07:35:39 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tOXXv-005NNe-08
 for xen-changelog@lists.xenproject.org;
 Fri, 20 Dec 2024 07:35:39 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=erDQdJ6EZlpcybPBOVBcxTKzoUNx5LyvC8yoBm8ruCQ=; b=p7Keyu32W4zcvTgmTopM05HZ8z
	kwbDJCzhZWz8ZfUwqtgnV1ED3+zXOHnotDX+drIyk/dA8YU1ui7Zl7le5OYU+mkvPyhMU4QwKCCGU
	HhATdCaKzfzUc6pOcssWKmAotmGw7nKuQFOCne7JsSQCEiR20Inu2grFFuPohlufy8EQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] SUPPORT.md: Describe SCMI-SMC layer feature
Message-Id: <E1tOXXv-005NNe-08@xenbits.xenproject.org>
Date: Fri, 20 Dec 2024 07:35:39 +0000

commit 294faa3760bd40c1084f5bcc6c213e2e64c64dae
Author:     Andrei Cherechesu <andrei.cherechesu@nxp.com>
AuthorDate: Thu Dec 19 13:23:14 2024 +0200
Commit:     Michal Orzel <michal.orzel@amd.com>
CommitDate: Thu Dec 19 19:26:21 2024 +0100

    SUPPORT.md: Describe SCMI-SMC layer feature
    
    Describe the layer which enables SCMI over SMC calls forwarding
    to EL3 FW if issued by the Hardware domain. If the SCMI firmware
    node is not found in the Host DT during initialization, it fails
    silently as it's not mandatory.
    
    The SCMI SMCs trapping at EL2 now lets hwdom perform SCMI ops for
    interacting with system-level resources almost as if it would be
    running natively.
    
    Signed-off-by: Andrei Cherechesu <andrei.cherechesu@nxp.com>
    Reviewed-by: Bertrand Marquis <bertrand.marquis@arm.com>
    Acked-by: Michal Orzel <michal.orzel@amd.com>
---
 SUPPORT.md | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/SUPPORT.md b/SUPPORT.md
index 998faf5635..54c78b722d 100644
--- a/SUPPORT.md
+++ b/SUPPORT.md
@@ -935,6 +935,14 @@ Add/Remove device tree nodes using a device tree overlay binary (.dtbo).
 
     Status: Tech Preview
 
+### Arm: SCMI over SMC calls forwarding to EL3 Firmware
+
+Enable SCMI calls using SMC as doorbell mechanism and Shared Memory for
+transport ("arm,scmi-smc" compatible only) to reach EL3 Firmware if issued
+by hwdom. Some platforms use SCMI for access to system-level resources.
+
+    Status: Supported
+
 ## Virtual Hardware, QEMU
 
 This section describes supported devices available in HVM mode using a
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Dec 20 07:35:50 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 20 Dec 2024 07:35:50 +0000
Received: from list by lists.xenproject.org with outflank-mailman.861663.1273681 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tOXY6-0008Ou-Al; Fri, 20 Dec 2024 07:35:50 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 861663.1273681; Fri, 20 Dec 2024 07:35:50 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tOXY6-0008Om-86; Fri, 20 Dec 2024 07:35:50 +0000
Received: by outflank-mailman (input) for mailman id 861663;
 Fri, 20 Dec 2024 07:35:49 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tOXY5-0008OW-5b
 for xen-changelog@lists.xenproject.org; Fri, 20 Dec 2024 07:35:49 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tOXY4-00D3Wg-2j
 for xen-changelog@lists.xenproject.org;
 Fri, 20 Dec 2024 07:35:49 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tOXY5-005NOZ-0O
 for xen-changelog@lists.xenproject.org;
 Fri, 20 Dec 2024 07:35:49 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=BiIdqEXta3TDZb9Dz4F1AAuyhK76lPR0QIZe14UJ3Ok=; b=brlITeL+nchJ+z9CNHUqsm3+Nz
	KIcXF8p4qm9o1pcV00rGxniCQiGrXcwYeNlGeFb52i2JxPOQkuW+QcqyzUn5w5SY50bZR3Jc5erbP
	52I34nbugo6LK6HTOGCoIP6lY0+lu2+AzGsHGRbQ90D14LaxvtzYrriLcJWoHfa/qwNc=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] MAINTAINERS: Add myself as maintainer for NXP S32G3
Message-Id: <E1tOXY5-005NOZ-0O@xenbits.xenproject.org>
Date: Fri, 20 Dec 2024 07:35:49 +0000

commit 075e7e35dbd9338d28f44f84b1fb573e521d51f1
Author:     Andrei Cherechesu <andrei.cherechesu@nxp.com>
AuthorDate: Thu Dec 19 13:23:15 2024 +0200
Commit:     Michal Orzel <michal.orzel@amd.com>
CommitDate: Thu Dec 19 19:26:21 2024 +0100

    MAINTAINERS: Add myself as maintainer for NXP S32G3
    
    Add myself as maintainer for NXP S32G3 SoCs Family,
    and the S32 Linux Team as relevant reviewers list.
    
    Signed-off-by: Andrei Cherechesu <andrei.cherechesu@nxp.com>
    Acked-by: Bertrand Marquis <bertrand.marquis@arm.com>
    Acked-by: Michal Orzel <michal.orzel@amd.com>
---
 MAINTAINERS | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/MAINTAINERS b/MAINTAINERS
index 34ad49bc39..392f780f76 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -426,6 +426,12 @@ L:	minios-devel@lists.xenproject.org
 T:	git https://xenbits.xenproject.org/git-http/mini-os.git
 F:	config/MiniOS.mk
 
+NXP S32G3 PROCESSORS FAMILY SUPPORT
+M:	Andrei Cherechesu <andrei.cherechesu@oss.nxp.com>
+L:	NXP S32 Linux Team <s32@nxp.com>
+F:	xen/arch/arm/include/asm/linflex-uart.h
+F:	xen/drivers/char/linflex-uart.c
+
 OCAML TOOLS
 M:	Christian Lindig <christian.lindig@citrix.com>
 M:	David Scott <dave@recoil.org>
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Dec 20 08:22:05 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 20 Dec 2024 08:22:05 +0000
Received: from list by lists.xenproject.org with outflank-mailman.861679.1273695 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tOYGo-00074I-OB; Fri, 20 Dec 2024 08:22:02 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 861679.1273695; Fri, 20 Dec 2024 08: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 1tOYGo-00074A-L2; Fri, 20 Dec 2024 08:22:02 +0000
Received: by outflank-mailman (input) for mailman id 861679;
 Fri, 20 Dec 2024 08:22:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tOYGo-000744-2N
 for xen-changelog@lists.xenproject.org; Fri, 20 Dec 2024 08:22:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tOYGn-00D4uu-1u
 for xen-changelog@lists.xenproject.org;
 Fri, 20 Dec 2024 08:22:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tOYGn-005SgQ-2d
 for xen-changelog@lists.xenproject.org;
 Fri, 20 Dec 2024 08:22:01 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=MtWemM6w89KlaUGsbmGnsAoVP1NTwOVesHZO12LTaJc=; b=iljn2HKV6ptzByNfjIYXRPwMyu
	NJI/jcLUR8z84zQDKxcVk3lbFmtpmELYl+rMml8v8vE4g3eZ3U7QFJJf9o9ZhQWPPaM1Jjau4tF6/
	AH6hzAWhviqtPOB4Z2T8duI3eBWe42mLuBMnypHFCwPoquTqQhVc3FX8QBhx+5uRpPIk=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/common: add cache coloring common code
Message-Id: <E1tOYGn-005SgQ-2d@xenbits.xenproject.org>
Date: Fri, 20 Dec 2024 08:22:01 +0000

commit 44dd6d4a124a33e44eeb7157b05a3ad3d9cf46c3
Author:     Carlo Nonato <carlo.nonato@minervasys.tech>
AuthorDate: Tue Dec 17 18:06:26 2024 +0100
Commit:     Michal Orzel <michal.orzel@amd.com>
CommitDate: Thu Dec 19 19:24:31 2024 +0100

    xen/common: add cache coloring common code
    
    Last Level Cache (LLC) coloring allows to partition the cache in smaller
    chunks called cache colors.
    
    Since not all architectures can actually implement it, add a HAS_LLC_COLORING
    Kconfig option.
    LLC_COLORS_ORDER Kconfig option has a range maximum of 10 (2^10 = 1024)
    because that's the number of colors that fit in a 4 KiB page when integers
    are 4 bytes long.
    
    LLC colors are a property of the domain, so struct domain has to be extended.
    
    Based on original work from: Luca Miccio <lucmiccio@gmail.com>
    
    Signed-off-by: Carlo Nonato <carlo.nonato@minervasys.tech>
    Signed-off-by: Marco Solieri <marco.solieri@minervasys.tech>
    Acked-by: Michal Orzel <michal.orzel@amd.com>
---
 SUPPORT.md                        |   7 +++
 docs/index.rst                    |   1 +
 docs/misc/cache-coloring.rst      | 118 ++++++++++++++++++++++++++++++++++++
 docs/misc/xen-command-line.pandoc |  39 ++++++++++++
 xen/common/Kconfig                |  21 +++++++
 xen/common/Makefile               |   1 +
 xen/common/keyhandler.c           |   3 +
 xen/common/llc-coloring.c         | 124 ++++++++++++++++++++++++++++++++++++++
 xen/common/page_alloc.c           |   3 +
 xen/include/xen/llc-coloring.h    |  36 +++++++++++
 xen/include/xen/sched.h           |   5 ++
 11 files changed, 358 insertions(+)

diff --git a/SUPPORT.md b/SUPPORT.md
index 82239d0294..998faf5635 100644
--- a/SUPPORT.md
+++ b/SUPPORT.md
@@ -401,6 +401,13 @@ by maintaining multiple physical to machine (p2m) memory mappings.
     Status, x86 HVM: Tech Preview
     Status, ARM: Tech Preview
 
+### Cache coloring
+
+Allows to reserve Last Level Cache (LLC) partitions for Dom0, DomUs and Xen
+itself.
+
+    Status, Arm64: Experimental
+
 ## Resource Management
 
 ### CPU Pools
diff --git a/docs/index.rst b/docs/index.rst
index 1d44796d72..1bb8d02ea3 100644
--- a/docs/index.rst
+++ b/docs/index.rst
@@ -66,6 +66,7 @@ Documents in need of some rearranging.
    misc/xen-makefiles/makefiles
    misra/index
    fusa/index
+   misc/cache-coloring
 
 
 Miscellanea
diff --git a/docs/misc/cache-coloring.rst b/docs/misc/cache-coloring.rst
new file mode 100644
index 0000000000..371f21a0e7
--- /dev/null
+++ b/docs/misc/cache-coloring.rst
@@ -0,0 +1,118 @@
+.. SPDX-License-Identifier: CC-BY-4.0
+
+Xen cache coloring user guide
+=============================
+
+The cache coloring support in Xen allows to reserve Last Level Cache (LLC)
+partitions for Dom0, DomUs and Xen itself. Currently only ARM64 is supported.
+Cache coloring realizes per-set cache partitioning in software and is applicable
+to shared LLCs as implemented in Cortex-A53, Cortex-A72 and similar CPUs.
+
+To compile LLC coloring support set ``CONFIG_LLC_COLORING=y``.
+
+If needed, change the maximum number of colors with
+``CONFIG_LLC_COLORS_ORDER=<n>``.
+
+Runtime configuration is done via `Command line parameters`_.
+
+Background
+**********
+
+Cache hierarchy of a modern multi-core CPU typically has first levels dedicated
+to each core (hence using multiple cache units), while the last level is shared
+among all of them. Such configuration implies that memory operations on one
+core (e.g. running a DomU) are able to generate interference on another core
+(e.g. hosting another DomU). Cache coloring realizes per-set cache-partitioning
+in software and mitigates this, guaranteeing more predictable performances for
+memory accesses.
+Software-based cache coloring is particularly useful in those situations where
+no hardware mechanisms (e.g., DSU-based way partitioning) are available to
+partition caches. This is the case for e.g., Cortex-A53, A57 and A72 CPUs that
+feature a L2 LLC cache shared among all cores.
+
+The key concept underlying cache coloring is a fragmentation of the memory
+space into a set of sub-spaces called colors that are mapped to disjoint cache
+partitions. Technically, the whole memory space is first divided into a number
+of subsequent regions. Then each region is in turn divided into a number of
+subsequent sub-colors. The generic i-th color is then obtained by all the
+i-th sub-colors in each region.
+
+::
+
+                            Region j            Region j+1
+                .....................   ............
+                .                     . .
+                .                       .
+            _ _ _______________ _ _____________________ _ _
+                |     |     |     |     |     |     |
+                | c_0 | c_1 |     | c_n | c_0 | c_1 |
+           _ _ _|_____|_____|_ _ _|_____|_____|_____|_ _ _
+                    :                       :
+                    :                       :...         ... .
+                    :                            color 0
+                    :...........................         ... .
+                                                :
+          . . ..................................:
+
+How colors are actually defined depends on the function that maps memory to
+cache lines. In case of physically-indexed, physically-tagged caches with linear
+mapping, the set index is found by extracting some contiguous bits from the
+physical address. This allows colors to be defined as shown in figure: they
+appear in memory as subsequent blocks of equal size and repeats themselves after
+``n`` different colors, where ``n`` is the total number of colors.
+
+If some kind of bit shuffling appears in the mapping function, then colors
+assume a different layout in memory. Those kind of caches aren't supported by
+the current implementation.
+
+**Note**: Finding the exact cache mapping function can be a really difficult
+task since it's not always documented in the CPU manual. As said Cortex-A53, A57
+and A72 are known to work with the current implementation.
+
+How to compute the number of colors
+###################################
+
+Given the linear mapping from physical memory to cache lines for granted, the
+number of available colors for a specific platform is computed using three
+parameters:
+
+- the size of the LLC.
+- the number of the LLC ways.
+- the page size used by Xen.
+
+The first two parameters can be found in the processor manual, while the third
+one is the minimum mapping granularity. Dividing the cache size by the number of
+its ways we obtain the size of a way. Dividing this number by the page size,
+the number of total cache colors is found. So for example an Arm Cortex-A53
+with a 16-ways associative 1 MiB LLC can isolate up to 16 colors when pages are
+4 KiB in size.
+
+Effective colors assignment
+###########################
+
+When assigning colors, if one wants to avoid cache interference between two
+domains, different colors needs to be used for their memory.
+
+Command line parameters
+***********************
+
+Specific documentation is available at `docs/misc/xen-command-line.pandoc`.
+
++----------------------+-------------------------------+
+| **Parameter**        | **Description**               |
++----------------------+-------------------------------+
+| ``llc-coloring``     | Enable coloring at runtime    |
++----------------------+-------------------------------+
+| ``llc-size``         | Set the LLC size              |
++----------------------+-------------------------------+
+| ``llc-nr-ways``      | Set the LLC number of ways    |
++----------------------+-------------------------------+
+
+Auto-probing of LLC specs
+#########################
+
+LLC size and number of ways are probed automatically by default.
+
+LLC specs can be manually set via the above command line parameters. This
+bypasses any auto-probing and it's used to overcome failing situations, such as
+flawed probing logic, or for debugging/testing purposes.
diff --git a/docs/misc/xen-command-line.pandoc b/docs/misc/xen-command-line.pandoc
index 67727f15e9..d75903b84c 100644
--- a/docs/misc/xen-command-line.pandoc
+++ b/docs/misc/xen-command-line.pandoc
@@ -1710,6 +1710,45 @@ 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.
 
+### llc-coloring (arm64)
+> `= <boolean>`
+
+> Default: `false`
+
+Flag to enable or disable LLC coloring support at runtime. This option is
+available only when `CONFIG_LLC_COLORING` is enabled. See the general
+cache coloring documentation for more info.
+
+### llc-nr-ways (arm64)
+> `= <integer>`
+
+> Default: `Obtained from hardware`
+
+Specify the number of ways of the Last Level Cache. This option is available
+only when `CONFIG_LLC_COLORING` is enabled. LLC size and number of ways are used
+to find the number of supported cache colors. By default the value is
+automatically computed by probing the hardware, but in case of specific needs,
+it can be manually set. Those include failing probing and debugging/testing
+purposes so that it's possible to emulate platforms with different number of
+supported colors. If set, also "llc-size" must be set, otherwise the default
+will be used. Note that using both options implies "llc-coloring=on" unless an
+earlier "llc-coloring=off" is there.
+
+### llc-size (arm64)
+> `= <size>`
+
+> Default: `Obtained from hardware`
+
+Specify the size of the Last Level Cache. This option is available only when
+`CONFIG_LLC_COLORING` is enabled. LLC size and number of ways are used to find
+the number of supported cache colors. By default the value is automatically
+computed by probing the hardware, but in case of specific needs, it can be
+manually set. Those include failing probing and debugging/testing purposes so
+that it's possible to emulate platforms with different number of supported
+colors. If set, also "llc-nr-ways" must be set, otherwise the default will be
+used. Note that using both options implies "llc-coloring=on" unless an
+earlier "llc-coloring=off" is there.
+
 ### lock-depth-size
 > `= <integer>`
 
diff --git a/xen/common/Kconfig b/xen/common/Kconfig
index 90268d9249..b4ec6893be 100644
--- a/xen/common/Kconfig
+++ b/xen/common/Kconfig
@@ -71,6 +71,9 @@ config HAS_IOPORTS
 config HAS_KEXEC
 	bool
 
+config HAS_LLC_COLORING
+	bool
+
 config HAS_PIRQ
 	bool
 
@@ -516,4 +519,22 @@ config TRACEBUFFER
 	  to be collected at run time for debugging or performance analysis.
 	  Memory and execution overhead when not active is minimal.
 
+config LLC_COLORING
+	bool "Last Level Cache (LLC) coloring" if EXPERT
+	depends on HAS_LLC_COLORING
+
+config LLC_COLORS_ORDER
+	int "Maximum number of LLC colors (base-2 exponent)"
+	range 1 10
+	default 7
+	depends on LLC_COLORING
+	help
+	  Controls the build-time size of various arrays associated with LLC
+	  coloring. The value is a base-2 exponent. Refer to cache coloring
+	  documentation for how to compute the number of colors supported by the
+	  platform. This is only an upper bound. The runtime value is autocomputed
+	  or manually set via cmdline parameters.
+	  The default value corresponds to an 8 MiB 16-ways LLC, which should be
+	  more than what's needed in the general case.
+
 endmenu
diff --git a/xen/common/Makefile b/xen/common/Makefile
index b279b09bfb..cba3b32733 100644
--- a/xen/common/Makefile
+++ b/xen/common/Makefile
@@ -25,6 +25,7 @@ obj-y += keyhandler.o
 obj-$(CONFIG_KEXEC) += kexec.o
 obj-$(CONFIG_KEXEC) += kimage.o
 obj-$(CONFIG_LIVEPATCH) += livepatch.o livepatch_elf.o
+obj-$(CONFIG_LLC_COLORING) += llc-coloring.o
 obj-$(CONFIG_MEM_ACCESS) += mem_access.o
 obj-y += memory.o
 obj-y += multicall.o
diff --git a/xen/common/keyhandler.c b/xen/common/keyhandler.c
index 6da291b34e..6ea54838d4 100644
--- a/xen/common/keyhandler.c
+++ b/xen/common/keyhandler.c
@@ -5,6 +5,7 @@
 #include <asm/regs.h>
 #include <xen/delay.h>
 #include <xen/keyhandler.h>
+#include <xen/llc-coloring.h>
 #include <xen/param.h>
 #include <xen/sections.h>
 #include <xen/shutdown.h>
@@ -304,6 +305,8 @@ static void cf_check dump_domains(unsigned char key)
 
         arch_dump_domain_info(d);
 
+        domain_dump_llc_colors(d);
+
         rangeset_domain_printk(d);
 
         dump_pageframe_info(d);
diff --git a/xen/common/llc-coloring.c b/xen/common/llc-coloring.c
new file mode 100644
index 0000000000..335a907296
--- /dev/null
+++ b/xen/common/llc-coloring.c
@@ -0,0 +1,124 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+/*
+ * Last Level Cache (LLC) coloring common code
+ *
+ * Copyright (C) 2024, Advanced Micro Devices, Inc.
+ * Copyright (C) 2024, Minerva Systems SRL
+ */
+#include <xen/keyhandler.h>
+#include <xen/llc-coloring.h>
+#include <xen/param.h>
+
+#define NR_LLC_COLORS          (1U << CONFIG_LLC_COLORS_ORDER)
+
+/*
+ * -1: not specified (disabled unless llc-size and llc-nr-ways present)
+ *  0: explicitly disabled through cmdline
+ *  1: explicitly enabled through cmdline
+ */
+static int8_t __initdata opt_llc_coloring = -1;
+boolean_param("llc-coloring", opt_llc_coloring);
+
+static bool __ro_after_init llc_coloring_enabled;
+
+static unsigned int __initdata llc_size;
+size_param("llc-size", llc_size);
+static unsigned int __initdata llc_nr_ways;
+integer_param("llc-nr-ways", llc_nr_ways);
+/* Number of colors available in the LLC */
+static unsigned int __ro_after_init max_nr_colors;
+
+static void print_colors(const unsigned int colors[], unsigned int num_colors)
+{
+    unsigned int i;
+
+    printk("{ ");
+    for ( i = 0; i < num_colors; i++ )
+    {
+        unsigned int start = colors[i], end = start;
+
+        printk("%u", start);
+
+        for ( ; i < num_colors - 1 && end + 1 == colors[i + 1]; i++, end++ )
+            ;
+
+        if ( start != end )
+            printk("-%u", end);
+
+        if ( i < num_colors - 1 )
+            printk(", ");
+    }
+    printk(" }\n");
+}
+
+void __init llc_coloring_init(void)
+{
+    unsigned int way_size;
+
+    llc_coloring_enabled = (opt_llc_coloring >= 1);
+    if ( (opt_llc_coloring != 0) && llc_size && llc_nr_ways )
+    {
+        llc_coloring_enabled = true;
+        way_size = llc_size / llc_nr_ways;
+    }
+    else if ( !llc_coloring_enabled )
+        return;
+    else
+    {
+        way_size = get_llc_way_size();
+        if ( !way_size )
+            panic("LLC probing failed and 'llc-size' or 'llc-nr-ways' missing\n");
+    }
+
+    if ( way_size & ~PAGE_MASK )
+        panic("LLC way size must be a multiple of PAGE_SIZE\n");
+
+    /*
+     * The maximum number of colors must be a power of 2 in order to correctly
+     * map them to bits of an address.
+     */
+    max_nr_colors = way_size >> PAGE_SHIFT;
+
+    if ( max_nr_colors & (max_nr_colors - 1) )
+        panic("Number of LLC colors (%u) isn't a power of 2\n", max_nr_colors);
+
+    if ( max_nr_colors > NR_LLC_COLORS )
+    {
+        printk(XENLOG_WARNING
+               "Number of LLC colors (%u) too big. Using configured max %u\n",
+               max_nr_colors, NR_LLC_COLORS);
+        max_nr_colors = NR_LLC_COLORS;
+    }
+    else if ( max_nr_colors < 2 )
+        panic("Number of LLC colors %u < 2\n", max_nr_colors);
+
+    arch_llc_coloring_init();
+}
+
+void dump_llc_coloring_info(void)
+{
+    if ( !llc_coloring_enabled )
+        return;
+
+    printk("LLC coloring info:\n");
+    printk("    Number of LLC colors supported: %u\n", max_nr_colors);
+}
+
+void domain_dump_llc_colors(const struct domain *d)
+{
+    if ( !llc_coloring_enabled )
+        return;
+
+    printk("%u LLC colors: ", d->num_llc_colors);
+    print_colors(d->llc_colors, d->num_llc_colors);
+}
+
+/*
+ * Local variables:
+ * mode: C
+ * c-file-style: "BSD"
+ * c-basic-offset: 4
+ * tab-width: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
diff --git a/xen/common/page_alloc.c b/xen/common/page_alloc.c
index b76a03fd73..6dc8e0d5c9 100644
--- a/xen/common/page_alloc.c
+++ b/xen/common/page_alloc.c
@@ -126,6 +126,7 @@
 #include <xen/irq.h>
 #include <xen/keyhandler.h>
 #include <xen/lib.h>
+#include <xen/llc-coloring.h>
 #include <xen/mm.h>
 #include <xen/nodemask.h>
 #include <xen/numa.h>
@@ -2651,6 +2652,8 @@ static void cf_check pagealloc_info(unsigned char key)
     }
 
     printk("    Dom heap: %lukB free\n", total << (PAGE_SHIFT-10));
+
+    dump_llc_coloring_info();
 }
 
 static __init int cf_check pagealloc_keyhandler_init(void)
diff --git a/xen/include/xen/llc-coloring.h b/xen/include/xen/llc-coloring.h
new file mode 100644
index 0000000000..0acd8d0ad6
--- /dev/null
+++ b/xen/include/xen/llc-coloring.h
@@ -0,0 +1,36 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+/*
+ * Last Level Cache (LLC) coloring common header
+ *
+ * Copyright (C) 2024, Advanced Micro Devices, Inc.
+ * Copyright (C) 2024, Minerva Systems SRL
+ */
+#ifndef __XEN_LLC_COLORING_H__
+#define __XEN_LLC_COLORING_H__
+
+struct domain;
+
+#ifdef CONFIG_LLC_COLORING
+void llc_coloring_init(void);
+void dump_llc_coloring_info(void);
+void domain_dump_llc_colors(const struct domain *d);
+#else
+static inline void llc_coloring_init(void) {}
+static inline void dump_llc_coloring_info(void) {}
+static inline void domain_dump_llc_colors(const struct domain *d) {}
+#endif
+
+unsigned int get_llc_way_size(void);
+void arch_llc_coloring_init(void);
+
+#endif /* __XEN_LLC_COLORING_H__ */
+
+/*
+ * Local variables:
+ * mode: C
+ * c-file-style: "BSD"
+ * c-basic-offset: 4
+ * tab-width: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
diff --git a/xen/include/xen/sched.h b/xen/include/xen/sched.h
index 711668e028..037c83fda2 100644
--- a/xen/include/xen/sched.h
+++ b/xen/include/xen/sched.h
@@ -640,6 +640,11 @@ struct domain
 
     /* Holding CDF_* constant. Internal flags for domain creation. */
     unsigned int cdf;
+
+#ifdef CONFIG_LLC_COLORING
+    unsigned int num_llc_colors;
+    const unsigned int *llc_colors;
+#endif
 };
 
 static inline struct page_list_head *page_to_list(
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Dec 20 08:22:12 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 20 Dec 2024 08:22:12 +0000
Received: from list by lists.xenproject.org with outflank-mailman.861680.1273699 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tOYGy-000771-R9; Fri, 20 Dec 2024 08:22:12 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 861680.1273699; Fri, 20 Dec 2024 08: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 1tOYGy-00076s-OM; Fri, 20 Dec 2024 08:22:12 +0000
Received: by outflank-mailman (input) for mailman id 861680;
 Fri, 20 Dec 2024 08:22:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tOYGy-00076h-2U
 for xen-changelog@lists.xenproject.org; Fri, 20 Dec 2024 08:22:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tOYGx-00D4v9-2N
 for xen-changelog@lists.xenproject.org;
 Fri, 20 Dec 2024 08:22:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tOYGx-005Sh8-35
 for xen-changelog@lists.xenproject.org;
 Fri, 20 Dec 2024 08:22:11 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=nRO2e6P2BE78GENfnoB8Grvz3L2rBELrbrHWTc8w5dU=; b=J5WROzQILXApmWYGOkkPQfiBBP
	oJ9ByeQGZ6gP3zoIK08+v3O1eoJ884sWVWiyK/HEhbQRwQBJEwhq6hBRngdyjLoycLCm0awyQjFxM
	I2ymvR4KFy5MA4+Y31sfexHeKrf1UW0Pl5Y4LXz+AruT+EIykFjyW3mIOMPODyMrg8jo=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/arm: add initial support for LLC coloring on arm64
Message-Id: <E1tOYGx-005Sh8-35@xenbits.xenproject.org>
Date: Fri, 20 Dec 2024 08:22:11 +0000

commit f4985fce6f0b2abd28875cdfbba95b37c00be548
Author:     Carlo Nonato <carlo.nonato@minervasys.tech>
AuthorDate: Tue Dec 17 18:06:27 2024 +0100
Commit:     Michal Orzel <michal.orzel@amd.com>
CommitDate: Thu Dec 19 19:24:31 2024 +0100

    xen/arm: add initial support for LLC coloring on arm64
    
    LLC coloring needs to know the last level cache layout in order to make the
    best use of it. This can be probed by inspecting the CLIDR_EL1 register,
    so the Last Level is defined as the last level visible by this register.
    Note that this excludes system caches in some platforms.
    
    Static memory allocation and cache coloring are incompatible because static
    memory can't be guaranteed to use only colors assigned to the domain.
    Panic during DomUs creation when both are enabled.
    
    Based on original work from: Luca Miccio <lucmiccio@gmail.com>
    
    Signed-off-by: Carlo Nonato <carlo.nonato@minervasys.tech>
    Signed-off-by: Marco Solieri <marco.solieri@minervasys.tech>
    Reviewed-by: Michal Orzel <michal.orzel@amd.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 docs/misc/cache-coloring.rst         | 14 +++++++
 xen/arch/arm/Kconfig                 |  1 +
 xen/arch/arm/Makefile                |  1 +
 xen/arch/arm/dom0less-build.c        |  6 +++
 xen/arch/arm/include/asm/processor.h | 15 +++++++
 xen/arch/arm/llc-coloring.c          | 79 ++++++++++++++++++++++++++++++++++++
 xen/arch/arm/setup.c                 |  3 ++
 xen/common/llc-coloring.c            |  4 +-
 xen/include/xen/llc-coloring.h       |  6 +++
 9 files changed, 128 insertions(+), 1 deletion(-)

diff --git a/docs/misc/cache-coloring.rst b/docs/misc/cache-coloring.rst
index 371f21a0e7..12972dbb2c 100644
--- a/docs/misc/cache-coloring.rst
+++ b/docs/misc/cache-coloring.rst
@@ -113,6 +113,20 @@ Auto-probing of LLC specs
 
 LLC size and number of ways are probed automatically by default.
 
+In the Arm implementation, this is done by inspecting the CLIDR_EL1 register.
+This means that other system caches that aren't visible there are ignored.
+
 LLC specs can be manually set via the above command line parameters. This
 bypasses any auto-probing and it's used to overcome failing situations, such as
 flawed probing logic, or for debugging/testing purposes.
+
+Known issues and limitations
+****************************
+
+"xen,static-mem" isn't supported when coloring is enabled
+#########################################################
+
+In the domain configuration, "xen,static-mem" allows memory to be statically
+allocated to the domain. This isn't possible when LLC coloring is enabled,
+because that memory can't be guaranteed to use only colors assigned to the
+domain.
diff --git a/xen/arch/arm/Kconfig b/xen/arch/arm/Kconfig
index 604aba4996..c5e7b74733 100644
--- a/xen/arch/arm/Kconfig
+++ b/xen/arch/arm/Kconfig
@@ -8,6 +8,7 @@ config ARM_64
 	depends on !ARM_32
 	select 64BIT
 	select HAS_FAST_MULTIPLY
+	select HAS_LLC_COLORING if !NUMA
 
 config ARM
 	def_bool y
diff --git a/xen/arch/arm/Makefile b/xen/arch/arm/Makefile
index e4ad1ce851..ccbfc61f88 100644
--- a/xen/arch/arm/Makefile
+++ b/xen/arch/arm/Makefile
@@ -35,6 +35,7 @@ obj-$(CONFIG_IOREQ_SERVER) += ioreq.o
 obj-y += irq.o
 obj-y += kernel.init.o
 obj-$(CONFIG_LIVEPATCH) += livepatch.o
+obj-$(CONFIG_LLC_COLORING) += llc-coloring.o
 obj-$(CONFIG_MEM_ACCESS) += mem_access.o
 obj-y += mm.o
 obj-y += monitor.o
diff --git a/xen/arch/arm/dom0less-build.c b/xen/arch/arm/dom0less-build.c
index f328a044e9..d93a85434e 100644
--- a/xen/arch/arm/dom0less-build.c
+++ b/xen/arch/arm/dom0less-build.c
@@ -5,6 +5,7 @@
 #include <xen/grant_table.h>
 #include <xen/iocap.h>
 #include <xen/libfdt/libfdt.h>
+#include <xen/llc-coloring.h>
 #include <xen/sched.h>
 #include <xen/serial.h>
 #include <xen/sizes.h>
@@ -890,7 +891,12 @@ void __init create_domUs(void)
             panic("No more domain IDs available\n");
 
         if ( dt_find_property(node, "xen,static-mem", NULL) )
+        {
+            if ( llc_coloring_enabled )
+                panic("LLC coloring and static memory are incompatible\n");
+
             flags |= CDF_staticmem;
+        }
 
         if ( dt_property_read_bool(node, "direct-map") )
         {
diff --git a/xen/arch/arm/include/asm/processor.h b/xen/arch/arm/include/asm/processor.h
index 8e02410465..60b587db69 100644
--- a/xen/arch/arm/include/asm/processor.h
+++ b/xen/arch/arm/include/asm/processor.h
@@ -18,6 +18,21 @@
 #define CTR_IDC_SHIFT       28
 #define CTR_DIC_SHIFT       29
 
+/* CCSIDR Current Cache Size ID Register */
+#define CCSIDR_LINESIZE_MASK            _AC(0x7, UL)
+#define CCSIDR_NUMSETS_SHIFT            13
+#define CCSIDR_NUMSETS_MASK             _AC(0x3fff, UL)
+#define CCSIDR_NUMSETS_SHIFT_FEAT_CCIDX 32
+#define CCSIDR_NUMSETS_MASK_FEAT_CCIDX  _AC(0xffffff, UL)
+
+/* CSSELR Cache Size Selection Register */
+#define CSSELR_LEVEL_SHIFT 1
+
+/* CLIDR Cache Level ID Register */
+#define CLIDR_CTYPEn_SHIFT(n) (3 * ((n) - 1))
+#define CLIDR_CTYPEn_MASK     _AC(0x7, UL)
+#define CLIDR_CTYPEn_LEVELS   7
+
 #define ICACHE_POLICY_VPIPT  0
 #define ICACHE_POLICY_AIVIVT 1
 #define ICACHE_POLICY_VIPT   2
diff --git a/xen/arch/arm/llc-coloring.c b/xen/arch/arm/llc-coloring.c
new file mode 100644
index 0000000000..1c7b92bc45
--- /dev/null
+++ b/xen/arch/arm/llc-coloring.c
@@ -0,0 +1,79 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+/*
+ * Last Level Cache (LLC) coloring support for ARM
+ *
+ * Copyright (C) 2024, Advanced Micro Devices, Inc.
+ * Copyright (C) 2024, Minerva Systems SRL
+ */
+#include <xen/init.h>
+#include <xen/llc-coloring.h>
+
+#include <asm/processor.h>
+#include <asm/sysregs.h>
+#include <asm/system.h>
+
+/* Return the LLC way size by probing the hardware */
+unsigned int __init get_llc_way_size(void)
+{
+    register_t ccsidr_el1;
+    register_t clidr_el1 = READ_SYSREG(CLIDR_EL1);
+    register_t csselr_el1 = READ_SYSREG(CSSELR_EL1);
+    register_t id_aa64mmfr2_el1 = READ_SYSREG(ID_AA64MMFR2_EL1);
+    uint32_t ccsidr_numsets_shift = CCSIDR_NUMSETS_SHIFT;
+    uint32_t ccsidr_numsets_mask = CCSIDR_NUMSETS_MASK;
+    unsigned int n, line_size, num_sets;
+
+    for ( n = CLIDR_CTYPEn_LEVELS; n != 0; n-- )
+    {
+        uint8_t ctype_n = (clidr_el1 >> CLIDR_CTYPEn_SHIFT(n)) &
+                           CLIDR_CTYPEn_MASK;
+
+        /* Unified cache (see Arm ARM DDI 0487J.a D19.2.27) */
+        if ( ctype_n == 0b100 )
+            break;
+    }
+
+    if ( n == 0 )
+        return 0;
+
+    WRITE_SYSREG((n - 1) << CSSELR_LEVEL_SHIFT, CSSELR_EL1);
+    isb();
+
+    ccsidr_el1 = READ_SYSREG(CCSIDR_EL1);
+
+    /* Arm ARM: (Log2(Number of bytes in cache line)) - 4 */
+    line_size = 1U << ((ccsidr_el1 & CCSIDR_LINESIZE_MASK) + 4);
+
+    /* If FEAT_CCIDX is enabled, CCSIDR_EL1 has a different bit layout */
+    if ( (id_aa64mmfr2_el1 >> ID_AA64MMFR2_CCIDX_SHIFT) & 0x7 )
+    {
+        ccsidr_numsets_shift = CCSIDR_NUMSETS_SHIFT_FEAT_CCIDX;
+        ccsidr_numsets_mask = CCSIDR_NUMSETS_MASK_FEAT_CCIDX;
+    }
+
+    /* Arm ARM: (Number of sets in cache) - 1 */
+    num_sets = ((ccsidr_el1 >> ccsidr_numsets_shift) & ccsidr_numsets_mask) + 1;
+
+    printk(XENLOG_INFO "LLC found: L%u (line size: %u bytes, sets num: %u)\n",
+           n, line_size, num_sets);
+
+    /* Restore value in CSSELR_EL1 */
+    WRITE_SYSREG(csselr_el1, CSSELR_EL1);
+    isb();
+
+    return line_size * num_sets;
+}
+
+void __init arch_llc_coloring_init(void)
+{
+}
+
+/*
+ * Local variables:
+ * mode: C
+ * c-file-style: "BSD"
+ * c-basic-offset: 4
+ * tab-width: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
diff --git a/xen/arch/arm/setup.c b/xen/arch/arm/setup.c
index 545702d8a3..5f1993ffed 100644
--- a/xen/arch/arm/setup.c
+++ b/xen/arch/arm/setup.c
@@ -12,6 +12,7 @@
 #include <xen/device_tree.h>
 #include <xen/domain_page.h>
 #include <xen/grant_table.h>
+#include <xen/llc-coloring.h>
 #include <xen/types.h>
 #include <xen/string.h>
 #include <xen/serial.h>
@@ -334,6 +335,8 @@ void asmlinkage __init start_xen(unsigned long fdt_paddr)
     printk("Command line: %s\n", cmdline);
     cmdline_parse(cmdline);
 
+    llc_coloring_init();
+
     setup_mm();
 
     vm_init();
diff --git a/xen/common/llc-coloring.c b/xen/common/llc-coloring.c
index 335a907296..b034c0169c 100644
--- a/xen/common/llc-coloring.c
+++ b/xen/common/llc-coloring.c
@@ -8,6 +8,8 @@
 #include <xen/keyhandler.h>
 #include <xen/llc-coloring.h>
 #include <xen/param.h>
+#include <xen/sched.h>
+#include <xen/types.h>
 
 #define NR_LLC_COLORS          (1U << CONFIG_LLC_COLORS_ORDER)
 
@@ -19,7 +21,7 @@
 static int8_t __initdata opt_llc_coloring = -1;
 boolean_param("llc-coloring", opt_llc_coloring);
 
-static bool __ro_after_init llc_coloring_enabled;
+bool __ro_after_init llc_coloring_enabled;
 
 static unsigned int __initdata llc_size;
 size_param("llc-size", llc_size);
diff --git a/xen/include/xen/llc-coloring.h b/xen/include/xen/llc-coloring.h
index 0acd8d0ad6..a3ebb17186 100644
--- a/xen/include/xen/llc-coloring.h
+++ b/xen/include/xen/llc-coloring.h
@@ -8,13 +8,19 @@
 #ifndef __XEN_LLC_COLORING_H__
 #define __XEN_LLC_COLORING_H__
 
+#include <xen/types.h>
+
 struct domain;
 
 #ifdef CONFIG_LLC_COLORING
+extern bool llc_coloring_enabled;
+
 void llc_coloring_init(void);
 void dump_llc_coloring_info(void);
 void domain_dump_llc_colors(const struct domain *d);
 #else
+#define llc_coloring_enabled false
+
 static inline void llc_coloring_init(void) {}
 static inline void dump_llc_coloring_info(void) {}
 static inline void domain_dump_llc_colors(const struct domain *d) {}
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Dec 20 08:22:22 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 20 Dec 2024 08:22:22 +0000
Received: from list by lists.xenproject.org with outflank-mailman.861681.1273703 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tOYH8-00079l-Sc; Fri, 20 Dec 2024 08:22:22 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 861681.1273703; Fri, 20 Dec 2024 08: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 1tOYH8-00079d-Q0; Fri, 20 Dec 2024 08:22:22 +0000
Received: by outflank-mailman (input) for mailman id 861681;
 Fri, 20 Dec 2024 08:22:22 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tOYH8-00079V-64
 for xen-changelog@lists.xenproject.org; Fri, 20 Dec 2024 08:22:22 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tOYH7-00D4vG-2m
 for xen-changelog@lists.xenproject.org;
 Fri, 20 Dec 2024 08:22:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tOYH8-005Shn-0J
 for xen-changelog@lists.xenproject.org;
 Fri, 20 Dec 2024 08:22:22 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=OBr+RLxhuP7G8UOdQfKtblFR5GPsjDAUdhzK+deRgl4=; b=ZoqBvcEqugna+eYSaNjU42YwqW
	bZobJw01soh/fpp6UzoiVPcIwpp6ZCbBce2IQWaOKK7vNVItKofvrNMg6QkzDFGZpj7YZnU5wUezL
	jLbtVczHObUcu5apAIbwTRXpIRsr3eMWwSCaBEP6XOewxF8mBQ7jx0wF850uCmvaa5NA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/arm: permit non direct-mapped Dom0 construction
Message-Id: <E1tOYH8-005Shn-0J@xenbits.xenproject.org>
Date: Fri, 20 Dec 2024 08:22:22 +0000

commit 02975cc383895d8b2484fce144b2cfec8df93707
Author:     Carlo Nonato <carlo.nonato@minervasys.tech>
AuthorDate: Tue Dec 17 18:06:28 2024 +0100
Commit:     Michal Orzel <michal.orzel@amd.com>
CommitDate: Thu Dec 19 19:24:31 2024 +0100

    xen/arm: permit non direct-mapped Dom0 construction
    
    Cache coloring requires Dom0 not to be direct-mapped because of its non
    contiguous mapping nature, so allocate_memory() is needed in this case.
    8d2c3ab18cc1 ("arm/dom0less: put dom0less feature code in a separate module")
    moved allocate_memory() in dom0less_build.c. In order to use it
    in Dom0 construction bring it back to domain_build.c and declare it in
    domain_build.h.
    
    Adapt the implementation of allocate_memory() so that it uses the host
    layout when called on the hwdom, via find_unallocated_memory().
    
    Since gnttab information are needed in the process, move find_gnttab_region()
    before allocate_memory() in construct_dom0().
    
    Introduce add_hwdom_free_regions() callback to add hwdom banks in descending
    order.
    
    Signed-off-by: Carlo Nonato <carlo.nonato@minervasys.tech>
    Reviewed-by: Michal Orzel <michal.orzel@amd.com>
---
 xen/arch/arm/dom0less-build.c           |  44 ---------
 xen/arch/arm/domain_build.c             | 156 +++++++++++++++++++++++++++++++-
 xen/arch/arm/include/asm/domain_build.h |   1 +
 3 files changed, 153 insertions(+), 48 deletions(-)

diff --git a/xen/arch/arm/dom0less-build.c b/xen/arch/arm/dom0less-build.c
index d93a85434e..67b1503647 100644
--- a/xen/arch/arm/dom0less-build.c
+++ b/xen/arch/arm/dom0less-build.c
@@ -49,50 +49,6 @@ bool __init is_dom0less_mode(void)
     return ( !dom0found && domUfound );
 }
 
-static void __init allocate_memory(struct domain *d, struct kernel_info *kinfo)
-{
-    struct membanks *mem = kernel_info_get_mem(kinfo);
-    unsigned int i;
-    paddr_t bank_size;
-
-    printk(XENLOG_INFO "Allocating mappings totalling %ldMB for %pd:\n",
-           /* Don't want format this as PRIpaddr (16 digit hex) */
-           (unsigned long)(kinfo->unassigned_mem >> 20), d);
-
-    mem->nr_banks = 0;
-    bank_size = MIN(GUEST_RAM0_SIZE, kinfo->unassigned_mem);
-    if ( !allocate_bank_memory(kinfo, gaddr_to_gfn(GUEST_RAM0_BASE),
-                               bank_size) )
-        goto fail;
-
-    bank_size = MIN(GUEST_RAM1_SIZE, kinfo->unassigned_mem);
-    if ( !allocate_bank_memory(kinfo, gaddr_to_gfn(GUEST_RAM1_BASE),
-                               bank_size) )
-        goto fail;
-
-    if ( kinfo->unassigned_mem )
-        goto fail;
-
-    for( i = 0; i < mem->nr_banks; i++ )
-    {
-        printk(XENLOG_INFO "%pd BANK[%d] %#"PRIpaddr"-%#"PRIpaddr" (%ldMB)\n",
-               d,
-               i,
-               mem->bank[i].start,
-               mem->bank[i].start + mem->bank[i].size,
-               /* Don't want format this as PRIpaddr (16 digit hex) */
-               (unsigned long)(mem->bank[i].size >> 20));
-    }
-
-    return;
-
-fail:
-    panic("Failed to allocate requested domain memory."
-          /* Don't want format this as PRIpaddr (16 digit hex) */
-          " %ldKB unallocated. Fix the VMs configurations.\n",
-          (unsigned long)kinfo->unassigned_mem >> 10);
-}
-
 #ifdef CONFIG_VGICV2
 static int __init make_gicv2_domU_node(struct kernel_info *kinfo)
 {
diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c
index adf26f2778..17cc76b6f2 100644
--- a/xen/arch/arm/domain_build.c
+++ b/xen/arch/arm/domain_build.c
@@ -2,6 +2,7 @@
 #include <xen/init.h>
 #include <xen/compile.h>
 #include <xen/lib.h>
+#include <xen/llc-coloring.h>
 #include <xen/mm.h>
 #include <xen/param.h>
 #include <xen/domain_page.h>
@@ -416,7 +417,6 @@ static void __init allocate_memory_11(struct domain *d,
     }
 }
 
-#ifdef CONFIG_DOM0LESS_BOOT
 bool __init allocate_domheap_memory(struct domain *d, paddr_t tot_size,
                                     alloc_domheap_mem_cb cb, void *extra)
 {
@@ -508,7 +508,6 @@ bool __init allocate_bank_memory(struct kernel_info *kinfo, gfn_t sgfn,
 
     return true;
 }
-#endif
 
 /*
  * When PCI passthrough is available we want to keep the
@@ -900,6 +899,52 @@ int __init add_ext_regions(unsigned long s_gfn, unsigned long e_gfn,
     return 0;
 }
 
+static int __init add_hwdom_free_regions(unsigned long s_gfn,
+                                         unsigned long e_gfn, void *data)
+{
+    struct membanks *free_regions = data;
+    paddr_t start, size;
+    paddr_t s = pfn_to_paddr(s_gfn);
+    paddr_t e = pfn_to_paddr(e_gfn);
+    unsigned int i, j;
+
+    if ( free_regions->nr_banks >= free_regions->max_banks )
+        return 0;
+
+    /*
+     * Both start and size of the free region should be 2MB aligned to
+     * potentially allow superpage mapping.
+     */
+    start = (s + SZ_2M - 1) & ~(SZ_2M - 1);
+    if ( start > e )
+        return 0;
+
+    /*
+     * e is actually "end-1" because it is called by rangeset functions
+     * which are inclusive of the last address.
+     */
+    e += 1;
+    size = (e - start) & ~(SZ_2M - 1);
+
+    /* Find the insert position (descending order). */
+    for ( i = 0; i < free_regions->nr_banks ; i++ )
+        if ( size > free_regions->bank[i].size )
+            break;
+
+    /* Move the other banks to make space. */
+    for ( j = free_regions->nr_banks; j > i ; j-- )
+    {
+        free_regions->bank[j].start = free_regions->bank[j - 1].start;
+        free_regions->bank[j].size = free_regions->bank[j - 1].size;
+    }
+
+    free_regions->bank[i].start = start;
+    free_regions->bank[i].size = size;
+    free_regions->nr_banks++;
+
+    return 0;
+}
+
 /*
  * Find unused regions of Host address space which can be exposed to domain
  * using the host memory layout. In order to calculate regions we exclude every
@@ -977,6 +1022,106 @@ out:
     return res;
 }
 
+void __init allocate_memory(struct domain *d, struct kernel_info *kinfo)
+{
+    struct membanks *mem = kernel_info_get_mem(kinfo);
+    unsigned int i, nr_banks = GUEST_RAM_BANKS;
+    struct membanks *hwdom_free_mem = NULL;
+
+    printk(XENLOG_INFO "Allocating mappings totalling %ldMB for %pd:\n",
+           /* Don't want format this as PRIpaddr (16 digit hex) */
+           (unsigned long)(kinfo->unassigned_mem >> 20), d);
+
+    mem->nr_banks = 0;
+    /*
+     * Use host memory layout for hwdom. Only case for this is when LLC coloring
+     * is enabled.
+     */
+    if ( is_hardware_domain(d) )
+    {
+        struct membanks *gnttab = xzalloc_flex_struct(struct membanks, bank, 1);
+        /*
+         * Exclude the following regions:
+         * 1) Remove reserved memory
+         * 2) Grant table assigned to hwdom
+         */
+        const struct membanks *mem_banks[] = {
+            bootinfo_get_reserved_mem(),
+            gnttab,
+        };
+
+        if ( !gnttab )
+            goto fail;
+
+        gnttab->nr_banks = 1;
+        gnttab->bank[0].start = kinfo->gnttab_start;
+        gnttab->bank[0].size = kinfo->gnttab_size;
+
+        hwdom_free_mem = xzalloc_flex_struct(struct membanks, bank,
+                                             NR_MEM_BANKS);
+        if ( !hwdom_free_mem )
+            goto fail;
+
+        hwdom_free_mem->max_banks = NR_MEM_BANKS;
+
+        if ( find_unallocated_memory(kinfo, mem_banks, ARRAY_SIZE(mem_banks),
+                                     hwdom_free_mem, add_hwdom_free_regions) )
+            goto fail;
+
+        nr_banks = hwdom_free_mem->nr_banks;
+        xfree(gnttab);
+    }
+
+    for ( i = 0; kinfo->unassigned_mem > 0 && nr_banks > 0; i++, nr_banks-- )
+    {
+        paddr_t bank_start, bank_size;
+
+        if ( is_hardware_domain(d) )
+        {
+            bank_start = hwdom_free_mem->bank[i].start;
+            bank_size = hwdom_free_mem->bank[i].size;
+        }
+        else
+        {
+            const uint64_t bankbase[] = GUEST_RAM_BANK_BASES;
+            const uint64_t banksize[] = GUEST_RAM_BANK_SIZES;
+
+            if ( i >= GUEST_RAM_BANKS )
+                goto fail;
+
+            bank_start = bankbase[i];
+            bank_size = banksize[i];
+        }
+
+        bank_size = MIN(bank_size, kinfo->unassigned_mem);
+        if ( !allocate_bank_memory(kinfo, gaddr_to_gfn(bank_start), bank_size) )
+            goto fail;
+    }
+
+    if ( kinfo->unassigned_mem )
+        goto fail;
+
+    for( i = 0; i < mem->nr_banks; i++ )
+    {
+        printk(XENLOG_INFO "%pd BANK[%d] %#"PRIpaddr"-%#"PRIpaddr" (%ldMB)\n",
+               d,
+               i,
+               mem->bank[i].start,
+               mem->bank[i].start + mem->bank[i].size,
+               /* Don't want format this as PRIpaddr (16 digit hex) */
+               (unsigned long)(mem->bank[i].size >> 20));
+    }
+
+    xfree(hwdom_free_mem);
+    return;
+
+  fail:
+    panic("Failed to allocate requested domain memory."
+          /* Don't want format this as PRIpaddr (16 digit hex) */
+          " %ldKB unallocated. Fix the VMs configurations.\n",
+          (unsigned long)kinfo->unassigned_mem >> 10);
+}
+
 static int __init handle_pci_range(const struct dt_device_node *dev,
                                    uint64_t addr, uint64_t len, void *data)
 {
@@ -1235,7 +1380,7 @@ int __init make_hypervisor_node(struct domain *d,
 
         ext_regions->max_banks = NR_MEM_BANKS;
 
-        if ( is_domain_direct_mapped(d) )
+        if ( domain_use_host_layout(d) )
         {
             if ( !is_iommu_enabled(d) )
                 res = find_host_extended_regions(kinfo, ext_regions);
@@ -2164,8 +2309,11 @@ static int __init construct_dom0(struct domain *d)
     /* type must be set before allocate_memory */
     d->arch.type = kinfo.type;
 #endif
-    allocate_memory_11(d, &kinfo);
     find_gnttab_region(d, &kinfo);
+    if ( is_domain_direct_mapped(d) )
+        allocate_memory_11(d, &kinfo);
+    else
+        allocate_memory(d, &kinfo);
 
     rc = process_shm_chosen(d, &kinfo);
     if ( rc < 0 )
diff --git a/xen/arch/arm/include/asm/domain_build.h b/xen/arch/arm/include/asm/domain_build.h
index e712afbc7f..5d77af2e8b 100644
--- a/xen/arch/arm/include/asm/domain_build.h
+++ b/xen/arch/arm/include/asm/domain_build.h
@@ -11,6 +11,7 @@ bool allocate_domheap_memory(struct domain *d, paddr_t tot_size,
                              alloc_domheap_mem_cb cb, void *extra);
 bool allocate_bank_memory(struct kernel_info *kinfo, gfn_t sgfn,
                           paddr_t tot_size);
+void allocate_memory(struct domain *d, struct kernel_info *kinfo);
 int construct_domain(struct domain *d, struct kernel_info *kinfo);
 int domain_fdt_begin_node(void *fdt, const char *name, uint64_t unit);
 int make_chosen_node(const struct kernel_info *kinfo);
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Dec 20 08:22:34 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 20 Dec 2024 08:22:34 +0000
Received: from list by lists.xenproject.org with outflank-mailman.861682.1273707 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tOYHJ-0007Ce-Um; Fri, 20 Dec 2024 08:22:33 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 861682.1273707; Fri, 20 Dec 2024 08:22:33 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tOYHJ-0007CW-RY; Fri, 20 Dec 2024 08:22:33 +0000
Received: by outflank-mailman (input) for mailman id 861682;
 Fri, 20 Dec 2024 08:22:32 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tOYHI-0007CM-9A
 for xen-changelog@lists.xenproject.org; Fri, 20 Dec 2024 08:22:32 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tOYHH-00D4vK-35
 for xen-changelog@lists.xenproject.org;
 Fri, 20 Dec 2024 08:22:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tOYHI-005SjS-0i
 for xen-changelog@lists.xenproject.org;
 Fri, 20 Dec 2024 08:22:32 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=crwCDpqBgyrTIaOn57U4CrHM3STQ0uor9+rJ2PDGVbA=; b=sGKSL1gspIVlmo0Oui8zJgJAKN
	noGJR9IsMUX2OkdtuInCyWTcsFef9f2RpH6nzeu8bZcVxnVwKGlkuGO3TIUvVarjwYFsluGNIlImS
	gGJBXvzkHodByuKGfoFOQmudAcxwUS9HDY3g6Dz8QeuMw9OKawQjPHUF174AbkXXVc4E=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/arm: add Dom0 cache coloring support
Message-Id: <E1tOYHI-005SjS-0i@xenbits.xenproject.org>
Date: Fri, 20 Dec 2024 08:22:32 +0000

commit 6cdea3444eafd6e4f293882ab3bf4dfb8bffaf64
Author:     Carlo Nonato <carlo.nonato@minervasys.tech>
AuthorDate: Tue Dec 17 18:06:29 2024 +0100
Commit:     Michal Orzel <michal.orzel@amd.com>
CommitDate: Thu Dec 19 19:24:31 2024 +0100

    xen/arm: add Dom0 cache coloring support
    
    Add a command line parameter to allow the user to set the coloring
    configuration for Dom0.
    A common configuration syntax for cache colors is introduced and
    documented.
    Take the opportunity to also add:
     - default configuration notion.
     - function to check well-formed configurations.
    
    Direct mapping Dom0 isn't possible when coloring is enabled, so
    CDF_directmap flag is removed when creating it.
    
    Based on original work from: Luca Miccio <lucmiccio@gmail.com>
    
    Signed-off-by: Carlo Nonato <carlo.nonato@minervasys.tech>
    Signed-off-by: Marco Solieri <marco.solieri@minervasys.tech>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Michal Orzel <michal.orzel@amd.com>
---
 docs/misc/cache-coloring.rst      |  29 +++++++++
 docs/misc/xen-command-line.pandoc |   9 +++
 xen/arch/arm/domain_build.c       |   9 ++-
 xen/common/llc-coloring.c         | 120 +++++++++++++++++++++++++++++++++++++-
 xen/include/xen/llc-coloring.h    |   1 +
 5 files changed, 166 insertions(+), 2 deletions(-)

diff --git a/docs/misc/cache-coloring.rst b/docs/misc/cache-coloring.rst
index 12972dbb2c..7b47d0ed92 100644
--- a/docs/misc/cache-coloring.rst
+++ b/docs/misc/cache-coloring.rst
@@ -107,6 +107,35 @@ Specific documentation is available at `docs/misc/xen-command-line.pandoc`.
 +----------------------+-------------------------------+
 | ``llc-nr-ways``      | Set the LLC number of ways    |
 +----------------------+-------------------------------+
+| ``dom0-llc-colors``  | Dom0 color configuration      |
++----------------------+-------------------------------+
+
+Colors selection format
+***********************
+
+Regardless of the memory pool that has to be colored (Xen, Dom0/DomUs),
+the color selection can be expressed using the same syntax. In particular a
+comma-separated list of colors or ranges of colors is used.
+Ranges are hyphen-separated intervals (such as `0-4`) and are inclusive on both
+sides.
+
+Note that:
+
+- no spaces are allowed between values.
+- no overlapping ranges or duplicated colors are allowed.
+- values must be written in ascending order.
+
+Examples:
+
++-------------------+-----------------------------+
+| **Configuration** | **Actual selection**        |
++-------------------+-----------------------------+
+| 1-2,5-8           | [1, 2, 5, 6, 7, 8]          |
++-------------------+-----------------------------+
+| 4-8,10,11,12      | [4, 5, 6, 7, 8, 10, 11, 12] |
++-------------------+-----------------------------+
+| 0                 | [0]                         |
++-------------------+-----------------------------+
 
 Auto-probing of LLC specs
 #########################
diff --git a/docs/misc/xen-command-line.pandoc b/docs/misc/xen-command-line.pandoc
index d75903b84c..2e8c9dab25 100644
--- a/docs/misc/xen-command-line.pandoc
+++ b/docs/misc/xen-command-line.pandoc
@@ -965,6 +965,15 @@ Controls for the dom0 IOMMU setup.
 
 Specify a list of IO ports to be excluded from dom0 access.
 
+### dom0-llc-colors (arm64)
+> `= List of [ <integer> | <integer>-<integer> ]`
+
+> Default: `All available LLC colors`
+
+Specify dom0 LLC color configuration. This option is available only when
+`CONFIG_LLC_COLORING` is enabled. If the parameter is not set, all available
+colors are used.
+
 ### dom0_max_vcpus
 
 Either:
diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c
index 17cc76b6f2..b072a16249 100644
--- a/xen/arch/arm/domain_build.c
+++ b/xen/arch/arm/domain_build.c
@@ -2356,6 +2356,7 @@ void __init create_dom0(void)
         .max_maptrack_frames = -1,
         .grant_opts = XEN_DOMCTL_GRANT_version(opt_gnttab_max_version),
     };
+    unsigned int flags = CDF_privileged;
     int rc;
 
     /* The vGIC for DOM0 is exactly emulating the hardware GIC */
@@ -2383,10 +2384,16 @@ void __init create_dom0(void)
             panic("SVE vector length error\n");
     }
 
-    dom0 = domain_create(0, &dom0_cfg, CDF_privileged | CDF_directmap);
+    if ( !llc_coloring_enabled )
+        flags |= CDF_directmap;
+
+    dom0 = domain_create(0, &dom0_cfg, flags);
     if ( IS_ERR(dom0) )
         panic("Error creating domain 0 (rc = %ld)\n", PTR_ERR(dom0));
 
+    if ( llc_coloring_enabled && (rc = dom0_set_llc_colors(dom0)) )
+        panic("Error initializing LLC coloring for domain 0 (rc = %d)\n", rc);
+
     if ( alloc_dom0_vcpu0(dom0) == NULL )
         panic("Error creating domain 0 vcpu0\n");
 
diff --git a/xen/common/llc-coloring.c b/xen/common/llc-coloring.c
index b034c0169c..5984ae82e7 100644
--- a/xen/common/llc-coloring.c
+++ b/xen/common/llc-coloring.c
@@ -29,6 +29,66 @@ static unsigned int __initdata llc_nr_ways;
 integer_param("llc-nr-ways", llc_nr_ways);
 /* Number of colors available in the LLC */
 static unsigned int __ro_after_init max_nr_colors;
+/* Default coloring configuration */
+static unsigned int __ro_after_init default_colors[NR_LLC_COLORS];
+
+static unsigned int __initdata dom0_colors[NR_LLC_COLORS];
+static unsigned int __initdata dom0_num_colors;
+
+/*
+ * Parse the coloring configuration given in the buf string, following the
+ * syntax below.
+ *
+ * COLOR_CONFIGURATION ::= COLOR | RANGE,...,COLOR | RANGE
+ * RANGE               ::= COLOR-COLOR
+ *
+ * Example: "0,2-6,15-16" represents the set of colors: 0,2,3,4,5,6,15,16.
+ */
+static int __init parse_color_config(const char *buf, unsigned int colors[],
+                                     unsigned int max_num_colors,
+                                     unsigned int *num_colors)
+{
+    const char *s = buf;
+
+    *num_colors = 0;
+
+    while ( *s != '\0' )
+    {
+        unsigned int color, start, end;
+
+        start = simple_strtoul(s, &s, 0);
+
+        if ( *s == '-' )    /* Range */
+        {
+            s++;
+            end = simple_strtoul(s, &s, 0);
+        }
+        else                /* Single value */
+            end = start;
+
+        if ( start > end || (end - start) > (UINT_MAX - *num_colors) ||
+             (*num_colors + (end - start)) >= max_num_colors )
+            return -EINVAL;
+
+        /* Colors are range checked in check_colors() */
+        for ( color = start; color <= end; color++ )
+            colors[(*num_colors)++] = color;
+
+        if ( *s == ',' )
+            s++;
+        else if ( *s != '\0' )
+            break;
+    }
+
+    return *s ? -EINVAL : 0;
+}
+
+static int __init parse_dom0_colors(const char *s)
+{
+    return parse_color_config(s, dom0_colors, ARRAY_SIZE(dom0_colors),
+                              &dom0_num_colors);
+}
+custom_param("dom0-llc-colors", parse_dom0_colors);
 
 static void print_colors(const unsigned int colors[], unsigned int num_colors)
 {
@@ -53,9 +113,27 @@ static void print_colors(const unsigned int colors[], unsigned int num_colors)
     printk(" }\n");
 }
 
+static bool __init check_colors(const unsigned int colors[],
+                                unsigned int num_colors)
+{
+    unsigned int i;
+
+    for ( i = 0; i < num_colors; i++ )
+    {
+        if ( colors[i] >= max_nr_colors )
+        {
+            printk(XENLOG_ERR "LLC color %u >= %u (max allowed)\n", colors[i],
+                   max_nr_colors);
+            return false;
+        }
+    }
+
+    return true;
+}
+
 void __init llc_coloring_init(void)
 {
-    unsigned int way_size;
+    unsigned int way_size, i;
 
     llc_coloring_enabled = (opt_llc_coloring >= 1);
     if ( (opt_llc_coloring != 0) && llc_size && llc_nr_ways )
@@ -94,6 +172,9 @@ void __init llc_coloring_init(void)
     else if ( max_nr_colors < 2 )
         panic("Number of LLC colors %u < 2\n", max_nr_colors);
 
+    for ( i = 0; i < max_nr_colors; i++ )
+        default_colors[i] = i;
+
     arch_llc_coloring_init();
 }
 
@@ -115,6 +196,43 @@ void domain_dump_llc_colors(const struct domain *d)
     print_colors(d->llc_colors, d->num_llc_colors);
 }
 
+static void __init domain_set_default_colors(struct domain *d)
+{
+    printk(XENLOG_WARNING
+           "LLC color config not found for %pd, using all colors\n", d);
+
+    d->llc_colors = default_colors;
+    d->num_llc_colors = max_nr_colors;
+}
+
+int __init dom0_set_llc_colors(struct domain *d)
+{
+    typeof(*dom0_colors) *colors;
+
+    if ( !dom0_num_colors )
+    {
+        domain_set_default_colors(d);
+        return 0;
+    }
+
+    if ( (dom0_num_colors > max_nr_colors) ||
+         !check_colors(dom0_colors, dom0_num_colors) )
+    {
+        printk(XENLOG_ERR "%pd:  bad LLC color config\n", d);
+        return -EINVAL;
+    }
+
+    colors = xmalloc_array(typeof(*dom0_colors), dom0_num_colors);
+    if ( !colors )
+        return -ENOMEM;
+
+    memcpy(colors, dom0_colors, sizeof(*colors) * dom0_num_colors);
+    d->llc_colors = colors;
+    d->num_llc_colors = dom0_num_colors;
+
+    return 0;
+}
+
 /*
  * Local variables:
  * mode: C
diff --git a/xen/include/xen/llc-coloring.h b/xen/include/xen/llc-coloring.h
index a3ebb17186..d29ebeb4c5 100644
--- a/xen/include/xen/llc-coloring.h
+++ b/xen/include/xen/llc-coloring.h
@@ -28,6 +28,7 @@ static inline void domain_dump_llc_colors(const struct domain *d) {}
 
 unsigned int get_llc_way_size(void);
 void arch_llc_coloring_init(void);
+int dom0_set_llc_colors(struct domain *d);
 
 #endif /* __XEN_LLC_COLORING_H__ */
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Dec 20 08:22:44 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 20 Dec 2024 08:22:44 +0000
Received: from list by lists.xenproject.org with outflank-mailman.861683.1273711 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tOYHU-0007Fs-0q; Fri, 20 Dec 2024 08:22:44 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 861683.1273711; Fri, 20 Dec 2024 08:22:43 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tOYHT-0007Fl-UO; Fri, 20 Dec 2024 08:22:43 +0000
Received: by outflank-mailman (input) for mailman id 861683;
 Fri, 20 Dec 2024 08:22:42 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tOYHS-0007FV-C4
 for xen-changelog@lists.xenproject.org; Fri, 20 Dec 2024 08:22:42 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tOYHS-00D4vO-09
 for xen-changelog@lists.xenproject.org;
 Fri, 20 Dec 2024 08:22:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tOYHS-005SmZ-11
 for xen-changelog@lists.xenproject.org;
 Fri, 20 Dec 2024 08:22:42 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=n2vwaPF0jwlikQDhbVz4f0f/XyLGYxiAjz24eD4vYrU=; b=f1Ygum1O3pwUZyTMSByD0Nip9i
	IjIz4uZla7nVvoDDjKBOfTCUVTMZ5T7v/C5z194wWxACSFQJzjBtdioN1N7htXw5nU+8UgHVbJMM/
	pQtu1xhasLl36d1LI/BT2QD+OJOMp07FoAJ39yTWj+UZl3lxA5k2MgnQeEDEBsPaHXd0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen: extend domctl interface for cache coloring
Message-Id: <E1tOYHS-005SmZ-11@xenbits.xenproject.org>
Date: Fri, 20 Dec 2024 08:22:42 +0000

commit 6985aa5e0c3c3872a976b340dc31c1075203d9aa
Author:     Carlo Nonato <carlo.nonato@minervasys.tech>
AuthorDate: Tue Dec 17 18:06:30 2024 +0100
Commit:     Michal Orzel <michal.orzel@amd.com>
CommitDate: Thu Dec 19 19:24:31 2024 +0100

    xen: extend domctl interface for cache coloring
    
    Add a new domctl hypercall to allow the user to set LLC coloring
    configurations. Colors can be set only once, just after domain creation,
    since recoloring isn't supported.
    
    Based on original work from: Luca Miccio <lucmiccio@gmail.com>
    
    Signed-off-by: Carlo Nonato <carlo.nonato@minervasys.tech>
    Signed-off-by: Marco Solieri <marco.solieri@minervasys.tech>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/common/domain.c            |  3 +++
 xen/common/domctl.c            | 10 ++++++++
 xen/common/llc-coloring.c      | 55 +++++++++++++++++++++++++++++++++++++++---
 xen/include/public/domctl.h    |  9 +++++++
 xen/include/xen/llc-coloring.h |  5 ++++
 5 files changed, 79 insertions(+), 3 deletions(-)

diff --git a/xen/common/domain.c b/xen/common/domain.c
index e33a0a5a21..0c4cc77111 100644
--- a/xen/common/domain.c
+++ b/xen/common/domain.c
@@ -34,6 +34,7 @@
 #include <xen/xenoprof.h>
 #include <xen/irq.h>
 #include <xen/argo.h>
+#include <xen/llc-coloring.h>
 #include <asm/p2m.h>
 #include <asm/processor.h>
 #include <public/sched.h>
@@ -1303,6 +1304,8 @@ void domain_destroy(struct domain *d)
 {
     BUG_ON(!d->is_dying);
 
+    domain_llc_coloring_free(d);
+
     /* May be already destroyed, or get_domain() can race us. */
     if ( atomic_cmpxchg(&d->refcnt, 0, DOMAIN_DESTROYED) != 0 )
         return;
diff --git a/xen/common/domctl.c b/xen/common/domctl.c
index 444e072fdc..05abb581a0 100644
--- a/xen/common/domctl.c
+++ b/xen/common/domctl.c
@@ -8,6 +8,7 @@
 
 #include <xen/types.h>
 #include <xen/lib.h>
+#include <xen/llc-coloring.h>
 #include <xen/err.h>
 #include <xen/mm.h>
 #include <xen/sched.h>
@@ -866,6 +867,15 @@ long do_domctl(XEN_GUEST_HANDLE_PARAM(xen_domctl_t) u_domctl)
                 __HYPERVISOR_domctl, "h", u_domctl);
         break;
 
+    case XEN_DOMCTL_set_llc_colors:
+        if ( op->u.set_llc_colors.pad )
+            ret = -EINVAL;
+        else if ( llc_coloring_enabled )
+            ret = domain_set_llc_colors(d, &op->u.set_llc_colors);
+        else
+            ret = -EOPNOTSUPP;
+        break;
+
     default:
         ret = arch_do_domctl(op, d, u_domctl);
         break;
diff --git a/xen/common/llc-coloring.c b/xen/common/llc-coloring.c
index 5984ae82e7..3dd1aaa4df 100644
--- a/xen/common/llc-coloring.c
+++ b/xen/common/llc-coloring.c
@@ -5,6 +5,7 @@
  * Copyright (C) 2024, Advanced Micro Devices, Inc.
  * Copyright (C) 2024, Minerva Systems SRL
  */
+#include <xen/guest_access.h>
 #include <xen/keyhandler.h>
 #include <xen/llc-coloring.h>
 #include <xen/param.h>
@@ -113,8 +114,7 @@ static void print_colors(const unsigned int colors[], unsigned int num_colors)
     printk(" }\n");
 }
 
-static bool __init check_colors(const unsigned int colors[],
-                                unsigned int num_colors)
+static bool check_colors(const unsigned int colors[], unsigned int num_colors)
 {
     unsigned int i;
 
@@ -196,7 +196,7 @@ void domain_dump_llc_colors(const struct domain *d)
     print_colors(d->llc_colors, d->num_llc_colors);
 }
 
-static void __init domain_set_default_colors(struct domain *d)
+static void domain_set_default_colors(struct domain *d)
 {
     printk(XENLOG_WARNING
            "LLC color config not found for %pd, using all colors\n", d);
@@ -233,6 +233,55 @@ int __init dom0_set_llc_colors(struct domain *d)
     return 0;
 }
 
+int domain_set_llc_colors(struct domain *d,
+                          const struct xen_domctl_set_llc_colors *config)
+{
+    unsigned int *colors;
+
+    if ( d->num_llc_colors )
+        return -EEXIST;
+
+    if ( !config->num_llc_colors )
+    {
+        domain_set_default_colors(d);
+        return 0;
+    }
+
+    if ( config->num_llc_colors > max_nr_colors )
+        return -EINVAL;
+
+    colors = xmalloc_array(unsigned int, config->num_llc_colors);
+    if ( !colors )
+        return -ENOMEM;
+
+    if ( copy_from_guest(colors, config->llc_colors, config->num_llc_colors) )
+    {
+        xfree(colors);
+        return -EFAULT;
+    }
+
+    if ( !check_colors(colors, config->num_llc_colors) )
+    {
+        printk(XENLOG_ERR "%pd: bad LLC color config\n", d);
+        xfree(colors);
+        return -EINVAL;
+    }
+
+    d->llc_colors = colors;
+    d->num_llc_colors = config->num_llc_colors;
+
+    return 0;
+}
+
+void domain_llc_coloring_free(struct domain *d)
+{
+    if ( !llc_coloring_enabled || d->llc_colors == default_colors )
+        return;
+
+    /* free pointer-to-const using __va(__pa()) */
+    xfree(__va(__pa(d->llc_colors)));
+}
+
 /*
  * Local variables:
  * mode: C
diff --git a/xen/include/public/domctl.h b/xen/include/public/domctl.h
index 353f831e40..e2d392d1e5 100644
--- a/xen/include/public/domctl.h
+++ b/xen/include/public/domctl.h
@@ -1236,6 +1236,13 @@ struct xen_domctl_dt_overlay {
 };
 #endif
 
+struct xen_domctl_set_llc_colors {
+    /* IN LLC coloring parameters */
+    uint32_t num_llc_colors;
+    uint32_t pad;
+    XEN_GUEST_HANDLE_64(uint32) llc_colors;
+};
+
 struct xen_domctl {
     uint32_t cmd;
 #define XEN_DOMCTL_createdomain                   1
@@ -1325,6 +1332,7 @@ struct xen_domctl {
 #define XEN_DOMCTL_set_paging_mempool_size       86
 #define XEN_DOMCTL_dt_overlay                    87
 #define XEN_DOMCTL_gsi_permission                88
+#define XEN_DOMCTL_set_llc_colors                89
 #define XEN_DOMCTL_gdbsx_guestmemio            1000
 #define XEN_DOMCTL_gdbsx_pausevcpu             1001
 #define XEN_DOMCTL_gdbsx_unpausevcpu           1002
@@ -1391,6 +1399,7 @@ struct xen_domctl {
 #if defined(__arm__) || defined(__aarch64__)
         struct xen_domctl_dt_overlay        dt_overlay;
 #endif
+        struct xen_domctl_set_llc_colors    set_llc_colors;
         uint8_t                             pad[128];
     } u;
 };
diff --git a/xen/include/xen/llc-coloring.h b/xen/include/xen/llc-coloring.h
index d29ebeb4c5..26353c808a 100644
--- a/xen/include/xen/llc-coloring.h
+++ b/xen/include/xen/llc-coloring.h
@@ -11,6 +11,7 @@
 #include <xen/types.h>
 
 struct domain;
+struct xen_domctl_set_llc_colors;
 
 #ifdef CONFIG_LLC_COLORING
 extern bool llc_coloring_enabled;
@@ -18,17 +19,21 @@ extern bool llc_coloring_enabled;
 void llc_coloring_init(void);
 void dump_llc_coloring_info(void);
 void domain_dump_llc_colors(const struct domain *d);
+void domain_llc_coloring_free(struct domain *d);
 #else
 #define llc_coloring_enabled false
 
 static inline void llc_coloring_init(void) {}
 static inline void dump_llc_coloring_info(void) {}
 static inline void domain_dump_llc_colors(const struct domain *d) {}
+static inline void domain_llc_coloring_free(struct domain *d) {}
 #endif
 
 unsigned int get_llc_way_size(void);
 void arch_llc_coloring_init(void);
 int dom0_set_llc_colors(struct domain *d);
+int domain_set_llc_colors(struct domain *d,
+                          const struct xen_domctl_set_llc_colors *config);
 
 #endif /* __XEN_LLC_COLORING_H__ */
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Dec 20 08:22:54 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 20 Dec 2024 08:22:54 +0000
Received: from list by lists.xenproject.org with outflank-mailman.861684.1273715 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tOYHe-0007IO-2R; Fri, 20 Dec 2024 08:22:54 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 861684.1273715; Fri, 20 Dec 2024 08: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 1tOYHd-0007IH-W3; Fri, 20 Dec 2024 08:22:53 +0000
Received: by outflank-mailman (input) for mailman id 861684;
 Fri, 20 Dec 2024 08:22:52 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tOYHc-0007I4-Fi
 for xen-changelog@lists.xenproject.org; Fri, 20 Dec 2024 08:22:52 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tOYHc-00D4vk-0V
 for xen-changelog@lists.xenproject.org;
 Fri, 20 Dec 2024 08:22:52 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tOYHc-005SnY-1M
 for xen-changelog@lists.xenproject.org;
 Fri, 20 Dec 2024 08:22:52 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=OcG7c7qrK6rSYI5vXQMKqE/Xb0GYza1s+TYtt7Og2x4=; b=cnPSMG+s9n+Vf8+ovCX6BzUnrg
	6lZSwA46o4drJka5Snr22RiY+YNnlrS9e9bmxuCbHF0jSlQx/vpKoxgnWv575EUEnv5rmHOIbUfIr
	dfEy0hRXYwVS4UzX1Y5cq9nmfPkR4F9zNHQlpqsBfOHpYGllS/vSCS4i42MHZP2UYuk8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools: add support for cache coloring configuration
Message-Id: <E1tOYHc-005SnY-1M@xenbits.xenproject.org>
Date: Fri, 20 Dec 2024 08:22:52 +0000

commit 748bd725fbeca1c412a17cf5e5d02d5ce5204209
Author:     Carlo Nonato <carlo.nonato@minervasys.tech>
AuthorDate: Tue Dec 17 18:06:31 2024 +0100
Commit:     Michal Orzel <michal.orzel@amd.com>
CommitDate: Thu Dec 19 19:24:31 2024 +0100

    tools: add support for cache coloring configuration
    
    Add a new "llc_colors" parameter that defines the LLC color assignment for
    a domain. The user can specify one or more color ranges using the same
    syntax used everywhere else for color config described in the
    documentation.
    The parameter is defined as a list of strings that represent the color
    ranges.
    
    Documentation is also added.
    Golang bindings are regenerated.
    
    Based on original work from: Luca Miccio <lucmiccio@gmail.com>
    
    Signed-off-by: Carlo Nonato <carlo.nonato@minervasys.tech>
    Signed-off-by: Marco Solieri <marco.solieri@minervasys.tech>
    Reviewed-by: Anthony PERARD <anthony.perard@vates.tech>
---
 docs/man/xl.cfg.5.pod.in             |  6 ++++++
 tools/golang/xenlight/helpers.gen.go | 16 +++++++++++++++
 tools/golang/xenlight/types.gen.go   |  1 +
 tools/include/libxl.h                |  5 +++++
 tools/include/xenctrl.h              |  9 +++++++++
 tools/libs/ctrl/xc_domain.c          | 34 ++++++++++++++++++++++++++++++++
 tools/libs/light/libxl_create.c      | 18 +++++++++++++++++
 tools/libs/light/libxl_types.idl     |  1 +
 tools/xl/xl_parse.c                  | 38 +++++++++++++++++++++++++++++++++++-
 9 files changed, 127 insertions(+), 1 deletion(-)

diff --git a/docs/man/xl.cfg.5.pod.in b/docs/man/xl.cfg.5.pod.in
index ac3f88fd57..8e1422104e 100644
--- a/docs/man/xl.cfg.5.pod.in
+++ b/docs/man/xl.cfg.5.pod.in
@@ -3074,6 +3074,12 @@ raised.
 
 =over 4
 
+=item B<llc_colors=[ "RANGE", "RANGE", ...]>
+
+Specify the Last Level Cache (LLC) color configuration for the guest.
+B<RANGE> can be either a single color value or a hypen-separated closed
+interval of colors (such as "0-4").
+
 =item B<nr_spis="NR_SPIS">
 
 An optional integer parameter specifying the number of SPIs (Shared
diff --git a/tools/golang/xenlight/helpers.gen.go b/tools/golang/xenlight/helpers.gen.go
index fe5110474d..90846ea8e8 100644
--- a/tools/golang/xenlight/helpers.gen.go
+++ b/tools/golang/xenlight/helpers.gen.go
@@ -1097,6 +1097,14 @@ if err := x.Iomem[i].fromC(&v); err != nil {
 return fmt.Errorf("converting field Iomem: %v", err) }
 }
 }
+x.LlcColors = nil
+if n := int(xc.num_llc_colors); n > 0 {
+cLlcColors := (*[1<<28]C.uint32_t)(unsafe.Pointer(xc.llc_colors))[:n:n]
+x.LlcColors = make([]uint32, n)
+for i, v := range cLlcColors {
+x.LlcColors[i] = uint32(v)
+}
+}
 if err := x.ClaimMode.fromC(&xc.claim_mode);err != nil {
 return fmt.Errorf("converting field ClaimMode: %v", err)
 }
@@ -1453,6 +1461,14 @@ return fmt.Errorf("converting field Iomem: %v", err)
 }
 }
 }
+if numLlcColors := len(x.LlcColors); numLlcColors > 0 {
+xc.llc_colors = (*C.uint32_t)(C.malloc(C.size_t(numLlcColors*numLlcColors)))
+xc.num_llc_colors = C.int(numLlcColors)
+cLlcColors := (*[1<<28]C.uint32_t)(unsafe.Pointer(xc.llc_colors))[:numLlcColors:numLlcColors]
+for i,v := range x.LlcColors {
+cLlcColors[i] = C.uint32_t(v)
+}
+}
 if err := x.ClaimMode.toC(&xc.claim_mode); err != nil {
 return fmt.Errorf("converting field ClaimMode: %v", err)
 }
diff --git a/tools/golang/xenlight/types.gen.go b/tools/golang/xenlight/types.gen.go
index c9e45b306f..e7667f1ce3 100644
--- a/tools/golang/xenlight/types.gen.go
+++ b/tools/golang/xenlight/types.gen.go
@@ -575,6 +575,7 @@ SchedParams DomainSchedParams
 Ioports []IoportRange
 Irqs []uint32
 Iomem []IomemRange
+LlcColors []uint32
 ClaimMode Defbool
 EventChannels uint32
 Kernel string
diff --git a/tools/include/libxl.h b/tools/include/libxl.h
index 8d32428ea9..f8fe4afd7d 100644
--- a/tools/include/libxl.h
+++ b/tools/include/libxl.h
@@ -1379,6 +1379,11 @@ void libxl_mac_copy(libxl_ctx *ctx, libxl_mac *dst, const libxl_mac *src);
  */
 #define LIBXL_HAVE_BUILDINFO_HVM_SYSTEM_FIRMWARE
 
+/*
+ * The libxl_domain_build_info has the llc_colors array.
+ */
+#define LIBXL_HAVE_BUILDINFO_LLC_COLORS 1
+
 /*
  * ERROR_REMUS_XXX error code only exists from Xen 4.5, Xen 4.6 and it
  * is changed to ERROR_CHECKPOINT_XXX in Xen 4.7
diff --git a/tools/include/xenctrl.h b/tools/include/xenctrl.h
index ea57e9dbb9..b08e438ea8 100644
--- a/tools/include/xenctrl.h
+++ b/tools/include/xenctrl.h
@@ -2641,6 +2641,15 @@ int xc_livepatch_replace(xc_interface *xch, char *name, uint32_t timeout, uint32
 int xc_domain_cacheflush(xc_interface *xch, uint32_t domid,
                          xen_pfn_t start_pfn, xen_pfn_t nr_pfns);
 
+/*
+ * Set LLC colors for a domain.
+ * It can only be used directly after domain creation. An attempt to use it
+ * afterwards will result in an error.
+ */
+int xc_domain_set_llc_colors(xc_interface *xch, uint32_t domid,
+                             const uint32_t *llc_colors,
+                             uint32_t num_llc_colors);
+
 #if defined(__arm__) || defined(__aarch64__)
 int xc_dt_overlay(xc_interface *xch, void *overlay_fdt,
                   uint32_t overlay_fdt_size, uint8_t overlay_op);
diff --git a/tools/libs/ctrl/xc_domain.c b/tools/libs/ctrl/xc_domain.c
index e3538ec0ba..2ddc3f4f42 100644
--- a/tools/libs/ctrl/xc_domain.c
+++ b/tools/libs/ctrl/xc_domain.c
@@ -2195,6 +2195,40 @@ int xc_domain_soft_reset(xc_interface *xch,
     domctl.domain = domid;
     return do_domctl(xch, &domctl);
 }
+
+int xc_domain_set_llc_colors(xc_interface *xch, uint32_t domid,
+                             const uint32_t *llc_colors,
+                             uint32_t num_llc_colors)
+{
+    struct xen_domctl domctl = {};
+    DECLARE_HYPERCALL_BUFFER(uint32_t, local);
+    int ret = -1;
+
+    if ( num_llc_colors )
+    {
+        size_t bytes = sizeof(uint32_t) * num_llc_colors;
+
+        local = xc_hypercall_buffer_alloc(xch, local, bytes);
+        if ( local == NULL )
+        {
+            PERROR("Could not allocate LLC colors for set_llc_colors");
+            goto out;
+        }
+        memcpy(local, llc_colors, bytes);
+        set_xen_guest_handle(domctl.u.set_llc_colors.llc_colors, local);
+    }
+
+    domctl.cmd = XEN_DOMCTL_set_llc_colors;
+    domctl.domain = domid;
+    domctl.u.set_llc_colors.num_llc_colors = num_llc_colors;
+
+    ret = do_domctl(xch, &domctl);
+
+out:
+    xc_hypercall_buffer_free(xch, local);
+
+    return ret;
+}
 /*
  * Local variables:
  * mode: C
diff --git a/tools/libs/light/libxl_create.c b/tools/libs/light/libxl_create.c
index edeadd57ef..e03599ea99 100644
--- a/tools/libs/light/libxl_create.c
+++ b/tools/libs/light/libxl_create.c
@@ -747,6 +747,24 @@ int libxl__domain_make(libxl__gc *gc, libxl_domain_config *d_config,
             /* A new domain now exists */
             *domid = local_domid;
 
+            ret = xc_domain_set_llc_colors(ctx->xch, local_domid,
+                                           b_info->llc_colors,
+                                           b_info->num_llc_colors);
+            if (ret < 0) {
+                if (errno == EOPNOTSUPP) {
+                    if (b_info->num_llc_colors > 0) {
+                        LOGED(ERROR, local_domid,
+                            "LLC coloring not enabled in the hypervisor");
+                        rc = ERROR_FAIL;
+                        goto out;
+                    }
+                } else {
+                    LOGED(ERROR, local_domid, "LLC colors allocation failed");
+                    rc = ERROR_FAIL;
+                    goto out;
+                }
+            }
+
             rc = libxl__is_domid_recent(gc, local_domid, &recent);
             if (rc)
                 goto out;
diff --git a/tools/libs/light/libxl_types.idl b/tools/libs/light/libxl_types.idl
index 4e65e6fda5..bd4b8721ff 100644
--- a/tools/libs/light/libxl_types.idl
+++ b/tools/libs/light/libxl_types.idl
@@ -616,6 +616,7 @@ libxl_domain_build_info = Struct("domain_build_info",[
     ("ioports",          Array(libxl_ioport_range, "num_ioports")),
     ("irqs",             Array(uint32, "num_irqs")),
     ("iomem",            Array(libxl_iomem_range, "num_iomem")),
+    ("llc_colors",       Array(uint32, "num_llc_colors")),
     ("claim_mode",	     libxl_defbool),
     ("event_channels",   uint32),
     ("kernel",           string),
diff --git a/tools/xl/xl_parse.c b/tools/xl/xl_parse.c
index e3a4800f6e..3d85be7dd4 100644
--- a/tools/xl/xl_parse.c
+++ b/tools/xl/xl_parse.c
@@ -1296,7 +1296,7 @@ void parse_config_data(const char *config_source,
     XLU_ConfigList *cpus, *vbds, *nics, *pcis, *cvfbs, *cpuids, *vtpms,
                    *usbctrls, *usbdevs, *p9devs, *vdispls, *pvcallsifs_devs;
     XLU_ConfigList *channels, *ioports, *irqs, *iomem, *viridian, *dtdevs,
-                   *mca_caps, *smbios;
+                   *mca_caps, *smbios, *llc_colors;
     int num_ioports, num_irqs, num_iomem, num_cpus, num_viridian, num_mca_caps;
     int num_smbios;
     int pci_power_mgmt = 0;
@@ -1304,6 +1304,7 @@ void parse_config_data(const char *config_source,
     int pci_permissive = 0;
     int pci_seize = 0;
     int i, e;
+    int num_llc_colors;
     char *kernel_basename;
 
     libxl_domain_create_info *c_info = &d_config->c_info;
@@ -1447,6 +1448,41 @@ void parse_config_data(const char *config_source,
     if (!xlu_cfg_get_long (config, "maxmem", &l, 0))
         b_info->max_memkb = l * 1024;
 
+    if (!xlu_cfg_get_list(config, "llc_colors", &llc_colors, &num_llc_colors, 0)) {
+        int cur_index = 0;
+
+        b_info->num_llc_colors = 0;
+        for (i = 0; i < num_llc_colors; i++) {
+            uint32_t start = 0, end = 0, k;
+
+            buf = xlu_cfg_get_listitem(llc_colors, i);
+            if (!buf) {
+                fprintf(stderr,
+                        "xl: Can't get element %d in LLC color list\n", i);
+                exit(1);
+            }
+
+            if (sscanf(buf, "%" SCNu32 "-%" SCNu32, &start, &end) != 2) {
+                if (sscanf(buf, "%" SCNu32, &start) != 1) {
+                    fprintf(stderr, "xl: Invalid LLC color range: %s\n", buf);
+                    exit(1);
+                }
+                end = start;
+            } else if (start > end) {
+                fprintf(stderr,
+                        "xl: Start LLC color is greater than end: %s\n", buf);
+                exit(1);
+            }
+
+            b_info->num_llc_colors += (end - start) + 1;
+            b_info->llc_colors = (uint32_t *)realloc(b_info->llc_colors,
+                        sizeof(*b_info->llc_colors) * b_info->num_llc_colors);
+
+            for (k = start; k <= end; k++)
+                b_info->llc_colors[cur_index++] = k;
+        }
+    }
+
     if (!xlu_cfg_get_long (config, "vcpus", &l, 0)) {
         vcpus = l;
         if (libxl_cpu_bitmap_alloc(ctx, &b_info->avail_vcpus, l)) {
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Dec 20 08:23:04 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 20 Dec 2024 08:23:04 +0000
Received: from list by lists.xenproject.org with outflank-mailman.861685.1273719 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tOYHo-0007Kw-3w; Fri, 20 Dec 2024 08:23:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 861685.1273719; Fri, 20 Dec 2024 08: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 1tOYHo-0007Ko-1M; Fri, 20 Dec 2024 08:23:04 +0000
Received: by outflank-mailman (input) for mailman id 861685;
 Fri, 20 Dec 2024 08:23:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tOYHm-0007Ke-J3
 for xen-changelog@lists.xenproject.org; Fri, 20 Dec 2024 08:23:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tOYHm-00D4yR-0r
 for xen-changelog@lists.xenproject.org;
 Fri, 20 Dec 2024 08:23:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tOYHm-005SoR-1e
 for xen-changelog@lists.xenproject.org;
 Fri, 20 Dec 2024 08:23:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=kFH6YQKCX1ZjHBkRWszb/qs678Vn6PP5L3sx3nqpZlU=; b=iQfJft8Xy7vG+c21MhIhsxWJMJ
	VjMd5ApbIocK6WWY7lKfHyW99fz1b7FK+fASviZv8ahUdxhlnw3rgLeiBn/r5gOOih/gwqY/7SAAq
	R3Qim6oqHiWFZm00OVxKLI8/k1lGrwao2G8PgpgGU4T1XIXTkH+ZhPF24jVuVEq8MabM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/arm: add support for cache coloring configuration via device-tree
Message-Id: <E1tOYHm-005SoR-1e@xenbits.xenproject.org>
Date: Fri, 20 Dec 2024 08:23:02 +0000

commit 5948dc16759c215810968bcb5ba6921e48bcf96e
Author:     Carlo Nonato <carlo.nonato@minervasys.tech>
AuthorDate: Tue Dec 17 18:06:32 2024 +0100
Commit:     Michal Orzel <michal.orzel@amd.com>
CommitDate: Thu Dec 19 19:24:31 2024 +0100

    xen/arm: add support for cache coloring configuration via device-tree
    
    Add the "llc-colors" Device Tree property to express DomUs and Dom0less
    color configurations.
    
    Based on original work from: Luca Miccio <lucmiccio@gmail.com>
    
    Signed-off-by: Carlo Nonato <carlo.nonato@minervasys.tech>
    Signed-off-by: Marco Solieri <marco.solieri@minervasys.tech>
    Reviewed-by: Jan Beulich <jbeulich@suse.com> # non-Arm
    Reviewed-by: Michal Orzel <michal.orzel@amd.com>
---
 docs/misc/arm/device-tree/booting.txt |  5 ++++
 docs/misc/cache-coloring.rst          | 48 +++++++++++++++++++++++++++++++++++
 xen/arch/arm/dom0less-build.c         | 10 ++++++++
 xen/common/llc-coloring.c             | 40 +++++++++++++++++++++++++++++
 xen/include/xen/llc-coloring.h        |  1 +
 xen/include/xen/xmalloc.h             | 12 +++++++++
 6 files changed, 116 insertions(+)

diff --git a/docs/misc/arm/device-tree/booting.txt b/docs/misc/arm/device-tree/booting.txt
index 3a04f5c57f..9c881baccc 100644
--- a/docs/misc/arm/device-tree/booting.txt
+++ b/docs/misc/arm/device-tree/booting.txt
@@ -162,6 +162,11 @@ with the following properties:
 
     An integer specifying the number of vcpus to allocate to the guest.
 
+- llc-colors
+    A string specifying the LLC color configuration for the guest.
+    Refer to docs/misc/cache_coloring.rst for syntax. This option is applicable
+    only to Arm64 guests.
+
 - vpl011
 
     An empty property to enable/disable a virtual pl011 for the guest to
diff --git a/docs/misc/cache-coloring.rst b/docs/misc/cache-coloring.rst
index 7b47d0ed92..e097e74032 100644
--- a/docs/misc/cache-coloring.rst
+++ b/docs/misc/cache-coloring.rst
@@ -14,6 +14,7 @@ If needed, change the maximum number of colors with
 ``CONFIG_LLC_COLORS_ORDER=<n>``.
 
 Runtime configuration is done via `Command line parameters`_.
+For DomUs follow `DomUs configuration`_.
 
 Background
 **********
@@ -149,6 +150,53 @@ LLC specs can be manually set via the above command line parameters. This
 bypasses any auto-probing and it's used to overcome failing situations, such as
 flawed probing logic, or for debugging/testing purposes.
 
+DomUs configuration
+*******************
+
+DomUs colors can be set either in the ``xl`` configuration file (documentation
+at `docs/man/xl.cfg.pod.5.in`) or via Device Tree (documentation at
+`docs/misc/arm/device-tree/booting.txt`) using the ``llc-colors`` option.
+For example:
+
+::
+
+    xen,xen-bootargs = "console=dtuart dtuart=serial0 dom0_mem=1G dom0_max_vcpus=1 sched=null llc-coloring=on dom0-llc-colors=2-6";
+    xen,dom0-bootargs "console=hvc0 earlycon=xen earlyprintk=xen root=/dev/ram0"
+
+    dom0 {
+        compatible = "xen,linux-zimage" "xen,multiboot-module";
+        reg = <0x0 0x1000000 0x0 15858176>;
+    };
+
+    dom0-ramdisk {
+        compatible = "xen,linux-initrd" "xen,multiboot-module";
+        reg = <0x0 0x2000000 0x0 20638062>;
+    };
+
+    domU0 {
+        #address-cells = <0x1>;
+        #size-cells = <0x1>;
+        compatible = "xen,domain";
+        memory = <0x0 0x40000>;
+        llc-colors = "4-8,10,11,12";
+        cpus = <0x1>;
+        vpl011 = <0x1>;
+
+        module@2000000 {
+            compatible = "multiboot,kernel", "multiboot,module";
+            reg = <0x2000000 0xffffff>;
+            bootargs = "console=ttyAMA0";
+        };
+
+        module@30000000 {
+            compatible = "multiboot,ramdisk", "multiboot,module";
+            reg = <0x3000000 0xffffff>;
+        };
+    };
+
+**Note:** If no color configuration is provided for a domain, the default one,
+which corresponds to all available colors is used instead.
+
 Known issues and limitations
 ****************************
 
diff --git a/xen/arch/arm/dom0less-build.c b/xen/arch/arm/dom0less-build.c
index 67b1503647..49d1f14d65 100644
--- a/xen/arch/arm/dom0less-build.c
+++ b/xen/arch/arm/dom0less-build.c
@@ -817,6 +817,7 @@ void __init create_domUs(void)
     bool iommu = false;
     const struct dt_device_node *cpupool_node,
                                 *chosen = dt_find_node_by_path("/chosen");
+    const char *llc_colors_str = NULL;
 
     BUG_ON(chosen == NULL);
     dt_for_each_child_node(chosen, node)
@@ -965,6 +966,10 @@ void __init create_domUs(void)
 #endif
         }
 
+        dt_property_read_string(node, "llc-colors", &llc_colors_str);
+        if ( !llc_coloring_enabled && llc_colors_str )
+            panic("'llc-colors' found, but LLC coloring is disabled\n");
+
         /*
          * The variable max_init_domid is initialized with zero, so here it's
          * very important to use the pre-increment operator to call
@@ -975,6 +980,11 @@ void __init create_domUs(void)
             panic("Error creating domain %s (rc = %ld)\n",
                   dt_node_name(node), PTR_ERR(d));
 
+        if ( llc_coloring_enabled &&
+             (rc = domain_set_llc_colors_from_str(d, llc_colors_str)) )
+            panic("Error initializing LLC coloring for domain %s (rc = %d)\n",
+                  dt_node_name(node), rc);
+
         d->is_console = true;
         dt_device_set_used_by(node, d->domain_id);
 
diff --git a/xen/common/llc-coloring.c b/xen/common/llc-coloring.c
index 3dd1aaa4df..5a0e3bac59 100644
--- a/xen/common/llc-coloring.c
+++ b/xen/common/llc-coloring.c
@@ -282,6 +282,46 @@ void domain_llc_coloring_free(struct domain *d)
     xfree(__va(__pa(d->llc_colors)));
 }
 
+int __init domain_set_llc_colors_from_str(struct domain *d, const char *str)
+{
+    int err;
+    unsigned int *colors, num_colors;
+
+    if ( !str )
+    {
+        domain_set_default_colors(d);
+        return 0;
+    }
+
+    colors = xmalloc_array(unsigned int, max_nr_colors);
+    if ( !colors )
+        return -ENOMEM;
+
+    err = parse_color_config(str, colors, max_nr_colors, &num_colors);
+    if ( err )
+    {
+        printk(XENLOG_ERR "Error parsing LLC color configuration");
+        xfree(colors);
+        return err;
+    }
+
+    if ( !check_colors(colors, num_colors) )
+    {
+        printk(XENLOG_ERR "%pd: bad LLC color config\n", d);
+        xfree(colors);
+        return -EINVAL;
+    }
+
+    /* Adjust the size cause it was initially set to max_nr_colors */
+    d->llc_colors = xrealloc_array(colors, num_colors);
+    if ( !d->llc_colors )
+        d->llc_colors = colors;
+
+    d->num_llc_colors = num_colors;
+
+    return 0;
+}
+
 /*
  * Local variables:
  * mode: C
diff --git a/xen/include/xen/llc-coloring.h b/xen/include/xen/llc-coloring.h
index 26353c808a..5d1355b3c9 100644
--- a/xen/include/xen/llc-coloring.h
+++ b/xen/include/xen/llc-coloring.h
@@ -34,6 +34,7 @@ void arch_llc_coloring_init(void);
 int dom0_set_llc_colors(struct domain *d);
 int domain_set_llc_colors(struct domain *d,
                           const struct xen_domctl_set_llc_colors *config);
+int domain_set_llc_colors_from_str(struct domain *d, const char *str);
 
 #endif /* __XEN_LLC_COLORING_H__ */
 
diff --git a/xen/include/xen/xmalloc.h b/xen/include/xen/xmalloc.h
index b903fa2e26..f0412fb4e0 100644
--- a/xen/include/xen/xmalloc.h
+++ b/xen/include/xen/xmalloc.h
@@ -37,6 +37,9 @@
     ((_type *)_xmalloc_array(sizeof(_type), __alignof__(_type), _num))
 #define xzalloc_array(_type, _num) \
     ((_type *)_xzalloc_array(sizeof(_type), __alignof__(_type), _num))
+#define xrealloc_array(_ptr, _num)                                  \
+    ((typeof(_ptr))_xrealloc_array(_ptr, sizeof(typeof(*(_ptr))),   \
+                                   __alignof__(typeof(*(_ptr))), _num))
 
 /* Allocate space for a structure with a flexible array of typed objects. */
 #define xzalloc_flex_struct(type, field, nr) \
@@ -98,6 +101,15 @@ static inline void *_xzalloc_array(
     return _xzalloc(size * num, align);
 }
 
+static inline void *_xrealloc_array(
+    void *ptr, unsigned long size, unsigned long align, unsigned long num)
+{
+    /* Check for overflow. */
+    if ( size && num > UINT_MAX / size )
+        return NULL;
+    return _xrealloc(ptr, size * num, align);
+}
+
 /*
  * Pooled allocator interface.
  */
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Dec 20 08:23:14 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 20 Dec 2024 08:23:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.861686.1273722 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tOYHy-0007O7-6f; Fri, 20 Dec 2024 08:23:14 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 861686.1273722; Fri, 20 Dec 2024 08:23:14 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tOYHy-0007O0-42; Fri, 20 Dec 2024 08:23:14 +0000
Received: by outflank-mailman (input) for mailman id 861686;
 Fri, 20 Dec 2024 08:23:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tOYHw-0007Np-Mj
 for xen-changelog@lists.xenproject.org; Fri, 20 Dec 2024 08:23:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tOYHw-00D4yW-1E
 for xen-changelog@lists.xenproject.org;
 Fri, 20 Dec 2024 08:23:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tOYHw-005SpJ-22
 for xen-changelog@lists.xenproject.org;
 Fri, 20 Dec 2024 08:23:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=dYyJF9g/+aixu2ax52ynsCS4QCEEbT6TBlgmAErbq9g=; b=J5ex+NEZ9HAiRUyE4dT/WpXju1
	GW+yuTRwaebvSWg78MWyNC0naLJ7F7Tgyj1R3mvSHnZQJf/7ToC7FeRxsRGqfKZ4qMOv8XWEdzjFe
	+Rrcpfl8ApzExb59Q1DYvnRxS8QnJvHhA38Yg+aTUjswsEPPHn1ihNmp0sRGFk7zGcts=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen: add cache coloring allocator for domains
Message-Id: <E1tOYHw-005SpJ-22@xenbits.xenproject.org>
Date: Fri, 20 Dec 2024 08:23:12 +0000

commit 95debe51a936276cdfe8e16f89b8f6ef07d381f3
Author:     Carlo Nonato <carlo.nonato@minervasys.tech>
AuthorDate: Tue Dec 17 18:06:34 2024 +0100
Commit:     Michal Orzel <michal.orzel@amd.com>
CommitDate: Thu Dec 19 19:24:31 2024 +0100

    xen: add cache coloring allocator for domains
    
    Add a new memory page allocator that implements the cache coloring mechanism.
    The allocation algorithm enforces equal frequency distribution of cache
    partitions, following the coloring configuration of a domain. This allows
    for an even utilization of cache sets for every domain.
    
    Pages are stored in a color-indexed array of lists. Those lists are filled
    by a simple init function which computes the color of each page.
    When a domain requests a page, the allocator extracts the page from the list
    with the maximum number of free pages among those that the domain can access,
    given its coloring configuration.
    
    The allocator can only handle requests of order-0 pages. This allows for
    easier implementation and since cache coloring targets only embedded systems,
    it's assumed not to be a major problem.
    
    The buddy allocator must coexist with the colored one because the Xen heap
    isn't colored. For this reason a new Kconfig option and a command line
    parameter are added to let the user set the amount of memory reserved for
    the buddy allocator. Even when cache coloring is enabled, this memory
    isn't managed by the colored allocator.
    
    Colored heap information is dumped in the dump_heap() debug-key function.
    
    Based on original work from: Luca Miccio <lucmiccio@gmail.com>
    
    Signed-off-by: Marco Solieri <marco.solieri@minervasys.tech>
    Signed-off-by: Carlo Nonato <carlo.nonato@minervasys.tech>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Michal Orzel <michal.orzel@amd.com>
---
 docs/misc/cache-coloring.rst      |  37 ++++++++
 docs/misc/xen-command-line.pandoc |  14 +++
 xen/arch/arm/include/asm/mm.h     |   5 +
 xen/common/Kconfig                |   8 ++
 xen/common/llc-coloring.c         |  13 +++
 xen/common/page_alloc.c           | 191 +++++++++++++++++++++++++++++++++++++-
 xen/include/xen/llc-coloring.h    |   3 +
 7 files changed, 267 insertions(+), 4 deletions(-)

diff --git a/docs/misc/cache-coloring.rst b/docs/misc/cache-coloring.rst
index e097e74032..5224b27afe 100644
--- a/docs/misc/cache-coloring.rst
+++ b/docs/misc/cache-coloring.rst
@@ -13,6 +13,9 @@ To compile LLC coloring support set ``CONFIG_LLC_COLORING=y``.
 If needed, change the maximum number of colors with
 ``CONFIG_LLC_COLORS_ORDER=<n>``.
 
+If needed, change the buddy allocator reserved size with
+``CONFIG_BUDDY_ALLOCATOR_SIZE=<n>``.
+
 Runtime configuration is done via `Command line parameters`_.
 For DomUs follow `DomUs configuration`_.
 
@@ -110,6 +113,8 @@ Specific documentation is available at `docs/misc/xen-command-line.pandoc`.
 +----------------------+-------------------------------+
 | ``dom0-llc-colors``  | Dom0 color configuration      |
 +----------------------+-------------------------------+
+| ``buddy-alloc-size`` | Buddy allocator reserved size |
++----------------------+-------------------------------+
 
 Colors selection format
 ***********************
@@ -197,6 +202,17 @@ For example:
 **Note:** If no color configuration is provided for a domain, the default one,
 which corresponds to all available colors is used instead.
 
+Colored allocator and buddy allocator
+*************************************
+
+The colored allocator distributes pages based on color configurations of
+domains so that each domains only gets pages of its own colors.
+The colored allocator is meant as an alternative to the buddy allocator because
+its allocation policy is by definition incompatible with the generic one. Since
+the Xen heap is not colored yet, we need to support the coexistence of the two
+allocators and some memory must be left for the buddy one. Buddy memory
+reservation is configured via Kconfig or via command-line.
+
 Known issues and limitations
 ****************************
 
@@ -207,3 +223,24 @@ In the domain configuration, "xen,static-mem" allows memory to be statically
 allocated to the domain. This isn't possible when LLC coloring is enabled,
 because that memory can't be guaranteed to use only colors assigned to the
 domain.
+
+Cache coloring is intended only for embedded systems
+####################################################
+
+The current implementation aims to satisfy the need of predictability in
+embedded systems with small amount of memory to be managed in a colored way.
+Given that, some shortcuts are taken in the development. Expect worse
+performances on larger systems.
+
+Colored allocator can only make use of order-0 pages
+####################################################
+
+The cache coloring technique relies on memory mappings and on the smallest
+mapping granularity to achieve the maximum number of colors (cache partitions)
+possible. This granularity is what is normally called a page and, in Xen
+terminology, the order-0 page is the smallest one. The fairly simple
+colored allocator currently implemented, makes use only of such pages.
+It must be said that a more complex one could, in theory, adopt higher order
+pages if the colors selection contained adjacent colors. Two subsequent colors,
+for example, can be represented by an order-1 page, four colors correspond to
+an order-2 page, etc.
diff --git a/docs/misc/xen-command-line.pandoc b/docs/misc/xen-command-line.pandoc
index 2e8c9dab25..cd43eccc5d 100644
--- a/docs/misc/xen-command-line.pandoc
+++ b/docs/misc/xen-command-line.pandoc
@@ -270,6 +270,20 @@ and not running softirqs. Reduce this if softirqs are not being run frequently
 enough. Setting this to a high value may cause boot failure, particularly if
 the NMI watchdog is also enabled.
 
+### buddy-alloc-size (arm64)
+> `= <size>`
+
+> Default: `64M`
+
+Amount of memory reserved for the buddy allocator when colored allocator is
+active. This option is available only when `CONFIG_LLC_COLORING` is enabled.
+The colored allocator is meant as an alternative to the buddy allocator,
+because its allocation policy is by definition incompatible with the generic
+one. Since the Xen heap systems is not colored yet, we need to support the
+coexistence of the two allocators for now. This parameter, which is optional
+and for expert only, it's used to set the amount of memory reserved to the
+buddy allocator.
+
 ### cet
     = List of [ <bool>, shstk=<bool>, ibt=<bool> ]
 
diff --git a/xen/arch/arm/include/asm/mm.h b/xen/arch/arm/include/asm/mm.h
index 59b774b7b8..f91ff088f6 100644
--- a/xen/arch/arm/include/asm/mm.h
+++ b/xen/arch/arm/include/asm/mm.h
@@ -145,6 +145,11 @@ struct page_info
 #else
 #define PGC_static     0
 #endif
+#ifdef CONFIG_LLC_COLORING
+/* Page is cache colored */
+#define _PGC_colored      PG_shift(4)
+#define PGC_colored       PG_mask(1, 4)
+#endif
 /* ... */
 /* Page is broken? */
 #define _PGC_broken       PG_shift(7)
diff --git a/xen/common/Kconfig b/xen/common/Kconfig
index b4ec6893be..6166327f4d 100644
--- a/xen/common/Kconfig
+++ b/xen/common/Kconfig
@@ -537,4 +537,12 @@ config LLC_COLORS_ORDER
 	  The default value corresponds to an 8 MiB 16-ways LLC, which should be
 	  more than what's needed in the general case.
 
+config BUDDY_ALLOCATOR_SIZE
+	int "Buddy allocator reserved memory size (MiB)"
+	default "64"
+	depends on LLC_COLORING
+	help
+	  Amount of memory reserved for the buddy allocator to serve Xen heap,
+	  working alongside the colored one.
+
 endmenu
diff --git a/xen/common/llc-coloring.c b/xen/common/llc-coloring.c
index 5a0e3bac59..bebd6e2056 100644
--- a/xen/common/llc-coloring.c
+++ b/xen/common/llc-coloring.c
@@ -36,6 +36,9 @@ static unsigned int __ro_after_init default_colors[NR_LLC_COLORS];
 static unsigned int __initdata dom0_colors[NR_LLC_COLORS];
 static unsigned int __initdata dom0_num_colors;
 
+#define mfn_color_mask              (max_nr_colors - 1)
+#define mfn_to_color(mfn)           (mfn_x(mfn) & mfn_color_mask)
+
 /*
  * Parse the coloring configuration given in the buf string, following the
  * syntax below.
@@ -322,6 +325,16 @@ int __init domain_set_llc_colors_from_str(struct domain *d, const char *str)
     return 0;
 }
 
+unsigned int page_to_llc_color(const struct page_info *pg)
+{
+    return mfn_to_color(page_to_mfn(pg));
+}
+
+unsigned int get_max_nr_llc_colors(void)
+{
+    return max_nr_colors;
+}
+
 /*
  * Local variables:
  * mode: C
diff --git a/xen/common/page_alloc.c b/xen/common/page_alloc.c
index 6dc8e0d5c9..1bf070c8c5 100644
--- a/xen/common/page_alloc.c
+++ b/xen/common/page_alloc.c
@@ -139,6 +139,7 @@
 #include <xen/softirq.h>
 #include <xen/spinlock.h>
 #include <xen/vm_event.h>
+#include <xen/xvmalloc.h>
 
 #include <asm/flushtlb.h>
 #include <asm/page.h>
@@ -160,11 +161,15 @@
 #define PGC_static 0
 #endif
 
-#define PGC_no_buddy_merge PGC_static
+#ifndef PGC_colored
+#define PGC_colored 0
+#endif
+
+#define PGC_no_buddy_merge (PGC_static | PGC_colored)
 /*
  * Flags that are preserved in assign_pages() (and only there)
  */
-#define PGC_preserved (PGC_extra | PGC_static)
+#define PGC_preserved (PGC_extra | PGC_static | PGC_colored)
 
 #ifndef PGT_TYPE_INFO_INITIALIZER
 #define PGT_TYPE_INFO_INITIALIZER 0
@@ -1480,6 +1485,8 @@ static bool mark_page_free(struct page_info *pg, mfn_t mfn)
     return pg_offlined;
 }
 
+static void free_color_heap_page(struct page_info *pg, bool need_scrub);
+
 /* Free 2^@order set of pages. */
 static void free_heap_pages(
     struct page_info *pg, unsigned int order, bool need_scrub)
@@ -1504,6 +1511,15 @@ static void free_heap_pages(
             pg[i].count_info |= PGC_need_scrub;
             poison_one_page(&pg[i]);
         }
+
+        if ( pg->count_info & PGC_colored )
+        {
+            ASSERT(order == 0);
+
+            free_color_heap_page(pg, need_scrub);
+            spin_unlock(&heap_lock);
+            return;
+        }
     }
 
     avail[node][zone] += 1 << order;
@@ -1968,6 +1984,157 @@ static unsigned long avail_heap_pages(
     return free_pages;
 }
 
+/*************************
+ * COLORED SIDE-ALLOCATOR
+ *
+ * Pages are grouped by LLC color in lists which are globally referred to as the
+ * color heap. Lists are populated in end_boot_allocator().
+ * After initialization there will be N lists where N is the number of
+ * available colors on the platform.
+ */
+static struct page_list_head *__ro_after_init _color_heap;
+#define color_heap(color) (&_color_heap[color])
+
+static unsigned long *__ro_after_init free_colored_pages;
+
+#ifdef CONFIG_LLC_COLORING
+#define domain_num_llc_colors(d) ((d)->num_llc_colors)
+#define domain_llc_color(d, i)   ((d)->llc_colors[i])
+
+/* Memory required for buddy allocator to work with colored one */
+static unsigned long __initdata buddy_alloc_size =
+    MB(CONFIG_BUDDY_ALLOCATOR_SIZE);
+size_param("buddy-alloc-size", buddy_alloc_size);
+#else
+#define domain_num_llc_colors(d) 0
+#define domain_llc_color(d, i)   0
+#endif
+
+static void free_color_heap_page(struct page_info *pg, bool need_scrub)
+{
+    unsigned int color;
+
+    color = page_to_llc_color(pg);
+    free_colored_pages[color]++;
+    /*
+     * Head insertion allows re-using cache-hot pages in configurations without
+     * sharing of colors.
+     */
+    page_list_add(pg, color_heap(color));
+}
+
+static struct page_info *alloc_color_heap_page(unsigned int memflags,
+                                               const struct domain *d)
+{
+    struct page_info *pg = NULL;
+    unsigned int i, color = 0;
+    unsigned long max = 0;
+    bool need_tlbflush = false;
+    uint32_t tlbflush_timestamp = 0;
+    bool need_scrub;
+
+    if ( memflags & ~(MEMF_no_refcount | MEMF_no_owner | MEMF_no_tlbflush |
+                      MEMF_no_icache_flush | MEMF_no_scrub) )
+        return NULL;
+
+    spin_lock(&heap_lock);
+
+    for ( i = 0; i < domain_num_llc_colors(d); i++ )
+    {
+        unsigned long free = free_colored_pages[domain_llc_color(d, i)];
+
+        if ( free > max )
+        {
+            color = domain_llc_color(d, i);
+            pg = page_list_first(color_heap(color));
+            max = free;
+        }
+    }
+
+    if ( !pg )
+    {
+        spin_unlock(&heap_lock);
+        return NULL;
+    }
+
+    need_scrub = pg->count_info & PGC_need_scrub;
+    pg->count_info = PGC_state_inuse | (pg->count_info & PGC_colored);
+    free_colored_pages[color]--;
+    page_list_del(pg, color_heap(color));
+
+    if ( !(memflags & MEMF_no_tlbflush) )
+        accumulate_tlbflush(&need_tlbflush, pg, &tlbflush_timestamp);
+
+    init_free_page_fields(pg);
+
+    spin_unlock(&heap_lock);
+
+    if ( !(memflags & MEMF_no_scrub) )
+    {
+        if ( need_scrub )
+            scrub_one_page(pg);
+        else
+            check_one_page(pg);
+    }
+
+    if ( need_tlbflush )
+        filtered_flush_tlb_mask(tlbflush_timestamp);
+
+    flush_page_to_ram(mfn_x(page_to_mfn(pg)),
+                      !(memflags & MEMF_no_icache_flush));
+
+    return pg;
+}
+
+static void __init init_color_heap_pages(struct page_info *pg,
+                                         unsigned long nr_pages)
+{
+    unsigned long i;
+    bool need_scrub = opt_bootscrub == BOOTSCRUB_IDLE;
+
+#ifdef CONFIG_LLC_COLORING
+    if ( buddy_alloc_size >= PAGE_SIZE )
+    {
+        unsigned long buddy_pages = min(PFN_DOWN(buddy_alloc_size), nr_pages);
+
+        init_heap_pages(pg, buddy_pages);
+        nr_pages -= buddy_pages;
+        buddy_alloc_size -= buddy_pages << PAGE_SHIFT;
+        pg += buddy_pages;
+    }
+#endif
+
+    if ( !_color_heap )
+    {
+        unsigned int max_nr_colors = get_max_nr_llc_colors();
+
+        _color_heap = xvmalloc_array(struct page_list_head, max_nr_colors);
+        free_colored_pages = xvzalloc_array(unsigned long, max_nr_colors);
+        if ( !_color_heap || !free_colored_pages )
+            panic("Can't allocate colored heap. Buddy reserved size is too low");
+
+        for ( i = 0; i < max_nr_colors; i++ )
+            INIT_PAGE_LIST_HEAD(color_heap(i));
+    }
+
+    for ( i = 0; i < nr_pages; i++ )
+    {
+        pg[i].count_info = PGC_colored;
+        free_color_heap_page(&pg[i], need_scrub);
+    }
+}
+
+static void dump_color_heap(void)
+{
+    unsigned int color;
+
+    printk("Dumping color heap info\n");
+    for ( color = 0; color < get_max_nr_llc_colors(); color++ )
+        if ( free_colored_pages[color] > 0 )
+            printk("Color heap[%u]: %lu pages\n",
+                   color, free_colored_pages[color]);
+}
+
 void __init end_boot_allocator(void)
 {
     unsigned int i;
@@ -1987,7 +2154,13 @@ void __init end_boot_allocator(void)
     for ( i = nr_bootmem_regions; i-- > 0; )
     {
         struct bootmem_region *r = &bootmem_region_list[i];
-        if ( r->s < r->e )
+
+        if ( r->s >= r->e )
+            continue;
+
+        if ( llc_coloring_enabled )
+            init_color_heap_pages(mfn_to_page(_mfn(r->s)), r->e - r->s);
+        else
             init_heap_pages(mfn_to_page(_mfn(r->s)), r->e - r->s);
     }
     nr_bootmem_regions = 0;
@@ -2483,7 +2656,14 @@ struct page_info *alloc_domheap_pages(
     if ( memflags & MEMF_no_owner )
         memflags |= MEMF_no_refcount;
 
-    if ( !dma_bitsize )
+    /* Only domains are supported for coloring */
+    if ( d && llc_coloring_enabled )
+    {
+        /* Colored allocation must be done on 0 order */
+        if ( order || (pg = alloc_color_heap_page(memflags, d)) == NULL )
+            return NULL;
+    }
+    else if ( !dma_bitsize )
         memflags &= ~MEMF_no_dma;
     else if ( (dma_zone = bits_to_zone(dma_bitsize)) < zone_hi )
         pg = alloc_heap_pages(dma_zone + 1, zone_hi, order, memflags, d);
@@ -2686,6 +2866,9 @@ static void cf_check dump_heap(unsigned char key)
             continue;
         printk("Node %d has %lu unscrubbed pages\n", i, node_need_scrub[i]);
     }
+
+    if ( llc_coloring_enabled )
+        dump_color_heap();
 }
 
 static __init int cf_check register_heap_trigger(void)
diff --git a/xen/include/xen/llc-coloring.h b/xen/include/xen/llc-coloring.h
index 5d1355b3c9..1216d1fbd4 100644
--- a/xen/include/xen/llc-coloring.h
+++ b/xen/include/xen/llc-coloring.h
@@ -11,6 +11,7 @@
 #include <xen/types.h>
 
 struct domain;
+struct page_info;
 struct xen_domctl_set_llc_colors;
 
 #ifdef CONFIG_LLC_COLORING
@@ -35,6 +36,8 @@ int dom0_set_llc_colors(struct domain *d);
 int domain_set_llc_colors(struct domain *d,
                           const struct xen_domctl_set_llc_colors *config);
 int domain_set_llc_colors_from_str(struct domain *d, const char *str);
+unsigned int page_to_llc_color(const struct page_info *pg);
+unsigned int get_max_nr_llc_colors(void);
 
 #endif /* __XEN_LLC_COLORING_H__ */
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Dec 20 08:23:24 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 20 Dec 2024 08:23:24 +0000
Received: from list by lists.xenproject.org with outflank-mailman.861687.1273726 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tOYI8-0007Qf-8I; Fri, 20 Dec 2024 08:23:24 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 861687.1273726; Fri, 20 Dec 2024 08:23:24 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tOYI8-0007QX-5X; Fri, 20 Dec 2024 08:23:24 +0000
Received: by outflank-mailman (input) for mailman id 861687;
 Fri, 20 Dec 2024 08:23:22 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tOYI6-0007QK-Ph
 for xen-changelog@lists.xenproject.org; Fri, 20 Dec 2024 08:23:22 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tOYI6-00D4yc-1V
 for xen-changelog@lists.xenproject.org;
 Fri, 20 Dec 2024 08:23:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tOYI6-005Stc-2N
 for xen-changelog@lists.xenproject.org;
 Fri, 20 Dec 2024 08:23:22 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=LYY2FDJfOKqotsYGIvBj+6GaEON9ux+m9WBAOc9AE8w=; b=LBIaRTAAURKs/QFcLQ5naPMJ3V
	z9i8bBj5WCVmb+WM4lYmoiXeZGBDNUzvfhauNNT5CILA7K8TVymDhoIj7F9Sw4E/9KPXBPDwXsvXX
	VjZCxdMnryXlECGwj9hUBqWrMhBBfDw39dl6QtA8wHRqogfjtr5d9NcMvkD8Ck9iur7w=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/arm: add Xen cache colors command line parameter
Message-Id: <E1tOYI6-005Stc-2N@xenbits.xenproject.org>
Date: Fri, 20 Dec 2024 08:23:22 +0000

commit 0975bab5ea9dcd52d5dc9431d2c77d4a6f1b690f
Author:     Luca Miccio <lucmiccio@gmail.com>
AuthorDate: Tue Dec 17 18:06:35 2024 +0100
Commit:     Michal Orzel <michal.orzel@amd.com>
CommitDate: Thu Dec 19 19:24:31 2024 +0100

    xen/arm: add Xen cache colors command line parameter
    
    Add a new command line parameter to configure Xen cache colors.
    These colors are dumped together with other coloring info.
    
    Benchmarking the VM interrupt response time provides an estimation of
    LLC usage by Xen's most latency-critical runtime task. Results on Arm
    Cortex-A53 on Xilinx Zynq UltraScale+ XCZU9EG show that one color, which
    reserves 64 KiB of L2, is enough to attain best responsiveness:
    - Xen 1 color latency:  3.1 us
    - Xen 2 color latency:  3.1 us
    
    Since this is the most common target for Arm cache coloring, the default
    amount of Xen colors is set to one.
    
    More colors are instead very likely to be needed on processors whose L1
    cache is physically-indexed and physically-tagged, such as Cortex-A57.
    In such cases, coloring applies to L1 also, and there typically are two
    distinct L1-colors. Therefore, reserving only one color for Xen would
    senselessly partitions a cache memory that is already private, i.e.
    underutilize it.
    
    Signed-off-by: Luca Miccio <lucmiccio@gmail.com>
    Signed-off-by: Marco Solieri <marco.solieri@minervasys.tech>
    Signed-off-by: Carlo Nonato <carlo.nonato@minervasys.tech>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 docs/misc/cache-coloring.rst      |  2 ++
 docs/misc/xen-command-line.pandoc | 10 ++++++++++
 xen/common/llc-coloring.c         | 29 +++++++++++++++++++++++++++++
 3 files changed, 41 insertions(+)

diff --git a/docs/misc/cache-coloring.rst b/docs/misc/cache-coloring.rst
index 5224b27afe..e156062aa2 100644
--- a/docs/misc/cache-coloring.rst
+++ b/docs/misc/cache-coloring.rst
@@ -115,6 +115,8 @@ Specific documentation is available at `docs/misc/xen-command-line.pandoc`.
 +----------------------+-------------------------------+
 | ``buddy-alloc-size`` | Buddy allocator reserved size |
 +----------------------+-------------------------------+
+| ``xen-llc-colors``   | Xen color configuration       |
++----------------------+-------------------------------+
 
 Colors selection format
 ***********************
diff --git a/docs/misc/xen-command-line.pandoc b/docs/misc/xen-command-line.pandoc
index cd43eccc5d..1dd8f714d3 100644
--- a/docs/misc/xen-command-line.pandoc
+++ b/docs/misc/xen-command-line.pandoc
@@ -2927,6 +2927,16 @@ mode.
 **WARNING: `x2apic_phys` is deprecated and superseded by `x2apic-mode`.
 The latter takes precedence if both are set.**
 
+### xen-llc-colors (arm64)
+> `= List of [ <integer> | <integer>-<integer> ]`
+
+> Default: `0: the lowermost color`
+
+Specify Xen LLC color configuration. This options is available only when
+`CONFIG_LLC_COLORING` is enabled.
+Two colors are most likely needed on platforms where private caches are
+physically indexed, e.g. the L1 instruction cache of the Arm Cortex-A57.
+
 ### xenheap_megabytes (arm32)
 > `= <size>`
 
diff --git a/xen/common/llc-coloring.c b/xen/common/llc-coloring.c
index bebd6e2056..0cfaa77a2b 100644
--- a/xen/common/llc-coloring.c
+++ b/xen/common/llc-coloring.c
@@ -13,6 +13,7 @@
 #include <xen/types.h>
 
 #define NR_LLC_COLORS          (1U << CONFIG_LLC_COLORS_ORDER)
+#define XEN_DEFAULT_NUM_COLORS 1
 
 /*
  * -1: not specified (disabled unless llc-size and llc-nr-ways present)
@@ -36,6 +37,9 @@ static unsigned int __ro_after_init default_colors[NR_LLC_COLORS];
 static unsigned int __initdata dom0_colors[NR_LLC_COLORS];
 static unsigned int __initdata dom0_num_colors;
 
+static unsigned int __ro_after_init xen_colors[NR_LLC_COLORS];
+static unsigned int __ro_after_init xen_num_colors;
+
 #define mfn_color_mask              (max_nr_colors - 1)
 #define mfn_to_color(mfn)           (mfn_x(mfn) & mfn_color_mask)
 
@@ -94,6 +98,13 @@ static int __init parse_dom0_colors(const char *s)
 }
 custom_param("dom0-llc-colors", parse_dom0_colors);
 
+static int __init parse_xen_colors(const char *s)
+{
+    return parse_color_config(s, xen_colors, ARRAY_SIZE(xen_colors),
+                              &xen_num_colors);
+}
+custom_param("xen-llc-colors", parse_xen_colors);
+
 static void print_colors(const unsigned int colors[], unsigned int num_colors)
 {
     unsigned int i;
@@ -178,6 +189,22 @@ void __init llc_coloring_init(void)
     for ( i = 0; i < max_nr_colors; i++ )
         default_colors[i] = i;
 
+    if ( !xen_num_colors )
+    {
+        unsigned int i;
+
+        xen_num_colors = MIN(XEN_DEFAULT_NUM_COLORS, max_nr_colors);
+
+        printk(XENLOG_WARNING
+               "Xen LLC color config not found. Using first %u colors\n",
+               xen_num_colors);
+        for ( i = 0; i < xen_num_colors; i++ )
+            xen_colors[i] = i;
+    }
+    else if ( xen_num_colors > max_nr_colors ||
+              !check_colors(xen_colors, xen_num_colors) )
+        panic("Bad LLC color config for Xen\n");
+
     arch_llc_coloring_init();
 }
 
@@ -188,6 +215,8 @@ void dump_llc_coloring_info(void)
 
     printk("LLC coloring info:\n");
     printk("    Number of LLC colors supported: %u\n", max_nr_colors);
+    printk("    Xen LLC colors (%u): ", xen_num_colors);
+    print_colors(xen_colors, xen_num_colors);
 }
 
 void domain_dump_llc_colors(const struct domain *d)
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Dec 20 08:23:34 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 20 Dec 2024 08:23:34 +0000
Received: from list by lists.xenproject.org with outflank-mailman.861689.1273731 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tOYII-0007V7-AA; Fri, 20 Dec 2024 08:23:34 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 861689.1273731; Fri, 20 Dec 2024 08:23:34 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tOYII-0007Uz-6y; Fri, 20 Dec 2024 08:23:34 +0000
Received: by outflank-mailman (input) for mailman id 861689;
 Fri, 20 Dec 2024 08:23:32 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tOYIG-0007Uk-SJ
 for xen-changelog@lists.xenproject.org; Fri, 20 Dec 2024 08:23:32 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tOYIG-00D4yg-1m
 for xen-changelog@lists.xenproject.org;
 Fri, 20 Dec 2024 08:23:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tOYIG-005Sw7-2e
 for xen-changelog@lists.xenproject.org;
 Fri, 20 Dec 2024 08:23:32 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=44NhnJnoQ3aeWoSNtgA9eeAXXCetRzg0a/R1DOCYNgs=; b=lK+s7h+yNLb7PgPwyihpmXNamA
	7ry2sxioN65cEIVBD3JNZze4wdbQew1GU9S78J3hLYFOsV7WCx6R/I1MH7AiFNs9IVzfZsmewRQNA
	0Tqyz8BnEvT5o56UWX+/8Q11bzVRftjhrm6eYYfH4mxpwMTNgFi0b4IbAcPgPv7BmMVc=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/arm: make consider_modules() available for xen relocation
Message-Id: <E1tOYIG-005Sw7-2e@xenbits.xenproject.org>
Date: Fri, 20 Dec 2024 08:23:32 +0000

commit f376ff0e4fc642281c49243c4895e31122db6bd2
Author:     Carlo Nonato <carlo.nonato@minervasys.tech>
AuthorDate: Tue Dec 17 18:06:36 2024 +0100
Commit:     Michal Orzel <michal.orzel@amd.com>
CommitDate: Thu Dec 19 19:24:31 2024 +0100

    xen/arm: make consider_modules() available for xen relocation
    
    Cache coloring must physically relocate Xen in order to color the hypervisor
    and consider_modules() is a key function that is needed to find a new
    available physical address.
    
    672d67f339c0 ("xen/arm: Split MMU-specific setup_mm() and related code out")
    moved consider_modules() under arm32. Move it to mmu/setup.c and make it
    non-static so that it can be used outside.
    
    Signed-off-by: Carlo Nonato <carlo.nonato@minervasys.tech>
    Reviewed-by: Michal Orzel <michal.orzel@amd.com>
---
 xen/arch/arm/arm32/mmu/mm.c      | 95 +---------------------------------------
 xen/arch/arm/include/asm/setup.h |  3 ++
 xen/arch/arm/mmu/setup.c         | 94 +++++++++++++++++++++++++++++++++++++++
 3 files changed, 98 insertions(+), 94 deletions(-)

diff --git a/xen/arch/arm/arm32/mmu/mm.c b/xen/arch/arm/arm32/mmu/mm.c
index 0824d61323..956693232a 100644
--- a/xen/arch/arm/arm32/mmu/mm.c
+++ b/xen/arch/arm/arm32/mmu/mm.c
@@ -7,6 +7,7 @@
 #include <xen/param.h>
 #include <xen/pfn.h>
 #include <asm/fixmap.h>
+#include <asm/setup.h>
 #include <asm/static-memory.h>
 #include <asm/static-shmem.h>
 
@@ -31,100 +32,6 @@ static void __init setup_directmap_mappings(unsigned long base_mfn,
     directmap_virt_end = XENHEAP_VIRT_START + nr_mfns * PAGE_SIZE;
 }
 
-/*
- * Returns the end address of the highest region in the range s..e
- * with required size and alignment that does not conflict with the
- * modules from first_mod to nr_modules.
- *
- * For non-recursive callers first_mod should normally be 0 (all
- * modules and Xen itself) or 1 (all modules but not Xen).
- */
-static paddr_t __init consider_modules(paddr_t s, paddr_t e,
-                                       uint32_t size, paddr_t align,
-                                       int first_mod)
-{
-    const struct membanks *reserved_mem = bootinfo_get_reserved_mem();
-#ifdef CONFIG_STATIC_SHM
-    const struct membanks *shmem = bootinfo_get_shmem();
-#endif
-    const struct bootmodules *mi = &bootinfo.modules;
-    int i;
-    int nr;
-
-    s = (s+align-1) & ~(align-1);
-    e = e & ~(align-1);
-
-    if ( s > e ||  e - s < size )
-        return 0;
-
-    /* First check the boot modules */
-    for ( i = first_mod; i < mi->nr_mods; i++ )
-    {
-        paddr_t mod_s = mi->module[i].start;
-        paddr_t mod_e = mod_s + mi->module[i].size;
-
-        if ( s < mod_e && mod_s < e )
-        {
-            mod_e = consider_modules(mod_e, e, size, align, i+1);
-            if ( mod_e )
-                return mod_e;
-
-            return consider_modules(s, mod_s, size, align, i+1);
-        }
-    }
-
-    /*
-     * i is the current bootmodule we are evaluating, across all
-     * possible kinds of bootmodules.
-     *
-     * When retrieving the corresponding reserved-memory addresses, we
-     * need to index the reserved_mem bank starting from 0, and only counting
-     * the reserved-memory modules. Hence, we need to use i - nr.
-     */
-    nr = mi->nr_mods;
-    for ( ; i - nr < reserved_mem->nr_banks; i++ )
-    {
-        paddr_t r_s = reserved_mem->bank[i - nr].start;
-        paddr_t r_e = r_s + reserved_mem->bank[i - nr].size;
-
-        if ( s < r_e && r_s < e )
-        {
-            r_e = consider_modules(r_e, e, size, align, i + 1);
-            if ( r_e )
-                return r_e;
-
-            return consider_modules(s, r_s, size, align, i + 1);
-        }
-    }
-
-#ifdef CONFIG_STATIC_SHM
-    nr += reserved_mem->nr_banks;
-    for ( ; i - nr < shmem->nr_banks; i++ )
-    {
-        paddr_t r_s, r_e;
-
-        r_s = shmem->bank[i - nr].start;
-
-        /* Shared memory banks can contain INVALID_PADDR as start */
-        if ( INVALID_PADDR == r_s )
-            continue;
-
-        r_e = r_s + shmem->bank[i - nr].size;
-
-        if ( s < r_e && r_s < e )
-        {
-            r_e = consider_modules(r_e, e, size, align, i + 1);
-            if ( r_e )
-                return r_e;
-
-            return consider_modules(s, r_s, size, align, i + 1);
-        }
-    }
-#endif
-
-    return e;
-}
-
 /*
  * Find a contiguous region that fits in the static heap region with
  * required size and alignment, and return the end address of the region
diff --git a/xen/arch/arm/include/asm/setup.h b/xen/arch/arm/include/asm/setup.h
index a5a80d9b47..6cf272c160 100644
--- a/xen/arch/arm/include/asm/setup.h
+++ b/xen/arch/arm/include/asm/setup.h
@@ -81,6 +81,9 @@ struct init_info
     unsigned int cpuid;
 };
 
+paddr_t consider_modules(paddr_t s, paddr_t e, uint32_t size, paddr_t align,
+                         int first_mod);
+
 #endif
 /*
  * Local variables:
diff --git a/xen/arch/arm/mmu/setup.c b/xen/arch/arm/mmu/setup.c
index 8c87649bc8..041e3fc1b6 100644
--- a/xen/arch/arm/mmu/setup.c
+++ b/xen/arch/arm/mmu/setup.c
@@ -222,6 +222,100 @@ static void xen_pt_enforce_wnx(void)
     flush_xen_tlb_local();
 }
 
+/*
+ * Returns the end address of the highest region in the range s..e
+ * with required size and alignment that does not conflict with the
+ * modules from first_mod to nr_modules.
+ *
+ * For non-recursive callers first_mod should normally be 0 (all
+ * modules and Xen itself) or 1 (all modules but not Xen).
+ */
+paddr_t __init consider_modules(paddr_t s, paddr_t e,
+                                uint32_t size, paddr_t align,
+                                int first_mod)
+{
+    const struct membanks *reserved_mem = bootinfo_get_reserved_mem();
+#ifdef CONFIG_STATIC_SHM
+    const struct membanks *shmem = bootinfo_get_shmem();
+#endif
+    const struct bootmodules *mi = &bootinfo.modules;
+    int i;
+    int nr;
+
+    s = (s+align-1) & ~(align-1);
+    e = e & ~(align-1);
+
+    if ( s > e ||  e - s < size )
+        return 0;
+
+    /* First check the boot modules */
+    for ( i = first_mod; i < mi->nr_mods; i++ )
+    {
+        paddr_t mod_s = mi->module[i].start;
+        paddr_t mod_e = mod_s + mi->module[i].size;
+
+        if ( s < mod_e && mod_s < e )
+        {
+            mod_e = consider_modules(mod_e, e, size, align, i+1);
+            if ( mod_e )
+                return mod_e;
+
+            return consider_modules(s, mod_s, size, align, i+1);
+        }
+    }
+
+    /*
+     * i is the current bootmodule we are evaluating, across all
+     * possible kinds of bootmodules.
+     *
+     * When retrieving the corresponding reserved-memory addresses, we
+     * need to index the reserved_mem bank starting from 0, and only counting
+     * the reserved-memory modules. Hence, we need to use i - nr.
+     */
+    nr = mi->nr_mods;
+    for ( ; i - nr < reserved_mem->nr_banks; i++ )
+    {
+        paddr_t r_s = reserved_mem->bank[i - nr].start;
+        paddr_t r_e = r_s + reserved_mem->bank[i - nr].size;
+
+        if ( s < r_e && r_s < e )
+        {
+            r_e = consider_modules(r_e, e, size, align, i + 1);
+            if ( r_e )
+                return r_e;
+
+            return consider_modules(s, r_s, size, align, i + 1);
+        }
+    }
+
+#ifdef CONFIG_STATIC_SHM
+    nr += reserved_mem->nr_banks;
+    for ( ; i - nr < shmem->nr_banks; i++ )
+    {
+        paddr_t r_s, r_e;
+
+        r_s = shmem->bank[i - nr].start;
+
+        /* Shared memory banks can contain INVALID_PADDR as start */
+        if ( INVALID_PADDR == r_s )
+            continue;
+
+        r_e = r_s + shmem->bank[i - nr].size;
+
+        if ( s < r_e && r_s < e )
+        {
+            r_e = consider_modules(r_e, e, size, align, i + 1);
+            if ( r_e )
+                return r_e;
+
+            return consider_modules(s, r_s, size, align, i + 1);
+        }
+    }
+#endif
+
+    return e;
+}
+
 /*
  * Boot-time pagetable setup.
  * Changes here may need matching changes in head.S
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Dec 20 08:23:44 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 20 Dec 2024 08:23:44 +0000
Received: from list by lists.xenproject.org with outflank-mailman.861690.1273735 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tOYIS-0007YQ-DQ; Fri, 20 Dec 2024 08:23:44 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 861690.1273735; Fri, 20 Dec 2024 08:23:44 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tOYIS-0007YI-Ag; Fri, 20 Dec 2024 08:23:44 +0000
Received: by outflank-mailman (input) for mailman id 861690;
 Fri, 20 Dec 2024 08:23:43 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tOYIQ-0007Y7-Vf
 for xen-changelog@lists.xenproject.org; Fri, 20 Dec 2024 08:23:42 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tOYIQ-00D4yk-26
 for xen-changelog@lists.xenproject.org;
 Fri, 20 Dec 2024 08:23:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tOYIQ-005SxH-2z
 for xen-changelog@lists.xenproject.org;
 Fri, 20 Dec 2024 08:23:42 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=pZ4S8sU2O+j/cw8V7GtM2XkikmeSM+kbLaYPX7z9Bm0=; b=yvTvipCbg/StGNG39YclIKj4AW
	hGElZ9gs1ZDmYwl7ct9K5LCaPZ0psqty864Y4cHGzc8FKEnz9p+/zSAchdKj3TZnvsXzyox+YliCu
	f99slej/rlwrXXl+Nnpe9mrcmVghXI3V9F/p2IGMHmDdlYscP0sHITwR9D6HzqwdKzXw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/arm: add cache coloring support for Xen image
Message-Id: <E1tOYIQ-005SxH-2z@xenbits.xenproject.org>
Date: Fri, 20 Dec 2024 08:23:42 +0000

commit e7a80636f16eb63299a6ffd6d41958e81c163991
Author:     Carlo Nonato <carlo.nonato@minervasys.tech>
AuthorDate: Tue Dec 17 18:06:37 2024 +0100
Commit:     Michal Orzel <michal.orzel@amd.com>
CommitDate: Thu Dec 19 19:24:31 2024 +0100

    xen/arm: add cache coloring support for Xen image
    
    Xen image is relocated to a new colored physical space. Some relocation
    functionalities must be brought back:
    - the virtual address of the new space is taken from 0c18fb76323b
      ("xen/arm: Remove unused BOOT_RELOC_VIRT_START").
    - relocate_xen() and get_xen_paddr() are taken from f60658c6ae47
      ("xen/arm: Stop relocating Xen").
    
    setup_pagetables() must be adapted for coloring and for relocation. Runtime
    page tables are used to map the colored space, but they are also linked in
    boot tables so that the new space is temporarily available for relocation.
    This implies that Xen protection must happen after the copy.
    
    Finally, since the alternative framework needs to remap the Xen text and
    inittext sections, this operation must be done in a coloring-aware way.
    The function xen_remap_colored() is introduced for that.
    
    Signed-off-by: Carlo Nonato <carlo.nonato@minervasys.tech>
    Signed-off-by: Marco Solieri <marco.solieri@minervasys.tech>
    Reviewed-by: Jan Beulich <jbeulich@suse.com> # common
    Reviewed-by: Michal Orzel <michal.orzel@amd.com>
---
 xen/arch/arm/alternative.c            |  26 ++++++++-
 xen/arch/arm/arm64/mmu/head.S         |  58 +++++++++++++++++-
 xen/arch/arm/arm64/mmu/mm.c           |  34 +++++++++++
 xen/arch/arm/include/asm/mmu/layout.h |   3 +
 xen/arch/arm/include/asm/mmu/mm.h     |   1 +
 xen/arch/arm/llc-coloring.c           |  63 ++++++++++++++++++++
 xen/arch/arm/mmu/setup.c              | 107 +++++++++++++++++++++++++++++-----
 xen/arch/arm/setup.c                  |  10 +++-
 xen/common/llc-coloring.c             |  18 ++++++
 xen/include/xen/llc-coloring.h        |  13 +++++
 10 files changed, 313 insertions(+), 20 deletions(-)

diff --git a/xen/arch/arm/alternative.c b/xen/arch/arm/alternative.c
index fec7dbd2cd..2c1af6e7e4 100644
--- a/xen/arch/arm/alternative.c
+++ b/xen/arch/arm/alternative.c
@@ -9,6 +9,7 @@
 #include <xen/init.h>
 #include <xen/types.h>
 #include <xen/kernel.h>
+#include <xen/llc-coloring.h>
 #include <xen/mm.h>
 #include <xen/vmap.h>
 #include <xen/smp.h>
@@ -191,6 +192,25 @@ static int __apply_alternatives_multi_stop(void *xenmap)
     return 0;
 }
 
+static void __init *xen_remap_colored(mfn_t xen_mfn, paddr_t xen_size)
+{
+    unsigned int i;
+    void *xenmap;
+    mfn_t *xen_colored_mfns, mfn;
+
+    xen_colored_mfns = xmalloc_array(mfn_t, xen_size >> PAGE_SHIFT);
+    if ( !xen_colored_mfns )
+        panic("Can't allocate LLC colored MFNs\n");
+
+    for_each_xen_colored_mfn ( xen_mfn, mfn, i )
+        xen_colored_mfns[i] = mfn;
+
+    xenmap = vmap(xen_colored_mfns, xen_size >> PAGE_SHIFT);
+    xfree(xen_colored_mfns);
+
+    return xenmap;
+}
+
 /*
  * This function should only be called during boot and before CPU0 jump
  * into the idle_loop.
@@ -209,7 +229,11 @@ void __init apply_alternatives_all(void)
      * The text and inittext section are read-only. So re-map Xen to
      * be able to patch the code.
      */
-    xenmap = vmap_contig(xen_mfn, 1U << xen_order);
+    if ( llc_coloring_enabled )
+        xenmap = xen_remap_colored(xen_mfn, xen_size);
+    else
+        xenmap = vmap_contig(xen_mfn, 1U << xen_order);
+
     /* Re-mapping Xen is not expected to fail during boot. */
     BUG_ON(!xenmap);
 
diff --git a/xen/arch/arm/arm64/mmu/head.S b/xen/arch/arm/arm64/mmu/head.S
index 665a51a337..634156f83d 100644
--- a/xen/arch/arm/arm64/mmu/head.S
+++ b/xen/arch/arm/arm64/mmu/head.S
@@ -428,6 +428,61 @@ FUNC_LOCAL(fail)
         b     1b
 END(fail)
 
+/*
+ * Copy Xen to new location and switch TTBR
+ * x0    ttbr
+ * x1    source address
+ * x2    destination address
+ * x3    length
+ *
+ * Source and destination must be word aligned, length is rounded up
+ * to a 16 byte boundary.
+ *
+ * MUST BE VERY CAREFUL when saving things to RAM over the copy
+ */
+FUNC(relocate_xen)
+        /*
+         * Copy 16 bytes at a time using:
+         *   x9: counter
+         *   x10: data
+         *   x11: data
+         *   x12: source
+         *   x13: destination
+         */
+        mov     x9, x3
+        mov     x12, x1
+        mov     x13, x2
+
+1:      ldp     x10, x11, [x12], #16
+        stp     x10, x11, [x13], #16
+
+        subs    x9, x9, #16
+        bgt     1b
+
+        /*
+         * Flush destination from dcache using:
+         *   x9: counter
+         *   x10: step
+         *   x11: vaddr
+         *
+         * This is to ensure data is visible to the instruction cache
+         */
+        dsb   sy
+
+        mov   x9, x3
+        ldr   x10, =dcache_line_bytes /* x10 := step */
+        ldr   x10, [x10]
+        mov   x11, x2
+
+1:      dc    cvau, x11
+
+        add   x11, x11, x10
+        subs  x9, x9, x10
+        bgt   1b
+
+        /* No need for dsb/isb because they are alredy done in switch_ttbr_id */
+        b switch_ttbr_id
+
 /*
  * Switch TTBR
  *
@@ -453,7 +508,8 @@ FUNC(switch_ttbr_id)
 
         /*
          * 5) Flush I-cache
-         * This should not be necessary but it is kept for safety.
+         * This should not be necessary in the general case, but it's needed
+         * for cache coloring because code is relocated in that case.
          */
         ic     iallu
         isb
diff --git a/xen/arch/arm/arm64/mmu/mm.c b/xen/arch/arm/arm64/mmu/mm.c
index 671eaadbc1..26361c4fe4 100644
--- a/xen/arch/arm/arm64/mmu/mm.c
+++ b/xen/arch/arm/arm64/mmu/mm.c
@@ -1,6 +1,7 @@
 /* SPDX-License-Identifier: GPL-2.0-only */
 
 #include <xen/init.h>
+#include <xen/llc-coloring.h>
 #include <xen/mm.h>
 #include <xen/pfn.h>
 
@@ -138,8 +139,41 @@ void update_boot_mapping(bool enable)
 }
 
 extern void switch_ttbr_id(uint64_t ttbr);
+extern void relocate_xen(uint64_t ttbr, void *src, void *dst, size_t len);
 
 typedef void (switch_ttbr_fn)(uint64_t ttbr);
+typedef void (relocate_xen_fn)(uint64_t ttbr, void *src, void *dst, size_t len);
+
+#ifdef CONFIG_LLC_COLORING
+void __init relocate_and_switch_ttbr(uint64_t ttbr)
+{
+    vaddr_t id_addr = virt_to_maddr(relocate_xen);
+    relocate_xen_fn *fn = (relocate_xen_fn *)id_addr;
+    lpae_t pte;
+
+    /* Enable the identity mapping in the boot page tables */
+    update_identity_mapping(true);
+
+    /* Enable the identity mapping in the runtime page tables */
+    pte = pte_of_xenaddr((vaddr_t)relocate_xen);
+    pte.pt.table = 1;
+    pte.pt.xn = 0;
+    pte.pt.ro = 1;
+    write_pte(&xen_third_id[third_table_offset(id_addr)], pte);
+
+    /* Relocate Xen and switch TTBR */
+    fn(ttbr, _start, (void *)BOOT_RELOC_VIRT_START, _end - _start);
+
+    /*
+     * Disable the identity mapping in the runtime page tables.
+     * Note it is not necessary to disable it in the boot page tables
+     * because they are not going to be used by this CPU anymore.
+     */
+    update_identity_mapping(false);
+}
+#else
+void __init relocate_and_switch_ttbr(uint64_t ttbr) {}
+#endif
 
 void __init switch_ttbr(uint64_t ttbr)
 {
diff --git a/xen/arch/arm/include/asm/mmu/layout.h b/xen/arch/arm/include/asm/mmu/layout.h
index a3b546465b..19c0ec63a5 100644
--- a/xen/arch/arm/include/asm/mmu/layout.h
+++ b/xen/arch/arm/include/asm/mmu/layout.h
@@ -30,6 +30,7 @@
  *  10M -  12M   Fixmap: special-purpose 4K mapping slots
  *  12M -  16M   Early boot mapping of FDT
  *  16M -  18M   Livepatch vmap (if compiled in)
+ *  16M -  24M   Cache-colored Xen text, data, bss (temporary, if compiled in)
  *
  *   1G -   2G   VMAP: ioremap and early_ioremap
  *
@@ -74,6 +75,8 @@
 #define BOOT_FDT_VIRT_START     (FIXMAP_VIRT_START + FIXMAP_VIRT_SIZE)
 #define BOOT_FDT_VIRT_SIZE      _AT(vaddr_t, MB(4))
 
+#define BOOT_RELOC_VIRT_START   (BOOT_FDT_VIRT_START + BOOT_FDT_VIRT_SIZE)
+
 #ifdef CONFIG_LIVEPATCH
 #define LIVEPATCH_VMAP_START    (BOOT_FDT_VIRT_START + BOOT_FDT_VIRT_SIZE)
 #define LIVEPATCH_VMAP_SIZE    _AT(vaddr_t, MB(2))
diff --git a/xen/arch/arm/include/asm/mmu/mm.h b/xen/arch/arm/include/asm/mmu/mm.h
index c5e03a66bf..f5a00558c4 100644
--- a/xen/arch/arm/include/asm/mmu/mm.h
+++ b/xen/arch/arm/include/asm/mmu/mm.h
@@ -31,6 +31,7 @@ void dump_pt_walk(paddr_t ttbr, paddr_t addr,
 
 /* Switch to a new root page-tables */
 extern void switch_ttbr(uint64_t ttbr);
+extern void relocate_and_switch_ttbr(uint64_t ttbr);
 
 #endif /* __ARM_MMU_MM_H__ */
 
diff --git a/xen/arch/arm/llc-coloring.c b/xen/arch/arm/llc-coloring.c
index 1c7b92bc45..99ac10b610 100644
--- a/xen/arch/arm/llc-coloring.c
+++ b/xen/arch/arm/llc-coloring.c
@@ -9,6 +9,7 @@
 #include <xen/llc-coloring.h>
 
 #include <asm/processor.h>
+#include <asm/setup.h>
 #include <asm/sysregs.h>
 #include <asm/system.h>
 
@@ -64,8 +65,70 @@ unsigned int __init get_llc_way_size(void)
     return line_size * num_sets;
 }
 
+/*
+ * get_xen_paddr - get physical address to relocate Xen to
+ *
+ * Xen is relocated to as near to the top of RAM as possible and
+ * aligned to a XEN_PADDR_ALIGN boundary.
+ */
+static paddr_t __init get_xen_paddr(paddr_t xen_size)
+{
+    const struct membanks *mem = bootinfo_get_mem();
+    paddr_t min_size, paddr = 0;
+    unsigned int i;
+
+    min_size = ROUNDUP(xen_size, XEN_PADDR_ALIGN);
+
+    /* Find the highest bank with enough space. */
+    for ( i = 0; i < mem->nr_banks; i++ )
+    {
+        const struct membank *bank = &mem->bank[i];
+        paddr_t s, e;
+
+        if ( bank->size >= min_size )
+        {
+            e = consider_modules(bank->start, bank->start + bank->size,
+                                 min_size, XEN_PADDR_ALIGN, 0);
+            if ( !e )
+                continue;
+
+#ifdef CONFIG_ARM_32
+            /* Xen must be under 4GB */
+            if ( e > GB(4) )
+                e = GB(4);
+            if ( e < bank->start )
+                continue;
+#endif
+
+            s = e - min_size;
+
+            if ( s > paddr )
+                paddr = s;
+        }
+    }
+
+    if ( !paddr )
+        panic("Not enough memory to relocate Xen\n");
+
+    printk("Placing Xen at 0x%"PRIpaddr"-0x%"PRIpaddr"\n",
+           paddr, paddr + min_size);
+
+    return paddr;
+}
+
+static paddr_t __init xen_colored_map_size(void)
+{
+    return ROUNDUP((_end - _start) * get_max_nr_llc_colors(), XEN_PADDR_ALIGN);
+}
+
 void __init arch_llc_coloring_init(void)
 {
+    struct bootmodule *xen_bootmodule = boot_module_find_by_kind(BOOTMOD_XEN);
+
+    BUG_ON(!xen_bootmodule);
+
+    xen_bootmodule->size = xen_colored_map_size();
+    xen_bootmodule->start = get_xen_paddr(xen_bootmodule->size);
 }
 
 /*
diff --git a/xen/arch/arm/mmu/setup.c b/xen/arch/arm/mmu/setup.c
index 041e3fc1b6..30afe97781 100644
--- a/xen/arch/arm/mmu/setup.c
+++ b/xen/arch/arm/mmu/setup.c
@@ -7,6 +7,7 @@
 
 #include <xen/init.h>
 #include <xen/libfdt/libfdt.h>
+#include <xen/llc-coloring.h>
 #include <xen/sections.h>
 #include <xen/sizes.h>
 #include <xen/vmap.h>
@@ -20,6 +21,9 @@
 #undef virt_to_mfn
 #define virt_to_mfn(va) _mfn(__virt_to_mfn(va))
 
+#define virt_to_reloc_virt(virt) \
+    (((vaddr_t)(virt)) - XEN_VIRT_START + BOOT_RELOC_VIRT_START)
+
 /* Main runtime page tables */
 
 /*
@@ -69,6 +73,7 @@ static void __init __maybe_unused build_assertions(void)
     /* 2MB aligned regions */
     BUILD_BUG_ON(XEN_VIRT_START & ~SECOND_MASK);
     BUILD_BUG_ON(FIXMAP_ADDR(0) & ~SECOND_MASK);
+    BUILD_BUG_ON(BOOT_RELOC_VIRT_START & ~SECOND_MASK);
     /* 1GB aligned regions */
 #ifdef CONFIG_ARM_32
     BUILD_BUG_ON(XENHEAP_VIRT_START & ~FIRST_MASK);
@@ -138,6 +143,9 @@ static void __init __maybe_unused build_assertions(void)
 
 lpae_t __init pte_of_xenaddr(vaddr_t va)
 {
+    if ( llc_coloring_enabled )
+        va = virt_to_reloc_virt(va);
+
     return mfn_to_xen_entry(virt_to_mfn(va), MT_NORMAL);
 }
 
@@ -316,6 +324,32 @@ paddr_t __init consider_modules(paddr_t s, paddr_t e,
     return e;
 }
 
+static void __init create_llc_coloring_mappings(void)
+{
+    lpae_t pte;
+    unsigned int i;
+    struct bootmodule *xen_bootmodule = boot_module_find_by_kind(BOOTMOD_XEN);
+    mfn_t start_mfn = maddr_to_mfn(xen_bootmodule->start), mfn;
+
+    for_each_xen_colored_mfn ( start_mfn, mfn, i )
+    {
+        pte = mfn_to_xen_entry(mfn, MT_NORMAL);
+        pte.pt.table = 1; /* level 3 mappings always have this bit set */
+        xen_xenmap[i] = pte;
+    }
+
+    for ( i = 0; i < XEN_NR_ENTRIES(2); i++ )
+    {
+        vaddr_t va = BOOT_RELOC_VIRT_START + (i << XEN_PT_LEVEL_SHIFT(2));
+
+        pte = mfn_to_xen_entry(virt_to_mfn(xen_xenmap +
+                                           i * XEN_PT_LPAE_ENTRIES),
+                               MT_NORMAL);
+        pte.pt.table = 1;
+        write_pte(&boot_second[second_table_offset(va)], pte);
+    }
+}
+
 /*
  * Boot-time pagetable setup.
  * Changes here may need matching changes in head.S
@@ -326,6 +360,14 @@ void __init setup_pagetables(void)
     lpae_t pte, *p;
     int i;
 
+    /*
+     * In case of cache coloring, map the new physical space in the boot page
+     * tables. From now on, pte_of_xenaddr() will translate addresses to this
+     * new space.
+     */
+    if ( llc_coloring_enabled )
+        create_llc_coloring_mappings();
+
     arch_setup_page_tables();
 
 #ifdef CONFIG_ARM_64
@@ -353,13 +395,7 @@ void __init setup_pagetables(void)
             break;
         pte = pte_of_xenaddr(va);
         pte.pt.table = 1; /* third level mappings always have this bit set */
-        if ( is_kernel_text(va) || is_kernel_inittext(va) )
-        {
-            pte.pt.xn = 0;
-            pte.pt.ro = 1;
-        }
-        if ( is_kernel_rodata(va) )
-            pte.pt.ro = 1;
+        pte.pt.xn = 0; /* Permissions will be enforced later. Allow execution */
         xen_xenmap[i] = pte;
     }
 
@@ -379,19 +415,58 @@ void __init setup_pagetables(void)
     pte.pt.table = 1;
     xen_second[second_table_offset(FIXMAP_ADDR(0))] = pte;
 
-#ifdef CONFIG_ARM_64
-    ttbr = virt_to_maddr(xen_pgtable);
-#else
-    ttbr = virt_to_maddr(cpu0_pgtable);
+#ifdef CONFIG_ARM_32
+    per_cpu(xen_pgtable, 0) = cpu0_pgtable;
 #endif
 
-    switch_ttbr(ttbr);
+    if ( llc_coloring_enabled )
+    {
+        ttbr = virt_to_maddr(virt_to_reloc_virt(THIS_CPU_PGTABLE));
+        relocate_and_switch_ttbr(ttbr);
+    }
+    else
+    {
+        ttbr = virt_to_maddr(THIS_CPU_PGTABLE);
+        switch_ttbr(ttbr);
+    }
 
-    xen_pt_enforce_wnx();
+    /* Protect Xen */
+    for ( i = 0; i < XEN_NR_ENTRIES(3); i++ )
+    {
+        vaddr_t va = XEN_VIRT_START + (i << PAGE_SHIFT);
+        lpae_t *entry = xen_xenmap + i;
 
-#ifdef CONFIG_ARM_32
-    per_cpu(xen_pgtable, 0) = cpu0_pgtable;
-#endif
+        if ( !is_kernel(va) )
+            break;
+
+        pte = read_atomic(entry);
+
+        if ( is_kernel_text(va) || is_kernel_inittext(va) )
+        {
+            pte.pt.xn = 0;
+            pte.pt.ro = 1;
+        }
+        else if ( is_kernel_rodata(va) )
+        {
+            pte.pt.ro = 1;
+            pte.pt.xn = 1;
+        }
+        else
+        {
+            pte.pt.xn = 1;
+            pte.pt.ro = 0;
+        }
+
+        write_pte(entry, pte);
+    }
+
+    /*
+     * We modified live page-tables. Ensure the TLBs are invalidated
+     * before setting enforcing the WnX permissions.
+     */
+    flush_xen_tlb_local();
+
+    xen_pt_enforce_wnx();
 }
 
 void *__init arch_vmap_virt_end(void)
diff --git a/xen/arch/arm/setup.c b/xen/arch/arm/setup.c
index 5f1993ffed..68c1f30920 100644
--- a/xen/arch/arm/setup.c
+++ b/xen/arch/arm/setup.c
@@ -312,8 +312,6 @@ void asmlinkage __init start_xen(unsigned long fdt_paddr)
     /* Initialize traps early allow us to get backtrace when an error occurred */
     init_traps();
 
-    setup_pagetables();
-
     smp_clear_cpu_maps();
 
     device_tree_flattened = early_fdt_map(fdt_paddr);
@@ -337,6 +335,14 @@ void asmlinkage __init start_xen(unsigned long fdt_paddr)
 
     llc_coloring_init();
 
+    /*
+     * Page tables must be setup after LLC coloring initialization because
+     * coloring info are required in order to create colored mappings
+     */
+    setup_pagetables();
+    /* Device-tree was mapped in boot page tables, remap it in the new tables */
+    device_tree_flattened = early_fdt_map(fdt_paddr);
+
     setup_mm();
 
     vm_init();
diff --git a/xen/common/llc-coloring.c b/xen/common/llc-coloring.c
index 0cfaa77a2b..a572f77a09 100644
--- a/xen/common/llc-coloring.c
+++ b/xen/common/llc-coloring.c
@@ -42,6 +42,8 @@ static unsigned int __ro_after_init xen_num_colors;
 
 #define mfn_color_mask              (max_nr_colors - 1)
 #define mfn_to_color(mfn)           (mfn_x(mfn) & mfn_color_mask)
+#define get_mfn_with_color(mfn, color) \
+    (_mfn((mfn_x(mfn) & ~mfn_color_mask) | (color)))
 
 /*
  * Parse the coloring configuration given in the buf string, following the
@@ -364,6 +366,22 @@ unsigned int get_max_nr_llc_colors(void)
     return max_nr_colors;
 }
 
+mfn_t __init xen_colored_mfn(mfn_t mfn)
+{
+    unsigned int i, color = mfn_to_color(mfn);
+
+    for ( i = 0; i < xen_num_colors; i++ )
+    {
+        if ( color == xen_colors[i] )
+            return mfn;
+        if ( color < xen_colors[i] )
+            return get_mfn_with_color(mfn, xen_colors[i]);
+    }
+
+    /* Jump to next color space (max_nr_colors mfns) and use the first color */
+    return get_mfn_with_color(mfn_add(mfn, max_nr_colors), xen_colors[0]);
+}
+
 /*
  * Local variables:
  * mode: C
diff --git a/xen/include/xen/llc-coloring.h b/xen/include/xen/llc-coloring.h
index 1216d1fbd4..45f250f9f3 100644
--- a/xen/include/xen/llc-coloring.h
+++ b/xen/include/xen/llc-coloring.h
@@ -8,6 +8,7 @@
 #ifndef __XEN_LLC_COLORING_H__
 #define __XEN_LLC_COLORING_H__
 
+#include <xen/mm-frame.h>
 #include <xen/types.h>
 
 struct domain;
@@ -30,6 +31,17 @@ static inline void domain_dump_llc_colors(const struct domain *d) {}
 static inline void domain_llc_coloring_free(struct domain *d) {}
 #endif
 
+/*
+ * Iterate over each Xen mfn in the colored space.
+ * @start_mfn:  the first mfn that needs to be colored.
+ * @mfn:        the current mfn.
+ * @i:          loop index.
+ */
+#define for_each_xen_colored_mfn(start_mfn, mfn, i) \
+    for ( (i) = 0, (mfn) = xen_colored_mfn(start_mfn);  \
+          (i) < (_end - _start) >> PAGE_SHIFT;        \
+          (i)++, (mfn) = xen_colored_mfn(mfn_add(mfn, 1)) )
+
 unsigned int get_llc_way_size(void);
 void arch_llc_coloring_init(void);
 int dom0_set_llc_colors(struct domain *d);
@@ -38,6 +50,7 @@ int domain_set_llc_colors(struct domain *d,
 int domain_set_llc_colors_from_str(struct domain *d, const char *str);
 unsigned int page_to_llc_color(const struct page_info *pg);
 unsigned int get_max_nr_llc_colors(void);
+mfn_t xen_colored_mfn(mfn_t mfn);
 
 #endif /* __XEN_LLC_COLORING_H__ */
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Dec 20 08:23:54 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 20 Dec 2024 08:23:54 +0000
Received: from list by lists.xenproject.org with outflank-mailman.861692.1273739 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tOYIc-0007ag-F1; Fri, 20 Dec 2024 08:23:54 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 861692.1273739; Fri, 20 Dec 2024 08:23:54 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tOYIc-0007aY-CE; Fri, 20 Dec 2024 08:23:54 +0000
Received: by outflank-mailman (input) for mailman id 861692;
 Fri, 20 Dec 2024 08:23:53 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tOYIb-0007aR-2C
 for xen-changelog@lists.xenproject.org; Fri, 20 Dec 2024 08:23:53 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tOYIa-00D4zB-2O
 for xen-changelog@lists.xenproject.org;
 Fri, 20 Dec 2024 08:23:53 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tOYIb-005Sy5-01
 for xen-changelog@lists.xenproject.org;
 Fri, 20 Dec 2024 08:23:53 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=gr47dqFfV/qHd1EwhzGFYyf+LPolUrraz282I6Bx2Mo=; b=lrRU5lv77a2imIbHV3P8Qv5b3L
	fAMpjVNDYZw+rDzuCBaUDu1Rj4a6+quZ6Of0eKLikerX2GQ1GkRu32d0vZLCPCsPHwr44oQGlpYYp
	y8a0S+UohqKE1WkeKi650/MunpKEfkaE3GKm3/7DXgYgdPqJGVBp9JlSkncs4+EfytFY=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/arm: firmware: Add SCMI over SMC calls handling layer
Message-Id: <E1tOYIb-005Sy5-01@xenbits.xenproject.org>
Date: Fri, 20 Dec 2024 08:23:53 +0000

commit 3e322bef8bc0ac6ed699486550a29c553de22771
Author:     Andrei Cherechesu <andrei.cherechesu@nxp.com>
AuthorDate: Thu Dec 19 13:23:10 2024 +0200
Commit:     Michal Orzel <michal.orzel@amd.com>
CommitDate: Thu Dec 19 19:26:21 2024 +0100

    xen/arm: firmware: Add SCMI over SMC calls handling layer
    
    Introduce the SCMI-SMC layer to have some basic degree of
    awareness about SCMI calls that are based on the ARM System
    Control and Management Interface (SCMI) specification (DEN0056E).
    
    The SCMI specification includes various protocols for managing
    system-level resources, such as: clocks, pins, reset, system power,
    power domains, performance domains, etc. The clients are named
    "SCMI agents" and the server is named "SCMI platform".
    
    Only support the shared-memory based transport with SMCs as
    the doorbell mechanism for notifying the platform. Also, this
    implementation only handles the "arm,scmi-smc" compatible,
    requiring the following properties:
            - "arm,smc-id" (unique SMC ID)
            - "shmem" (one or more phandles pointing to shmem zones
            for each channel)
    
    The initialization is done as initcall, since we need
    SMCs, and PSCI should already probe EL3 FW for SMCCC support.
    If no "arm,scmi-smc" compatible node is found in the host
    DT, the initialization fails silently, as it's not mandatory.
    Otherwise, we get the 'arm,smc-id' DT property from the node,
    to know the SCMI SMC ID we handle. The 'shmem' memory ranges
    are not validated, as the SMC calls are only passed through
    to EL3 FW if coming from the hardware domain.
    
    Create a new 'firmware' folder to keep the SCMI code separate
    from the generic ARM code.
    
    Signed-off-by: Andrei Cherechesu <andrei.cherechesu@nxp.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
    Acked-by: Michal Orzel <michal.orzel@amd.com>
---
 xen/arch/arm/Kconfig                         |   2 +
 xen/arch/arm/Makefile                        |   1 +
 xen/arch/arm/firmware/Kconfig                |  13 +++
 xen/arch/arm/firmware/Makefile               |   1 +
 xen/arch/arm/firmware/scmi-smc.c             | 162 +++++++++++++++++++++++++++
 xen/arch/arm/include/asm/firmware/scmi-smc.h |  41 +++++++
 6 files changed, 220 insertions(+)

diff --git a/xen/arch/arm/Kconfig b/xen/arch/arm/Kconfig
index c5e7b74733..a26d3e1182 100644
--- a/xen/arch/arm/Kconfig
+++ b/xen/arch/arm/Kconfig
@@ -272,6 +272,8 @@ config PARTIAL_EMULATION
 	  not been emulated to their complete functionality. Enabling this might
 	  result in unwanted/non-spec compliant behavior.
 
+source "arch/arm/firmware/Kconfig"
+
 endmenu
 
 menu "ARM errata workaround via the alternative framework"
diff --git a/xen/arch/arm/Makefile b/xen/arch/arm/Makefile
index ccbfc61f88..43ab5e8f25 100644
--- a/xen/arch/arm/Makefile
+++ b/xen/arch/arm/Makefile
@@ -6,6 +6,7 @@ obj-$(CONFIG_HAS_PCI) += pci/
 ifneq ($(CONFIG_NO_PLAT),y)
 obj-y += platforms/
 endif
+obj-y += firmware/
 obj-$(CONFIG_TEE) += tee/
 obj-$(CONFIG_HAS_VPCI) += vpci.o
 
diff --git a/xen/arch/arm/firmware/Kconfig b/xen/arch/arm/firmware/Kconfig
new file mode 100644
index 0000000000..817da745fd
--- /dev/null
+++ b/xen/arch/arm/firmware/Kconfig
@@ -0,0 +1,13 @@
+menu "Firmware Drivers"
+
+config SCMI_SMC
+	bool "Forward SCMI over SMC calls from hwdom to EL3 firmware"
+	default y
+	help
+	  This option enables basic awareness for SCMI calls using SMC as
+	  doorbell mechanism and Shared Memory for transport ("arm,scmi-smc"
+	  compatible only). The value of "arm,smc-id" DT property from SCMI
+	  firmware node is used to trap and forward corresponding SCMI SMCs
+	  to firmware running at EL3, for calls coming from the hardware domain.
+
+endmenu
diff --git a/xen/arch/arm/firmware/Makefile b/xen/arch/arm/firmware/Makefile
new file mode 100644
index 0000000000..a5e4542666
--- /dev/null
+++ b/xen/arch/arm/firmware/Makefile
@@ -0,0 +1 @@
+obj-$(CONFIG_SCMI_SMC) += scmi-smc.o
diff --git a/xen/arch/arm/firmware/scmi-smc.c b/xen/arch/arm/firmware/scmi-smc.c
new file mode 100644
index 0000000000..33473c04b1
--- /dev/null
+++ b/xen/arch/arm/firmware/scmi-smc.c
@@ -0,0 +1,162 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+/*
+ * xen/arch/arm/firmware/scmi-smc.c
+ *
+ * ARM System Control and Management Interface (SCMI) over SMC
+ * Generic handling layer
+ *
+ * Andrei Cherechesu <andrei.cherechesu@nxp.com>
+ * Copyright 2024 NXP
+ */
+
+#include <xen/acpi.h>
+#include <xen/device_tree.h>
+#include <xen/errno.h>
+#include <xen/init.h>
+#include <xen/sched.h>
+#include <xen/types.h>
+
+#include <asm/smccc.h>
+#include <asm/firmware/scmi-smc.h>
+
+#define SCMI_SMC_ID_PROP   "arm,smc-id"
+
+static bool __ro_after_init scmi_enabled;
+static uint32_t __ro_after_init scmi_smc_id;
+
+/*
+ * Check if provided SMC Function Identifier matches the one known by the SCMI
+ * layer, as read from DT prop 'arm,smc-id' during initialiation.
+ */
+static bool scmi_is_valid_smc_id(uint32_t fid)
+{
+    return (fid == scmi_smc_id);
+}
+
+/*
+ * Generic handler for SCMI-SMC requests, currently only forwarding the
+ * request to FW running at EL3 if it came from the hardware domain.
+ * Called from the vSMC layer for SiP SMCs, since SCMI calls are usually
+ * provided this way.
+ *
+ * Returns true if SMC was handled (regardless of response), false otherwise.
+ */
+bool scmi_handle_smc(struct cpu_user_regs *regs)
+{
+    uint32_t fid = (uint32_t)get_user_reg(regs, 0);
+    struct arm_smccc_res res;
+
+    if ( !scmi_enabled )
+        return false;
+
+    if ( !scmi_is_valid_smc_id(fid) )
+        return false;
+
+    /* Only the hardware domain should use SCMI calls */
+    if ( !is_hardware_domain(current->domain) )
+    {
+        gdprintk(XENLOG_WARNING, "SCMI: Unprivileged access attempt\n");
+        return false;
+    }
+
+    /* For the moment, forward the SCMI Request to FW running at EL3 */
+    arm_smccc_1_1_smc(fid,
+                      get_user_reg(regs, 1),
+                      get_user_reg(regs, 2),
+                      get_user_reg(regs, 3),
+                      get_user_reg(regs, 4),
+                      get_user_reg(regs, 5),
+                      get_user_reg(regs, 6),
+                      get_user_reg(regs, 7),
+                      &res);
+
+    set_user_reg(regs, 0, res.a0);
+    set_user_reg(regs, 1, res.a1);
+    set_user_reg(regs, 2, res.a2);
+    set_user_reg(regs, 3, res.a3);
+
+    return true;
+}
+
+static int __init scmi_check_smccc_ver(void)
+{
+    if ( smccc_ver < ARM_SMCCC_VERSION_1_1 )
+    {
+        printk(XENLOG_WARNING
+               "SCMI: No SMCCC 1.1 support, SCMI calls forwarding disabled\n");
+        return -ENOSYS;
+    }
+
+    return 0;
+}
+
+static int __init scmi_dt_init_smccc(void)
+{
+    static const struct dt_device_match scmi_ids[] __initconst =
+    {
+        /* We only support "arm,scmi-smc" binding for now */
+        DT_MATCH_COMPATIBLE("arm,scmi-smc"),
+        { /* sentinel */ },
+    };
+    const struct dt_device_node *scmi_node;
+    int ret;
+
+    /* If no SCMI firmware node found, fail silently as it's not mandatory */
+    scmi_node = dt_find_matching_node(NULL, scmi_ids);
+    if ( !scmi_node )
+        return -EOPNOTSUPP;
+
+    ret = dt_property_read_u32(scmi_node, SCMI_SMC_ID_PROP, &scmi_smc_id);
+    if ( !ret )
+    {
+        printk(XENLOG_ERR "SCMI: No valid \"%s\" property in \"%s\" DT node\n",
+               SCMI_SMC_ID_PROP, scmi_node->full_name);
+        return -ENOENT;
+    }
+
+    scmi_enabled = true;
+
+    return 0;
+}
+
+/* Initialize the SCMI layer based on SMCs and Device-tree */
+static int __init scmi_init(void)
+{
+    int ret;
+
+    if ( !acpi_disabled )
+    {
+        printk(XENLOG_WARNING "SCMI is not supported when using ACPI\n");
+        return -EINVAL;
+    }
+
+    ret = scmi_check_smccc_ver();
+    if ( ret )
+        return ret;
+
+    ret = scmi_dt_init_smccc();
+    if ( ret == -EOPNOTSUPP )
+        return ret;
+    if ( ret )
+        goto err;
+
+    printk(XENLOG_INFO "Using SCMI with SMC ID: 0x%x\n", scmi_smc_id);
+
+    return 0;
+
+ err:
+    printk(XENLOG_ERR "SCMI: Initialization failed (ret = %d)\n", ret);
+    return ret;
+}
+
+__initcall(scmi_init);
+
+/*
+ * Local variables:
+ * mode: C
+ * c-file-style: "BSD"
+ * c-basic-offset: 4
+ * tab-width: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
diff --git a/xen/arch/arm/include/asm/firmware/scmi-smc.h b/xen/arch/arm/include/asm/firmware/scmi-smc.h
new file mode 100644
index 0000000000..6b1a164a40
--- /dev/null
+++ b/xen/arch/arm/include/asm/firmware/scmi-smc.h
@@ -0,0 +1,41 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+/*
+ * xen/arch/arm/include/asm/firmware/scmi-smc.h
+ *
+ * ARM System Control and Management Interface (SCMI) over SMC
+ * Generic handling layer
+ *
+ * Andrei Cherechesu <andrei.cherechesu@nxp.com>
+ * Copyright 2024 NXP
+ */
+
+#ifndef __ASM_SCMI_SMC_H__
+#define __ASM_SCMI_SMC_H__
+
+#include <xen/types.h>
+
+struct cpu_user_regs;
+
+#ifdef CONFIG_SCMI_SMC
+
+bool scmi_handle_smc(struct cpu_user_regs *regs);
+
+#else
+
+static inline bool scmi_handle_smc(struct cpu_user_regs *regs)
+{
+    return false;
+}
+
+#endif /* CONFIG_SCMI_SMC */
+
+#endif /* __ASM_SCMI_H__ */
+
+/*
+ * Local variables:
+ * mode: C
+ * c-file-style: "BSD"
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Dec 20 08:24:04 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 20 Dec 2024 08:24:04 +0000
Received: from list by lists.xenproject.org with outflank-mailman.861693.1273743 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tOYIm-0007dj-I2; Fri, 20 Dec 2024 08:24:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 861693.1273743; Fri, 20 Dec 2024 08:24:04 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tOYIm-0007db-FC; Fri, 20 Dec 2024 08:24:04 +0000
Received: by outflank-mailman (input) for mailman id 861693;
 Fri, 20 Dec 2024 08:24:03 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tOYIl-0007dR-4m
 for xen-changelog@lists.xenproject.org; Fri, 20 Dec 2024 08:24:03 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tOYIk-00D4zQ-2e
 for xen-changelog@lists.xenproject.org;
 Fri, 20 Dec 2024 08:24:03 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tOYIl-005Szn-0I
 for xen-changelog@lists.xenproject.org;
 Fri, 20 Dec 2024 08:24:03 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=9bbYSO2llo5MsmfNlBaykDgVzQpk0JjST3hpY7XVAk0=; b=p5scTUcyZwq8GhsJ7BpzAqEhG+
	tKYeL+LA+zMKtXzagXJqnnCyXyUWUtEc34h7z6ncgPrw7DXFTW0euL8uGK439W9kD5chKW4+dDtas
	L+2lwsxari6hpnnCn/EVjUE75lJ/429YxLWlFYMOnf5f6apvNW7pHqfS/EuuztXZiRU8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/arm: vsmc: Enable handling SiP-owned SCMI SMC calls
Message-Id: <E1tOYIl-005Szn-0I@xenbits.xenproject.org>
Date: Fri, 20 Dec 2024 08:24:03 +0000

commit a767076c03a65eb67d5e59ccd23f418ce314a5bd
Author:     Andrei Cherechesu <andrei.cherechesu@nxp.com>
AuthorDate: Thu Dec 19 13:23:11 2024 +0200
Commit:     Michal Orzel <michal.orzel@amd.com>
CommitDate: Thu Dec 19 19:26:21 2024 +0100

    xen/arm: vsmc: Enable handling SiP-owned SCMI SMC calls
    
    Change the handling of SiP SMC calls to be more generic,
    instead of directly relying on the `platform_smc()` callback
    implementation.
    
    Try to handle the SiP SMC first through the `platform_smc()`
    callback (if implemented). Otherwise, try to handle it as SCMI
    message.
    
    Signed-off-by: Andrei Cherechesu <andrei.cherechesu@nxp.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
    Acked-by: Julien Grall <jgrall@amazon.com>
---
 xen/arch/arm/vsmc.c | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/xen/arch/arm/vsmc.c b/xen/arch/arm/vsmc.c
index f679cced7f..62d8117a12 100644
--- a/xen/arch/arm/vsmc.c
+++ b/xen/arch/arm/vsmc.c
@@ -20,6 +20,7 @@
 #include <asm/traps.h>
 #include <asm/vpsci.h>
 #include <asm/platform.h>
+#include <asm/firmware/scmi-smc.h>
 
 /* Number of functions currently supported by Hypervisor Service. */
 #define XEN_SMCCC_FUNCTION_COUNT 3
@@ -224,6 +225,16 @@ static bool handle_sssc(struct cpu_user_regs *regs)
     }
 }
 
+/* Secure Calls defined by the Silicon Provider (SiP) */
+static bool handle_sip(struct cpu_user_regs *regs)
+{
+    /* Firstly, let each platform define custom handling for these SMCs */
+    if ( platform_smc(regs) )
+        return true;
+
+    return scmi_handle_smc(regs);
+}
+
 /*
  * vsmccc_handle_call() - handle SMC/HVC call according to ARM SMCCC.
  * returns true if that was valid SMCCC call (even if function number
@@ -288,7 +299,7 @@ static bool vsmccc_handle_call(struct cpu_user_regs *regs)
             handled = handle_sssc(regs);
             break;
         case ARM_SMCCC_OWNER_SIP:
-            handled = platform_smc(regs);
+            handled = handle_sip(regs);
             break;
         case ARM_SMCCC_OWNER_TRUSTED_APP ... ARM_SMCCC_OWNER_TRUSTED_APP_END:
         case ARM_SMCCC_OWNER_TRUSTED_OS ... ARM_SMCCC_OWNER_TRUSTED_OS_END:
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Dec 20 08:24:14 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 20 Dec 2024 08:24:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.861694.1273747 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tOYIw-0007fy-JP; Fri, 20 Dec 2024 08:24:14 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 861694.1273747; Fri, 20 Dec 2024 08:24: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 1tOYIw-0007fo-Gg; Fri, 20 Dec 2024 08:24:14 +0000
Received: by outflank-mailman (input) for mailman id 861694;
 Fri, 20 Dec 2024 08:24:13 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tOYIv-0007fi-7g
 for xen-changelog@lists.xenproject.org; Fri, 20 Dec 2024 08:24:13 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tOYIu-00D4zV-2x
 for xen-changelog@lists.xenproject.org;
 Fri, 20 Dec 2024 08:24:13 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tOYIv-005T0k-0Y
 for xen-changelog@lists.xenproject.org;
 Fri, 20 Dec 2024 08:24:13 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=23BDL8pSsCmDildocSSMrlCMFgWDxrQBVGpyO/SDaCI=; b=3Z7vHXcorkRzKYNMPrTSi7XgPS
	Xt1xrjlsnSNe3m5g3lTK0xI+e63uBL9V69MDuZFQcad91zvuuZSDGjaTgkM3aw5spBQNwsYCSIB83
	MH+i4A2Tt6AP3jmnXS5FnbppZASAw+OLMh5DnSZvm0chrvH7ACFWdO7bOqcP+Qnw4590=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/arm: platforms: Add NXP S32G3 Processors config
Message-Id: <E1tOYIv-005T0k-0Y@xenbits.xenproject.org>
Date: Fri, 20 Dec 2024 08:24:13 +0000

commit 78b0b025be2fef0d19c466b2758bacc26ee2cbdc
Author:     Andrei Cherechesu <andrei.cherechesu@nxp.com>
AuthorDate: Thu Dec 19 13:23:12 2024 +0200
Commit:     Michal Orzel <michal.orzel@amd.com>
CommitDate: Thu Dec 19 19:26:21 2024 +0100

    xen/arm: platforms: Add NXP S32G3 Processors config
    
    Platforms based on NXP S32G3 processors use the NXP LINFlexD
    UART driver for console by default, and rely on Dom0 having
    access to SCMI services for system-level resources from
    firmware at EL3.
    
    Signed-off-by: Andrei Cherechesu <andrei.cherechesu@nxp.com>
    Reviewed-by: Bertrand Marquis <bertrand.marquis@arm.com>
---
 xen/arch/arm/platforms/Kconfig | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/xen/arch/arm/platforms/Kconfig b/xen/arch/arm/platforms/Kconfig
index 02322c259c..6dbf6ec87b 100644
--- a/xen/arch/arm/platforms/Kconfig
+++ b/xen/arch/arm/platforms/Kconfig
@@ -37,6 +37,14 @@ config MPSOC
 	help
 	Enable all the required drivers for Xilinx Ultrascale+ MPSoC
 
+config S32G3
+	bool "NXP S32G3 Processors support"
+	depends on ARM_64
+	select HAS_LINFLEX
+	select SCMI_SMC
+	help
+	Enable all the required drivers for NXP S32G3 Processors Family
+
 config NO_PLAT
 	bool "No Platforms"
 	help
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Dec 20 08:24:24 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 20 Dec 2024 08:24:24 +0000
Received: from list by lists.xenproject.org with outflank-mailman.861695.1273751 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tOYJ6-0007id-LD; Fri, 20 Dec 2024 08:24:24 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 861695.1273751; Fri, 20 Dec 2024 08:24: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 1tOYJ6-0007iV-I3; Fri, 20 Dec 2024 08:24:24 +0000
Received: by outflank-mailman (input) for mailman id 861695;
 Fri, 20 Dec 2024 08:24:23 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tOYJ5-0007iG-Ax
 for xen-changelog@lists.xenproject.org; Fri, 20 Dec 2024 08:24:23 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tOYJ5-00D4zi-02
 for xen-changelog@lists.xenproject.org;
 Fri, 20 Dec 2024 08:24:23 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tOYJ5-005T2X-0r
 for xen-changelog@lists.xenproject.org;
 Fri, 20 Dec 2024 08:24:23 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=/mff0pT/V2C8ZqZn8Ux8lim0HTvBlVueZQeAD+CSVaA=; b=mghNHA/RgfGIhPfq1fMOj1fp6C
	iPMlO+JVMWlNpriln6uNLVNOXL1hOgzXt47qApVDBfvbT2tOdVe1rH9mHcsCiGJFqfUv33R83QZmG
	/jhyqN0EiYExp/G4UA4/405QPQKYHKdCTwdIMoHU7+VODYcpZ6rGDmkAmZXcSgj/N+pU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] CHANGELOG.md: Add NXP S32G3 and SCMI-SMC layer support mentions
Message-Id: <E1tOYJ5-005T2X-0r@xenbits.xenproject.org>
Date: Fri, 20 Dec 2024 08:24:23 +0000

commit f09ee5f55032a7fda0aefb89bf0fca5db0d37187
Author:     Andrei Cherechesu <andrei.cherechesu@nxp.com>
AuthorDate: Thu Dec 19 13:23:13 2024 +0200
Commit:     Michal Orzel <michal.orzel@amd.com>
CommitDate: Thu Dec 19 19:26:21 2024 +0100

    CHANGELOG.md: Add NXP S32G3 and SCMI-SMC layer support mentions
    
    Signed-off-by: Andrei Cherechesu <andrei.cherechesu@nxp.com>
    Reviewed-by: Bertrand Marquis <bertrand.marquis@arm.com>
    Acked-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
---
 CHANGELOG.md | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 61510e6a11..fe6c4cf943 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -18,6 +18,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
 ### Added
  - On Arm:
    - Experimental support for Armv8-R.
+   - Support for NXP S32G3 Processors Family and NXP LINFlexD UART driver.
+   - Basic handling for SCMI requests over SMC using Shared Memory, by allowing
+     forwarding the calls to EL3 FW if coming from hwdom.
  - On x86:
    - xl suspend/resume subcommands.
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Dec 20 08:24:34 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 20 Dec 2024 08:24:34 +0000
Received: from list by lists.xenproject.org with outflank-mailman.861696.1273754 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tOYJG-0007lt-Lq; Fri, 20 Dec 2024 08:24:34 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 861696.1273754; Fri, 20 Dec 2024 08:24: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 1tOYJG-0007lm-JQ; Fri, 20 Dec 2024 08:24:34 +0000
Received: by outflank-mailman (input) for mailman id 861696;
 Fri, 20 Dec 2024 08:24:33 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tOYJF-0007lY-E8
 for xen-changelog@lists.xenproject.org; Fri, 20 Dec 2024 08:24:33 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tOYJF-00D4zp-0M
 for xen-changelog@lists.xenproject.org;
 Fri, 20 Dec 2024 08:24:33 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tOYJF-005T3b-1B
 for xen-changelog@lists.xenproject.org;
 Fri, 20 Dec 2024 08:24:33 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Lz2QA4N+4213teWnPeCbjMWnmWXDSn96/3U2hOGE4dk=; b=WBh2pNz5PnEBLwbEqrxufZyNJb
	L1xY+WsNJWv/3eJjFFgdtxmrpTSW8LSH9FWhvXNqOuPO9SJd7ZmYvWi9fhCQHKcktjUhj66ABBRGV
	SyYxmuVDQRWYdjuJiUbQWp3wSOHr1jC8WTugButgKtJxtxjfMFN7HZbcj2NdxKFU3Zx0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] SUPPORT.md: Describe SCMI-SMC layer feature
Message-Id: <E1tOYJF-005T3b-1B@xenbits.xenproject.org>
Date: Fri, 20 Dec 2024 08:24:33 +0000

commit 294faa3760bd40c1084f5bcc6c213e2e64c64dae
Author:     Andrei Cherechesu <andrei.cherechesu@nxp.com>
AuthorDate: Thu Dec 19 13:23:14 2024 +0200
Commit:     Michal Orzel <michal.orzel@amd.com>
CommitDate: Thu Dec 19 19:26:21 2024 +0100

    SUPPORT.md: Describe SCMI-SMC layer feature
    
    Describe the layer which enables SCMI over SMC calls forwarding
    to EL3 FW if issued by the Hardware domain. If the SCMI firmware
    node is not found in the Host DT during initialization, it fails
    silently as it's not mandatory.
    
    The SCMI SMCs trapping at EL2 now lets hwdom perform SCMI ops for
    interacting with system-level resources almost as if it would be
    running natively.
    
    Signed-off-by: Andrei Cherechesu <andrei.cherechesu@nxp.com>
    Reviewed-by: Bertrand Marquis <bertrand.marquis@arm.com>
    Acked-by: Michal Orzel <michal.orzel@amd.com>
---
 SUPPORT.md | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/SUPPORT.md b/SUPPORT.md
index 998faf5635..54c78b722d 100644
--- a/SUPPORT.md
+++ b/SUPPORT.md
@@ -935,6 +935,14 @@ Add/Remove device tree nodes using a device tree overlay binary (.dtbo).
 
     Status: Tech Preview
 
+### Arm: SCMI over SMC calls forwarding to EL3 Firmware
+
+Enable SCMI calls using SMC as doorbell mechanism and Shared Memory for
+transport ("arm,scmi-smc" compatible only) to reach EL3 Firmware if issued
+by hwdom. Some platforms use SCMI for access to system-level resources.
+
+    Status: Supported
+
 ## Virtual Hardware, QEMU
 
 This section describes supported devices available in HVM mode using a
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Dec 20 08:24:44 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 20 Dec 2024 08:24:44 +0000
Received: from list by lists.xenproject.org with outflank-mailman.861697.1273759 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tOYJQ-0007oL-Nb; Fri, 20 Dec 2024 08:24:44 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 861697.1273759; Fri, 20 Dec 2024 08:24: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 1tOYJQ-0007oD-Kv; Fri, 20 Dec 2024 08:24:44 +0000
Received: by outflank-mailman (input) for mailman id 861697;
 Fri, 20 Dec 2024 08:24:43 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tOYJP-0007o1-GZ
 for xen-changelog@lists.xenproject.org; Fri, 20 Dec 2024 08:24:43 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tOYJP-00D4zt-0b
 for xen-changelog@lists.xenproject.org;
 Fri, 20 Dec 2024 08:24:43 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tOYJP-005T5K-1U
 for xen-changelog@lists.xenproject.org;
 Fri, 20 Dec 2024 08:24:43 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=48Vc1X4pqLd7w73VSdhJnt1RSig/S3d1kJ3woVgFSVo=; b=A6C+HLX2nr7w+wXq1E3V9RlV12
	bIogE8rH21TkyEbkGm+tNQnQkaZ9vP/EtfDXVBoO2QLk+TAtxXRmdUrXqndjDYJVvS8VwGMXjq1CU
	gc3mklwcLETuYFYZHWaahpGqInDJsiR40pqqppTQsE2H/rYTuC4V68KyC4c5sprKgISw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] MAINTAINERS: Add myself as maintainer for NXP S32G3
Message-Id: <E1tOYJP-005T5K-1U@xenbits.xenproject.org>
Date: Fri, 20 Dec 2024 08:24:43 +0000

commit 075e7e35dbd9338d28f44f84b1fb573e521d51f1
Author:     Andrei Cherechesu <andrei.cherechesu@nxp.com>
AuthorDate: Thu Dec 19 13:23:15 2024 +0200
Commit:     Michal Orzel <michal.orzel@amd.com>
CommitDate: Thu Dec 19 19:26:21 2024 +0100

    MAINTAINERS: Add myself as maintainer for NXP S32G3
    
    Add myself as maintainer for NXP S32G3 SoCs Family,
    and the S32 Linux Team as relevant reviewers list.
    
    Signed-off-by: Andrei Cherechesu <andrei.cherechesu@nxp.com>
    Acked-by: Bertrand Marquis <bertrand.marquis@arm.com>
    Acked-by: Michal Orzel <michal.orzel@amd.com>
---
 MAINTAINERS | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/MAINTAINERS b/MAINTAINERS
index 34ad49bc39..392f780f76 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -426,6 +426,12 @@ L:	minios-devel@lists.xenproject.org
 T:	git https://xenbits.xenproject.org/git-http/mini-os.git
 F:	config/MiniOS.mk
 
+NXP S32G3 PROCESSORS FAMILY SUPPORT
+M:	Andrei Cherechesu <andrei.cherechesu@oss.nxp.com>
+L:	NXP S32 Linux Team <s32@nxp.com>
+F:	xen/arch/arm/include/asm/linflex-uart.h
+F:	xen/drivers/char/linflex-uart.c
+
 OCAML TOOLS
 M:	Christian Lindig <christian.lindig@citrix.com>
 M:	David Scott <dave@recoil.org>
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Dec 21 00:11:17 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 21 Dec 2024 00:11:17 +0000
Received: from list by lists.xenproject.org with outflank-mailman.862110.1274004 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tOn5J-00056U-1q; Sat, 21 Dec 2024 00:11:09 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 862110.1274004; Sat, 21 Dec 2024 00:11:09 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tOn5I-00056M-Uv; Sat, 21 Dec 2024 00:11:08 +0000
Received: by outflank-mailman (input) for mailman id 862110;
 Sat, 21 Dec 2024 00:11:08 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tOn5I-00056G-Js
 for xen-changelog@lists.xenproject.org; Sat, 21 Dec 2024 00:11:08 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tOn5I-00DOt8-0L
 for xen-changelog@lists.xenproject.org;
 Sat, 21 Dec 2024 00:11:08 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tOn5I-007E1j-14
 for xen-changelog@lists.xenproject.org;
 Sat, 21 Dec 2024 00:11:08 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=8XvXpdT7UjLR2Xm0Q0oaz63BcY/hdk6QScQSHER4pYQ=; b=AILfd6r2FmP7+fvYkeBYweRIAz
	M3ZFdfgGvtN5wn05rq/lJMYRMP6VvjvrrZ/iZzykTJYG4G9I+wwYvdbBFgNaCDViPsqUjdisTiqrm
	1Vg1v96oUPcTCi93nOaOjWoTe+BYPZAZxAFnWbNztnhAWOLb9DJ7SMuoqxvoVQVjsICo=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/version: Calculate xen_capabilities_info once at boot
Message-Id: <E1tOn5I-007E1j-14@xenbits.xenproject.org>
Date: Sat, 21 Dec 2024 00:11:08 +0000

commit 7cf44c61c531274185966a89684ab822c8d6f555
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Fri Jan 13 17:20:41 2023 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Dec 20 22:44:42 2024 +0000

    xen/version: Calculate xen_capabilities_info once at boot
    
    The arch_get_xen_caps() infrastructure is horribly inefficient for something
    that is constant after features have been resolved on boot.
    
    Every instance used snprintf() to format constants into a string (which gets
    shorter when %d gets resolved!), and which get double buffered on the stack.
    
    Switch to using string literals with the "3.0" inserted - these numbers
    haven't changed in 19 years; the Xen 3.0 release was Dec 5th 2005.
    
    Use initcalls to format the data into xen_cap_info, which is deliberately not
    of type xen_capabilities_info_t because a 1k array is a silly overhead for
    storing a maximum of 77 chars (the x86 version) and isn't liable to need any
    more space in the forseeable future.  RISC-V and PPC have their stub dropped,
    with the expectation that they won't carry this legacy interface forward.
    
    This speeds up the the XENVER_capabilities hypercall, but the purpose of the
    change is to allow us to introduce a better XENVER_* API that doesn't force
    the use of a 1k buffer on the stack.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/arm/setup.c        | 18 +++++++-----------
 xen/arch/ppc/setup.c        |  5 -----
 xen/arch/riscv/setup.c      |  5 -----
 xen/arch/x86/setup.c        | 29 ++++++++++-------------------
 xen/common/kernel.c         |  3 ++-
 xen/include/xen/hypercall.h |  2 --
 xen/include/xen/version.h   |  2 ++
 7 files changed, 21 insertions(+), 43 deletions(-)

diff --git a/xen/arch/arm/setup.c b/xen/arch/arm/setup.c
index 68c1f30920..c1f2d1b89d 100644
--- a/xen/arch/arm/setup.c
+++ b/xen/arch/arm/setup.c
@@ -28,6 +28,7 @@
 #include <xen/cpu.h>
 #include <xen/pfn.h>
 #include <xen/virtual_region.h>
+#include <xen/version.h>
 #include <xen/vmap.h>
 #include <xen/trace.h>
 #include <xen/libfdt/libfdt-xen.h>
@@ -513,24 +514,19 @@ void asmlinkage __init start_xen(unsigned long fdt_paddr)
     switch_stack_and_jump(idle_vcpu[0]->arch.cpu_info, init_done);
 }
 
-void arch_get_xen_caps(xen_capabilities_info_t *info)
+static int __init init_xen_cap_info(void)
 {
     /* Interface name is always xen-3.0-* for Xen-3.x. */
-    int major = 3, minor = 0;
-    char s[32];
-
-    (*info)[0] = '\0';
 
 #ifdef CONFIG_ARM_64
-    snprintf(s, sizeof(s), "xen-%d.%d-aarch64 ", major, minor);
-    safe_strcat(*info, s);
+    safe_strcat(xen_cap_info, "xen-3.0-aarch64 ");
 #endif
     if ( cpu_has_aarch32 )
-    {
-        snprintf(s, sizeof(s), "xen-%d.%d-armv7l ", major, minor);
-        safe_strcat(*info, s);
-    }
+        safe_strcat(xen_cap_info, "xen-3.0-armv7l ");
+
+    return 0;
 }
+__initcall(init_xen_cap_info);
 
 /*
  * Local variables:
diff --git a/xen/arch/ppc/setup.c b/xen/arch/ppc/setup.c
index 5fb5ab64e3..9c1e4791af 100644
--- a/xen/arch/ppc/setup.c
+++ b/xen/arch/ppc/setup.c
@@ -47,8 +47,3 @@ void __init noreturn start_xen(unsigned long r3, unsigned long r4,
 
     machine_halt();
 }
-
-void arch_get_xen_caps(xen_capabilities_info_t *info)
-{
-    BUG_ON("unimplemented");
-}
diff --git a/xen/arch/riscv/setup.c b/xen/arch/riscv/setup.c
index fb6bbba684..38ca4f3baa 100644
--- a/xen/arch/riscv/setup.c
+++ b/xen/arch/riscv/setup.c
@@ -20,11 +20,6 @@
 #include <asm/smp.h>
 #include <asm/traps.h>
 
-void arch_get_xen_caps(xen_capabilities_info_t *info)
-{
-    BUG_ON("unimplemented");
-}
-
 /* Xen stack for bringing up the first CPU. */
 unsigned char __initdata cpu0_boot_stack[STACK_SIZE]
     __aligned(STACK_SIZE);
diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c
index 397347bea4..8ebe5a9443 100644
--- a/xen/arch/x86/setup.c
+++ b/xen/arch/x86/setup.c
@@ -2165,35 +2165,26 @@ void asmlinkage __init noreturn __start_xen(void)
     unreachable();
 }
 
-void arch_get_xen_caps(xen_capabilities_info_t *info)
+static int __init cf_check init_xen_cap_info(void)
 {
     /* Interface name is always xen-3.0-* for Xen-3.x. */
-    int major = 3, minor = 0;
-    char s[32];
-
-    (*info)[0] = '\0';
 
     if ( IS_ENABLED(CONFIG_PV) )
     {
-        snprintf(s, sizeof(s), "xen-%d.%d-x86_64 ", major, minor);
-        safe_strcat(*info, s);
+        safe_strcat(xen_cap_info, "xen-3.0-x86_64 ");
 
         if ( opt_pv32 )
-        {
-            snprintf(s, sizeof(s), "xen-%d.%d-x86_32p ", major, minor);
-            safe_strcat(*info, s);
-        }
+            safe_strcat(xen_cap_info, "xen-3.0-x86_32p ");
     }
     if ( hvm_enabled )
-    {
-        snprintf(s, sizeof(s), "hvm-%d.%d-x86_32 ", major, minor);
-        safe_strcat(*info, s);
-        snprintf(s, sizeof(s), "hvm-%d.%d-x86_32p ", major, minor);
-        safe_strcat(*info, s);
-        snprintf(s, sizeof(s), "hvm-%d.%d-x86_64 ", major, minor);
-        safe_strcat(*info, s);
-    }
+        safe_strcat(xen_cap_info,
+                    "hvm-3.0-x86_32 "
+                    "hvm-3.0-x86_32p "
+                    "hvm-3.0-x86_64 ");
+
+    return 0;
 }
+__initcall(init_xen_cap_info);
 
 int __hwdom_init remove_xen_ranges(struct rangeset *r)
 {
diff --git a/xen/common/kernel.c b/xen/common/kernel.c
index b44b2439ca..d30ab56f57 100644
--- a/xen/common/kernel.c
+++ b/xen/common/kernel.c
@@ -35,6 +35,7 @@ boolean_param("dit", opt_dit);
 
 static xen_commandline_t saved_cmdline;
 static const char __initconst opt_builtin_cmdline[] = CONFIG_CMDLINE;
+char __ro_after_init xen_cap_info[128];
 
 static int assign_integer_param(const struct kernel_param *param, uint64_t val)
 {
@@ -542,7 +543,7 @@ long do_xen_version(int cmd, XEN_GUEST_HANDLE_PARAM(void) arg)
 
         memset(info, 0, sizeof(info));
         if ( !deny )
-            arch_get_xen_caps(&info);
+            safe_strcpy(info, xen_cap_info);
 
         if ( copy_to_guest(arg, info, ARRAY_SIZE(info)) )
             return -EFAULT;
diff --git a/xen/include/xen/hypercall.h b/xen/include/xen/hypercall.h
index f307dfb597..15b6be6ec8 100644
--- a/xen/include/xen/hypercall.h
+++ b/xen/include/xen/hypercall.h
@@ -56,6 +56,4 @@ common_vcpu_op(int cmd,
     struct vcpu *v,
     XEN_GUEST_HANDLE_PARAM(void) arg);
 
-void arch_get_xen_caps(xen_capabilities_info_t *info);
-
 #endif /* __XEN_HYPERCALL_H__ */
diff --git a/xen/include/xen/version.h b/xen/include/xen/version.h
index 93c5877363..4856ad1b44 100644
--- a/xen/include/xen/version.h
+++ b/xen/include/xen/version.h
@@ -19,6 +19,8 @@ const char *xen_deny(void);
 const char *xen_build_info(void);
 int xen_build_id(const void **p, unsigned int *len);
 
+extern char xen_cap_info[128];
+
 #ifdef BUILD_ID
 void xen_build_init(void);
 int xen_build_id_check(const Elf_Note *n, unsigned int n_sz,
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Sat Dec 21 00:11:19 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 21 Dec 2024 00:11:19 +0000
Received: from list by lists.xenproject.org with outflank-mailman.862111.1274007 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tOn5T-00058B-3L; Sat, 21 Dec 2024 00:11:19 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 862111.1274007; Sat, 21 Dec 2024 00:11:19 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tOn5T-000583-0M; Sat, 21 Dec 2024 00:11:19 +0000
Received: by outflank-mailman (input) for mailman id 862111;
 Sat, 21 Dec 2024 00:11:18 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tOn5S-00057v-HR
 for xen-changelog@lists.xenproject.org; Sat, 21 Dec 2024 00:11:18 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tOn5S-00DOtL-0f
 for xen-changelog@lists.xenproject.org;
 Sat, 21 Dec 2024 00:11:18 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tOn5S-007E2Y-1V
 for xen-changelog@lists.xenproject.org;
 Sat, 21 Dec 2024 00:11:18 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=C1uyPcVTGMUB5L8AI1xj1xC7AA9snuaUWGh8Lfj+ZnE=; b=Im64GNSzC2E14735rwwr3PAAw2
	w4ymY7ePawiIeqzaAxeahlSor7D6lKo5cUFsveq0hZc3TizyTQEy4RVQjnk0jAWO7xaMoBrqpHISe
	FV30QgaqtAiaajNXz1nc0t9WHDOmnxiNNXlrh3OW10K20qhoR/5mKNBY3hh8Qs9mXQbo=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/version: Introduce non-truncating deterministically-signed XENVER_* subops
Message-Id: <E1tOn5S-007E2Y-1V@xenbits.xenproject.org>
Date: Sat, 21 Dec 2024 00:11:18 +0000

commit e3bb1b6525edbf3a377f478e822b8be4dec7f5f1
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Tue Dec 20 13:12:52 2022 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Dec 20 22:44:42 2024 +0000

    xen/version: Introduce non-truncating deterministically-signed XENVER_* subops
    
    In XenServer, we have encountered problems caused by both XENVER_extraversion
    and XENVER_commandline having fixed bounds.
    
    More than just the invariant size, the APIs/ABIs also broken by typedef-ing an
    array, and using an unqualified 'char' which has implementation-specific
    signed-ness.
    
    Provide brand new ops, which are capable of expressing variable length
    strings, and mark the older ops as broken.
    
    This fixes all issues around XENVER_extraversion being longer than 15 chars.
    Further work beyond just this API is needed to remove other assumptions about
    XENVER_commandline being 1023 chars long.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jason Andryuk <jandryuk@gmail.com>
    ---
    Non-technical objections to this patch were raised, and subsequently rejected
    by a community wide vote.  The results of the vote have not been shared with
    the community at the time of committing.
---
 xen/common/kernel.c          | 59 +++++++++++++++++++++++++++++++++++++++++
 xen/include/public/version.h | 63 ++++++++++++++++++++++++++++++++++++++++++--
 xen/include/xlat.lst         |  1 +
 xen/include/xsm/dummy.h      |  3 +++
 xen/xsm/flask/hooks.c        |  4 +++
 5 files changed, 128 insertions(+), 2 deletions(-)

diff --git a/xen/common/kernel.c b/xen/common/kernel.c
index d30ab56f57..eb7122b74f 100644
--- a/xen/common/kernel.c
+++ b/xen/common/kernel.c
@@ -24,6 +24,7 @@
 CHECK_build_id;
 CHECK_compile_info;
 CHECK_feature_info;
+CHECK_varbuf;
 #endif
 
 enum system_state system_state = SYS_STATE_early_boot;
@@ -503,6 +504,56 @@ static int __init cf_check param_init(void)
 __initcall(param_init);
 #endif
 
+static long xenver_varbuf_op(int cmd, XEN_GUEST_HANDLE_PARAM(void) arg)
+{
+    struct xen_varbuf user_str;
+    const char *str = NULL;
+    size_t sz;
+
+    switch ( cmd )
+    {
+    case XENVER_extraversion2:
+        str = xen_extra_version();
+        break;
+
+    case XENVER_changeset2:
+        str = xen_changeset();
+        break;
+
+    case XENVER_commandline2:
+        str = saved_cmdline;
+        break;
+
+    case XENVER_capabilities2:
+        str = xen_cap_info;
+        break;
+
+    default:
+        ASSERT_UNREACHABLE();
+        return -ENODATA;
+    }
+
+    sz = strlen(str);
+
+    if ( sz > KB(64) ) /* Arbitrary limit.  Avoid long-running operations. */
+        return -E2BIG;
+
+    if ( guest_handle_is_null(arg) ) /* Length request */
+        return sz;
+
+    if ( copy_from_guest(&user_str, arg, 1) )
+        return -EFAULT;
+
+    if ( sz > user_str.len )
+        return -ENOBUFS;
+
+    if ( copy_to_guest_offset(arg, offsetof(struct xen_varbuf, buf),
+                              str, sz) )
+        return -EFAULT;
+
+    return sz;
+}
+
 long do_xen_version(int cmd, XEN_GUEST_HANDLE_PARAM(void) arg)
 {
     bool deny = xsm_xen_version(XSM_OTHER, cmd);
@@ -721,6 +772,14 @@ long do_xen_version(int cmd, XEN_GUEST_HANDLE_PARAM(void) arg)
 
         return sz;
     }
+
+    case XENVER_extraversion2:
+    case XENVER_capabilities2:
+    case XENVER_changeset2:
+    case XENVER_commandline2:
+        if ( deny )
+            return -EPERM;
+        return xenver_varbuf_op(cmd, arg);
     }
 
     return -ENOSYS;
diff --git a/xen/include/public/version.h b/xen/include/public/version.h
index cbc4ef7a46..0dd6bbcb43 100644
--- a/xen/include/public/version.h
+++ b/xen/include/public/version.h
@@ -19,12 +19,20 @@
 /* arg == NULL; returns major:minor (16:16). */
 #define XENVER_version      0
 
-/* arg == xen_extraversion_t. */
+/*
+ * arg == xen_extraversion_t.
+ *
+ * This API/ABI is broken.  Use XENVER_extraversion2 where possible.
+ */
 #define XENVER_extraversion 1
 typedef char xen_extraversion_t[16];
 #define XEN_EXTRAVERSION_LEN (sizeof(xen_extraversion_t))
 
-/* arg == xen_compile_info_t. */
+/*
+ * arg == xen_compile_info_t.
+ *
+ * This API/ABI is broken and truncates data.
+ */
 #define XENVER_compile_info 2
 struct xen_compile_info {
     char compiler[64];
@@ -34,10 +42,20 @@ struct xen_compile_info {
 };
 typedef struct xen_compile_info xen_compile_info_t;
 
+/*
+ * arg == xen_capabilities_info_t.
+ *
+ * This API/ABI is broken.  Use XENVER_capabilities2 where possible.
+ */
 #define XENVER_capabilities 3
 typedef char xen_capabilities_info_t[1024];
 #define XEN_CAPABILITIES_INFO_LEN (sizeof(xen_capabilities_info_t))
 
+/*
+ * arg == xen_changeset_info_t.
+ *
+ * This API/ABI is broken.  Use XENVER_changeset2 where possible.
+ */
 #define XENVER_changeset 4
 typedef char xen_changeset_info_t[64];
 #define XEN_CHANGESET_INFO_LEN (sizeof(xen_changeset_info_t))
@@ -95,6 +113,11 @@ typedef struct xen_feature_info xen_feature_info_t;
  */
 #define XENVER_guest_handle 8
 
+/*
+ * arg == xen_commandline_t.
+ *
+ * This API/ABI is broken.  Use XENVER_commandline2 where possible.
+ */
 #define XENVER_commandline 9
 typedef char xen_commandline_t[1024];
 
@@ -110,6 +133,42 @@ struct xen_build_id {
 };
 typedef struct xen_build_id xen_build_id_t;
 
+/*
+ * Container for an arbitrary variable length buffer.
+ */
+struct xen_varbuf {
+    uint32_t len;                          /* IN:  size of buf[] in bytes. */
+    unsigned char buf[XEN_FLEX_ARRAY_DIM]; /* OUT: requested data.         */
+};
+typedef struct xen_varbuf xen_varbuf_t;
+
+/*
+ * arg == xen_varbuf_t
+ *
+ * Equivalent to the original ops, but with a non-truncating API/ABI.
+ *
+ * These hypercalls can fail for a number of reasons.  All callers must handle
+ * -XEN_xxx return values appropriately.
+ *
+ * Passing arg == NULL is a request for size, which will be signalled with a
+ * non-negative return value.  Note: a return size of 0 may be legitimate for
+ * the requested subop.
+ *
+ * Otherwise, the input xen_varbuf_t provides the size of the following
+ * buffer.  Xen will fill the buffer, and return the number of bytes written
+ * (e.g. if the input buffer was longer than necessary).
+ *
+ * Some subops may return binary data.  Some subops may be expected to return
+ * textural data.  These are returned without a NUL terminator, and while the
+ * contents is expected to be ASCII/UTF-8, Xen makes no guarentees to this
+ * effect.  e.g. Xen has no control over the formatting used for the command
+ * line.
+ */
+#define XENVER_extraversion2 11
+#define XENVER_capabilities2 12
+#define XENVER_changeset2    13
+#define XENVER_commandline2  14
+
 #endif /* __XEN_PUBLIC_VERSION_H__ */
 
 /*
diff --git a/xen/include/xlat.lst b/xen/include/xlat.lst
index 2046b36c04..3c7b6c6830 100644
--- a/xen/include/xlat.lst
+++ b/xen/include/xlat.lst
@@ -195,6 +195,7 @@
 ?	build_id			version.h
 ?	compile_info			version.h
 ?	feature_info			version.h
+?	varbuf                          version.h
 
 ?	xenoprof_init			xenoprof.h
 ?	xenoprof_passive		xenoprof.h
diff --git a/xen/include/xsm/dummy.h b/xen/include/xsm/dummy.h
index f8a3c4b81e..6a2fc33c3b 100644
--- a/xen/include/xsm/dummy.h
+++ b/xen/include/xsm/dummy.h
@@ -828,9 +828,12 @@ static XSM_INLINE int cf_check xsm_xen_version(XSM_DEFAULT_ARG uint32_t op)
         block_speculation();
         return 0;
     case XENVER_extraversion:
+    case XENVER_extraversion2:
     case XENVER_compile_info:
     case XENVER_capabilities:
+    case XENVER_capabilities2:
     case XENVER_changeset:
+    case XENVER_changeset2:
     case XENVER_pagesize:
     case XENVER_guest_handle:
         /* These MUST always be accessible to any guest by default. */
diff --git a/xen/xsm/flask/hooks.c b/xen/xsm/flask/hooks.c
index a79474ffe4..2b4efde689 100644
--- a/xen/xsm/flask/hooks.c
+++ b/xen/xsm/flask/hooks.c
@@ -1795,15 +1795,18 @@ static int cf_check flask_xen_version(uint32_t op)
         /* These sub-ops ignore the permission checks and return data. */
         return 0;
     case XENVER_extraversion:
+    case XENVER_extraversion2:
         return avc_has_perm(dsid, SECINITSID_XEN, SECCLASS_VERSION,
                             VERSION__XEN_EXTRAVERSION, NULL);
     case XENVER_compile_info:
         return avc_has_perm(dsid, SECINITSID_XEN, SECCLASS_VERSION,
                             VERSION__XEN_COMPILE_INFO, NULL);
     case XENVER_capabilities:
+    case XENVER_capabilities2:
         return avc_has_perm(dsid, SECINITSID_XEN, SECCLASS_VERSION,
                             VERSION__XEN_CAPABILITIES, NULL);
     case XENVER_changeset:
+    case XENVER_changeset2:
         return avc_has_perm(dsid, SECINITSID_XEN, SECCLASS_VERSION,
                             VERSION__XEN_CHANGESET, NULL);
     case XENVER_pagesize:
@@ -1813,6 +1816,7 @@ static int cf_check flask_xen_version(uint32_t op)
         return avc_has_perm(dsid, SECINITSID_XEN, SECCLASS_VERSION,
                             VERSION__XEN_GUEST_HANDLE, NULL);
     case XENVER_commandline:
+    case XENVER_commandline2:
         return avc_has_perm(dsid, SECINITSID_XEN, SECCLASS_VERSION,
                             VERSION__XEN_COMMANDLINE, NULL);
     case XENVER_build_id:
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Sat Dec 21 00:11:29 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 21 Dec 2024 00:11:29 +0000
Received: from list by lists.xenproject.org with outflank-mailman.862112.1274011 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tOn5d-0005Ap-50; Sat, 21 Dec 2024 00:11:29 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 862112.1274011; Sat, 21 Dec 2024 00:11:29 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tOn5d-0005Ah-1v; Sat, 21 Dec 2024 00:11:29 +0000
Received: by outflank-mailman (input) for mailman id 862112;
 Sat, 21 Dec 2024 00:11:28 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tOn5c-0005AZ-MT
 for xen-changelog@lists.xenproject.org; Sat, 21 Dec 2024 00:11:28 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tOn5c-00DOtU-15
 for xen-changelog@lists.xenproject.org;
 Sat, 21 Dec 2024 00:11:28 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tOn5c-007E2z-1o
 for xen-changelog@lists.xenproject.org;
 Sat, 21 Dec 2024 00:11:28 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=gLDTr4lOr6Fjq93AUlsGu3eFgOxaz0o41E4DOT/tt6Y=; b=3uUveU0ijllsZw1mbI2T8Ev654
	KYSdxCniJj421N3JULUoXPiN8V4NvmlUYS6Cy/00EtXRQb76O3t+E3dX7twhLbZySL0WT1ZE8Q9Wu
	1ozTrPqexxIGiPrIN1/G6Tb6MUkw3h1bEPTz2Q0RQk+hf8bMZWkwNjSUwGD9QuN0DXcE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/version: Fold build_id handling into xenver_varbuf_op()
Message-Id: <E1tOn5c-007E2z-1o@xenbits.xenproject.org>
Date: Sat, 21 Dec 2024 00:11:28 +0000

commit 8eed14bf9d6517726e6998fd8f55a5528ed7dab5
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Tue Jan 3 19:06:43 2023 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Dec 20 22:44:42 2024 +0000

    xen/version: Fold build_id handling into xenver_varbuf_op()
    
    struct xen_build_id and struct xen_varbuf are identical from an ABI point of
    view, so XENVER_build_id can reuse xenver_varbuf_op() rather than having it's
    own almost identical copy of the logic.
    
    No functional change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/common/kernel.c          | 49 +++++++++++++-------------------------------
 xen/include/public/version.h |  5 ++++-
 2 files changed, 18 insertions(+), 36 deletions(-)

diff --git a/xen/common/kernel.c b/xen/common/kernel.c
index eb7122b74f..9e17e22a19 100644
--- a/xen/common/kernel.c
+++ b/xen/common/kernel.c
@@ -509,9 +509,22 @@ static long xenver_varbuf_op(int cmd, XEN_GUEST_HANDLE_PARAM(void) arg)
     struct xen_varbuf user_str;
     const char *str = NULL;
     size_t sz;
+    int rc;
 
     switch ( cmd )
     {
+    case XENVER_build_id:
+    {
+        unsigned int local_sz;
+
+        rc = xen_build_id((const void **)&str, &local_sz);
+        if ( rc )
+            return rc;
+
+        sz = local_sz;
+        goto have_len;
+    }
+
     case XENVER_extraversion2:
         str = xen_extra_version();
         break;
@@ -535,6 +548,7 @@ static long xenver_varbuf_op(int cmd, XEN_GUEST_HANDLE_PARAM(void) arg)
 
     sz = strlen(str);
 
+ have_len:
     if ( sz > KB(64) ) /* Arbitrary limit.  Avoid long-running operations. */
         return -E2BIG;
 
@@ -738,41 +752,6 @@ long do_xen_version(int cmd, XEN_GUEST_HANDLE_PARAM(void) arg)
     }
 
     case XENVER_build_id:
-    {
-        xen_build_id_t build_id;
-        unsigned int sz;
-        int rc;
-        const void *p;
-
-        if ( deny )
-            return -EPERM;
-
-        /* Only return size. */
-        if ( !guest_handle_is_null(arg) )
-        {
-            if ( copy_from_guest(&build_id, arg, 1) )
-                return -EFAULT;
-
-            if ( build_id.len == 0 )
-                return -EINVAL;
-        }
-
-        rc = xen_build_id(&p, &sz);
-        if ( rc )
-            return rc;
-
-        if ( guest_handle_is_null(arg) )
-            return sz;
-
-        if ( sz > build_id.len )
-            return -ENOBUFS;
-
-        if ( copy_to_guest_offset(arg, offsetof(xen_build_id_t, buf), p, sz) )
-            return -EFAULT;
-
-        return sz;
-    }
-
     case XENVER_extraversion2:
     case XENVER_capabilities2:
     case XENVER_changeset2:
diff --git a/xen/include/public/version.h b/xen/include/public/version.h
index 0dd6bbcb43..1022604daa 100644
--- a/xen/include/public/version.h
+++ b/xen/include/public/version.h
@@ -124,8 +124,10 @@ typedef char xen_commandline_t[1024];
 /*
  * Return value is the number of bytes written, or XEN_Exx on error.
  * Calling with empty parameter returns the size of build_id.
+ *
+ * Note: structure only kept for backwards compatibility.  Xen operates in
+ * terms of xen_varbuf_t.
  */
-#define XENVER_build_id 10
 struct xen_build_id {
         uint32_t        len; /* IN: size of buf[]. */
         unsigned char   buf[XEN_FLEX_ARRAY_DIM];
@@ -164,6 +166,7 @@ typedef struct xen_varbuf xen_varbuf_t;
  * effect.  e.g. Xen has no control over the formatting used for the command
  * line.
  */
+#define XENVER_build_id      10
 #define XENVER_extraversion2 11
 #define XENVER_capabilities2 12
 #define XENVER_changeset2    13
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Sat Dec 21 00:11:39 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 21 Dec 2024 00:11:39 +0000
Received: from list by lists.xenproject.org with outflank-mailman.862113.1274014 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tOn5n-0005DK-5x; Sat, 21 Dec 2024 00:11:39 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 862113.1274014; Sat, 21 Dec 2024 00:11:39 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tOn5n-0005DC-3L; Sat, 21 Dec 2024 00:11:39 +0000
Received: by outflank-mailman (input) for mailman id 862113;
 Sat, 21 Dec 2024 00:11:38 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tOn5m-0005D6-PF
 for xen-changelog@lists.xenproject.org; Sat, 21 Dec 2024 00:11:38 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tOn5m-00DOtY-1S
 for xen-changelog@lists.xenproject.org;
 Sat, 21 Dec 2024 00:11:38 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tOn5m-007E47-2D
 for xen-changelog@lists.xenproject.org;
 Sat, 21 Dec 2024 00:11:38 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=bmna+XF9QY/G79Qnu8jmi02aWs9i05IWklwsXZ5e6ys=; b=H2XWsfm2UGav3vlVb/xrT38FcN
	W9Yerxy2Q5Uegu2IJFmq87BUVolVaUBSRb8tNtqYdu49Z24sCnuHJDlJaacxcquLHcnWua7cqTsOm
	jI+tcORBi21Q07/51s0xhuWVmA6VzIiBuBWF4vgQWSCy3uCT62SaD46cS6ZBNjz0nhZU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/version: Misc style fixes
Message-Id: <E1tOn5m-007E47-2D@xenbits.xenproject.org>
Date: Sat, 21 Dec 2024 00:11:38 +0000

commit 3d94cc88098dfb451da9a0fb03947bf0ad89e1a7
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Tue Dec 20 16:45:23 2022 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Dec 20 22:44:42 2024 +0000

    xen/version: Misc style fixes
    
    No functional change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Daniel P. Smith <dpsmith@apertussolutions.com>
---
 xen/common/kernel.c  | 9 ++++-----
 xen/common/version.c | 4 ++--
 2 files changed, 6 insertions(+), 7 deletions(-)

diff --git a/xen/common/kernel.c b/xen/common/kernel.c
index 9e17e22a19..8b63ca55f1 100644
--- a/xen/common/kernel.c
+++ b/xen/common/kernel.c
@@ -1,6 +1,6 @@
 /******************************************************************************
  * kernel.c
- * 
+ *
  * Copyright (c) 2002-2005 K A Fraser
  */
 
@@ -614,7 +614,7 @@ long do_xen_version(int cmd, XEN_GUEST_HANDLE_PARAM(void) arg)
             return -EFAULT;
         return 0;
     }
-    
+
     case XENVER_platform_parameters:
     {
         const struct vcpu *curr = current;
@@ -653,9 +653,8 @@ long do_xen_version(int cmd, XEN_GUEST_HANDLE_PARAM(void) arg)
         }
 
         return 0;
-        
     }
-    
+
     case XENVER_changeset:
     {
         xen_changeset_info_t chgset;
@@ -686,7 +685,7 @@ long do_xen_version(int cmd, XEN_GUEST_HANDLE_PARAM(void) arg)
             if ( VM_ASSIST(d, pae_extended_cr3) )
                 fi.submap |= (1U << XENFEAT_pae_pgdir_above_4gb);
             if ( paging_mode_translate(d) )
-                fi.submap |= 
+                fi.submap |=
                     (1U << XENFEAT_writable_page_tables) |
                     (1U << XENFEAT_auto_translated_physmap);
             if ( is_hardware_domain(d) )
diff --git a/xen/common/version.c b/xen/common/version.c
index b7d7d515a3..bc3714b45f 100644
--- a/xen/common/version.c
+++ b/xen/common/version.c
@@ -209,11 +209,11 @@ void __init xen_build_init(void)
             }
         }
     }
-#endif
+#endif /* CONFIG_X86 */
     if ( !rc )
         printk(XENLOG_INFO "build-id: %*phN\n", build_id_len, build_id_p);
 }
-#endif
+#endif /* BUILD_ID */
 /*
  * Local variables:
  * mode: C
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Sat Dec 21 00:11:50 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 21 Dec 2024 00:11:50 +0000
Received: from list by lists.xenproject.org with outflank-mailman.862114.1274020 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tOn5y-0005HB-9d; Sat, 21 Dec 2024 00:11:50 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 862114.1274020; Sat, 21 Dec 2024 00:11:50 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tOn5y-0005H3-62; Sat, 21 Dec 2024 00:11:50 +0000
Received: by outflank-mailman (input) for mailman id 862114;
 Sat, 21 Dec 2024 00:11:48 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tOn5w-0005Gs-Su
 for xen-changelog@lists.xenproject.org; Sat, 21 Dec 2024 00:11:48 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tOn5w-00DOtc-1p
 for xen-changelog@lists.xenproject.org;
 Sat, 21 Dec 2024 00:11:48 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tOn5w-007E6z-2a
 for xen-changelog@lists.xenproject.org;
 Sat, 21 Dec 2024 00:11:48 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=3f8p53ki0y2LrYETAmLXVb7LS34HuIDZBSLb7/I/cJs=; b=ZJkllB+cTSvVK1I1hDzasdvtIQ
	UbQV1OkTedc9womRFdXdiRbVE+fM65gT9IkSRi96eDIjD6bwO6BnZRVqj4yxAwnqGjAFf4KVO15hK
	MPClYX945nhkVdHuCPfcvm+xxliC042iHDZW5q2Mdn/2KpXGKa35HYKjfllAPNsTQnkI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] tools/libxc: Move xc_version() out of xc_private.c into its own file
Message-Id: <E1tOn5w-007E6z-2a@xenbits.xenproject.org>
Date: Sat, 21 Dec 2024 00:11:48 +0000

commit 583a0fb0fa0a503e8562808fc90eebd6a19d0a99
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Mon Jan 16 14:40:07 2023 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Dec 20 22:44:42 2024 +0000

    tools/libxc: Move xc_version() out of xc_private.c into its own file
    
    kexec-tools uses xc_version(), meaning that it is not a private API.  As we're
    going to extend the functionality substantially, move it to its own file.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Anthony PERARD <anthony.perard@citrix.com>
---
 tools/libs/ctrl/Makefile.common |  1 +
 tools/libs/ctrl/xc_private.c    | 66 --------------------------------
 tools/libs/ctrl/xc_private.h    |  7 ----
 tools/libs/ctrl/xc_version.c    | 83 +++++++++++++++++++++++++++++++++++++++++
 4 files changed, 84 insertions(+), 73 deletions(-)

diff --git a/tools/libs/ctrl/Makefile.common b/tools/libs/ctrl/Makefile.common
index 247afbe5f9..68137d42f2 100644
--- a/tools/libs/ctrl/Makefile.common
+++ b/tools/libs/ctrl/Makefile.common
@@ -16,6 +16,7 @@ OBJS-y       += xc_pm.o
 OBJS-y       += xc_cpu_hotplug.o
 OBJS-y       += xc_vm_event.o
 OBJS-y       += xc_vmtrace.o
+OBJS-y       += xc_version.o
 OBJS-y       += xc_monitor.o
 OBJS-y       += xc_mem_paging.o
 OBJS-y       += xc_mem_access.o
diff --git a/tools/libs/ctrl/xc_private.c b/tools/libs/ctrl/xc_private.c
index abd0b0d849..bb0f81d6f3 100644
--- a/tools/libs/ctrl/xc_private.c
+++ b/tools/libs/ctrl/xc_private.c
@@ -490,72 +490,6 @@ int xc_sysctl(xc_interface *xch, struct xen_sysctl *sysctl)
     return do_sysctl(xch, sysctl);
 }
 
-int xc_version(xc_interface *xch, int cmd, void *arg)
-{
-    DECLARE_HYPERCALL_BOUNCE(arg, 0, XC_HYPERCALL_BUFFER_BOUNCE_OUT); /* Size unknown until cmd decoded */
-    size_t sz;
-    int rc;
-
-    switch ( cmd )
-    {
-    case XENVER_version:
-        sz = 0;
-        break;
-    case XENVER_extraversion:
-        sz = sizeof(xen_extraversion_t);
-        break;
-    case XENVER_compile_info:
-        sz = sizeof(xen_compile_info_t);
-        break;
-    case XENVER_capabilities:
-        sz = sizeof(xen_capabilities_info_t);
-        break;
-    case XENVER_changeset:
-        sz = sizeof(xen_changeset_info_t);
-        break;
-    case XENVER_platform_parameters:
-        sz = sizeof(xen_platform_parameters_t);
-        break;
-    case XENVER_get_features:
-        sz = sizeof(xen_feature_info_t);
-        break;
-    case XENVER_pagesize:
-        sz = 0;
-        break;
-    case XENVER_guest_handle:
-        sz = sizeof(xen_domain_handle_t);
-        break;
-    case XENVER_commandline:
-        sz = sizeof(xen_commandline_t);
-        break;
-    case XENVER_build_id:
-        {
-            xen_build_id_t *build_id = (xen_build_id_t *)arg;
-            sz = sizeof(*build_id) + build_id->len;
-            HYPERCALL_BOUNCE_SET_DIR(arg, XC_HYPERCALL_BUFFER_BOUNCE_BOTH);
-            break;
-        }
-    default:
-        ERROR("xc_version: unknown command %d\n", cmd);
-        return -EINVAL;
-    }
-
-    HYPERCALL_BOUNCE_SET_SIZE(arg, sz);
-
-    if ( (sz != 0) && xc_hypercall_bounce_pre(xch, arg) )
-    {
-        PERROR("Could not bounce buffer for version hypercall");
-        return -ENOMEM;
-    }
-
-    rc = do_xen_version(xch, cmd, HYPERCALL_BUFFER(arg));
-
-    if ( sz != 0 )
-        xc_hypercall_bounce_post(xch, arg);
-
-    return rc;
-}
-
 unsigned long xc_make_page_below_4G(
     xc_interface *xch, uint32_t domid, unsigned long mfn)
 {
diff --git a/tools/libs/ctrl/xc_private.h b/tools/libs/ctrl/xc_private.h
index d8b7da2805..b5892ae8dc 100644
--- a/tools/libs/ctrl/xc_private.h
+++ b/tools/libs/ctrl/xc_private.h
@@ -210,13 +210,6 @@ void xc__hypercall_buffer_cache_release(xc_interface *xch);
  * Hypercall interfaces.
  */
 
-static inline int do_xen_version(xc_interface *xch, int cmd, xc_hypercall_buffer_t *dest)
-{
-    DECLARE_HYPERCALL_BUFFER_ARGUMENT(dest);
-    return xencall2(xch->xcall, __HYPERVISOR_xen_version,
-                    cmd, HYPERCALL_BUFFER_AS_ARG(dest));
-}
-
 static inline int do_physdev_op(xc_interface *xch, int cmd, void *op, size_t len)
 {
     int ret = -1;
diff --git a/tools/libs/ctrl/xc_version.c b/tools/libs/ctrl/xc_version.c
new file mode 100644
index 0000000000..60e107dcee
--- /dev/null
+++ b/tools/libs/ctrl/xc_version.c
@@ -0,0 +1,83 @@
+/* SPDX-License-Identifier: LGPL-2.1 */
+/*
+ * xc_version.c
+ *
+ * Wrappers aound XENVER_* hypercalls
+ */
+
+#include "xc_private.h"
+#include <assert.h>
+
+static int do_xen_version(xc_interface *xch, int cmd,
+                          xc_hypercall_buffer_t *dest)
+{
+    DECLARE_HYPERCALL_BUFFER_ARGUMENT(dest);
+    return xencall2(xch->xcall, __HYPERVISOR_xen_version,
+                    cmd, HYPERCALL_BUFFER_AS_ARG(dest));
+}
+
+int xc_version(xc_interface *xch, int cmd, void *arg)
+{
+    DECLARE_HYPERCALL_BOUNCE(arg, 0, XC_HYPERCALL_BUFFER_BOUNCE_OUT); /* Size unknown until cmd decoded */
+    size_t sz;
+    int rc;
+
+    switch ( cmd )
+    {
+    case XENVER_version:
+        sz = 0;
+        break;
+    case XENVER_extraversion:
+        sz = sizeof(xen_extraversion_t);
+        break;
+    case XENVER_compile_info:
+        sz = sizeof(xen_compile_info_t);
+        break;
+    case XENVER_capabilities:
+        sz = sizeof(xen_capabilities_info_t);
+        break;
+    case XENVER_changeset:
+        sz = sizeof(xen_changeset_info_t);
+        break;
+    case XENVER_platform_parameters:
+        sz = sizeof(xen_platform_parameters_t);
+        break;
+    case XENVER_get_features:
+        sz = sizeof(xen_feature_info_t);
+        break;
+    case XENVER_pagesize:
+        sz = 0;
+        break;
+    case XENVER_guest_handle:
+        sz = sizeof(xen_domain_handle_t);
+        break;
+    case XENVER_commandline:
+        sz = sizeof(xen_commandline_t);
+        break;
+    case XENVER_build_id:
+        {
+            xen_build_id_t *build_id = (xen_build_id_t *)arg;
+            sz = sizeof(*build_id) + build_id->len;
+            HYPERCALL_BOUNCE_SET_DIR(arg, XC_HYPERCALL_BUFFER_BOUNCE_BOTH);
+            break;
+        }
+    default:
+        ERROR("xc_version: unknown command %d\n", cmd);
+        return -EINVAL;
+    }
+
+    HYPERCALL_BOUNCE_SET_SIZE(arg, sz);
+
+    if ( (sz != 0) && xc_hypercall_bounce_pre(xch, arg) )
+    {
+        PERROR("Could not bounce buffer for version hypercall");
+        return -ENOMEM;
+    }
+
+    rc = do_xen_version(xch, cmd, HYPERCALL_BUFFER(arg));
+
+    if ( sz != 0 )
+        xc_hypercall_bounce_post(xch, arg);
+
+    return rc;
+}
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Sat Dec 21 00:12:00 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 21 Dec 2024 00:12:00 +0000
Received: from list by lists.xenproject.org with outflank-mailman.862115.1274023 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tOn68-0005Jj-Ag; Sat, 21 Dec 2024 00:12:00 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 862115.1274023; Sat, 21 Dec 2024 00:12:00 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tOn68-0005Jb-7b; Sat, 21 Dec 2024 00:12:00 +0000
Received: by outflank-mailman (input) for mailman id 862115;
 Sat, 21 Dec 2024 00:11:59 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tOn66-0005JT-Vd
 for xen-changelog@lists.xenproject.org; Sat, 21 Dec 2024 00:11:58 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tOn66-00DOtz-27
 for xen-changelog@lists.xenproject.org;
 Sat, 21 Dec 2024 00:11:58 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tOn66-007E88-2z
 for xen-changelog@lists.xenproject.org;
 Sat, 21 Dec 2024 00:11:58 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=GAqGJLayAHXnDeMVG/rnKzTnY/45yvk6MlVhu+N7nSU=; b=SMFacUJt6/t8yz54ARPGjdDO+/
	42QsvOc8UqNeQmr1cmaBB8y8o5ojIelj7C7ldoilizSDF0fBzwkkmnPHZ5M2QdvZPWsvY+hrEg2Cp
	rOMSNVGlC0i7z/Oh1kIm/TVrU0Ef985AA61aIlTVzh5yEk3NXudqzWusRFtMKnP3RjPc=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] tools: Introduce a non-truncating xc_xenver_extraversion()
Message-Id: <E1tOn66-007E88-2z@xenbits.xenproject.org>
Date: Sat, 21 Dec 2024 00:11:58 +0000

commit 504ea442e35a29b8de4660873b7ebafc12386531
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Mon Jan 16 16:56:17 2023 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Dec 20 22:44:42 2024 +0000

    tools: Introduce a non-truncating xc_xenver_extraversion()
    
    ... which uses XENVER_extraversion2.
    
    In order to do this sensibly, use manual hypercall buffer handling.  Not only
    does this avoid an extra bounce buffer (we need to strip the xen_varbuf_t
    header anyway), it's also shorter and easlier to follow.
    
    Update libxl and the ocaml stubs to match.  No API/ABI change in either.
    
    With this change made, `xl info` can now correctly access a >15 char
    extraversion:
    
      # xl info xen_version
      4.18-unstable+REALLY LONG EXTRAVERSION
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Anthony PERARD <anthony.perard@citrix.com>
    Acked-by: Christian Lindig <christian.lindig@citrix.com>
---
 tools/include/xenctrl.h             |  6 +++
 tools/libs/ctrl/xc_version.c        | 75 +++++++++++++++++++++++++++++++++++++
 tools/libs/light/libxl.c            |  4 +-
 tools/ocaml/libs/xc/xenctrl_stubs.c |  9 +++--
 4 files changed, 87 insertions(+), 7 deletions(-)

diff --git a/tools/include/xenctrl.h b/tools/include/xenctrl.h
index b08e438ea8..879b626614 100644
--- a/tools/include/xenctrl.h
+++ b/tools/include/xenctrl.h
@@ -1573,6 +1573,12 @@ long xc_memory_op(xc_interface *xch, unsigned int cmd, void *arg, size_t len);
 
 int xc_version(xc_interface *xch, int cmd, void *arg);
 
+/*
+ * Wrappers around XENVER_* subops.  Callers must pass the returned pointer to
+ * free().
+ */
+char *xc_xenver_extraversion(xc_interface *xch);
+
 int xc_flask_op(xc_interface *xch, xen_flask_op_t *op);
 
 /*
diff --git a/tools/libs/ctrl/xc_version.c b/tools/libs/ctrl/xc_version.c
index 60e107dcee..2c14474fee 100644
--- a/tools/libs/ctrl/xc_version.c
+++ b/tools/libs/ctrl/xc_version.c
@@ -81,3 +81,78 @@ int xc_version(xc_interface *xch, int cmd, void *arg)
 
     return rc;
 }
+
+/*
+ * Raw hypercall wrapper, letting us pass NULL and things which aren't of
+ * xc_hypercall_buffer_t *.
+ */
+static int do_xen_version_raw(xc_interface *xch, int cmd, void *hbuf)
+{
+    return xencall2(xch->xcall, __HYPERVISOR_xen_version,
+                    cmd, (unsigned long)hbuf);
+}
+
+/*
+ * Issues a xen_varbuf_t subop, using manual hypercall buffer handling to
+ * avoid unnecessary buffering.
+ *
+ * On failure, returns NULL.  errno probably useful.
+ * On success, returns a pointer which must be freed with xencall_free_buffer().
+ */
+static xen_varbuf_t *varbuf_op(xc_interface *xch, unsigned int subop)
+{
+    xen_varbuf_t *hbuf = NULL;
+    ssize_t sz;
+
+    sz = do_xen_version_raw(xch, subop, NULL);
+    if ( sz < 0 )
+        return NULL;
+
+    hbuf = xencall_alloc_buffer(xch->xcall, sizeof(*hbuf) + sz);
+    if ( !hbuf )
+        return NULL;
+
+    hbuf->len = sz;
+
+    sz = do_xen_version_raw(xch, subop, hbuf);
+    if ( sz < 0 )
+    {
+        xencall_free_buffer(xch->xcall, hbuf);
+        return NULL;
+    }
+
+    hbuf->len = sz;
+    return hbuf;
+}
+
+/*
+ * Wrap varbuf_op() to obtain a simple string.  Copy out of the hypercall
+ * buffer, stripping the xen_varbuf_t header and appending a NUL terminator.
+ *
+ * On failure, returns NULL, errno probably useful.
+ * On success, returns a pointer which must be free()'d.
+ */
+static char *varbuf_simple_string(xc_interface *xch, unsigned int subop)
+{
+    xen_varbuf_t *hbuf = varbuf_op(xch, subop);
+    char *res;
+
+    if ( !hbuf )
+        return NULL;
+
+    res = malloc(hbuf->len + 1);
+    if ( res )
+    {
+        memcpy(res, hbuf->buf, hbuf->len);
+        res[hbuf->len] = '\0';
+    }
+
+    xencall_free_buffer(xch->xcall, hbuf);
+
+    return res;
+}
+
+char *xc_xenver_extraversion(xc_interface *xch)
+{
+    return varbuf_simple_string(xch, XENVER_extraversion2);
+}
diff --git a/tools/libs/light/libxl.c b/tools/libs/light/libxl.c
index 175d6dde0b..f91f7271d5 100644
--- a/tools/libs/light/libxl.c
+++ b/tools/libs/light/libxl.c
@@ -582,7 +582,6 @@ const libxl_version_info* libxl_get_version_info(libxl_ctx *ctx)
 {
     GC_INIT(ctx);
     union {
-        xen_extraversion_t xen_extra;
         xen_compile_info_t xen_cc;
         xen_changeset_info_t xen_chgset;
         xen_capabilities_info_t xen_caps;
@@ -601,8 +600,7 @@ const libxl_version_info* libxl_get_version_info(libxl_ctx *ctx)
     info->xen_version_major = xen_version >> 16;
     info->xen_version_minor = xen_version & 0xFF;
 
-    xc_version(ctx->xch, XENVER_extraversion, &u.xen_extra);
-    info->xen_version_extra = libxl__strdup(NOGC, u.xen_extra);
+    info->xen_version_extra = xc_xenver_extraversion(ctx->xch);
 
     xc_version(ctx->xch, XENVER_compile_info, &u.xen_cc);
     info->compiler = libxl__strdup(NOGC, u.xen_cc.compiler);
diff --git a/tools/ocaml/libs/xc/xenctrl_stubs.c b/tools/ocaml/libs/xc/xenctrl_stubs.c
index c78191f95a..1dd12081e9 100644
--- a/tools/ocaml/libs/xc/xenctrl_stubs.c
+++ b/tools/ocaml/libs/xc/xenctrl_stubs.c
@@ -985,9 +985,8 @@ CAMLprim value stub_xc_version_version(value xch_val)
 	CAMLparam1(xch_val);
 	CAMLlocal1(result);
 	xc_interface *xch = xch_of_val(xch_val);
-	xen_extraversion_t extra;
+	char *extra;
 	long packed;
-	int retval;
 
 	caml_enter_blocking_section();
 	packed = xc_version(xch, XENVER_version, NULL);
@@ -997,10 +996,10 @@ CAMLprim value stub_xc_version_version(value xch_val)
 		failwith_xc(xch);
 
 	caml_enter_blocking_section();
-	retval = xc_version(xch, XENVER_extraversion, &extra);
+	extra = xc_xenver_extraversion(xch);
 	caml_leave_blocking_section();
 
-	if (retval)
+	if (!extra)
 		failwith_xc(xch);
 
 	result = caml_alloc_tuple(3);
@@ -1009,6 +1008,8 @@ CAMLprim value stub_xc_version_version(value xch_val)
 	Store_field(result, 1, Val_int(packed & 0xffff));
 	Store_field(result, 2, caml_copy_string(extra));
 
+	free(extra);
+
 	CAMLreturn(result);
 }
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Sat Dec 21 00:12:10 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 21 Dec 2024 00:12:10 +0000
Received: from list by lists.xenproject.org with outflank-mailman.862116.1274027 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tOn6I-0005MF-Bo; Sat, 21 Dec 2024 00:12:10 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 862116.1274027; Sat, 21 Dec 2024 00:12:10 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tOn6I-0005M7-9C; Sat, 21 Dec 2024 00:12:10 +0000
Received: by outflank-mailman (input) for mailman id 862116;
 Sat, 21 Dec 2024 00:12:09 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tOn6H-0005Lw-2F
 for xen-changelog@lists.xenproject.org; Sat, 21 Dec 2024 00:12:09 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tOn6G-00DOuE-2O
 for xen-changelog@lists.xenproject.org;
 Sat, 21 Dec 2024 00:12:09 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tOn6H-007E9h-02
 for xen-changelog@lists.xenproject.org;
 Sat, 21 Dec 2024 00:12:09 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=EnAlvAemTBGBPrzACaePFSSwRrIPQhus4gEkq/daZew=; b=AtHI8jfO2ylsiYJ+1uVAO7i3rj
	nZ7cEKs57jF5dIrD5s9YwbG2pKgvjYRDbEvmTs/HoCNGiWfX4uw0yJ9DF4rA3s5KWyVl/ICMXBFpa
	LI3o15rc7qe2k3mBBpHPAp8PO+1nIFCpuDTPgQLwNfk8/D2wkN3voJzqPXLvbUmBF8Po=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] tools: Introduce a non-truncating xc_xenver_capabilities()
Message-Id: <E1tOn6H-007E9h-02@xenbits.xenproject.org>
Date: Sat, 21 Dec 2024 00:12:09 +0000

commit 6625d581ec9bcd3816b5060cb60fd157256057ca
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Tue Jan 17 12:39:48 2023 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Dec 20 22:44:42 2024 +0000

    tools: Introduce a non-truncating xc_xenver_capabilities()
    
    Update libxl and the ocaml stubs to match.  No API/ABI change in either.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Anthony PERARD <anthony.perard@citrix.com>
    Acked-by: Christian Lindig <christian.lindig@citrix.com>
---
 tools/include/xenctrl.h             |  1 +
 tools/libs/ctrl/xc_version.c        |  5 +++++
 tools/libs/light/libxl.c            |  4 +---
 tools/ocaml/libs/xc/xenctrl_stubs.c | 18 ++++++++++++++++--
 4 files changed, 23 insertions(+), 5 deletions(-)

diff --git a/tools/include/xenctrl.h b/tools/include/xenctrl.h
index 879b626614..6ed2ac9db2 100644
--- a/tools/include/xenctrl.h
+++ b/tools/include/xenctrl.h
@@ -1578,6 +1578,7 @@ int xc_version(xc_interface *xch, int cmd, void *arg);
  * free().
  */
 char *xc_xenver_extraversion(xc_interface *xch);
+char *xc_xenver_capabilities(xc_interface *xch);
 
 int xc_flask_op(xc_interface *xch, xen_flask_op_t *op);
 
diff --git a/tools/libs/ctrl/xc_version.c b/tools/libs/ctrl/xc_version.c
index 2c14474fee..512302a393 100644
--- a/tools/libs/ctrl/xc_version.c
+++ b/tools/libs/ctrl/xc_version.c
@@ -156,3 +156,8 @@ char *xc_xenver_extraversion(xc_interface *xch)
 {
     return varbuf_simple_string(xch, XENVER_extraversion2);
 }
+
+char *xc_xenver_capabilities(xc_interface *xch)
+{
+    return varbuf_simple_string(xch, XENVER_capabilities2);
+}
diff --git a/tools/libs/light/libxl.c b/tools/libs/light/libxl.c
index f91f7271d5..ae6c5e04cd 100644
--- a/tools/libs/light/libxl.c
+++ b/tools/libs/light/libxl.c
@@ -584,7 +584,6 @@ const libxl_version_info* libxl_get_version_info(libxl_ctx *ctx)
     union {
         xen_compile_info_t xen_cc;
         xen_changeset_info_t xen_chgset;
-        xen_capabilities_info_t xen_caps;
         xen_platform_parameters_t p_parms;
         xen_commandline_t xen_commandline;
         xen_build_id_t build_id;
@@ -608,8 +607,7 @@ const libxl_version_info* libxl_get_version_info(libxl_ctx *ctx)
     info->compile_domain = libxl__strdup(NOGC, u.xen_cc.compile_domain);
     info->compile_date = libxl__strdup(NOGC, u.xen_cc.compile_date);
 
-    xc_version(ctx->xch, XENVER_capabilities, &u.xen_caps);
-    info->capabilities = libxl__strdup(NOGC, u.xen_caps);
+    info->capabilities = xc_xenver_capabilities(ctx->xch);
 
     xc_version(ctx->xch, XENVER_changeset, &u.xen_chgset);
     info->changeset = libxl__strdup(NOGC, u.xen_chgset);
diff --git a/tools/ocaml/libs/xc/xenctrl_stubs.c b/tools/ocaml/libs/xc/xenctrl_stubs.c
index 1dd12081e9..8d1d66e81d 100644
--- a/tools/ocaml/libs/xc/xenctrl_stubs.c
+++ b/tools/ocaml/libs/xc/xenctrl_stubs.c
@@ -1067,9 +1067,23 @@ CAMLprim value stub_xc_version_changeset(value xch_val)
 
 CAMLprim value stub_xc_version_capabilities(value xch_val)
 {
-	xen_capabilities_info_t ci;
+	CAMLparam1(xch_val);
+	CAMLlocal1(result);
+	xc_interface *xch = xch_of_val(xch_val);
+	char *capabilities;
+
+	caml_enter_blocking_section();
+	capabilities = xc_xenver_capabilities(xch);
+	caml_leave_blocking_section();
 
-	return xc_version_single_string(xch_val, XENVER_capabilities, &ci);
+	if (!capabilities)
+		failwith_xc(xch);
+
+	result = caml_copy_string(capabilities);
+
+	free(capabilities);
+
+	CAMLreturn(result);
 }
 
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Sat Dec 21 00:12:20 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 21 Dec 2024 00:12:20 +0000
Received: from list by lists.xenproject.org with outflank-mailman.862117.1274032 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tOn6S-0005Oj-Dn; Sat, 21 Dec 2024 00:12:20 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 862117.1274032; Sat, 21 Dec 2024 00:12:20 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tOn6S-0005OX-Ad; Sat, 21 Dec 2024 00:12:20 +0000
Received: by outflank-mailman (input) for mailman id 862117;
 Sat, 21 Dec 2024 00:12:19 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tOn6R-0005OP-64
 for xen-changelog@lists.xenproject.org; Sat, 21 Dec 2024 00:12:19 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tOn6Q-00DOuI-2j
 for xen-changelog@lists.xenproject.org;
 Sat, 21 Dec 2024 00:12:19 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tOn6R-007EAU-0K
 for xen-changelog@lists.xenproject.org;
 Sat, 21 Dec 2024 00:12:19 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=CTjVvUhXrg5nAWpatWTsPswaMdxJihh5YGErhNOrkr0=; b=2XzW8YlcpVdqTxc0aQrVzWhfVe
	la9biI6i39PzHIRda76HURlOwjrEcNbMi0ZHRoTFPK5e3n1YNalz35fg8FQ/NgSgI+pgwvPMBORLd
	IbKbN+2kqG8dWyOwn4meIyeNxLfNFPVwS8uUcQm0jxDb2BmYMHLScBNBq83H6PUeiQas=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] tools: Introduce a non-truncating xc_xenver_changeset()
Message-Id: <E1tOn6R-007EAU-0K@xenbits.xenproject.org>
Date: Sat, 21 Dec 2024 00:12:19 +0000

commit 1b421d52b23c7f048541e351d55167ef0fd9df0b
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Tue Jan 17 12:45:37 2023 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Dec 20 22:44:42 2024 +0000

    tools: Introduce a non-truncating xc_xenver_changeset()
    
    Update libxl and the ocaml stubs to match.  No API/ABI change in either.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Anthony PERARD <anthony.perard@citrix.com>
    Acked-by: Christian Lindig <christian.lindig@citrix.com>
---
 tools/include/xenctrl.h             |  1 +
 tools/libs/ctrl/xc_version.c        |  5 +++++
 tools/libs/light/libxl.c            |  5 +----
 tools/ocaml/libs/xc/xenctrl_stubs.c | 19 ++++++++-----------
 4 files changed, 15 insertions(+), 15 deletions(-)

diff --git a/tools/include/xenctrl.h b/tools/include/xenctrl.h
index 6ed2ac9db2..8ca493c5ff 100644
--- a/tools/include/xenctrl.h
+++ b/tools/include/xenctrl.h
@@ -1579,6 +1579,7 @@ int xc_version(xc_interface *xch, int cmd, void *arg);
  */
 char *xc_xenver_extraversion(xc_interface *xch);
 char *xc_xenver_capabilities(xc_interface *xch);
+char *xc_xenver_changeset(xc_interface *xch);
 
 int xc_flask_op(xc_interface *xch, xen_flask_op_t *op);
 
diff --git a/tools/libs/ctrl/xc_version.c b/tools/libs/ctrl/xc_version.c
index 512302a393..9f2cae03db 100644
--- a/tools/libs/ctrl/xc_version.c
+++ b/tools/libs/ctrl/xc_version.c
@@ -161,3 +161,8 @@ char *xc_xenver_capabilities(xc_interface *xch)
 {
     return varbuf_simple_string(xch, XENVER_capabilities2);
 }
+
+char *xc_xenver_changeset(xc_interface *xch)
+{
+    return varbuf_simple_string(xch, XENVER_changeset2);
+}
diff --git a/tools/libs/light/libxl.c b/tools/libs/light/libxl.c
index ae6c5e04cd..9a3532ce13 100644
--- a/tools/libs/light/libxl.c
+++ b/tools/libs/light/libxl.c
@@ -583,7 +583,6 @@ const libxl_version_info* libxl_get_version_info(libxl_ctx *ctx)
     GC_INIT(ctx);
     union {
         xen_compile_info_t xen_cc;
-        xen_changeset_info_t xen_chgset;
         xen_platform_parameters_t p_parms;
         xen_commandline_t xen_commandline;
         xen_build_id_t build_id;
@@ -608,9 +607,7 @@ const libxl_version_info* libxl_get_version_info(libxl_ctx *ctx)
     info->compile_date = libxl__strdup(NOGC, u.xen_cc.compile_date);
 
     info->capabilities = xc_xenver_capabilities(ctx->xch);
-
-    xc_version(ctx->xch, XENVER_changeset, &u.xen_chgset);
-    info->changeset = libxl__strdup(NOGC, u.xen_chgset);
+    info->changeset = xc_xenver_changeset(ctx->xch);
 
     xc_version(ctx->xch, XENVER_platform_parameters, &u.p_parms);
     info->virt_start = u.p_parms.virt_start;
diff --git a/tools/ocaml/libs/xc/xenctrl_stubs.c b/tools/ocaml/libs/xc/xenctrl_stubs.c
index 8d1d66e81d..863ab3c778 100644
--- a/tools/ocaml/libs/xc/xenctrl_stubs.c
+++ b/tools/ocaml/libs/xc/xenctrl_stubs.c
@@ -1040,28 +1040,25 @@ CAMLprim value stub_xc_version_compile_info(value xch_val)
 }
 
 
-static value xc_version_single_string(value xch_val, int code, void *info)
+CAMLprim value stub_xc_version_changeset(value xch_val)
 {
 	CAMLparam1(xch_val);
+	CAMLlocal1(result);
 	xc_interface *xch = xch_of_val(xch_val);
-	int retval;
+	char *changeset;
 
 	caml_enter_blocking_section();
-	retval = xc_version(xch, code, info);
+	changeset = xc_xenver_changeset(xch);
 	caml_leave_blocking_section();
 
-	if (retval)
+	if (!changeset)
 		failwith_xc(xch);
 
-	CAMLreturn(caml_copy_string((char *)info));
-}
+	result = caml_copy_string(changeset);
 
+	free(changeset);
 
-CAMLprim value stub_xc_version_changeset(value xch_val)
-{
-	xen_changeset_info_t ci;
-
-	return xc_version_single_string(xch_val, XENVER_changeset, &ci);
+	CAMLreturn(result);
 }
 
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Sat Dec 21 00:12:30 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 21 Dec 2024 00:12:30 +0000
Received: from list by lists.xenproject.org with outflank-mailman.862118.1274035 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tOn6c-0005RB-Ek; Sat, 21 Dec 2024 00:12:30 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 862118.1274035; Sat, 21 Dec 2024 00:12:30 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tOn6c-0005R1-C2; Sat, 21 Dec 2024 00:12:30 +0000
Received: by outflank-mailman (input) for mailman id 862118;
 Sat, 21 Dec 2024 00:12:29 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tOn6b-0005Qr-9L
 for xen-changelog@lists.xenproject.org; Sat, 21 Dec 2024 00:12:29 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tOn6a-00DOuO-36
 for xen-changelog@lists.xenproject.org;
 Sat, 21 Dec 2024 00:12:29 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tOn6b-007EB1-0e
 for xen-changelog@lists.xenproject.org;
 Sat, 21 Dec 2024 00:12:29 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=J82SzQbWrNLvXnSXEq9KAyF+e72fMJQAjwRhch/InVk=; b=64ZueYg67y1flR60/SQ60yzgcn
	nr0yq/UFdtfumOKLTmXgUAZd5AsRC9QQaF6ajZJsI/QSYJ6IGHmojYM6GZfFSW9Ec2I9Z0wFYJb2w
	juXuB0qwPwN0z34hpTnuve70vW+rQIvWrc2P0Bj9rXBvR56C1SguVPQ5l2Ke47pBjWuI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] tools: Introduce a non-truncating xc_xenver_cmdline()
Message-Id: <E1tOn6b-007EB1-0e@xenbits.xenproject.org>
Date: Sat, 21 Dec 2024 00:12:29 +0000

commit 75f91607621c98b0ea73b2749cb9a563f6db1618
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Tue Jan 17 12:47:44 2023 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Dec 20 22:44:42 2024 +0000

    tools: Introduce a non-truncating xc_xenver_cmdline()
    
    Update libxl to match.  No API/ABI change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Anthony PERARD <anthony.perard@citrix.com>
---
 tools/include/xenctrl.h      | 1 +
 tools/libs/ctrl/xc_version.c | 5 +++++
 tools/libs/light/libxl.c     | 4 +---
 3 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/tools/include/xenctrl.h b/tools/include/xenctrl.h
index 8ca493c5ff..3aeff3f0e9 100644
--- a/tools/include/xenctrl.h
+++ b/tools/include/xenctrl.h
@@ -1580,6 +1580,7 @@ int xc_version(xc_interface *xch, int cmd, void *arg);
 char *xc_xenver_extraversion(xc_interface *xch);
 char *xc_xenver_capabilities(xc_interface *xch);
 char *xc_xenver_changeset(xc_interface *xch);
+char *xc_xenver_commandline(xc_interface *xch);
 
 int xc_flask_op(xc_interface *xch, xen_flask_op_t *op);
 
diff --git a/tools/libs/ctrl/xc_version.c b/tools/libs/ctrl/xc_version.c
index 9f2cae03db..02f6e9551b 100644
--- a/tools/libs/ctrl/xc_version.c
+++ b/tools/libs/ctrl/xc_version.c
@@ -166,3 +166,8 @@ char *xc_xenver_changeset(xc_interface *xch)
 {
     return varbuf_simple_string(xch, XENVER_changeset2);
 }
+
+char *xc_xenver_commandline(xc_interface *xch)
+{
+    return varbuf_simple_string(xch, XENVER_commandline2);
+}
diff --git a/tools/libs/light/libxl.c b/tools/libs/light/libxl.c
index 9a3532ce13..04f037f3c1 100644
--- a/tools/libs/light/libxl.c
+++ b/tools/libs/light/libxl.c
@@ -584,7 +584,6 @@ const libxl_version_info* libxl_get_version_info(libxl_ctx *ctx)
     union {
         xen_compile_info_t xen_cc;
         xen_platform_parameters_t p_parms;
-        xen_commandline_t xen_commandline;
         xen_build_id_t build_id;
     } u;
     long xen_version;
@@ -614,8 +613,7 @@ const libxl_version_info* libxl_get_version_info(libxl_ctx *ctx)
 
     info->pagesize = xc_version(ctx->xch, XENVER_pagesize, NULL);
 
-    xc_version(ctx->xch, XENVER_commandline, &u.xen_commandline);
-    info->commandline = libxl__strdup(NOGC, u.xen_commandline);
+    info->commandline = xc_xenver_commandline(ctx->xch);
 
     u.build_id.len = sizeof(u) - sizeof(u.build_id);
     r = libxl__xc_version_wrap(gc, info, &u.build_id);
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Sat Dec 21 00:12:40 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 21 Dec 2024 00:12:40 +0000
Received: from list by lists.xenproject.org with outflank-mailman.862120.1274039 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tOn6m-0005UE-Hx; Sat, 21 Dec 2024 00:12:40 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 862120.1274039; Sat, 21 Dec 2024 00:12:40 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tOn6m-0005U6-FI; Sat, 21 Dec 2024 00:12:40 +0000
Received: by outflank-mailman (input) for mailman id 862120;
 Sat, 21 Dec 2024 00:12:39 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tOn6l-0005Ty-CF
 for xen-changelog@lists.xenproject.org; Sat, 21 Dec 2024 00:12:39 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tOn6l-00DOuS-0B
 for xen-changelog@lists.xenproject.org;
 Sat, 21 Dec 2024 00:12:39 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tOn6l-007EBa-11
 for xen-changelog@lists.xenproject.org;
 Sat, 21 Dec 2024 00:12:39 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=1Hc1WaIFswl7hFQSIflRSIAcmhGb5ugNC7DRbEEKPIA=; b=Sq0lBqWiZnAAApuSCQLPpn7Y2i
	IWok+H4gUucCM0cu6ZOAUQPsNOOpKoV4KuSh2m+9IF0U/Rvcds9BziW6lXyEqI3DfSphncJfQU/Al
	BUYyTCcwGQbodO/YrTHHqGW+E85tEUTcbKLAXgy1Tuji/6q0NPDFXNSWtzl5H9mYc7+8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] tools: Introduce a xc_xenver_buildid() wrapper
Message-Id: <E1tOn6l-007EBa-11@xenbits.xenproject.org>
Date: Sat, 21 Dec 2024 00:12:39 +0000

commit 869aeb7f0253cdcf55b85b5a2196e6332c2d4d7a
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Tue Jan 17 12:52:01 2023 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Dec 20 22:44:42 2024 +0000

    tools: Introduce a xc_xenver_buildid() wrapper
    
    ... which converts binary content to hex automatically.
    
    Update libxl to match.  No API/ABI change.
    
    This removes a latent libxl bug for cases when the buildid is longer than 4092
    bytes.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Anthony PERARD <anthony.perard@citrix.com>
---
 tools/include/xenctrl.h      |  1 +
 tools/libs/ctrl/xc_version.c | 33 +++++++++++++++++++++++++++++++++
 tools/libs/light/libxl.c     | 44 +-------------------------------------------
 3 files changed, 35 insertions(+), 43 deletions(-)

diff --git a/tools/include/xenctrl.h b/tools/include/xenctrl.h
index 3aeff3f0e9..5bb41c9c53 100644
--- a/tools/include/xenctrl.h
+++ b/tools/include/xenctrl.h
@@ -1581,6 +1581,7 @@ char *xc_xenver_extraversion(xc_interface *xch);
 char *xc_xenver_capabilities(xc_interface *xch);
 char *xc_xenver_changeset(xc_interface *xch);
 char *xc_xenver_commandline(xc_interface *xch);
+char *xc_xenver_buildid(xc_interface *xch);
 
 int xc_flask_op(xc_interface *xch, xen_flask_op_t *op);
 
diff --git a/tools/libs/ctrl/xc_version.c b/tools/libs/ctrl/xc_version.c
index 02f6e9551b..54d1b92966 100644
--- a/tools/libs/ctrl/xc_version.c
+++ b/tools/libs/ctrl/xc_version.c
@@ -171,3 +171,36 @@ char *xc_xenver_commandline(xc_interface *xch)
 {
     return varbuf_simple_string(xch, XENVER_commandline2);
 }
+
+static void str2hex(char *dst, const unsigned char *src, size_t n)
+{
+    static const unsigned char hex[] = "0123456789abcdef";
+
+    for ( ; n; n-- )
+    {
+        unsigned char c = *src++;
+
+        *dst++ = hex[c >> 4];
+        *dst++ = hex[c & 0xf];
+    }
+}
+
+char *xc_xenver_buildid(xc_interface *xch)
+{
+    xen_varbuf_t *hbuf = varbuf_op(xch, XENVER_build_id);
+    char *res;
+
+    if ( !hbuf )
+        return NULL;
+
+    res = malloc((hbuf->len * 2) + 1);
+    if ( res )
+    {
+        str2hex(res, hbuf->buf, hbuf->len);
+        res[hbuf->len * 2] = '\0';
+    }
+
+    xencall_free_buffer(xch->xcall, hbuf);
+
+    return res;
+}
diff --git a/tools/libs/light/libxl.c b/tools/libs/light/libxl.c
index 04f037f3c1..a1fe16274d 100644
--- a/tools/libs/light/libxl.c
+++ b/tools/libs/light/libxl.c
@@ -546,38 +546,6 @@ libxl_numainfo *libxl_get_numainfo(libxl_ctx *ctx, int *nr)
     return ret;
 }
 
-static int libxl__xc_version_wrap(libxl__gc *gc, libxl_version_info *info,
-                                  xen_build_id_t *build)
-{
-    int r;
-
-    r = xc_version(CTX->xch, XENVER_build_id, build);
-    switch (r) {
-    case -EPERM:
-    case -ENODATA:
-    case 0:
-        info->build_id = libxl__strdup(NOGC, "");
-        break;
-
-    case -ENOBUFS:
-        break;
-
-    default:
-        if (r > 0) {
-            unsigned int i;
-
-            info->build_id = libxl__zalloc(NOGC, (r * 2) + 1);
-
-            for (i = 0; i < r ; i++)
-                snprintf(&info->build_id[i * 2], 3, "%02hhx", build->buf[i]);
-
-            r = 0;
-        }
-        break;
-    }
-    return r;
-}
-
 const libxl_version_info* libxl_get_version_info(libxl_ctx *ctx)
 {
     GC_INIT(ctx);
@@ -587,7 +555,6 @@ const libxl_version_info* libxl_get_version_info(libxl_ctx *ctx)
         xen_build_id_t build_id;
     } u;
     long xen_version;
-    int r;
     libxl_version_info *info = &ctx->version_info;
 
     if (info->xen_version_extra != NULL)
@@ -614,17 +581,8 @@ const libxl_version_info* libxl_get_version_info(libxl_ctx *ctx)
     info->pagesize = xc_version(ctx->xch, XENVER_pagesize, NULL);
 
     info->commandline = xc_xenver_commandline(ctx->xch);
+    info->build_id = xc_xenver_buildid(ctx->xch);
 
-    u.build_id.len = sizeof(u) - sizeof(u.build_id);
-    r = libxl__xc_version_wrap(gc, info, &u.build_id);
-    if (r == -ENOBUFS) {
-            xen_build_id_t *build_id;
-
-            build_id = libxl__zalloc(gc, info->pagesize);
-            build_id->len = info->pagesize - sizeof(*build_id);
-            r = libxl__xc_version_wrap(gc, info, build_id);
-            if (r) LOGEV(ERROR, r, "getting build_id");
-    }
  out:
     GC_FREE;
     return info;
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Sat Dec 21 00:55:10 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 21 Dec 2024 00:55:10 +0000
Received: from list by lists.xenproject.org with outflank-mailman.862134.1274042 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tOnln-0001XI-Ey; Sat, 21 Dec 2024 00:55:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 862134.1274042; Sat, 21 Dec 2024 00: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 1tOnln-0001XA-CM; Sat, 21 Dec 2024 00:55:03 +0000
Received: by outflank-mailman (input) for mailman id 862134;
 Sat, 21 Dec 2024 00:55:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tOnlm-0001X4-5F
 for xen-changelog@lists.xenproject.org; Sat, 21 Dec 2024 00:55:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tOnll-00DPiT-26
 for xen-changelog@lists.xenproject.org;
 Sat, 21 Dec 2024 00:55:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tOnll-007IJx-2r
 for xen-changelog@lists.xenproject.org;
 Sat, 21 Dec 2024 00:55:01 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=QQWAM8Qyd/kPGe9bTiNT4rvGJb1M8ddqEcWq4DiJgj8=; b=TlL8xOrrDXiXLGm/OxnAyVKpK/
	wmq8jUz7cO5yERZlRknbMrmFlWkrd9jUXYlOvSCS7HmuoDLMe6ZlEyLwbxIcYjdisOgHyGStOWaPc
	ZzXcAI3WBVxVs1Ea4MnM0esWI5I9gdve20cnJHKVHly5cLSZMQzVrfldztk8Pj4JdoRg=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/version: Calculate xen_capabilities_info once at boot
Message-Id: <E1tOnll-007IJx-2r@xenbits.xenproject.org>
Date: Sat, 21 Dec 2024 00:55:01 +0000

commit 7cf44c61c531274185966a89684ab822c8d6f555
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Fri Jan 13 17:20:41 2023 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Dec 20 22:44:42 2024 +0000

    xen/version: Calculate xen_capabilities_info once at boot
    
    The arch_get_xen_caps() infrastructure is horribly inefficient for something
    that is constant after features have been resolved on boot.
    
    Every instance used snprintf() to format constants into a string (which gets
    shorter when %d gets resolved!), and which get double buffered on the stack.
    
    Switch to using string literals with the "3.0" inserted - these numbers
    haven't changed in 19 years; the Xen 3.0 release was Dec 5th 2005.
    
    Use initcalls to format the data into xen_cap_info, which is deliberately not
    of type xen_capabilities_info_t because a 1k array is a silly overhead for
    storing a maximum of 77 chars (the x86 version) and isn't liable to need any
    more space in the forseeable future.  RISC-V and PPC have their stub dropped,
    with the expectation that they won't carry this legacy interface forward.
    
    This speeds up the the XENVER_capabilities hypercall, but the purpose of the
    change is to allow us to introduce a better XENVER_* API that doesn't force
    the use of a 1k buffer on the stack.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/arm/setup.c        | 18 +++++++-----------
 xen/arch/ppc/setup.c        |  5 -----
 xen/arch/riscv/setup.c      |  5 -----
 xen/arch/x86/setup.c        | 29 ++++++++++-------------------
 xen/common/kernel.c         |  3 ++-
 xen/include/xen/hypercall.h |  2 --
 xen/include/xen/version.h   |  2 ++
 7 files changed, 21 insertions(+), 43 deletions(-)

diff --git a/xen/arch/arm/setup.c b/xen/arch/arm/setup.c
index 68c1f30920..c1f2d1b89d 100644
--- a/xen/arch/arm/setup.c
+++ b/xen/arch/arm/setup.c
@@ -28,6 +28,7 @@
 #include <xen/cpu.h>
 #include <xen/pfn.h>
 #include <xen/virtual_region.h>
+#include <xen/version.h>
 #include <xen/vmap.h>
 #include <xen/trace.h>
 #include <xen/libfdt/libfdt-xen.h>
@@ -513,24 +514,19 @@ void asmlinkage __init start_xen(unsigned long fdt_paddr)
     switch_stack_and_jump(idle_vcpu[0]->arch.cpu_info, init_done);
 }
 
-void arch_get_xen_caps(xen_capabilities_info_t *info)
+static int __init init_xen_cap_info(void)
 {
     /* Interface name is always xen-3.0-* for Xen-3.x. */
-    int major = 3, minor = 0;
-    char s[32];
-
-    (*info)[0] = '\0';
 
 #ifdef CONFIG_ARM_64
-    snprintf(s, sizeof(s), "xen-%d.%d-aarch64 ", major, minor);
-    safe_strcat(*info, s);
+    safe_strcat(xen_cap_info, "xen-3.0-aarch64 ");
 #endif
     if ( cpu_has_aarch32 )
-    {
-        snprintf(s, sizeof(s), "xen-%d.%d-armv7l ", major, minor);
-        safe_strcat(*info, s);
-    }
+        safe_strcat(xen_cap_info, "xen-3.0-armv7l ");
+
+    return 0;
 }
+__initcall(init_xen_cap_info);
 
 /*
  * Local variables:
diff --git a/xen/arch/ppc/setup.c b/xen/arch/ppc/setup.c
index 5fb5ab64e3..9c1e4791af 100644
--- a/xen/arch/ppc/setup.c
+++ b/xen/arch/ppc/setup.c
@@ -47,8 +47,3 @@ void __init noreturn start_xen(unsigned long r3, unsigned long r4,
 
     machine_halt();
 }
-
-void arch_get_xen_caps(xen_capabilities_info_t *info)
-{
-    BUG_ON("unimplemented");
-}
diff --git a/xen/arch/riscv/setup.c b/xen/arch/riscv/setup.c
index fb6bbba684..38ca4f3baa 100644
--- a/xen/arch/riscv/setup.c
+++ b/xen/arch/riscv/setup.c
@@ -20,11 +20,6 @@
 #include <asm/smp.h>
 #include <asm/traps.h>
 
-void arch_get_xen_caps(xen_capabilities_info_t *info)
-{
-    BUG_ON("unimplemented");
-}
-
 /* Xen stack for bringing up the first CPU. */
 unsigned char __initdata cpu0_boot_stack[STACK_SIZE]
     __aligned(STACK_SIZE);
diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c
index 397347bea4..8ebe5a9443 100644
--- a/xen/arch/x86/setup.c
+++ b/xen/arch/x86/setup.c
@@ -2165,35 +2165,26 @@ void asmlinkage __init noreturn __start_xen(void)
     unreachable();
 }
 
-void arch_get_xen_caps(xen_capabilities_info_t *info)
+static int __init cf_check init_xen_cap_info(void)
 {
     /* Interface name is always xen-3.0-* for Xen-3.x. */
-    int major = 3, minor = 0;
-    char s[32];
-
-    (*info)[0] = '\0';
 
     if ( IS_ENABLED(CONFIG_PV) )
     {
-        snprintf(s, sizeof(s), "xen-%d.%d-x86_64 ", major, minor);
-        safe_strcat(*info, s);
+        safe_strcat(xen_cap_info, "xen-3.0-x86_64 ");
 
         if ( opt_pv32 )
-        {
-            snprintf(s, sizeof(s), "xen-%d.%d-x86_32p ", major, minor);
-            safe_strcat(*info, s);
-        }
+            safe_strcat(xen_cap_info, "xen-3.0-x86_32p ");
     }
     if ( hvm_enabled )
-    {
-        snprintf(s, sizeof(s), "hvm-%d.%d-x86_32 ", major, minor);
-        safe_strcat(*info, s);
-        snprintf(s, sizeof(s), "hvm-%d.%d-x86_32p ", major, minor);
-        safe_strcat(*info, s);
-        snprintf(s, sizeof(s), "hvm-%d.%d-x86_64 ", major, minor);
-        safe_strcat(*info, s);
-    }
+        safe_strcat(xen_cap_info,
+                    "hvm-3.0-x86_32 "
+                    "hvm-3.0-x86_32p "
+                    "hvm-3.0-x86_64 ");
+
+    return 0;
 }
+__initcall(init_xen_cap_info);
 
 int __hwdom_init remove_xen_ranges(struct rangeset *r)
 {
diff --git a/xen/common/kernel.c b/xen/common/kernel.c
index b44b2439ca..d30ab56f57 100644
--- a/xen/common/kernel.c
+++ b/xen/common/kernel.c
@@ -35,6 +35,7 @@ boolean_param("dit", opt_dit);
 
 static xen_commandline_t saved_cmdline;
 static const char __initconst opt_builtin_cmdline[] = CONFIG_CMDLINE;
+char __ro_after_init xen_cap_info[128];
 
 static int assign_integer_param(const struct kernel_param *param, uint64_t val)
 {
@@ -542,7 +543,7 @@ long do_xen_version(int cmd, XEN_GUEST_HANDLE_PARAM(void) arg)
 
         memset(info, 0, sizeof(info));
         if ( !deny )
-            arch_get_xen_caps(&info);
+            safe_strcpy(info, xen_cap_info);
 
         if ( copy_to_guest(arg, info, ARRAY_SIZE(info)) )
             return -EFAULT;
diff --git a/xen/include/xen/hypercall.h b/xen/include/xen/hypercall.h
index f307dfb597..15b6be6ec8 100644
--- a/xen/include/xen/hypercall.h
+++ b/xen/include/xen/hypercall.h
@@ -56,6 +56,4 @@ common_vcpu_op(int cmd,
     struct vcpu *v,
     XEN_GUEST_HANDLE_PARAM(void) arg);
 
-void arch_get_xen_caps(xen_capabilities_info_t *info);
-
 #endif /* __XEN_HYPERCALL_H__ */
diff --git a/xen/include/xen/version.h b/xen/include/xen/version.h
index 93c5877363..4856ad1b44 100644
--- a/xen/include/xen/version.h
+++ b/xen/include/xen/version.h
@@ -19,6 +19,8 @@ const char *xen_deny(void);
 const char *xen_build_info(void);
 int xen_build_id(const void **p, unsigned int *len);
 
+extern char xen_cap_info[128];
+
 #ifdef BUILD_ID
 void xen_build_init(void);
 int xen_build_id_check(const Elf_Note *n, unsigned int n_sz,
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Dec 21 00:55:13 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 21 Dec 2024 00:55:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.862135.1274047 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tOnlx-0001Z2-GO; Sat, 21 Dec 2024 00:55:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 862135.1274047; Sat, 21 Dec 2024 00: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 1tOnlx-0001Yv-Dk; Sat, 21 Dec 2024 00:55:13 +0000
Received: by outflank-mailman (input) for mailman id 862135;
 Sat, 21 Dec 2024 00:55:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tOnlw-0001Yn-3X
 for xen-changelog@lists.xenproject.org; Sat, 21 Dec 2024 00:55:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tOnlv-00DPiZ-2W
 for xen-changelog@lists.xenproject.org;
 Sat, 21 Dec 2024 00:55:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tOnlw-007IKq-02
 for xen-changelog@lists.xenproject.org;
 Sat, 21 Dec 2024 00:55:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=we0ASuSxrgyoQeOfs9KZF5NiFLszXMBdLBBAiFhmy7k=; b=4n2U4C9OKYu68zoTKXYWcgdGhd
	5WBNQLDj3N2pTnWCM2BHXteS9NWvA8AnyAq9ytERD71+IOGPpZrf/S7Bd5vZ1J9YgcS1i8VhrGirs
	FwiJB2lD7QBgc3h0lIus/mJLopIe1eDv5NGaPHcXKUDLwp/S7EPfdY1oXR2a8cbylM6E=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/version: Introduce non-truncating deterministically-signed XENVER_* subops
Message-Id: <E1tOnlw-007IKq-02@xenbits.xenproject.org>
Date: Sat, 21 Dec 2024 00:55:12 +0000

commit e3bb1b6525edbf3a377f478e822b8be4dec7f5f1
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Tue Dec 20 13:12:52 2022 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Dec 20 22:44:42 2024 +0000

    xen/version: Introduce non-truncating deterministically-signed XENVER_* subops
    
    In XenServer, we have encountered problems caused by both XENVER_extraversion
    and XENVER_commandline having fixed bounds.
    
    More than just the invariant size, the APIs/ABIs also broken by typedef-ing an
    array, and using an unqualified 'char' which has implementation-specific
    signed-ness.
    
    Provide brand new ops, which are capable of expressing variable length
    strings, and mark the older ops as broken.
    
    This fixes all issues around XENVER_extraversion being longer than 15 chars.
    Further work beyond just this API is needed to remove other assumptions about
    XENVER_commandline being 1023 chars long.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jason Andryuk <jandryuk@gmail.com>
    ---
    Non-technical objections to this patch were raised, and subsequently rejected
    by a community wide vote.  The results of the vote have not been shared with
    the community at the time of committing.
---
 xen/common/kernel.c          | 59 +++++++++++++++++++++++++++++++++++++++++
 xen/include/public/version.h | 63 ++++++++++++++++++++++++++++++++++++++++++--
 xen/include/xlat.lst         |  1 +
 xen/include/xsm/dummy.h      |  3 +++
 xen/xsm/flask/hooks.c        |  4 +++
 5 files changed, 128 insertions(+), 2 deletions(-)

diff --git a/xen/common/kernel.c b/xen/common/kernel.c
index d30ab56f57..eb7122b74f 100644
--- a/xen/common/kernel.c
+++ b/xen/common/kernel.c
@@ -24,6 +24,7 @@
 CHECK_build_id;
 CHECK_compile_info;
 CHECK_feature_info;
+CHECK_varbuf;
 #endif
 
 enum system_state system_state = SYS_STATE_early_boot;
@@ -503,6 +504,56 @@ static int __init cf_check param_init(void)
 __initcall(param_init);
 #endif
 
+static long xenver_varbuf_op(int cmd, XEN_GUEST_HANDLE_PARAM(void) arg)
+{
+    struct xen_varbuf user_str;
+    const char *str = NULL;
+    size_t sz;
+
+    switch ( cmd )
+    {
+    case XENVER_extraversion2:
+        str = xen_extra_version();
+        break;
+
+    case XENVER_changeset2:
+        str = xen_changeset();
+        break;
+
+    case XENVER_commandline2:
+        str = saved_cmdline;
+        break;
+
+    case XENVER_capabilities2:
+        str = xen_cap_info;
+        break;
+
+    default:
+        ASSERT_UNREACHABLE();
+        return -ENODATA;
+    }
+
+    sz = strlen(str);
+
+    if ( sz > KB(64) ) /* Arbitrary limit.  Avoid long-running operations. */
+        return -E2BIG;
+
+    if ( guest_handle_is_null(arg) ) /* Length request */
+        return sz;
+
+    if ( copy_from_guest(&user_str, arg, 1) )
+        return -EFAULT;
+
+    if ( sz > user_str.len )
+        return -ENOBUFS;
+
+    if ( copy_to_guest_offset(arg, offsetof(struct xen_varbuf, buf),
+                              str, sz) )
+        return -EFAULT;
+
+    return sz;
+}
+
 long do_xen_version(int cmd, XEN_GUEST_HANDLE_PARAM(void) arg)
 {
     bool deny = xsm_xen_version(XSM_OTHER, cmd);
@@ -721,6 +772,14 @@ long do_xen_version(int cmd, XEN_GUEST_HANDLE_PARAM(void) arg)
 
         return sz;
     }
+
+    case XENVER_extraversion2:
+    case XENVER_capabilities2:
+    case XENVER_changeset2:
+    case XENVER_commandline2:
+        if ( deny )
+            return -EPERM;
+        return xenver_varbuf_op(cmd, arg);
     }
 
     return -ENOSYS;
diff --git a/xen/include/public/version.h b/xen/include/public/version.h
index cbc4ef7a46..0dd6bbcb43 100644
--- a/xen/include/public/version.h
+++ b/xen/include/public/version.h
@@ -19,12 +19,20 @@
 /* arg == NULL; returns major:minor (16:16). */
 #define XENVER_version      0
 
-/* arg == xen_extraversion_t. */
+/*
+ * arg == xen_extraversion_t.
+ *
+ * This API/ABI is broken.  Use XENVER_extraversion2 where possible.
+ */
 #define XENVER_extraversion 1
 typedef char xen_extraversion_t[16];
 #define XEN_EXTRAVERSION_LEN (sizeof(xen_extraversion_t))
 
-/* arg == xen_compile_info_t. */
+/*
+ * arg == xen_compile_info_t.
+ *
+ * This API/ABI is broken and truncates data.
+ */
 #define XENVER_compile_info 2
 struct xen_compile_info {
     char compiler[64];
@@ -34,10 +42,20 @@ struct xen_compile_info {
 };
 typedef struct xen_compile_info xen_compile_info_t;
 
+/*
+ * arg == xen_capabilities_info_t.
+ *
+ * This API/ABI is broken.  Use XENVER_capabilities2 where possible.
+ */
 #define XENVER_capabilities 3
 typedef char xen_capabilities_info_t[1024];
 #define XEN_CAPABILITIES_INFO_LEN (sizeof(xen_capabilities_info_t))
 
+/*
+ * arg == xen_changeset_info_t.
+ *
+ * This API/ABI is broken.  Use XENVER_changeset2 where possible.
+ */
 #define XENVER_changeset 4
 typedef char xen_changeset_info_t[64];
 #define XEN_CHANGESET_INFO_LEN (sizeof(xen_changeset_info_t))
@@ -95,6 +113,11 @@ typedef struct xen_feature_info xen_feature_info_t;
  */
 #define XENVER_guest_handle 8
 
+/*
+ * arg == xen_commandline_t.
+ *
+ * This API/ABI is broken.  Use XENVER_commandline2 where possible.
+ */
 #define XENVER_commandline 9
 typedef char xen_commandline_t[1024];
 
@@ -110,6 +133,42 @@ struct xen_build_id {
 };
 typedef struct xen_build_id xen_build_id_t;
 
+/*
+ * Container for an arbitrary variable length buffer.
+ */
+struct xen_varbuf {
+    uint32_t len;                          /* IN:  size of buf[] in bytes. */
+    unsigned char buf[XEN_FLEX_ARRAY_DIM]; /* OUT: requested data.         */
+};
+typedef struct xen_varbuf xen_varbuf_t;
+
+/*
+ * arg == xen_varbuf_t
+ *
+ * Equivalent to the original ops, but with a non-truncating API/ABI.
+ *
+ * These hypercalls can fail for a number of reasons.  All callers must handle
+ * -XEN_xxx return values appropriately.
+ *
+ * Passing arg == NULL is a request for size, which will be signalled with a
+ * non-negative return value.  Note: a return size of 0 may be legitimate for
+ * the requested subop.
+ *
+ * Otherwise, the input xen_varbuf_t provides the size of the following
+ * buffer.  Xen will fill the buffer, and return the number of bytes written
+ * (e.g. if the input buffer was longer than necessary).
+ *
+ * Some subops may return binary data.  Some subops may be expected to return
+ * textural data.  These are returned without a NUL terminator, and while the
+ * contents is expected to be ASCII/UTF-8, Xen makes no guarentees to this
+ * effect.  e.g. Xen has no control over the formatting used for the command
+ * line.
+ */
+#define XENVER_extraversion2 11
+#define XENVER_capabilities2 12
+#define XENVER_changeset2    13
+#define XENVER_commandline2  14
+
 #endif /* __XEN_PUBLIC_VERSION_H__ */
 
 /*
diff --git a/xen/include/xlat.lst b/xen/include/xlat.lst
index 2046b36c04..3c7b6c6830 100644
--- a/xen/include/xlat.lst
+++ b/xen/include/xlat.lst
@@ -195,6 +195,7 @@
 ?	build_id			version.h
 ?	compile_info			version.h
 ?	feature_info			version.h
+?	varbuf                          version.h
 
 ?	xenoprof_init			xenoprof.h
 ?	xenoprof_passive		xenoprof.h
diff --git a/xen/include/xsm/dummy.h b/xen/include/xsm/dummy.h
index f8a3c4b81e..6a2fc33c3b 100644
--- a/xen/include/xsm/dummy.h
+++ b/xen/include/xsm/dummy.h
@@ -828,9 +828,12 @@ static XSM_INLINE int cf_check xsm_xen_version(XSM_DEFAULT_ARG uint32_t op)
         block_speculation();
         return 0;
     case XENVER_extraversion:
+    case XENVER_extraversion2:
     case XENVER_compile_info:
     case XENVER_capabilities:
+    case XENVER_capabilities2:
     case XENVER_changeset:
+    case XENVER_changeset2:
     case XENVER_pagesize:
     case XENVER_guest_handle:
         /* These MUST always be accessible to any guest by default. */
diff --git a/xen/xsm/flask/hooks.c b/xen/xsm/flask/hooks.c
index a79474ffe4..2b4efde689 100644
--- a/xen/xsm/flask/hooks.c
+++ b/xen/xsm/flask/hooks.c
@@ -1795,15 +1795,18 @@ static int cf_check flask_xen_version(uint32_t op)
         /* These sub-ops ignore the permission checks and return data. */
         return 0;
     case XENVER_extraversion:
+    case XENVER_extraversion2:
         return avc_has_perm(dsid, SECINITSID_XEN, SECCLASS_VERSION,
                             VERSION__XEN_EXTRAVERSION, NULL);
     case XENVER_compile_info:
         return avc_has_perm(dsid, SECINITSID_XEN, SECCLASS_VERSION,
                             VERSION__XEN_COMPILE_INFO, NULL);
     case XENVER_capabilities:
+    case XENVER_capabilities2:
         return avc_has_perm(dsid, SECINITSID_XEN, SECCLASS_VERSION,
                             VERSION__XEN_CAPABILITIES, NULL);
     case XENVER_changeset:
+    case XENVER_changeset2:
         return avc_has_perm(dsid, SECINITSID_XEN, SECCLASS_VERSION,
                             VERSION__XEN_CHANGESET, NULL);
     case XENVER_pagesize:
@@ -1813,6 +1816,7 @@ static int cf_check flask_xen_version(uint32_t op)
         return avc_has_perm(dsid, SECINITSID_XEN, SECCLASS_VERSION,
                             VERSION__XEN_GUEST_HANDLE, NULL);
     case XENVER_commandline:
+    case XENVER_commandline2:
         return avc_has_perm(dsid, SECINITSID_XEN, SECCLASS_VERSION,
                             VERSION__XEN_COMMANDLINE, NULL);
     case XENVER_build_id:
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Dec 21 00:55:23 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 21 Dec 2024 00:55:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.862136.1274051 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tOnm7-0001br-I2; Sat, 21 Dec 2024 00:55:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 862136.1274051; Sat, 21 Dec 2024 00: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 1tOnm7-0001bj-F9; Sat, 21 Dec 2024 00:55:23 +0000
Received: by outflank-mailman (input) for mailman id 862136;
 Sat, 21 Dec 2024 00:55:22 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tOnm6-0001bX-7W
 for xen-changelog@lists.xenproject.org; Sat, 21 Dec 2024 00:55:22 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tOnm5-00DPid-2v
 for xen-changelog@lists.xenproject.org;
 Sat, 21 Dec 2024 00:55:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tOnm6-007ILd-0S
 for xen-changelog@lists.xenproject.org;
 Sat, 21 Dec 2024 00:55:22 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=hoKte0/Id+qphoBPfxsAUNf9NDXwcdOwLODc2INP+HM=; b=gP4qNfsx9Tnq/CkJ5Y7nVKKDEr
	fcvIZHagak7Fl155TugtQtjgEtUB7dajbFBPL0B4x5m+xeRVgnFsTQxfgnY5+tamXms1CuPmKWutS
	wKRZNpBv0t18rCQlAiLG1WWrtUxduPDCOz3v8HSAoliBqEBuj/YjGkzNvEREaPpWiyts=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/version: Fold build_id handling into xenver_varbuf_op()
Message-Id: <E1tOnm6-007ILd-0S@xenbits.xenproject.org>
Date: Sat, 21 Dec 2024 00:55:22 +0000

commit 8eed14bf9d6517726e6998fd8f55a5528ed7dab5
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Tue Jan 3 19:06:43 2023 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Dec 20 22:44:42 2024 +0000

    xen/version: Fold build_id handling into xenver_varbuf_op()
    
    struct xen_build_id and struct xen_varbuf are identical from an ABI point of
    view, so XENVER_build_id can reuse xenver_varbuf_op() rather than having it's
    own almost identical copy of the logic.
    
    No functional change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/common/kernel.c          | 49 +++++++++++++-------------------------------
 xen/include/public/version.h |  5 ++++-
 2 files changed, 18 insertions(+), 36 deletions(-)

diff --git a/xen/common/kernel.c b/xen/common/kernel.c
index eb7122b74f..9e17e22a19 100644
--- a/xen/common/kernel.c
+++ b/xen/common/kernel.c
@@ -509,9 +509,22 @@ static long xenver_varbuf_op(int cmd, XEN_GUEST_HANDLE_PARAM(void) arg)
     struct xen_varbuf user_str;
     const char *str = NULL;
     size_t sz;
+    int rc;
 
     switch ( cmd )
     {
+    case XENVER_build_id:
+    {
+        unsigned int local_sz;
+
+        rc = xen_build_id((const void **)&str, &local_sz);
+        if ( rc )
+            return rc;
+
+        sz = local_sz;
+        goto have_len;
+    }
+
     case XENVER_extraversion2:
         str = xen_extra_version();
         break;
@@ -535,6 +548,7 @@ static long xenver_varbuf_op(int cmd, XEN_GUEST_HANDLE_PARAM(void) arg)
 
     sz = strlen(str);
 
+ have_len:
     if ( sz > KB(64) ) /* Arbitrary limit.  Avoid long-running operations. */
         return -E2BIG;
 
@@ -738,41 +752,6 @@ long do_xen_version(int cmd, XEN_GUEST_HANDLE_PARAM(void) arg)
     }
 
     case XENVER_build_id:
-    {
-        xen_build_id_t build_id;
-        unsigned int sz;
-        int rc;
-        const void *p;
-
-        if ( deny )
-            return -EPERM;
-
-        /* Only return size. */
-        if ( !guest_handle_is_null(arg) )
-        {
-            if ( copy_from_guest(&build_id, arg, 1) )
-                return -EFAULT;
-
-            if ( build_id.len == 0 )
-                return -EINVAL;
-        }
-
-        rc = xen_build_id(&p, &sz);
-        if ( rc )
-            return rc;
-
-        if ( guest_handle_is_null(arg) )
-            return sz;
-
-        if ( sz > build_id.len )
-            return -ENOBUFS;
-
-        if ( copy_to_guest_offset(arg, offsetof(xen_build_id_t, buf), p, sz) )
-            return -EFAULT;
-
-        return sz;
-    }
-
     case XENVER_extraversion2:
     case XENVER_capabilities2:
     case XENVER_changeset2:
diff --git a/xen/include/public/version.h b/xen/include/public/version.h
index 0dd6bbcb43..1022604daa 100644
--- a/xen/include/public/version.h
+++ b/xen/include/public/version.h
@@ -124,8 +124,10 @@ typedef char xen_commandline_t[1024];
 /*
  * Return value is the number of bytes written, or XEN_Exx on error.
  * Calling with empty parameter returns the size of build_id.
+ *
+ * Note: structure only kept for backwards compatibility.  Xen operates in
+ * terms of xen_varbuf_t.
  */
-#define XENVER_build_id 10
 struct xen_build_id {
         uint32_t        len; /* IN: size of buf[]. */
         unsigned char   buf[XEN_FLEX_ARRAY_DIM];
@@ -164,6 +166,7 @@ typedef struct xen_varbuf xen_varbuf_t;
  * effect.  e.g. Xen has no control over the formatting used for the command
  * line.
  */
+#define XENVER_build_id      10
 #define XENVER_extraversion2 11
 #define XENVER_capabilities2 12
 #define XENVER_changeset2    13
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Dec 21 00:55:33 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 21 Dec 2024 00:55:33 +0000
Received: from list by lists.xenproject.org with outflank-mailman.862137.1274055 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tOnmH-0001f2-Kp; Sat, 21 Dec 2024 00:55:33 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 862137.1274055; Sat, 21 Dec 2024 00: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 1tOnmH-0001et-Hu; Sat, 21 Dec 2024 00:55:33 +0000
Received: by outflank-mailman (input) for mailman id 862137;
 Sat, 21 Dec 2024 00:55:32 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tOnmG-0001ei-Aq
 for xen-changelog@lists.xenproject.org; Sat, 21 Dec 2024 00:55:32 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tOnmG-00DPih-02
 for xen-changelog@lists.xenproject.org;
 Sat, 21 Dec 2024 00:55:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tOnmG-007IMM-0p
 for xen-changelog@lists.xenproject.org;
 Sat, 21 Dec 2024 00:55:32 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=MzBAD1W0a9YjpGsVJCRFeBUDwssHLlQXEh/qAB3BbcU=; b=oW1zx7Dcpyb1T6OlDOVnWnvQbS
	M6fwDmj/UXzEevzuQahQ+FGwdS+c+4mNchntrXJr70mKmF564rUh2OETD/e4D5ZixVgi70AvpTIaM
	v+8enekXzxRxg7x98PLiZAHhGGU/Lxr/+zKhTydJNBqMpkqg+kL09FPHx+Eo3OcjcsPc=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/version: Misc style fixes
Message-Id: <E1tOnmG-007IMM-0p@xenbits.xenproject.org>
Date: Sat, 21 Dec 2024 00:55:32 +0000

commit 3d94cc88098dfb451da9a0fb03947bf0ad89e1a7
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Tue Dec 20 16:45:23 2022 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Dec 20 22:44:42 2024 +0000

    xen/version: Misc style fixes
    
    No functional change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Daniel P. Smith <dpsmith@apertussolutions.com>
---
 xen/common/kernel.c  | 9 ++++-----
 xen/common/version.c | 4 ++--
 2 files changed, 6 insertions(+), 7 deletions(-)

diff --git a/xen/common/kernel.c b/xen/common/kernel.c
index 9e17e22a19..8b63ca55f1 100644
--- a/xen/common/kernel.c
+++ b/xen/common/kernel.c
@@ -1,6 +1,6 @@
 /******************************************************************************
  * kernel.c
- * 
+ *
  * Copyright (c) 2002-2005 K A Fraser
  */
 
@@ -614,7 +614,7 @@ long do_xen_version(int cmd, XEN_GUEST_HANDLE_PARAM(void) arg)
             return -EFAULT;
         return 0;
     }
-    
+
     case XENVER_platform_parameters:
     {
         const struct vcpu *curr = current;
@@ -653,9 +653,8 @@ long do_xen_version(int cmd, XEN_GUEST_HANDLE_PARAM(void) arg)
         }
 
         return 0;
-        
     }
-    
+
     case XENVER_changeset:
     {
         xen_changeset_info_t chgset;
@@ -686,7 +685,7 @@ long do_xen_version(int cmd, XEN_GUEST_HANDLE_PARAM(void) arg)
             if ( VM_ASSIST(d, pae_extended_cr3) )
                 fi.submap |= (1U << XENFEAT_pae_pgdir_above_4gb);
             if ( paging_mode_translate(d) )
-                fi.submap |= 
+                fi.submap |=
                     (1U << XENFEAT_writable_page_tables) |
                     (1U << XENFEAT_auto_translated_physmap);
             if ( is_hardware_domain(d) )
diff --git a/xen/common/version.c b/xen/common/version.c
index b7d7d515a3..bc3714b45f 100644
--- a/xen/common/version.c
+++ b/xen/common/version.c
@@ -209,11 +209,11 @@ void __init xen_build_init(void)
             }
         }
     }
-#endif
+#endif /* CONFIG_X86 */
     if ( !rc )
         printk(XENLOG_INFO "build-id: %*phN\n", build_id_len, build_id_p);
 }
-#endif
+#endif /* BUILD_ID */
 /*
  * Local variables:
  * mode: C
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Dec 21 00:55:43 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 21 Dec 2024 00:55:43 +0000
Received: from list by lists.xenproject.org with outflank-mailman.862138.1274059 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tOnmR-0001hi-Lx; Sat, 21 Dec 2024 00:55:43 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 862138.1274059; Sat, 21 Dec 2024 00: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 1tOnmR-0001ha-JK; Sat, 21 Dec 2024 00:55:43 +0000
Received: by outflank-mailman (input) for mailman id 862138;
 Sat, 21 Dec 2024 00:55:42 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tOnmQ-0001hS-F5
 for xen-changelog@lists.xenproject.org; Sat, 21 Dec 2024 00:55:42 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tOnmQ-00DPit-0P
 for xen-changelog@lists.xenproject.org;
 Sat, 21 Dec 2024 00:55:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tOnmQ-007IN5-1B
 for xen-changelog@lists.xenproject.org;
 Sat, 21 Dec 2024 00:55:42 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=0rF2wVzy3/gGjgz50fjX81LAu5K3ted6OOhUfiCjxEA=; b=0rAKkRsP1H1iiPUHG3ln1QBiAQ
	3tGZiQav6M3I/JQukne9mdEqld+dgqWUiys/+aqgiRvT+u68NJBD7xNUAS301NzZMMWe0amhoag2y
	Ie89O2slrvU1wVbJbgKP2Id6bJOO6hlO9gsCFYamAfgd+k/h7Y74L0no54szs0o2Zdnc=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools/libxc: Move xc_version() out of xc_private.c into its own file
Message-Id: <E1tOnmQ-007IN5-1B@xenbits.xenproject.org>
Date: Sat, 21 Dec 2024 00:55:42 +0000

commit 583a0fb0fa0a503e8562808fc90eebd6a19d0a99
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Mon Jan 16 14:40:07 2023 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Dec 20 22:44:42 2024 +0000

    tools/libxc: Move xc_version() out of xc_private.c into its own file
    
    kexec-tools uses xc_version(), meaning that it is not a private API.  As we're
    going to extend the functionality substantially, move it to its own file.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Anthony PERARD <anthony.perard@citrix.com>
---
 tools/libs/ctrl/Makefile.common |  1 +
 tools/libs/ctrl/xc_private.c    | 66 --------------------------------
 tools/libs/ctrl/xc_private.h    |  7 ----
 tools/libs/ctrl/xc_version.c    | 83 +++++++++++++++++++++++++++++++++++++++++
 4 files changed, 84 insertions(+), 73 deletions(-)

diff --git a/tools/libs/ctrl/Makefile.common b/tools/libs/ctrl/Makefile.common
index 247afbe5f9..68137d42f2 100644
--- a/tools/libs/ctrl/Makefile.common
+++ b/tools/libs/ctrl/Makefile.common
@@ -16,6 +16,7 @@ OBJS-y       += xc_pm.o
 OBJS-y       += xc_cpu_hotplug.o
 OBJS-y       += xc_vm_event.o
 OBJS-y       += xc_vmtrace.o
+OBJS-y       += xc_version.o
 OBJS-y       += xc_monitor.o
 OBJS-y       += xc_mem_paging.o
 OBJS-y       += xc_mem_access.o
diff --git a/tools/libs/ctrl/xc_private.c b/tools/libs/ctrl/xc_private.c
index abd0b0d849..bb0f81d6f3 100644
--- a/tools/libs/ctrl/xc_private.c
+++ b/tools/libs/ctrl/xc_private.c
@@ -490,72 +490,6 @@ int xc_sysctl(xc_interface *xch, struct xen_sysctl *sysctl)
     return do_sysctl(xch, sysctl);
 }
 
-int xc_version(xc_interface *xch, int cmd, void *arg)
-{
-    DECLARE_HYPERCALL_BOUNCE(arg, 0, XC_HYPERCALL_BUFFER_BOUNCE_OUT); /* Size unknown until cmd decoded */
-    size_t sz;
-    int rc;
-
-    switch ( cmd )
-    {
-    case XENVER_version:
-        sz = 0;
-        break;
-    case XENVER_extraversion:
-        sz = sizeof(xen_extraversion_t);
-        break;
-    case XENVER_compile_info:
-        sz = sizeof(xen_compile_info_t);
-        break;
-    case XENVER_capabilities:
-        sz = sizeof(xen_capabilities_info_t);
-        break;
-    case XENVER_changeset:
-        sz = sizeof(xen_changeset_info_t);
-        break;
-    case XENVER_platform_parameters:
-        sz = sizeof(xen_platform_parameters_t);
-        break;
-    case XENVER_get_features:
-        sz = sizeof(xen_feature_info_t);
-        break;
-    case XENVER_pagesize:
-        sz = 0;
-        break;
-    case XENVER_guest_handle:
-        sz = sizeof(xen_domain_handle_t);
-        break;
-    case XENVER_commandline:
-        sz = sizeof(xen_commandline_t);
-        break;
-    case XENVER_build_id:
-        {
-            xen_build_id_t *build_id = (xen_build_id_t *)arg;
-            sz = sizeof(*build_id) + build_id->len;
-            HYPERCALL_BOUNCE_SET_DIR(arg, XC_HYPERCALL_BUFFER_BOUNCE_BOTH);
-            break;
-        }
-    default:
-        ERROR("xc_version: unknown command %d\n", cmd);
-        return -EINVAL;
-    }
-
-    HYPERCALL_BOUNCE_SET_SIZE(arg, sz);
-
-    if ( (sz != 0) && xc_hypercall_bounce_pre(xch, arg) )
-    {
-        PERROR("Could not bounce buffer for version hypercall");
-        return -ENOMEM;
-    }
-
-    rc = do_xen_version(xch, cmd, HYPERCALL_BUFFER(arg));
-
-    if ( sz != 0 )
-        xc_hypercall_bounce_post(xch, arg);
-
-    return rc;
-}
-
 unsigned long xc_make_page_below_4G(
     xc_interface *xch, uint32_t domid, unsigned long mfn)
 {
diff --git a/tools/libs/ctrl/xc_private.h b/tools/libs/ctrl/xc_private.h
index d8b7da2805..b5892ae8dc 100644
--- a/tools/libs/ctrl/xc_private.h
+++ b/tools/libs/ctrl/xc_private.h
@@ -210,13 +210,6 @@ void xc__hypercall_buffer_cache_release(xc_interface *xch);
  * Hypercall interfaces.
  */
 
-static inline int do_xen_version(xc_interface *xch, int cmd, xc_hypercall_buffer_t *dest)
-{
-    DECLARE_HYPERCALL_BUFFER_ARGUMENT(dest);
-    return xencall2(xch->xcall, __HYPERVISOR_xen_version,
-                    cmd, HYPERCALL_BUFFER_AS_ARG(dest));
-}
-
 static inline int do_physdev_op(xc_interface *xch, int cmd, void *op, size_t len)
 {
     int ret = -1;
diff --git a/tools/libs/ctrl/xc_version.c b/tools/libs/ctrl/xc_version.c
new file mode 100644
index 0000000000..60e107dcee
--- /dev/null
+++ b/tools/libs/ctrl/xc_version.c
@@ -0,0 +1,83 @@
+/* SPDX-License-Identifier: LGPL-2.1 */
+/*
+ * xc_version.c
+ *
+ * Wrappers aound XENVER_* hypercalls
+ */
+
+#include "xc_private.h"
+#include <assert.h>
+
+static int do_xen_version(xc_interface *xch, int cmd,
+                          xc_hypercall_buffer_t *dest)
+{
+    DECLARE_HYPERCALL_BUFFER_ARGUMENT(dest);
+    return xencall2(xch->xcall, __HYPERVISOR_xen_version,
+                    cmd, HYPERCALL_BUFFER_AS_ARG(dest));
+}
+
+int xc_version(xc_interface *xch, int cmd, void *arg)
+{
+    DECLARE_HYPERCALL_BOUNCE(arg, 0, XC_HYPERCALL_BUFFER_BOUNCE_OUT); /* Size unknown until cmd decoded */
+    size_t sz;
+    int rc;
+
+    switch ( cmd )
+    {
+    case XENVER_version:
+        sz = 0;
+        break;
+    case XENVER_extraversion:
+        sz = sizeof(xen_extraversion_t);
+        break;
+    case XENVER_compile_info:
+        sz = sizeof(xen_compile_info_t);
+        break;
+    case XENVER_capabilities:
+        sz = sizeof(xen_capabilities_info_t);
+        break;
+    case XENVER_changeset:
+        sz = sizeof(xen_changeset_info_t);
+        break;
+    case XENVER_platform_parameters:
+        sz = sizeof(xen_platform_parameters_t);
+        break;
+    case XENVER_get_features:
+        sz = sizeof(xen_feature_info_t);
+        break;
+    case XENVER_pagesize:
+        sz = 0;
+        break;
+    case XENVER_guest_handle:
+        sz = sizeof(xen_domain_handle_t);
+        break;
+    case XENVER_commandline:
+        sz = sizeof(xen_commandline_t);
+        break;
+    case XENVER_build_id:
+        {
+            xen_build_id_t *build_id = (xen_build_id_t *)arg;
+            sz = sizeof(*build_id) + build_id->len;
+            HYPERCALL_BOUNCE_SET_DIR(arg, XC_HYPERCALL_BUFFER_BOUNCE_BOTH);
+            break;
+        }
+    default:
+        ERROR("xc_version: unknown command %d\n", cmd);
+        return -EINVAL;
+    }
+
+    HYPERCALL_BOUNCE_SET_SIZE(arg, sz);
+
+    if ( (sz != 0) && xc_hypercall_bounce_pre(xch, arg) )
+    {
+        PERROR("Could not bounce buffer for version hypercall");
+        return -ENOMEM;
+    }
+
+    rc = do_xen_version(xch, cmd, HYPERCALL_BUFFER(arg));
+
+    if ( sz != 0 )
+        xc_hypercall_bounce_post(xch, arg);
+
+    return rc;
+}
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Dec 21 00:55:53 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 21 Dec 2024 00:55:53 +0000
Received: from list by lists.xenproject.org with outflank-mailman.862139.1274063 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tOnmb-0001kD-NX; Sat, 21 Dec 2024 00:55:53 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 862139.1274063; Sat, 21 Dec 2024 00: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 1tOnmb-0001k5-Kr; Sat, 21 Dec 2024 00:55:53 +0000
Received: by outflank-mailman (input) for mailman id 862139;
 Sat, 21 Dec 2024 00:55:52 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tOnma-0001jt-Ha
 for xen-changelog@lists.xenproject.org; Sat, 21 Dec 2024 00:55:52 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tOnma-00DPix-0h
 for xen-changelog@lists.xenproject.org;
 Sat, 21 Dec 2024 00:55:52 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tOnma-007IPc-1Y
 for xen-changelog@lists.xenproject.org;
 Sat, 21 Dec 2024 00:55:52 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=6ls/ZynPKU1EVdEVaabEltvdXMsncvaifO2o2cJZMms=; b=aXj3F8GlDOuKrLuea2Cc6EKVx9
	k+cj+ctHZ17vYMcxhlRzfNGYO/Seu3xHLQkofC8yNf2VN7BMGg1R7IT2OXG7JtVmf4XlJp3RoPGf+
	f8pNDWWh5Dfr4HCPX0lFe6sSbGcdKP+xQmBJkWkH+tKl2ydD4BYp/h+ATfqobEBYyy8o=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools: Introduce a non-truncating xc_xenver_extraversion()
Message-Id: <E1tOnma-007IPc-1Y@xenbits.xenproject.org>
Date: Sat, 21 Dec 2024 00:55:52 +0000

commit 504ea442e35a29b8de4660873b7ebafc12386531
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Mon Jan 16 16:56:17 2023 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Dec 20 22:44:42 2024 +0000

    tools: Introduce a non-truncating xc_xenver_extraversion()
    
    ... which uses XENVER_extraversion2.
    
    In order to do this sensibly, use manual hypercall buffer handling.  Not only
    does this avoid an extra bounce buffer (we need to strip the xen_varbuf_t
    header anyway), it's also shorter and easlier to follow.
    
    Update libxl and the ocaml stubs to match.  No API/ABI change in either.
    
    With this change made, `xl info` can now correctly access a >15 char
    extraversion:
    
      # xl info xen_version
      4.18-unstable+REALLY LONG EXTRAVERSION
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Anthony PERARD <anthony.perard@citrix.com>
    Acked-by: Christian Lindig <christian.lindig@citrix.com>
---
 tools/include/xenctrl.h             |  6 +++
 tools/libs/ctrl/xc_version.c        | 75 +++++++++++++++++++++++++++++++++++++
 tools/libs/light/libxl.c            |  4 +-
 tools/ocaml/libs/xc/xenctrl_stubs.c |  9 +++--
 4 files changed, 87 insertions(+), 7 deletions(-)

diff --git a/tools/include/xenctrl.h b/tools/include/xenctrl.h
index b08e438ea8..879b626614 100644
--- a/tools/include/xenctrl.h
+++ b/tools/include/xenctrl.h
@@ -1573,6 +1573,12 @@ long xc_memory_op(xc_interface *xch, unsigned int cmd, void *arg, size_t len);
 
 int xc_version(xc_interface *xch, int cmd, void *arg);
 
+/*
+ * Wrappers around XENVER_* subops.  Callers must pass the returned pointer to
+ * free().
+ */
+char *xc_xenver_extraversion(xc_interface *xch);
+
 int xc_flask_op(xc_interface *xch, xen_flask_op_t *op);
 
 /*
diff --git a/tools/libs/ctrl/xc_version.c b/tools/libs/ctrl/xc_version.c
index 60e107dcee..2c14474fee 100644
--- a/tools/libs/ctrl/xc_version.c
+++ b/tools/libs/ctrl/xc_version.c
@@ -81,3 +81,78 @@ int xc_version(xc_interface *xch, int cmd, void *arg)
 
     return rc;
 }
+
+/*
+ * Raw hypercall wrapper, letting us pass NULL and things which aren't of
+ * xc_hypercall_buffer_t *.
+ */
+static int do_xen_version_raw(xc_interface *xch, int cmd, void *hbuf)
+{
+    return xencall2(xch->xcall, __HYPERVISOR_xen_version,
+                    cmd, (unsigned long)hbuf);
+}
+
+/*
+ * Issues a xen_varbuf_t subop, using manual hypercall buffer handling to
+ * avoid unnecessary buffering.
+ *
+ * On failure, returns NULL.  errno probably useful.
+ * On success, returns a pointer which must be freed with xencall_free_buffer().
+ */
+static xen_varbuf_t *varbuf_op(xc_interface *xch, unsigned int subop)
+{
+    xen_varbuf_t *hbuf = NULL;
+    ssize_t sz;
+
+    sz = do_xen_version_raw(xch, subop, NULL);
+    if ( sz < 0 )
+        return NULL;
+
+    hbuf = xencall_alloc_buffer(xch->xcall, sizeof(*hbuf) + sz);
+    if ( !hbuf )
+        return NULL;
+
+    hbuf->len = sz;
+
+    sz = do_xen_version_raw(xch, subop, hbuf);
+    if ( sz < 0 )
+    {
+        xencall_free_buffer(xch->xcall, hbuf);
+        return NULL;
+    }
+
+    hbuf->len = sz;
+    return hbuf;
+}
+
+/*
+ * Wrap varbuf_op() to obtain a simple string.  Copy out of the hypercall
+ * buffer, stripping the xen_varbuf_t header and appending a NUL terminator.
+ *
+ * On failure, returns NULL, errno probably useful.
+ * On success, returns a pointer which must be free()'d.
+ */
+static char *varbuf_simple_string(xc_interface *xch, unsigned int subop)
+{
+    xen_varbuf_t *hbuf = varbuf_op(xch, subop);
+    char *res;
+
+    if ( !hbuf )
+        return NULL;
+
+    res = malloc(hbuf->len + 1);
+    if ( res )
+    {
+        memcpy(res, hbuf->buf, hbuf->len);
+        res[hbuf->len] = '\0';
+    }
+
+    xencall_free_buffer(xch->xcall, hbuf);
+
+    return res;
+}
+
+char *xc_xenver_extraversion(xc_interface *xch)
+{
+    return varbuf_simple_string(xch, XENVER_extraversion2);
+}
diff --git a/tools/libs/light/libxl.c b/tools/libs/light/libxl.c
index 175d6dde0b..f91f7271d5 100644
--- a/tools/libs/light/libxl.c
+++ b/tools/libs/light/libxl.c
@@ -582,7 +582,6 @@ const libxl_version_info* libxl_get_version_info(libxl_ctx *ctx)
 {
     GC_INIT(ctx);
     union {
-        xen_extraversion_t xen_extra;
         xen_compile_info_t xen_cc;
         xen_changeset_info_t xen_chgset;
         xen_capabilities_info_t xen_caps;
@@ -601,8 +600,7 @@ const libxl_version_info* libxl_get_version_info(libxl_ctx *ctx)
     info->xen_version_major = xen_version >> 16;
     info->xen_version_minor = xen_version & 0xFF;
 
-    xc_version(ctx->xch, XENVER_extraversion, &u.xen_extra);
-    info->xen_version_extra = libxl__strdup(NOGC, u.xen_extra);
+    info->xen_version_extra = xc_xenver_extraversion(ctx->xch);
 
     xc_version(ctx->xch, XENVER_compile_info, &u.xen_cc);
     info->compiler = libxl__strdup(NOGC, u.xen_cc.compiler);
diff --git a/tools/ocaml/libs/xc/xenctrl_stubs.c b/tools/ocaml/libs/xc/xenctrl_stubs.c
index c78191f95a..1dd12081e9 100644
--- a/tools/ocaml/libs/xc/xenctrl_stubs.c
+++ b/tools/ocaml/libs/xc/xenctrl_stubs.c
@@ -985,9 +985,8 @@ CAMLprim value stub_xc_version_version(value xch_val)
 	CAMLparam1(xch_val);
 	CAMLlocal1(result);
 	xc_interface *xch = xch_of_val(xch_val);
-	xen_extraversion_t extra;
+	char *extra;
 	long packed;
-	int retval;
 
 	caml_enter_blocking_section();
 	packed = xc_version(xch, XENVER_version, NULL);
@@ -997,10 +996,10 @@ CAMLprim value stub_xc_version_version(value xch_val)
 		failwith_xc(xch);
 
 	caml_enter_blocking_section();
-	retval = xc_version(xch, XENVER_extraversion, &extra);
+	extra = xc_xenver_extraversion(xch);
 	caml_leave_blocking_section();
 
-	if (retval)
+	if (!extra)
 		failwith_xc(xch);
 
 	result = caml_alloc_tuple(3);
@@ -1009,6 +1008,8 @@ CAMLprim value stub_xc_version_version(value xch_val)
 	Store_field(result, 1, Val_int(packed & 0xffff));
 	Store_field(result, 2, caml_copy_string(extra));
 
+	free(extra);
+
 	CAMLreturn(result);
 }
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Dec 21 00:56:03 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 21 Dec 2024 00:56:03 +0000
Received: from list by lists.xenproject.org with outflank-mailman.862140.1274067 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tOnml-0001mh-Ox; Sat, 21 Dec 2024 00:56:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 862140.1274067; Sat, 21 Dec 2024 00: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 1tOnml-0001mZ-ML; Sat, 21 Dec 2024 00:56:03 +0000
Received: by outflank-mailman (input) for mailman id 862140;
 Sat, 21 Dec 2024 00:56:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tOnmk-0001mT-MI
 for xen-changelog@lists.xenproject.org; Sat, 21 Dec 2024 00:56:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tOnmk-00DPjV-18
 for xen-changelog@lists.xenproject.org;
 Sat, 21 Dec 2024 00:56:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tOnmk-007IQq-1r
 for xen-changelog@lists.xenproject.org;
 Sat, 21 Dec 2024 00:56:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=qaefwtE+AdT4HS3TZqvvNnH806TeO8UPQUmmovElHEU=; b=tgnBCA4G3mXxdTDBCnfncnunN/
	ezXEu+fDNjDLN4pwKuWbdtIWv+Chx0NbJS5foXahnRKXENxLWn8hDvfsxZwBMFPeKAAGBK8KGQyEE
	0wwqzt4gNeVWxtSmSkNqfLlpsXbzViqiLi7RMl4/1zhjHqXza4m6g/TX8nrqZULy9w1M=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools: Introduce a non-truncating xc_xenver_capabilities()
Message-Id: <E1tOnmk-007IQq-1r@xenbits.xenproject.org>
Date: Sat, 21 Dec 2024 00:56:02 +0000

commit 6625d581ec9bcd3816b5060cb60fd157256057ca
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Tue Jan 17 12:39:48 2023 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Dec 20 22:44:42 2024 +0000

    tools: Introduce a non-truncating xc_xenver_capabilities()
    
    Update libxl and the ocaml stubs to match.  No API/ABI change in either.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Anthony PERARD <anthony.perard@citrix.com>
    Acked-by: Christian Lindig <christian.lindig@citrix.com>
---
 tools/include/xenctrl.h             |  1 +
 tools/libs/ctrl/xc_version.c        |  5 +++++
 tools/libs/light/libxl.c            |  4 +---
 tools/ocaml/libs/xc/xenctrl_stubs.c | 18 ++++++++++++++++--
 4 files changed, 23 insertions(+), 5 deletions(-)

diff --git a/tools/include/xenctrl.h b/tools/include/xenctrl.h
index 879b626614..6ed2ac9db2 100644
--- a/tools/include/xenctrl.h
+++ b/tools/include/xenctrl.h
@@ -1578,6 +1578,7 @@ int xc_version(xc_interface *xch, int cmd, void *arg);
  * free().
  */
 char *xc_xenver_extraversion(xc_interface *xch);
+char *xc_xenver_capabilities(xc_interface *xch);
 
 int xc_flask_op(xc_interface *xch, xen_flask_op_t *op);
 
diff --git a/tools/libs/ctrl/xc_version.c b/tools/libs/ctrl/xc_version.c
index 2c14474fee..512302a393 100644
--- a/tools/libs/ctrl/xc_version.c
+++ b/tools/libs/ctrl/xc_version.c
@@ -156,3 +156,8 @@ char *xc_xenver_extraversion(xc_interface *xch)
 {
     return varbuf_simple_string(xch, XENVER_extraversion2);
 }
+
+char *xc_xenver_capabilities(xc_interface *xch)
+{
+    return varbuf_simple_string(xch, XENVER_capabilities2);
+}
diff --git a/tools/libs/light/libxl.c b/tools/libs/light/libxl.c
index f91f7271d5..ae6c5e04cd 100644
--- a/tools/libs/light/libxl.c
+++ b/tools/libs/light/libxl.c
@@ -584,7 +584,6 @@ const libxl_version_info* libxl_get_version_info(libxl_ctx *ctx)
     union {
         xen_compile_info_t xen_cc;
         xen_changeset_info_t xen_chgset;
-        xen_capabilities_info_t xen_caps;
         xen_platform_parameters_t p_parms;
         xen_commandline_t xen_commandline;
         xen_build_id_t build_id;
@@ -608,8 +607,7 @@ const libxl_version_info* libxl_get_version_info(libxl_ctx *ctx)
     info->compile_domain = libxl__strdup(NOGC, u.xen_cc.compile_domain);
     info->compile_date = libxl__strdup(NOGC, u.xen_cc.compile_date);
 
-    xc_version(ctx->xch, XENVER_capabilities, &u.xen_caps);
-    info->capabilities = libxl__strdup(NOGC, u.xen_caps);
+    info->capabilities = xc_xenver_capabilities(ctx->xch);
 
     xc_version(ctx->xch, XENVER_changeset, &u.xen_chgset);
     info->changeset = libxl__strdup(NOGC, u.xen_chgset);
diff --git a/tools/ocaml/libs/xc/xenctrl_stubs.c b/tools/ocaml/libs/xc/xenctrl_stubs.c
index 1dd12081e9..8d1d66e81d 100644
--- a/tools/ocaml/libs/xc/xenctrl_stubs.c
+++ b/tools/ocaml/libs/xc/xenctrl_stubs.c
@@ -1067,9 +1067,23 @@ CAMLprim value stub_xc_version_changeset(value xch_val)
 
 CAMLprim value stub_xc_version_capabilities(value xch_val)
 {
-	xen_capabilities_info_t ci;
+	CAMLparam1(xch_val);
+	CAMLlocal1(result);
+	xc_interface *xch = xch_of_val(xch_val);
+	char *capabilities;
+
+	caml_enter_blocking_section();
+	capabilities = xc_xenver_capabilities(xch);
+	caml_leave_blocking_section();
 
-	return xc_version_single_string(xch_val, XENVER_capabilities, &ci);
+	if (!capabilities)
+		failwith_xc(xch);
+
+	result = caml_copy_string(capabilities);
+
+	free(capabilities);
+
+	CAMLreturn(result);
 }
 
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Dec 21 00:56:13 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 21 Dec 2024 00:56:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.862141.1274070 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tOnmv-0001p8-QQ; Sat, 21 Dec 2024 00:56:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 862141.1274070; Sat, 21 Dec 2024 00: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 1tOnmv-0001p1-Nl; Sat, 21 Dec 2024 00:56:13 +0000
Received: by outflank-mailman (input) for mailman id 862141;
 Sat, 21 Dec 2024 00:56:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tOnmu-0001oo-Pc
 for xen-changelog@lists.xenproject.org; Sat, 21 Dec 2024 00:56:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tOnmu-00DPjd-1Q
 for xen-changelog@lists.xenproject.org;
 Sat, 21 Dec 2024 00:56:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tOnmu-007IRZ-2H
 for xen-changelog@lists.xenproject.org;
 Sat, 21 Dec 2024 00:56:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=g5FT1pfkaa9956nPAf78YWWMClCCovxl6Q0Nxq9pVxA=; b=vhH+LJ3v9ZUD9yI+5bHCwSBprX
	AkFN7ROvHcpdXH/li7aN3AH2gMyL8/B494ou3u5KV5e6G7se2qowv+LPpB1Ax0wUqptAxzIC0XlqZ
	iCzHuD6fpsGEzhJHyV75Yf/q3KeSVGn1es29f8gB7plB55SWPUagS2ZtoAL9i5ls8fGg=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools: Introduce a non-truncating xc_xenver_changeset()
Message-Id: <E1tOnmu-007IRZ-2H@xenbits.xenproject.org>
Date: Sat, 21 Dec 2024 00:56:12 +0000

commit 1b421d52b23c7f048541e351d55167ef0fd9df0b
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Tue Jan 17 12:45:37 2023 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Dec 20 22:44:42 2024 +0000

    tools: Introduce a non-truncating xc_xenver_changeset()
    
    Update libxl and the ocaml stubs to match.  No API/ABI change in either.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Anthony PERARD <anthony.perard@citrix.com>
    Acked-by: Christian Lindig <christian.lindig@citrix.com>
---
 tools/include/xenctrl.h             |  1 +
 tools/libs/ctrl/xc_version.c        |  5 +++++
 tools/libs/light/libxl.c            |  5 +----
 tools/ocaml/libs/xc/xenctrl_stubs.c | 19 ++++++++-----------
 4 files changed, 15 insertions(+), 15 deletions(-)

diff --git a/tools/include/xenctrl.h b/tools/include/xenctrl.h
index 6ed2ac9db2..8ca493c5ff 100644
--- a/tools/include/xenctrl.h
+++ b/tools/include/xenctrl.h
@@ -1579,6 +1579,7 @@ int xc_version(xc_interface *xch, int cmd, void *arg);
  */
 char *xc_xenver_extraversion(xc_interface *xch);
 char *xc_xenver_capabilities(xc_interface *xch);
+char *xc_xenver_changeset(xc_interface *xch);
 
 int xc_flask_op(xc_interface *xch, xen_flask_op_t *op);
 
diff --git a/tools/libs/ctrl/xc_version.c b/tools/libs/ctrl/xc_version.c
index 512302a393..9f2cae03db 100644
--- a/tools/libs/ctrl/xc_version.c
+++ b/tools/libs/ctrl/xc_version.c
@@ -161,3 +161,8 @@ char *xc_xenver_capabilities(xc_interface *xch)
 {
     return varbuf_simple_string(xch, XENVER_capabilities2);
 }
+
+char *xc_xenver_changeset(xc_interface *xch)
+{
+    return varbuf_simple_string(xch, XENVER_changeset2);
+}
diff --git a/tools/libs/light/libxl.c b/tools/libs/light/libxl.c
index ae6c5e04cd..9a3532ce13 100644
--- a/tools/libs/light/libxl.c
+++ b/tools/libs/light/libxl.c
@@ -583,7 +583,6 @@ const libxl_version_info* libxl_get_version_info(libxl_ctx *ctx)
     GC_INIT(ctx);
     union {
         xen_compile_info_t xen_cc;
-        xen_changeset_info_t xen_chgset;
         xen_platform_parameters_t p_parms;
         xen_commandline_t xen_commandline;
         xen_build_id_t build_id;
@@ -608,9 +607,7 @@ const libxl_version_info* libxl_get_version_info(libxl_ctx *ctx)
     info->compile_date = libxl__strdup(NOGC, u.xen_cc.compile_date);
 
     info->capabilities = xc_xenver_capabilities(ctx->xch);
-
-    xc_version(ctx->xch, XENVER_changeset, &u.xen_chgset);
-    info->changeset = libxl__strdup(NOGC, u.xen_chgset);
+    info->changeset = xc_xenver_changeset(ctx->xch);
 
     xc_version(ctx->xch, XENVER_platform_parameters, &u.p_parms);
     info->virt_start = u.p_parms.virt_start;
diff --git a/tools/ocaml/libs/xc/xenctrl_stubs.c b/tools/ocaml/libs/xc/xenctrl_stubs.c
index 8d1d66e81d..863ab3c778 100644
--- a/tools/ocaml/libs/xc/xenctrl_stubs.c
+++ b/tools/ocaml/libs/xc/xenctrl_stubs.c
@@ -1040,28 +1040,25 @@ CAMLprim value stub_xc_version_compile_info(value xch_val)
 }
 
 
-static value xc_version_single_string(value xch_val, int code, void *info)
+CAMLprim value stub_xc_version_changeset(value xch_val)
 {
 	CAMLparam1(xch_val);
+	CAMLlocal1(result);
 	xc_interface *xch = xch_of_val(xch_val);
-	int retval;
+	char *changeset;
 
 	caml_enter_blocking_section();
-	retval = xc_version(xch, code, info);
+	changeset = xc_xenver_changeset(xch);
 	caml_leave_blocking_section();
 
-	if (retval)
+	if (!changeset)
 		failwith_xc(xch);
 
-	CAMLreturn(caml_copy_string((char *)info));
-}
+	result = caml_copy_string(changeset);
 
+	free(changeset);
 
-CAMLprim value stub_xc_version_changeset(value xch_val)
-{
-	xen_changeset_info_t ci;
-
-	return xc_version_single_string(xch_val, XENVER_changeset, &ci);
+	CAMLreturn(result);
 }
 
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Dec 21 00:56:24 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 21 Dec 2024 00:56:24 +0000
Received: from list by lists.xenproject.org with outflank-mailman.862142.1274074 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tOnn5-0001sK-TL; Sat, 21 Dec 2024 00:56:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 862142.1274074; Sat, 21 Dec 2024 00: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 1tOnn5-0001sD-Qx; Sat, 21 Dec 2024 00:56:23 +0000
Received: by outflank-mailman (input) for mailman id 862142;
 Sat, 21 Dec 2024 00:56:22 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tOnn4-0001s2-S1
 for xen-changelog@lists.xenproject.org; Sat, 21 Dec 2024 00:56:22 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tOnn4-00DPji-1l
 for xen-changelog@lists.xenproject.org;
 Sat, 21 Dec 2024 00:56:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tOnn4-007ISB-2Z
 for xen-changelog@lists.xenproject.org;
 Sat, 21 Dec 2024 00:56:22 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=ZSPxVbj2LVqwNJtiHFom2BQg04negBvuX7J8B3G04rE=; b=F+KdLVGoH2CqWKrLfyFscuIFh8
	n6deLTJboHx15jXfBbN0SajpFJaKKfPCoYN0kxoFwW0cOI4BO474itX7pmtAW07Mfui0bRIcCjx8Q
	fHFA5a3ejOB4ml0FriuGCprTydgoQJT4UV37y68SjBosq7/rG7SBhcUkVxxDr8T/7UfI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools: Introduce a non-truncating xc_xenver_cmdline()
Message-Id: <E1tOnn4-007ISB-2Z@xenbits.xenproject.org>
Date: Sat, 21 Dec 2024 00:56:22 +0000

commit 75f91607621c98b0ea73b2749cb9a563f6db1618
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Tue Jan 17 12:47:44 2023 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Dec 20 22:44:42 2024 +0000

    tools: Introduce a non-truncating xc_xenver_cmdline()
    
    Update libxl to match.  No API/ABI change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Anthony PERARD <anthony.perard@citrix.com>
---
 tools/include/xenctrl.h      | 1 +
 tools/libs/ctrl/xc_version.c | 5 +++++
 tools/libs/light/libxl.c     | 4 +---
 3 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/tools/include/xenctrl.h b/tools/include/xenctrl.h
index 8ca493c5ff..3aeff3f0e9 100644
--- a/tools/include/xenctrl.h
+++ b/tools/include/xenctrl.h
@@ -1580,6 +1580,7 @@ int xc_version(xc_interface *xch, int cmd, void *arg);
 char *xc_xenver_extraversion(xc_interface *xch);
 char *xc_xenver_capabilities(xc_interface *xch);
 char *xc_xenver_changeset(xc_interface *xch);
+char *xc_xenver_commandline(xc_interface *xch);
 
 int xc_flask_op(xc_interface *xch, xen_flask_op_t *op);
 
diff --git a/tools/libs/ctrl/xc_version.c b/tools/libs/ctrl/xc_version.c
index 9f2cae03db..02f6e9551b 100644
--- a/tools/libs/ctrl/xc_version.c
+++ b/tools/libs/ctrl/xc_version.c
@@ -166,3 +166,8 @@ char *xc_xenver_changeset(xc_interface *xch)
 {
     return varbuf_simple_string(xch, XENVER_changeset2);
 }
+
+char *xc_xenver_commandline(xc_interface *xch)
+{
+    return varbuf_simple_string(xch, XENVER_commandline2);
+}
diff --git a/tools/libs/light/libxl.c b/tools/libs/light/libxl.c
index 9a3532ce13..04f037f3c1 100644
--- a/tools/libs/light/libxl.c
+++ b/tools/libs/light/libxl.c
@@ -584,7 +584,6 @@ const libxl_version_info* libxl_get_version_info(libxl_ctx *ctx)
     union {
         xen_compile_info_t xen_cc;
         xen_platform_parameters_t p_parms;
-        xen_commandline_t xen_commandline;
         xen_build_id_t build_id;
     } u;
     long xen_version;
@@ -614,8 +613,7 @@ const libxl_version_info* libxl_get_version_info(libxl_ctx *ctx)
 
     info->pagesize = xc_version(ctx->xch, XENVER_pagesize, NULL);
 
-    xc_version(ctx->xch, XENVER_commandline, &u.xen_commandline);
-    info->commandline = libxl__strdup(NOGC, u.xen_commandline);
+    info->commandline = xc_xenver_commandline(ctx->xch);
 
     u.build_id.len = sizeof(u) - sizeof(u.build_id);
     r = libxl__xc_version_wrap(gc, info, &u.build_id);
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Dec 21 00:56:34 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 21 Dec 2024 00:56:34 +0000
Received: from list by lists.xenproject.org with outflank-mailman.862143.1274079 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tOnnG-0001ut-Uz; Sat, 21 Dec 2024 00:56:34 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 862143.1274079; Sat, 21 Dec 2024 00: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 1tOnnG-0001ul-SP; Sat, 21 Dec 2024 00:56:34 +0000
Received: by outflank-mailman (input) for mailman id 862143;
 Sat, 21 Dec 2024 00:56:33 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tOnnE-0001uW-VB
 for xen-changelog@lists.xenproject.org; Sat, 21 Dec 2024 00:56:32 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tOnnE-00DPjr-23
 for xen-changelog@lists.xenproject.org;
 Sat, 21 Dec 2024 00:56:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tOnnE-007ISm-2u
 for xen-changelog@lists.xenproject.org;
 Sat, 21 Dec 2024 00:56:32 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=PhZUKVSRGMKBqXwD6RTjgJrgmvKZYuA1EOiLl3XALXo=; b=H00gw/2qREz2EI+ZHB25BYxy46
	5RvuAe/IbL2uGGoKahfnNUa3yzF1OMEK6hNcWuK8K/+IO+KFYmtib8FRRQL0OpPkHZyQRiQBD/NrQ
	Io9y2mPcC8MBof5sGS1JLBfpISmexV0w7cXUNCOw9TfftMcR6e33uS4IihPk96rTRzvc=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools: Introduce a xc_xenver_buildid() wrapper
Message-Id: <E1tOnnE-007ISm-2u@xenbits.xenproject.org>
Date: Sat, 21 Dec 2024 00:56:32 +0000

commit 869aeb7f0253cdcf55b85b5a2196e6332c2d4d7a
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Tue Jan 17 12:52:01 2023 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Dec 20 22:44:42 2024 +0000

    tools: Introduce a xc_xenver_buildid() wrapper
    
    ... which converts binary content to hex automatically.
    
    Update libxl to match.  No API/ABI change.
    
    This removes a latent libxl bug for cases when the buildid is longer than 4092
    bytes.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Anthony PERARD <anthony.perard@citrix.com>
---
 tools/include/xenctrl.h      |  1 +
 tools/libs/ctrl/xc_version.c | 33 +++++++++++++++++++++++++++++++++
 tools/libs/light/libxl.c     | 44 +-------------------------------------------
 3 files changed, 35 insertions(+), 43 deletions(-)

diff --git a/tools/include/xenctrl.h b/tools/include/xenctrl.h
index 3aeff3f0e9..5bb41c9c53 100644
--- a/tools/include/xenctrl.h
+++ b/tools/include/xenctrl.h
@@ -1581,6 +1581,7 @@ char *xc_xenver_extraversion(xc_interface *xch);
 char *xc_xenver_capabilities(xc_interface *xch);
 char *xc_xenver_changeset(xc_interface *xch);
 char *xc_xenver_commandline(xc_interface *xch);
+char *xc_xenver_buildid(xc_interface *xch);
 
 int xc_flask_op(xc_interface *xch, xen_flask_op_t *op);
 
diff --git a/tools/libs/ctrl/xc_version.c b/tools/libs/ctrl/xc_version.c
index 02f6e9551b..54d1b92966 100644
--- a/tools/libs/ctrl/xc_version.c
+++ b/tools/libs/ctrl/xc_version.c
@@ -171,3 +171,36 @@ char *xc_xenver_commandline(xc_interface *xch)
 {
     return varbuf_simple_string(xch, XENVER_commandline2);
 }
+
+static void str2hex(char *dst, const unsigned char *src, size_t n)
+{
+    static const unsigned char hex[] = "0123456789abcdef";
+
+    for ( ; n; n-- )
+    {
+        unsigned char c = *src++;
+
+        *dst++ = hex[c >> 4];
+        *dst++ = hex[c & 0xf];
+    }
+}
+
+char *xc_xenver_buildid(xc_interface *xch)
+{
+    xen_varbuf_t *hbuf = varbuf_op(xch, XENVER_build_id);
+    char *res;
+
+    if ( !hbuf )
+        return NULL;
+
+    res = malloc((hbuf->len * 2) + 1);
+    if ( res )
+    {
+        str2hex(res, hbuf->buf, hbuf->len);
+        res[hbuf->len * 2] = '\0';
+    }
+
+    xencall_free_buffer(xch->xcall, hbuf);
+
+    return res;
+}
diff --git a/tools/libs/light/libxl.c b/tools/libs/light/libxl.c
index 04f037f3c1..a1fe16274d 100644
--- a/tools/libs/light/libxl.c
+++ b/tools/libs/light/libxl.c
@@ -546,38 +546,6 @@ libxl_numainfo *libxl_get_numainfo(libxl_ctx *ctx, int *nr)
     return ret;
 }
 
-static int libxl__xc_version_wrap(libxl__gc *gc, libxl_version_info *info,
-                                  xen_build_id_t *build)
-{
-    int r;
-
-    r = xc_version(CTX->xch, XENVER_build_id, build);
-    switch (r) {
-    case -EPERM:
-    case -ENODATA:
-    case 0:
-        info->build_id = libxl__strdup(NOGC, "");
-        break;
-
-    case -ENOBUFS:
-        break;
-
-    default:
-        if (r > 0) {
-            unsigned int i;
-
-            info->build_id = libxl__zalloc(NOGC, (r * 2) + 1);
-
-            for (i = 0; i < r ; i++)
-                snprintf(&info->build_id[i * 2], 3, "%02hhx", build->buf[i]);
-
-            r = 0;
-        }
-        break;
-    }
-    return r;
-}
-
 const libxl_version_info* libxl_get_version_info(libxl_ctx *ctx)
 {
     GC_INIT(ctx);
@@ -587,7 +555,6 @@ const libxl_version_info* libxl_get_version_info(libxl_ctx *ctx)
         xen_build_id_t build_id;
     } u;
     long xen_version;
-    int r;
     libxl_version_info *info = &ctx->version_info;
 
     if (info->xen_version_extra != NULL)
@@ -614,17 +581,8 @@ const libxl_version_info* libxl_get_version_info(libxl_ctx *ctx)
     info->pagesize = xc_version(ctx->xch, XENVER_pagesize, NULL);
 
     info->commandline = xc_xenver_commandline(ctx->xch);
+    info->build_id = xc_xenver_buildid(ctx->xch);
 
-    u.build_id.len = sizeof(u) - sizeof(u.build_id);
-    r = libxl__xc_version_wrap(gc, info, &u.build_id);
-    if (r == -ENOBUFS) {
-            xen_build_id_t *build_id;
-
-            build_id = libxl__zalloc(gc, info->pagesize);
-            build_id->len = info->pagesize - sizeof(*build_id);
-            r = libxl__xc_version_wrap(gc, info, build_id);
-            if (r) LOGEV(ERROR, r, "getting build_id");
-    }
  out:
     GC_FREE;
     return info;
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Mon Dec 23 10:22:15 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 23 Dec 2024 10:22:15 +0000
Received: from list by lists.xenproject.org with outflank-mailman.862822.1274353 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tPfZh-0006wJ-FK; Mon, 23 Dec 2024 10:22:09 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 862822.1274353; Mon, 23 Dec 2024 10:22:09 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tPfZh-0006wA-CX; Mon, 23 Dec 2024 10:22:09 +0000
Received: by outflank-mailman (input) for mailman id 862822;
 Mon, 23 Dec 2024 10:22:07 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tPfZf-0006w4-AQ
 for xen-changelog@lists.xenproject.org; Mon, 23 Dec 2024 10:22:07 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tPfZe-000XR0-2q
 for xen-changelog@lists.xenproject.org;
 Mon, 23 Dec 2024 10:22:07 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tPfZf-00FGgX-0S
 for xen-changelog@lists.xenproject.org;
 Mon, 23 Dec 2024 10:22:07 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=fn+whFGQuGKVQUQVe15Iwx/x5dlSzTB08k05ioaxYjY=; b=N9Ts11ZY5epPAC3Y20DDzSXB4x
	mKEi0ZRC1LxUSnTC5416XU8UYEf4AqrB814Hf9hNJi03kMoEMTUUr9sR9mlp+7ppW8xEFzwCYfdr+
	8/5N+0nNWAJOtpsd5TWdDHTHXOzUFgtEBwUuWnCTe07Rqpp3Sm14kRe/eBetbTm9fUk0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] CHANGELOG: Mention LLC coloring feature on Arm
Message-Id: <E1tPfZf-00FGgX-0S@xenbits.xenproject.org>
Date: Mon, 23 Dec 2024 10:22:07 +0000

commit 6419020270a13b297971ceedf8ee24532d325b2d
Author:     Michal Orzel <michal.orzel@amd.com>
AuthorDate: Fri Dec 20 09:19:40 2024 +0100
Commit:     Michal Orzel <michal.orzel@amd.com>
CommitDate: Mon Dec 23 08:20:27 2024 +0100

    CHANGELOG: Mention LLC coloring feature on Arm
    
    It's definitely worth mentioning as one of the most notable feature on
    Arm this release.
    
    Signed-off-by: Michal Orzel <michal.orzel@amd.com>
    Acked-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
---
 CHANGELOG.md | 1 +
 1 file changed, 1 insertion(+)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index fe6c4cf943..8507e6556a 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -21,6 +21,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
    - Support for NXP S32G3 Processors Family and NXP LINFlexD UART driver.
    - Basic handling for SCMI requests over SMC using Shared Memory, by allowing
      forwarding the calls to EL3 FW if coming from hwdom.
+   - Support for LLC (Last Level Cache) coloring.
  - On x86:
    - xl suspend/resume subcommands.
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Dec 23 11:11:09 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 23 Dec 2024 11:11:09 +0000
Received: from list by lists.xenproject.org with outflank-mailman.862868.1274397 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tPgL1-0006ci-Nx; Mon, 23 Dec 2024 11:11:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 862868.1274397; Mon, 23 Dec 2024 11: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 1tPgL1-0006cb-LD; Mon, 23 Dec 2024 11:11:03 +0000
Received: by outflank-mailman (input) for mailman id 862868;
 Mon, 23 Dec 2024 11:11:01 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tPgKz-0006cV-OW
 for xen-changelog@lists.xenproject.org; Mon, 23 Dec 2024 11:11:01 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tPgKz-000YTt-0Y
 for xen-changelog@lists.xenproject.org;
 Mon, 23 Dec 2024 11:11:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tPgKz-00FMKc-1E
 for xen-changelog@lists.xenproject.org;
 Mon, 23 Dec 2024 11:11:01 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=hceW20GFRn8nzYdH4N/Rn9Bhemx1QQI3BOHD8t+/BgU=; b=NH/NidfExk6RhzRBD+XczXufi2
	g/N6vWS+pJKNiG21JaAG3dkGLHR8iHajXVnddh5pD4l1N3VAsQhhKyngflpZcQmf3FrEl3zb8bKw9
	u/5twwMCSSwtMu4xtpV9HQcLlC9V8zfLzU+5+41QWOL6W/6fkJZ4UEtEPWlhvfOsQV3c=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] CHANGELOG: Mention LLC coloring feature on Arm
Message-Id: <E1tPgKz-00FMKc-1E@xenbits.xenproject.org>
Date: Mon, 23 Dec 2024 11:11:01 +0000

commit 6419020270a13b297971ceedf8ee24532d325b2d
Author:     Michal Orzel <michal.orzel@amd.com>
AuthorDate: Fri Dec 20 09:19:40 2024 +0100
Commit:     Michal Orzel <michal.orzel@amd.com>
CommitDate: Mon Dec 23 08:20:27 2024 +0100

    CHANGELOG: Mention LLC coloring feature on Arm
    
    It's definitely worth mentioning as one of the most notable feature on
    Arm this release.
    
    Signed-off-by: Michal Orzel <michal.orzel@amd.com>
    Acked-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
---
 CHANGELOG.md | 1 +
 1 file changed, 1 insertion(+)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index fe6c4cf943..8507e6556a 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -21,6 +21,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
    - Support for NXP S32G3 Processors Family and NXP LINFlexD UART driver.
    - Basic handling for SCMI requests over SMC using Shared Memory, by allowing
      forwarding the calls to EL3 FW if coming from hwdom.
+   - Support for LLC (Last Level Cache) coloring.
  - On x86:
    - xl suspend/resume subcommands.
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Mon Dec 30 22:33:14 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 30 Dec 2024 22:33:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.863637.1275007 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tSOJx-0007th-1d; Mon, 30 Dec 2024 22:33:09 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 863637.1275007; Mon, 30 Dec 2024 22:33:09 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tSOJw-0007tZ-Uz; Mon, 30 Dec 2024 22:33:08 +0000
Received: by outflank-mailman (input) for mailman id 863637;
 Mon, 30 Dec 2024 22:33:07 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tSOJv-0007tT-Oa
 for xen-changelog@lists.xenproject.org; Mon, 30 Dec 2024 22:33:07 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tSOJv-00Ce0A-0v
 for xen-changelog@lists.xenproject.org;
 Mon, 30 Dec 2024 22:33:07 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tSOJv-000d8y-1e
 for xen-changelog@lists.xenproject.org;
 Mon, 30 Dec 2024 22:33:07 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=eH5NVua0YAP8FS/W4NaRsR4VyGUlzEhyscjnMU6v8ic=; b=gorNwHE1Qkgslyby8BHzWeXlVW
	a8zeAigChTqomkocGyl56VOaDfoL69U1SyMjgLjCONIcf8erqXmlP6ESxUDsVRf0QKMDtTSxg5CXy
	zIghprOvqy5M9Fy9afb5HilajAZen5r/OpBeG6Rma6SUBLEfbUiSFN8bTf/u1GKEL0Es=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] docs/man/xen-vbd-interface.7: Provide properly-formatted NAME section
Message-Id: <E1tSOJv-000d8y-1e@xenbits.xenproject.org>
Date: Mon, 30 Dec 2024 22:33:07 +0000

commit 5becb6bbad69c73f13114955254e8a20365beca7
Author:     Ian Jackson <ian.jackson@citrix.com>
AuthorDate: Mon Dec 30 22:00:29 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Mon Dec 30 21:40:31 2024 +0000

    docs/man/xen-vbd-interface.7: Provide properly-formatted NAME section
    
    This manpage was omitted from
       docs/man: Provide properly-formatted NAME sections
       (423c4def1f7a01eeff56fa70564180640ef3af43)
    because I was previously building with markdown not installed.
    
    Signed-off-by: Ian Jackson <ian.jackson@citrix.com>
    Tested-by: Maximilian Engelhardt <maxi@daemonizer.de>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 docs/man/xen-vbd-interface.7.pandoc | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/docs/man/xen-vbd-interface.7.pandoc b/docs/man/xen-vbd-interface.7.pandoc
index ba0d159dfa..2f18d5b72e 100644
--- a/docs/man/xen-vbd-interface.7.pandoc
+++ b/docs/man/xen-vbd-interface.7.pandoc
@@ -1,3 +1,8 @@
+Name
+----
+
+xen-vbd-interface - Xen paravirtualised block device protocol
+
 Xen guest interface
 -------------------
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Dec 30 22:33:19 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 30 Dec 2024 22:33:19 +0000
Received: from list by lists.xenproject.org with outflank-mailman.863638.1275011 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tSOK7-0007vr-2a; Mon, 30 Dec 2024 22:33:19 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 863638.1275011; Mon, 30 Dec 2024 22:33:19 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tSOK7-0007vj-06; Mon, 30 Dec 2024 22:33:19 +0000
Received: by outflank-mailman (input) for mailman id 863638;
 Mon, 30 Dec 2024 22:33:17 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tSOK5-0007vZ-Nz
 for xen-changelog@lists.xenproject.org; Mon, 30 Dec 2024 22:33:17 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tSOK5-00Ce0E-1K
 for xen-changelog@lists.xenproject.org;
 Mon, 30 Dec 2024 22:33:17 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tSOK5-000d9o-23
 for xen-changelog@lists.xenproject.org;
 Mon, 30 Dec 2024 22:33:17 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=N1e3OIJQqLHTaa4gb1WTNMQGGEag3QHLp5NSW0mUWFQ=; b=p5niTF34TKYeeGd82kOkT8cq+s
	Unbo/LOLeuHjnccIVbtquFiPWvovfA+v8FLjISUQIu3dM/5rY5seK51Q4QJBrAZ1EZpYQXsodSkJT
	14MDpni459LXvXZ5Bh0O5fWfau1z1dGuXtsfw+4MNy5OOETtWC09HKf1xHZIRJ83+mJc=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] docs/man: fix typo: hexidecimal -> hexadecimal
Message-Id: <E1tSOK5-000d9o-23@xenbits.xenproject.org>
Date: Mon, 30 Dec 2024 22:33:17 +0000

commit c6d0d89c30c98416bec14a8709d80fd5627ff941
Author:     Maximilian Engelhardt <maxi@daemonizer.de>
AuthorDate: Mon Dec 30 22:00:32 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Mon Dec 30 21:40:35 2024 +0000

    docs/man: fix typo: hexidecimal -> hexadecimal
    
    This was found by the lintian tool (Debian package checker) during
    packaging xen for Debian.
    
    Signed-off-by: Maximilian Engelhardt <maxi@daemonizer.de>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 docs/man/xl-pci-configuration.5.pod | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/docs/man/xl-pci-configuration.5.pod b/docs/man/xl-pci-configuration.5.pod
index db3360307c..ec76f590b7 100644
--- a/docs/man/xl-pci-configuration.5.pod
+++ b/docs/man/xl-pci-configuration.5.pod
@@ -89,7 +89,7 @@ device. For example, running L<lspci(1)> in a Linux guest where B<vslot>
 was specified as C<8> would identify the device as C<00:08.0>. Virtual domain
 and bus numbers are always 0.
 
-B<NOTE:> This parameter is always parsed as a hexidecimal value.
+B<NOTE:> This parameter is always parsed as a hexadecimal value.
 
 =item Default Value
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Dec 30 22:33:29 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 30 Dec 2024 22:33:29 +0000
Received: from list by lists.xenproject.org with outflank-mailman.863639.1275015 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tSOKH-00080A-48; Mon, 30 Dec 2024 22:33:29 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 863639.1275015; Mon, 30 Dec 2024 22:33:29 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tSOKH-000802-1S; Mon, 30 Dec 2024 22:33:29 +0000
Received: by outflank-mailman (input) for mailman id 863639;
 Mon, 30 Dec 2024 22:33:27 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tSOKF-0007zh-RA
 for xen-changelog@lists.xenproject.org; Mon, 30 Dec 2024 22:33:27 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tSOKF-00Ce0b-1e
 for xen-changelog@lists.xenproject.org;
 Mon, 30 Dec 2024 22:33:27 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tSOKF-000dAg-2S
 for xen-changelog@lists.xenproject.org;
 Mon, 30 Dec 2024 22:33:27 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Lfclk6P2chbdsMRWUPODYPSqQzTsP66wJT+CRsG2Wr0=; b=tZnbiKBxDblq7Oh5N8SRwhMDeM
	hUhjFLNe1wZYpxkXyiFhmpAbmGUktbrRHj+j5awA8NOw7tds8Yk/Qto+r3pR+qiwcUDlj6LHADS7j
	MI5V3QgEOvv6rZBrGz62DM0Rw4M17DJTKdwFVHo0WYn0hQAqXnm/vlpWTx6+qyiWY4mI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] tools: fix typo: subsytem -> subsystem
Message-Id: <E1tSOKF-000dAg-2S@xenbits.xenproject.org>
Date: Mon, 30 Dec 2024 22:33:27 +0000

commit 6e1036b1976b5c4b6707ad441770007d347aff7c
Author:     Maximilian Engelhardt <maxi@daemonizer.de>
AuthorDate: Mon Dec 30 22:00:33 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Mon Dec 30 21:40:36 2024 +0000

    tools: fix typo: subsytem -> subsystem
    
    This was found by the lintian tool (Debian package checker) during
    packaging xen for Debian.
    
    Signed-off-by: Maximilian Engelhardt <maxi@daemonizer.de>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 tools/include/xenctrl.h   | 2 +-
 tools/misc/xen-memshare.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/include/xenctrl.h b/tools/include/xenctrl.h
index 5bb41c9c53..4955981231 100644
--- a/tools/include/xenctrl.h
+++ b/tools/include/xenctrl.h
@@ -2212,7 +2212,7 @@ int xc_memshr_domain_resume(xc_interface *xch,
  * May fail with:
  *  EINVAL if the gfn is not populated or not sharable (mmio, etc)
  *  ENOMEM if internal data structures cannot be allocated
- *  E2BIG if the page is being referenced by other subsytems (e.g. qemu)
+ *  E2BIG if the page is being referenced by other subsystems (e.g. qemu)
  *  ENOENT or EEXIST if there are internal hypervisor errors.
  */
 int xc_memshr_nominate_gfn(xc_interface *xch,
diff --git a/tools/misc/xen-memshare.c b/tools/misc/xen-memshare.c
index 8e5e22b9e9..ab30979ebc 100644
--- a/tools/misc/xen-memshare.c
+++ b/tools/misc/xen-memshare.c
@@ -30,7 +30,7 @@ static int usage(const char* prog)
     printf("  add-to-physmap <domid> <gfn> <source> <source-gfn> <source-handle>\n");
     printf("                          - Populate a page in a domain with a shared page.\n");
     printf("  debug-gfn <domid> <gfn> - Debug a particular domain and gfn.\n");
-    printf("  audit                   - Audit the sharing subsytem in Xen.\n");
+    printf("  audit                   - Audit the sharing subsystem in Xen.\n");
     return 1;
 }
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Dec 30 22:33:40 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 30 Dec 2024 22:33:40 +0000
Received: from list by lists.xenproject.org with outflank-mailman.863640.1275018 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tSOKS-00082k-5V; Mon, 30 Dec 2024 22:33:40 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 863640.1275018; Mon, 30 Dec 2024 22:33:40 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tSOKS-00082c-2u; Mon, 30 Dec 2024 22:33:40 +0000
Received: by outflank-mailman (input) for mailman id 863640;
 Mon, 30 Dec 2024 22:33:38 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tSOKP-00082O-VO
 for xen-changelog@lists.xenproject.org; Mon, 30 Dec 2024 22:33:37 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tSOKP-00Ce0f-20
 for xen-changelog@lists.xenproject.org;
 Mon, 30 Dec 2024 22:33:37 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tSOKP-000dC1-2m
 for xen-changelog@lists.xenproject.org;
 Mon, 30 Dec 2024 22:33:37 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=/p2wNvOHWt5FdtX0xhLhCOJg9izKPKYKZzSR0mGDFwY=; b=hvCFge3YbdioTjRemIhfoDnVJL
	KtEkQr+PucVsgLNxetsbwUfOnmupMlL7C/4RfdcCyxa3D0fH+23t10bUI4mS0rlTXkSnkRargMmf6
	Z3w8UlpKi/6oMYeJ0YfHu29z2X6JBT2iYLSbn1AVBLbFebdMoRZ4GogDYpDtuZKIsFd8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/arch/x86: make objdump output user locale agnostic
Message-Id: <E1tSOKP-000dC1-2m@xenbits.xenproject.org>
Date: Mon, 30 Dec 2024 22:33:37 +0000

commit 0d729221ab74c5d2571e71501dc63838acbf752a
Author:     Maximilian Engelhardt <maxi@daemonizer.de>
AuthorDate: Mon Dec 30 22:00:31 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Mon Dec 30 21:40:37 2024 +0000

    xen/arch/x86: make objdump output user locale agnostic
    
    The objdump output is fed to grep, so make sure it doesn't change with
    different user locales and break the grep parsing.
    This problem was identified while updating xen in Debian and the fix is
    needed for generating reproducible builds in varying environments.
    
    Signed-off-by: Maximilian Engelhardt <maxi@daemonizer.de>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/arch.mk | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/arch/x86/arch.mk b/xen/arch/x86/arch.mk
index 9dde8a5756..cb47d72991 100644
--- a/xen/arch/x86/arch.mk
+++ b/xen/arch/x86/arch.mk
@@ -109,7 +109,7 @@ endif
 ifeq ($(XEN_BUILD_PE),y)
 
 # Check if the linker produces fixups in PE by default
-efi-nr-fixups := $(shell $(OBJDUMP) -p $(efi-check).efi | grep '^[[:blank:]]*reloc[[:blank:]]*[0-9][[:blank:]].*DIR64$$' | wc -l)
+efi-nr-fixups := $(shell LC_ALL=C $(OBJDUMP) -p $(efi-check).efi | grep '^[[:blank:]]*reloc[[:blank:]]*[0-9][[:blank:]].*DIR64$$' | wc -l)
 
 ifeq ($(efi-nr-fixups),2)
 MKRELOC := :
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Dec 30 23:55:10 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 30 Dec 2024 23:55:10 +0000
Received: from list by lists.xenproject.org with outflank-mailman.863641.1275023 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tSPbD-0000Xo-Ig; Mon, 30 Dec 2024 23:55:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 863641.1275023; Mon, 30 Dec 2024 23: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 1tSPbD-0000Xh-G5; Mon, 30 Dec 2024 23:55:03 +0000
Received: by outflank-mailman (input) for mailman id 863641;
 Mon, 30 Dec 2024 23:55:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tSPbC-0000Xb-83
 for xen-changelog@lists.xenproject.org; Mon, 30 Dec 2024 23:55:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tSPbB-00CfZY-2P
 for xen-changelog@lists.xenproject.org;
 Mon, 30 Dec 2024 23:55:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tSPbB-000lM5-2s
 for xen-changelog@lists.xenproject.org;
 Mon, 30 Dec 2024 23:55:01 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=zJtdPjOUm7qyBGzShjvWg20fuH18jr9oOzbwSFsc8zQ=; b=juDxVb8eFFKf5YONglSg1KZMIg
	vJqHxD7R86S6rq5r/4Po07B6+DkoOM0+ODEaNo2viNkTm/A1tHxOiSekhUXnfAQzz3dFdgoQw5sw8
	M2IbTw3y+qD8pV/mRnQoguTEqypVXkQG9a6XiPrrjaYeL24Y3wkv4pOypKAXR9FuhiSk=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] docs/man/xen-vbd-interface.7: Provide properly-formatted NAME section
Message-Id: <E1tSPbB-000lM5-2s@xenbits.xenproject.org>
Date: Mon, 30 Dec 2024 23:55:01 +0000

commit 5becb6bbad69c73f13114955254e8a20365beca7
Author:     Ian Jackson <ian.jackson@citrix.com>
AuthorDate: Mon Dec 30 22:00:29 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Mon Dec 30 21:40:31 2024 +0000

    docs/man/xen-vbd-interface.7: Provide properly-formatted NAME section
    
    This manpage was omitted from
       docs/man: Provide properly-formatted NAME sections
       (423c4def1f7a01eeff56fa70564180640ef3af43)
    because I was previously building with markdown not installed.
    
    Signed-off-by: Ian Jackson <ian.jackson@citrix.com>
    Tested-by: Maximilian Engelhardt <maxi@daemonizer.de>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 docs/man/xen-vbd-interface.7.pandoc | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/docs/man/xen-vbd-interface.7.pandoc b/docs/man/xen-vbd-interface.7.pandoc
index ba0d159dfa..2f18d5b72e 100644
--- a/docs/man/xen-vbd-interface.7.pandoc
+++ b/docs/man/xen-vbd-interface.7.pandoc
@@ -1,3 +1,8 @@
+Name
+----
+
+xen-vbd-interface - Xen paravirtualised block device protocol
+
 Xen guest interface
 -------------------
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Mon Dec 30 23:55:12 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 30 Dec 2024 23:55:12 +0000
Received: from list by lists.xenproject.org with outflank-mailman.863642.1275027 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tSPbM-0000ZQ-Kb; Mon, 30 Dec 2024 23:55:12 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 863642.1275027; Mon, 30 Dec 2024 23: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 1tSPbM-0000ZJ-Hd; Mon, 30 Dec 2024 23:55:12 +0000
Received: by outflank-mailman (input) for mailman id 863642;
 Mon, 30 Dec 2024 23:55:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tSPbM-0000ZB-8a
 for xen-changelog@lists.xenproject.org; Mon, 30 Dec 2024 23:55:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tSPbL-00CfZc-2w
 for xen-changelog@lists.xenproject.org;
 Mon, 30 Dec 2024 23:55:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tSPbM-000lOK-0J
 for xen-changelog@lists.xenproject.org;
 Mon, 30 Dec 2024 23:55:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=5lJIr/VMGx8meJ2SEo8i7o3oPNhhNTzhlHSlP3d9x3Q=; b=HehbnLWB2DwPCCeE3M7krt/mde
	0uPYGrvzKcFAneEVdlD04r6KkVUJZsUzy+0jmQ2/zvHvLWC9rAEX3tNIRdN7+mYXXUrIpt7X8Khhz
	dfW/Ta/dD6aSVhINB+hc3Hy8UOvDg2DCH7G6lBMX/mKz7v/mCMxa14WM0cLFpF4DKqhk=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] docs/man: fix typo: hexidecimal -> hexadecimal
Message-Id: <E1tSPbM-000lOK-0J@xenbits.xenproject.org>
Date: Mon, 30 Dec 2024 23:55:12 +0000

commit c6d0d89c30c98416bec14a8709d80fd5627ff941
Author:     Maximilian Engelhardt <maxi@daemonizer.de>
AuthorDate: Mon Dec 30 22:00:32 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Mon Dec 30 21:40:35 2024 +0000

    docs/man: fix typo: hexidecimal -> hexadecimal
    
    This was found by the lintian tool (Debian package checker) during
    packaging xen for Debian.
    
    Signed-off-by: Maximilian Engelhardt <maxi@daemonizer.de>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 docs/man/xl-pci-configuration.5.pod | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/docs/man/xl-pci-configuration.5.pod b/docs/man/xl-pci-configuration.5.pod
index db3360307c..ec76f590b7 100644
--- a/docs/man/xl-pci-configuration.5.pod
+++ b/docs/man/xl-pci-configuration.5.pod
@@ -89,7 +89,7 @@ device. For example, running L<lspci(1)> in a Linux guest where B<vslot>
 was specified as C<8> would identify the device as C<00:08.0>. Virtual domain
 and bus numbers are always 0.
 
-B<NOTE:> This parameter is always parsed as a hexidecimal value.
+B<NOTE:> This parameter is always parsed as a hexadecimal value.
 
 =item Default Value
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Mon Dec 30 23:55:23 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 30 Dec 2024 23:55:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.863643.1275031 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tSPbX-0000cU-MC; Mon, 30 Dec 2024 23:55:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 863643.1275031; Mon, 30 Dec 2024 23: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 1tSPbX-0000cL-JK; Mon, 30 Dec 2024 23:55:23 +0000
Received: by outflank-mailman (input) for mailman id 863643;
 Mon, 30 Dec 2024 23:55:22 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tSPbW-0000c8-Cn
 for xen-changelog@lists.xenproject.org; Mon, 30 Dec 2024 23:55:22 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tSPbW-00CfZg-0D
 for xen-changelog@lists.xenproject.org;
 Mon, 30 Dec 2024 23:55:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tSPbW-000lOl-0s
 for xen-changelog@lists.xenproject.org;
 Mon, 30 Dec 2024 23:55:22 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=OA48j/pkkn/6VYnw1ghY+uYJD54xula6LAhrVkKM8C0=; b=pvrRuhgGshs719b3TVZWScpO76
	QWq2SVsVdP1Hd+jiFCWM7vch0WOsKgp9vHZU9NQbkHCkirRlQfO90StTVe84lfztqLtIXMW1JMuIC
	8WXC2uWPgVmXheiBSFKAFv2nCKyDH+Us5Pf4hkOmyWwuA9WLBvzKlTsK4jcyBHEuZJlE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools: fix typo: subsytem -> subsystem
Message-Id: <E1tSPbW-000lOl-0s@xenbits.xenproject.org>
Date: Mon, 30 Dec 2024 23:55:22 +0000

commit 6e1036b1976b5c4b6707ad441770007d347aff7c
Author:     Maximilian Engelhardt <maxi@daemonizer.de>
AuthorDate: Mon Dec 30 22:00:33 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Mon Dec 30 21:40:36 2024 +0000

    tools: fix typo: subsytem -> subsystem
    
    This was found by the lintian tool (Debian package checker) during
    packaging xen for Debian.
    
    Signed-off-by: Maximilian Engelhardt <maxi@daemonizer.de>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 tools/include/xenctrl.h   | 2 +-
 tools/misc/xen-memshare.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/include/xenctrl.h b/tools/include/xenctrl.h
index 5bb41c9c53..4955981231 100644
--- a/tools/include/xenctrl.h
+++ b/tools/include/xenctrl.h
@@ -2212,7 +2212,7 @@ int xc_memshr_domain_resume(xc_interface *xch,
  * May fail with:
  *  EINVAL if the gfn is not populated or not sharable (mmio, etc)
  *  ENOMEM if internal data structures cannot be allocated
- *  E2BIG if the page is being referenced by other subsytems (e.g. qemu)
+ *  E2BIG if the page is being referenced by other subsystems (e.g. qemu)
  *  ENOENT or EEXIST if there are internal hypervisor errors.
  */
 int xc_memshr_nominate_gfn(xc_interface *xch,
diff --git a/tools/misc/xen-memshare.c b/tools/misc/xen-memshare.c
index 8e5e22b9e9..ab30979ebc 100644
--- a/tools/misc/xen-memshare.c
+++ b/tools/misc/xen-memshare.c
@@ -30,7 +30,7 @@ static int usage(const char* prog)
     printf("  add-to-physmap <domid> <gfn> <source> <source-gfn> <source-handle>\n");
     printf("                          - Populate a page in a domain with a shared page.\n");
     printf("  debug-gfn <domid> <gfn> - Debug a particular domain and gfn.\n");
-    printf("  audit                   - Audit the sharing subsytem in Xen.\n");
+    printf("  audit                   - Audit the sharing subsystem in Xen.\n");
     return 1;
 }
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Mon Dec 30 23:55:33 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 30 Dec 2024 23:55:33 +0000
Received: from list by lists.xenproject.org with outflank-mailman.863644.1275034 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1tSPbh-0000f8-NS; Mon, 30 Dec 2024 23:55:33 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 863644.1275034; Mon, 30 Dec 2024 23: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 1tSPbh-0000f1-Kk; Mon, 30 Dec 2024 23:55:33 +0000
Received: by outflank-mailman (input) for mailman id 863644;
 Mon, 30 Dec 2024 23:55:32 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <infra@xenproject.org>) id 1tSPbg-0000ep-GK
 for xen-changelog@lists.xenproject.org; Mon, 30 Dec 2024 23:55:32 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tSPbg-00Cfa3-0Y
 for xen-changelog@lists.xenproject.org;
 Mon, 30 Dec 2024 23:55:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <infra@xenproject.org>) id 1tSPbg-000lPO-1M
 for xen-changelog@lists.xenproject.org;
 Mon, 30 Dec 2024 23:55:32 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
	d=xenproject.org; s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=4uYE5Sj08vuzJ3kAWcyPX6UnG6h2JTYol0PUty2J/24=; b=4t9JdWCbV8vywGX8k7k2iLCcvJ
	n3ymic5o8IOGtEycPTszpdu0gZiR/RdDM9pEEKahvtHzP2PHqfMeg8mWupXD4Eij9Vzv5ZKPS1BuK
	z7fiX2d7LPngw4G8NYQ8Uv13mqMwzYGzEqo7GrQFGzN/bz5MvX3dvta2F45/o6jcRcrU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/arch/x86: make objdump output user locale agnostic
Message-Id: <E1tSPbg-000lPO-1M@xenbits.xenproject.org>
Date: Mon, 30 Dec 2024 23:55:32 +0000

commit 0d729221ab74c5d2571e71501dc63838acbf752a
Author:     Maximilian Engelhardt <maxi@daemonizer.de>
AuthorDate: Mon Dec 30 22:00:31 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Mon Dec 30 21:40:37 2024 +0000

    xen/arch/x86: make objdump output user locale agnostic
    
    The objdump output is fed to grep, so make sure it doesn't change with
    different user locales and break the grep parsing.
    This problem was identified while updating xen in Debian and the fix is
    needed for generating reproducible builds in varying environments.
    
    Signed-off-by: Maximilian Engelhardt <maxi@daemonizer.de>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/arch.mk | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/arch/x86/arch.mk b/xen/arch/x86/arch.mk
index 9dde8a5756..cb47d72991 100644
--- a/xen/arch/x86/arch.mk
+++ b/xen/arch/x86/arch.mk
@@ -109,7 +109,7 @@ endif
 ifeq ($(XEN_BUILD_PE),y)
 
 # Check if the linker produces fixups in PE by default
-efi-nr-fixups := $(shell $(OBJDUMP) -p $(efi-check).efi | grep '^[[:blank:]]*reloc[[:blank:]]*[0-9][[:blank:]].*DIR64$$' | wc -l)
+efi-nr-fixups := $(shell LC_ALL=C $(OBJDUMP) -p $(efi-check).efi | grep '^[[:blank:]]*reloc[[:blank:]]*[0-9][[:blank:]].*DIR64$$' | wc -l)
 
 ifeq ($(efi-nr-fixups),2)
 MKRELOC := :
--
generated by git-patchbot for /home/xen/git/xen.git#master


