From xen-changelog-bounces@lists.xenproject.org Sat Feb 04 22:44:10 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 04 Feb 2023 22:44:10 +0000
Received: from list by lists.xenproject.org with outflank-mailman.489621.757955 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pORGN-0006c5-FV; Sat, 04 Feb 2023 22:44:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 489621.757955; Sat, 04 Feb 2023 22:44:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pORGN-0006bx-C7; Sat, 04 Feb 2023 22:44:03 +0000
Received: by outflank-mailman (input) for mailman id 489621;
 Sat, 04 Feb 2023 22:44: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 1pORGL-0006br-Ml
 for xen-changelog@lists.xenproject.org; Sat, 04 Feb 2023 22:44:01 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pORGL-0002F5-L1
 for xen-changelog@lists.xenproject.org; Sat, 04 Feb 2023 22:44:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pORGL-0003Uc-K3
 for xen-changelog@lists.xenproject.org; Sat, 04 Feb 2023 22:44:01 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Ks7BnP3D9atIE7l7EFcxhc7+9Hbwq8+yrCvui3SVaiE=; b=r3cgA/RfXcxUUe8SzEU0htYlv9
	mq+mfWcYe1RPuchb0oUgj6BC5qHoOMqacdljMn47XBSBpD00QkaOZJwwBOT2euQJ9Mf0NP9L59T0c
	nWqRbCJH6iZLK5+tJg3Y2DDD3O9e8bp3xYEk+2CRHl1ogOdZJr7IA8fV+QykK1zrEc70=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.17] Revert "tools/xenstore: simplify loop handling connection I/O"
Message-Id: <E1pORGL-0003Uc-K3@xenbits.xenproject.org>
Date: Sat, 04 Feb 2023 22:44:01 +0000

commit 2f8851c37f88e4eb4858e16626fcb2379db71a4f
Author:     Jason Andryuk <jandryuk@gmail.com>
AuthorDate: Thu Jan 26 11:00:24 2023 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Jan 26 11:00:24 2023 +0100

    Revert "tools/xenstore: simplify loop handling connection I/O"
    
    I'm observing guest kexec trigger xenstored to abort on a double free.
    
    gdb output:
    Program received signal SIGABRT, Aborted.
    __pthread_kill_implementation (no_tid=0, signo=6, threadid=140645614258112) at ./nptl/pthread_kill.c:44
    44    ./nptl/pthread_kill.c: No such file or directory.
    (gdb) bt
        at ./nptl/pthread_kill.c:44
        at ./nptl/pthread_kill.c:78
        at ./nptl/pthread_kill.c:89
        at ../sysdeps/posix/raise.c:26
        at talloc.c:119
        ptr=ptr@entry=0x559fae724290) at talloc.c:232
        at xenstored_core.c:2945
    (gdb) frame 5
        at talloc.c:119
    119            TALLOC_ABORT("Bad talloc magic value - double free");
    (gdb) frame 7
        at xenstored_core.c:2945
    2945                talloc_increase_ref_count(conn);
    (gdb) p conn
    $1 = (struct connection *) 0x559fae724290
    
    Looking at a xenstore trace, we have:
    IN 0x559fae71f250 20230120 17:40:53 READ (/local/domain/3/image/device-model-dom
    id )
    wrl: dom    0      1  msec      10000 credit     1000000 reserve        100 disc
    ard
    wrl: dom    3      1  msec      10000 credit     1000000 reserve        100 disc
    ard
    wrl: dom    0      0  msec      10000 credit     1000000 reserve          0 disc
    ard
    wrl: dom    3      0  msec      10000 credit     1000000 reserve          0 disc
    ard
    OUT 0x559fae71f250 20230120 17:40:53 ERROR (ENOENT )
    wrl: dom    0      1  msec      10000 credit     1000000 reserve        100 disc
    ard
    wrl: dom    3      1  msec      10000 credit     1000000 reserve        100 disc
    ard
    IN 0x559fae71f250 20230120 17:40:53 RELEASE (3 )
    DESTROY watch 0x559fae73f630
    DESTROY watch 0x559fae75ddf0
    DESTROY watch 0x559fae75ec30
    DESTROY watch 0x559fae75ea60
    DESTROY watch 0x559fae732c00
    DESTROY watch 0x559fae72cea0
    DESTROY watch 0x559fae728fc0
    DESTROY watch 0x559fae729570
    DESTROY connection 0x559fae724290
    orphaned node /local/domain/3/device/suspend/event-channel deleted
    orphaned node /local/domain/3/device/vbd/51712 deleted
    orphaned node /local/domain/3/device/vkbd/0 deleted
    orphaned node /local/domain/3/device/vif/0 deleted
    orphaned node /local/domain/3/control/shutdown deleted
    orphaned node /local/domain/3/control/feature-poweroff deleted
    orphaned node /local/domain/3/control/feature-reboot deleted
    orphaned node /local/domain/3/control/feature-suspend deleted
    orphaned node /local/domain/3/control/feature-s3 deleted
    orphaned node /local/domain/3/control/feature-s4 deleted
    orphaned node /local/domain/3/control/sysrq deleted
    orphaned node /local/domain/3/data deleted
    orphaned node /local/domain/3/drivers deleted
    orphaned node /local/domain/3/feature deleted
    orphaned node /local/domain/3/attr deleted
    orphaned node /local/domain/3/error deleted
    orphaned node /local/domain/3/console/backend-id deleted
    
    and no further output.
    
    The trace shows that DESTROY was called for connection 0x559fae724290,
    but that is the same pointer (conn) main() was looping through from
    connections.  So it wasn't actually removed from the connections list?
    
    Reverting commit e8e6e42279a5 "tools/xenstore: simplify loop handling
    connection I/O" fixes the abort/double free.  I think the use of
    list_for_each_entry_safe is incorrect.  list_for_each_entry_safe makes
    traversal safe for deleting the current iterator, but RELEASE/do_release
    will delete some other entry in the connections list.  I think the
    observed abort is because list_for_each_entry has next pointing to the
    deleted connection, and it is used in the subsequent iteration.
    
    Add a comment explaining the unsuitability of list_for_each_entry_safe.
    Also notice that the old code takes a reference on next which would
    prevents a use-after-free.
    
    This reverts commit e8e6e42279a5723239c5c40ba4c7f579a979465d.
    
    This is XSA-425/CVE-2022-42330.
    
    Fixes: e8e6e42279a5 ("tools/xenstore: simplify loop handling connection I/O")
    Signed-off-by: Jason Andryuk <jandryuk@gmail.com>
    Reviewed-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Julien Grall <jgrall@amazon.com>
---
 tools/xenstore/xenstored_core.c | 19 +++++++++++++++++--
 1 file changed, 17 insertions(+), 2 deletions(-)

diff --git a/tools/xenstore/xenstored_core.c b/tools/xenstore/xenstored_core.c
index 476d5c6d51..56dbdc2530 100644
--- a/tools/xenstore/xenstored_core.c
+++ b/tools/xenstore/xenstored_core.c
@@ -2935,8 +2935,23 @@ int main(int argc, char *argv[])
 			}
 		}
 
-		list_for_each_entry_safe(conn, next, &connections, list) {
-			talloc_increase_ref_count(conn);
+		/*
+		 * list_for_each_entry_safe is not suitable here because
+		 * handle_input may delete entries besides the current one, but
+		 * those may be in the temporary next which would trigger a
+		 * use-after-free.  list_for_each_entry_safe is only safe for
+		 * deleting the current entry.
+		 */
+		next = list_entry(connections.next, typeof(*conn), list);
+		if (&next->list != &connections)
+			talloc_increase_ref_count(next);
+		while (&next->list != &connections) {
+			conn = next;
+
+			next = list_entry(conn->list.next,
+					  typeof(*conn), list);
+			if (&next->list != &connections)
+				talloc_increase_ref_count(next);
 
 			if (conn_can_read(conn))
 				handle_input(conn);
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.17


From xen-changelog-bounces@lists.xenproject.org Sun Feb 05 04:11:10 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 05 Feb 2023 04:11:10 +0000
Received: from list by lists.xenproject.org with outflank-mailman.489677.758014 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pOWMq-0007mP-LL; Sun, 05 Feb 2023 04:11:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 489677.758014; Sun, 05 Feb 2023 04:11:04 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pOWMq-0007mH-ID; Sun, 05 Feb 2023 04:11:04 +0000
Received: by outflank-mailman (input) for mailman id 489677;
 Sun, 05 Feb 2023 04:11:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pOWMo-0007m9-Ms
 for xen-changelog@lists.xenproject.org; Sun, 05 Feb 2023 04:11:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pOWMo-0000qZ-L0
 for xen-changelog@lists.xenproject.org; Sun, 05 Feb 2023 04:11:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pOWMo-0008Cn-Jr
 for xen-changelog@lists.xenproject.org; Sun, 05 Feb 2023 04:11:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=fWuJBRahXjv3BEzjh3yhb4GJGUxmqaZVZEyucRW7+DA=; b=bt4DpLV1QGrGuw2OSJAhMiup+s
	uG7JqK6+t2F+cia6mKfRGNlzKdsohtvzrb8NT/IjQj1e8E1tzW+wPfcP3+AqSngRFZO6ztBXGNf61
	FF1SCPvKgCWUkwrJk90TMCSKDpwXm7wSI8R9dmmttzxseaNmVUzZZL41KUCYbpCdwA78=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86: split populating of struct vcpu_time_info into a separate function
Message-Id: <E1pOWMo-0008Cn-Jr@xenbits.xenproject.org>
Date: Sun, 05 Feb 2023 04:11:02 +0000

commit 20279afd732371dd2534380d27aa6d1863d82d1f
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Fri Jan 20 09:12:48 2023 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Jan 20 09:12:48 2023 +0100

    x86: split populating of struct vcpu_time_info into a separate function
    
    This is to facilitate subsequent re-use of this code.
    
    While doing so add const in a number of places, extending to
    gtime_to_gtsc() and then for symmetry also its inverse function.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper@citrix.com>
---
 xen/arch/x86/include/asm/time.h |  4 ++--
 xen/arch/x86/time.c             | 51 +++++++++++++++++++++++------------------
 2 files changed, 31 insertions(+), 24 deletions(-)

diff --git a/xen/arch/x86/include/asm/time.h b/xen/arch/x86/include/asm/time.h
index 2a57d930ef..dc2e636916 100644
--- a/xen/arch/x86/include/asm/time.h
+++ b/xen/arch/x86/include/asm/time.h
@@ -52,8 +52,8 @@ uint64_t cf_check acpi_pm_tick_to_ns(uint64_t ticks);
 uint64_t tsc_ticks2ns(uint64_t ticks);
 
 uint64_t pv_soft_rdtsc(const struct vcpu *v, const struct cpu_user_regs *regs);
-u64 gtime_to_gtsc(struct domain *d, u64 time);
-u64 gtsc_to_gtime(struct domain *d, u64 tsc);
+uint64_t gtime_to_gtsc(const struct domain *d, uint64_t time);
+uint64_t gtsc_to_gtime(const struct domain *d, uint64_t tsc);
 
 int tsc_set_info(struct domain *d, uint32_t tsc_mode, uint64_t elapsed_nsec,
                  uint32_t gtsc_khz, uint32_t incarnation);
diff --git a/xen/arch/x86/time.c b/xen/arch/x86/time.c
index d882b43cf0..7bee4f784f 100644
--- a/xen/arch/x86/time.c
+++ b/xen/arch/x86/time.c
@@ -1373,18 +1373,14 @@ uint64_t tsc_ticks2ns(uint64_t ticks)
     return scale_delta(ticks, &t->tsc_scale);
 }
 
-static void __update_vcpu_system_time(struct vcpu *v, int force)
+static void collect_time_info(const struct vcpu *v,
+                              struct vcpu_time_info *u)
 {
-    const struct cpu_time *t;
-    struct vcpu_time_info *u, _u = {};
-    struct domain *d = v->domain;
+    const struct cpu_time *t = &this_cpu(cpu_time);
+    const struct domain *d = v->domain;
     s_time_t tsc_stamp;
 
-    if ( v->vcpu_info == NULL )
-        return;
-
-    t = &this_cpu(cpu_time);
-    u = &vcpu_info(v, time);
+    memset(u, 0, sizeof(*u));
 
     if ( d->arch.vtsc )
     {
@@ -1392,7 +1388,7 @@ static void __update_vcpu_system_time(struct vcpu *v, int force)
 
         if ( is_hvm_domain(d) )
         {
-            struct pl_time *pl = v->domain->arch.hvm.pl_time;
+            const struct pl_time *pl = d->arch.hvm.pl_time;
 
             stime += pl->stime_offset + v->arch.hvm.stime_offset;
             if ( stime >= 0 )
@@ -1403,27 +1399,27 @@ static void __update_vcpu_system_time(struct vcpu *v, int force)
         else
             tsc_stamp = gtime_to_gtsc(d, stime);
 
-        _u.tsc_to_system_mul = d->arch.vtsc_to_ns.mul_frac;
-        _u.tsc_shift         = d->arch.vtsc_to_ns.shift;
+        u->tsc_to_system_mul = d->arch.vtsc_to_ns.mul_frac;
+        u->tsc_shift         = d->arch.vtsc_to_ns.shift;
     }
     else
     {
         if ( is_hvm_domain(d) && hvm_tsc_scaling_supported )
         {
             tsc_stamp            = hvm_scale_tsc(d, t->stamp.local_tsc);
-            _u.tsc_to_system_mul = d->arch.vtsc_to_ns.mul_frac;
-            _u.tsc_shift         = d->arch.vtsc_to_ns.shift;
+            u->tsc_to_system_mul = d->arch.vtsc_to_ns.mul_frac;
+            u->tsc_shift         = d->arch.vtsc_to_ns.shift;
         }
         else
         {
             tsc_stamp            = t->stamp.local_tsc;
-            _u.tsc_to_system_mul = t->tsc_scale.mul_frac;
-            _u.tsc_shift         = t->tsc_scale.shift;
+            u->tsc_to_system_mul = t->tsc_scale.mul_frac;
+            u->tsc_shift         = t->tsc_scale.shift;
         }
     }
 
-    _u.tsc_timestamp = tsc_stamp;
-    _u.system_time   = t->stamp.local_stime;
+    u->tsc_timestamp = tsc_stamp;
+    u->system_time   = t->stamp.local_stime;
 
     /*
      * It's expected that domains cope with this bit changing on every
@@ -1431,10 +1427,21 @@ static void __update_vcpu_system_time(struct vcpu *v, int force)
      * or if it further requires monotonicity checks with other vcpus.
      */
     if ( clocksource_is_tsc() )
-        _u.flags |= XEN_PVCLOCK_TSC_STABLE_BIT;
+        u->flags |= XEN_PVCLOCK_TSC_STABLE_BIT;
 
     if ( is_hvm_domain(d) )
-        _u.tsc_timestamp += v->arch.hvm.cache_tsc_offset;
+        u->tsc_timestamp += v->arch.hvm.cache_tsc_offset;
+}
+
+static void __update_vcpu_system_time(struct vcpu *v, int force)
+{
+    struct vcpu_time_info *u = &vcpu_info(v, time), _u;
+    const struct domain *d = v->domain;
+
+    if ( v->vcpu_info == NULL )
+        return;
+
+    collect_time_info(v, &_u);
 
     /* Don't bother unless timestamp record has changed or we are forced. */
     _u.version = u->version; /* make versions match for memcmp test */
@@ -2476,7 +2483,7 @@ static int __init cf_check tsc_parse(const char *s)
 }
 custom_param("tsc", tsc_parse);
 
-u64 gtime_to_gtsc(struct domain *d, u64 time)
+uint64_t gtime_to_gtsc(const struct domain *d, uint64_t time)
 {
     if ( !is_hvm_domain(d) )
     {
@@ -2488,7 +2495,7 @@ u64 gtime_to_gtsc(struct domain *d, u64 time)
     return scale_delta(time, &d->arch.ns_to_vtsc);
 }
 
-u64 gtsc_to_gtime(struct domain *d, u64 tsc)
+uint64_t gtsc_to_gtime(const struct domain *d, uint64_t tsc)
 {
     u64 time = scale_delta(tsc, &d->arch.vtsc_to_ns);
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sun Feb 05 04:11:14 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 05 Feb 2023 04:11:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.489678.758018 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pOWN0-0007oo-NI; Sun, 05 Feb 2023 04:11:14 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 489678.758018; Sun, 05 Feb 2023 04:11:14 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pOWN0-0007oh-K7; Sun, 05 Feb 2023 04:11:14 +0000
Received: by outflank-mailman (input) for mailman id 489678;
 Sun, 05 Feb 2023 04:11:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pOWMy-0007oL-QG
 for xen-changelog@lists.xenproject.org; Sun, 05 Feb 2023 04:11:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pOWMy-0000qh-PV
 for xen-changelog@lists.xenproject.org; Sun, 05 Feb 2023 04:11:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pOWMy-0008DL-No
 for xen-changelog@lists.xenproject.org; Sun, 05 Feb 2023 04:11:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=XigbXQuvCQNqcX0+089nDIfo54PAVw6eQdDLY+o9U28=; b=eL1XSL5mQt70jDLL7w7GHveyjV
	8eM1FUyqLt8QzZEuOIh9eYHth9kUjZb1eKfIMGsTMAtuq94npYc2ELEbh1hJWoytr0e+wFTOwW9Ri
	4DnWyifht7LuCfl2pOyCXkwiBwtC/CMF5mGrsnAZh2iGSqVViiEs1g1mhWsSJ8aUId1A=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/shadow: L2H shadow type is PV32-only
Message-Id: <E1pOWMy-0008DL-No@xenbits.xenproject.org>
Date: Sun, 05 Feb 2023 04:11:12 +0000

commit 1894049fa283308d5f90446370be1ade7afe8975
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Fri Jan 20 09:17:33 2023 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Jan 20 09:17:33 2023 +0100

    x86/shadow: L2H shadow type is PV32-only
    
    Like for the various HVM-only types, save a little bit of code by suitably
    "masking" this type out when !PV32.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/mm/shadow/common.c  | 12 +++++++++++
 xen/arch/x86/mm/shadow/hvm.c     |  2 +-
 xen/arch/x86/mm/shadow/multi.c   | 43 ++++++++++++++++++++++++----------------
 xen/arch/x86/mm/shadow/private.h |  8 ++++++++
 4 files changed, 47 insertions(+), 18 deletions(-)

diff --git a/xen/arch/x86/mm/shadow/common.c b/xen/arch/x86/mm/shadow/common.c
index 8b4bea5f92..26901b8b3b 100644
--- a/xen/arch/x86/mm/shadow/common.c
+++ b/xen/arch/x86/mm/shadow/common.c
@@ -1791,9 +1791,11 @@ void sh_destroy_shadow(struct domain *d, mfn_t smfn)
     case SH_type_fl1_64_shadow:
         SHADOW_INTERNAL_NAME(sh_destroy_l1_shadow, 4)(d, smfn);
         break;
+#ifdef CONFIG_PV32
     case SH_type_l2h_64_shadow:
         ASSERT(is_pv_32bit_domain(d));
         /* Fall through... */
+#endif
     case SH_type_l2_64_shadow:
         SHADOW_INTERNAL_NAME(sh_destroy_l2_shadow, 4)(d, smfn);
         break;
@@ -2146,7 +2148,9 @@ static int sh_remove_shadow_via_pointer(struct domain *d, mfn_t smfn)
 #endif
     case SH_type_l1_64_shadow:
     case SH_type_l2_64_shadow:
+#ifdef CONFIG_PV32
     case SH_type_l2h_64_shadow:
+#endif
     case SH_type_l3_64_shadow:
     case SH_type_l4_64_shadow:
         SHADOW_INTERNAL_NAME(sh_clear_shadow_entry, 4)(d, vaddr, pmfn);
@@ -2184,7 +2188,9 @@ void sh_remove_shadows(struct domain *d, mfn_t gmfn, int fast, int all)
         [SH_type_l2_pae_shadow] = SHADOW_INTERNAL_NAME(sh_remove_l1_shadow, 3),
 #endif
         [SH_type_l2_64_shadow] = SHADOW_INTERNAL_NAME(sh_remove_l1_shadow, 4),
+#ifdef CONFIG_PV32
         [SH_type_l2h_64_shadow] = SHADOW_INTERNAL_NAME(sh_remove_l1_shadow, 4),
+#endif
         [SH_type_l3_64_shadow] = SHADOW_INTERNAL_NAME(sh_remove_l2_shadow, 4),
         [SH_type_l4_64_shadow] = SHADOW_INTERNAL_NAME(sh_remove_l3_shadow, 4),
     };
@@ -2197,7 +2203,9 @@ void sh_remove_shadows(struct domain *d, mfn_t gmfn, int fast, int all)
 #endif
         [SH_type_l1_64_shadow] = SHF_L2H_64 | SHF_L2_64,
         [SH_type_l2_64_shadow] = SHF_L3_64,
+#ifdef CONFIG_PV32
         [SH_type_l2h_64_shadow] = SHF_L3_64,
+#endif
         [SH_type_l3_64_shadow] = SHF_L4_64,
     };
 
@@ -2261,7 +2269,9 @@ void sh_remove_shadows(struct domain *d, mfn_t gmfn, int fast, int all)
 #endif
     DO_UNSHADOW(SH_type_l4_64_shadow);
     DO_UNSHADOW(SH_type_l3_64_shadow);
+#ifdef CONFIG_PV32
     DO_UNSHADOW(SH_type_l2h_64_shadow);
+#endif
     DO_UNSHADOW(SH_type_l2_64_shadow);
     DO_UNSHADOW(SH_type_l1_64_shadow);
 
@@ -3268,7 +3278,9 @@ void shadow_audit_tables(struct vcpu *v)
         [SH_type_l1_64_shadow] = SHADOW_INTERNAL_NAME(sh_audit_l1_table, 4),
         [SH_type_fl1_64_shadow] = SHADOW_INTERNAL_NAME(sh_audit_fl1_table, 4),
         [SH_type_l2_64_shadow] = SHADOW_INTERNAL_NAME(sh_audit_l2_table, 4),
+# ifdef CONFIG_PV32
         [SH_type_l2h_64_shadow] = SHADOW_INTERNAL_NAME(sh_audit_l2_table, 4),
+# endif
         [SH_type_l3_64_shadow] = SHADOW_INTERNAL_NAME(sh_audit_l3_table, 4),
         [SH_type_l4_64_shadow] = SHADOW_INTERNAL_NAME(sh_audit_l4_table, 4),
 #endif
diff --git a/xen/arch/x86/mm/shadow/hvm.c b/xen/arch/x86/mm/shadow/hvm.c
index f14fc42eab..918865cf1b 100644
--- a/xen/arch/x86/mm/shadow/hvm.c
+++ b/xen/arch/x86/mm/shadow/hvm.c
@@ -56,7 +56,7 @@ const uint8_t sh_type_to_size[] = {
     [SH_type_l1_64_shadow]   = 1,
     [SH_type_fl1_64_shadow]  = 1,
     [SH_type_l2_64_shadow]   = 1,
-    [SH_type_l2h_64_shadow]  = 1,
+/*  [SH_type_l2h_64_shadow]  = 1,  PV32-only */
     [SH_type_l3_64_shadow]   = 1,
     [SH_type_l4_64_shadow]   = 1,
     [SH_type_p2m_table]      = 1,
diff --git a/xen/arch/x86/mm/shadow/multi.c b/xen/arch/x86/mm/shadow/multi.c
index cd5a778d52..eb90bf2b15 100644
--- a/xen/arch/x86/mm/shadow/multi.c
+++ b/xen/arch/x86/mm/shadow/multi.c
@@ -97,6 +97,13 @@ static void sh_flush_local(const struct domain *d)
     flush_local(guest_flush_tlb_flags(d));
 }
 
+#if GUEST_PAGING_LEVELS >= 4 && defined(CONFIG_PV32)
+#define ASSERT_VALID_L2(t) \
+    ASSERT((t) == SH_type_l2_shadow || (t) == SH_type_l2h_shadow)
+#else
+#define ASSERT_VALID_L2(t) ASSERT((t) == SH_type_l2_shadow)
+#endif
+
 /**************************************************************************/
 /* Hash table mapping from guest pagetables to shadows
  *
@@ -337,7 +344,7 @@ static void sh_audit_gw(struct vcpu *v, const walk_t *gw)
         if ( mfn_valid((smfn = get_shadow_status(d, gw->l2mfn,
                                                  SH_type_l2_shadow))) )
             (void) sh_audit_l2_table(v, smfn, INVALID_MFN);
-#if GUEST_PAGING_LEVELS >= 4 /* 32-bit PV only */
+#if GUEST_PAGING_LEVELS >= 4 && defined(CONFIG_PV32)
         if ( mfn_valid((smfn = get_shadow_status(d, gw->l2mfn,
                                                  SH_type_l2h_shadow))) )
             (void) sh_audit_l2_table(v, smfn, INVALID_MFN);
@@ -859,13 +866,12 @@ do {                                                                        \
     int _i;                                                                 \
     int _xen = !shadow_mode_external(_dom);                                 \
     shadow_l2e_t *_sp = map_domain_page((_sl2mfn));                         \
-    ASSERT(mfn_to_page(_sl2mfn)->u.sh.type == SH_type_l2_64_shadow ||\
-           mfn_to_page(_sl2mfn)->u.sh.type == SH_type_l2h_64_shadow);\
+    ASSERT_VALID_L2(mfn_to_page(_sl2mfn)->u.sh.type);                       \
     for ( _i = 0; _i < SHADOW_L2_PAGETABLE_ENTRIES; _i++ )                  \
     {                                                                       \
         if ( (!(_xen))                                                      \
              || !is_pv_32bit_domain(_dom)                                   \
-             || mfn_to_page(_sl2mfn)->u.sh.type != SH_type_l2h_64_shadow    \
+             || mfn_to_page(_sl2mfn)->u.sh.type == SH_type_l2_64_shadow     \
              || (_i < COMPAT_L2_PAGETABLE_FIRST_XEN_SLOT(_dom)) )           \
         {                                                                   \
             (_sl2e) = _sp + _i;                                             \
@@ -989,6 +995,7 @@ sh_make_shadow(struct vcpu *v, mfn_t gmfn, u32 shadow_type)
         }
         break;
 
+#ifdef CONFIG_PV32
         case SH_type_l2h_shadow:
             BUILD_BUG_ON(sizeof(l2_pgentry_t) != sizeof(shadow_l2e_t));
             if ( is_pv_32bit_domain(d) )
@@ -999,6 +1006,8 @@ sh_make_shadow(struct vcpu *v, mfn_t gmfn, u32 shadow_type)
                 unmap_domain_page(l2t);
             }
             break;
+#endif
+
         default: /* Do nothing */ break;
         }
     }
@@ -1120,11 +1129,13 @@ static shadow_l2e_t * shadow_get_and_create_l2e(struct vcpu *v,
         shadow_l3e_t new_sl3e;
         unsigned int t = SH_type_l2_shadow;
 
+#ifdef CONFIG_PV32
         /* Tag compat L2 containing hypervisor (m2p) mappings */
         if ( is_pv_32bit_domain(d) &&
              guest_l4_table_offset(gw->va) == 0 &&
              guest_l3_table_offset(gw->va) == 3 )
             t = SH_type_l2h_shadow;
+#endif
 
         /* No l2 shadow installed: find and install it. */
         *sl2mfn = get_shadow_status(d, gw->l2mfn, t);
@@ -1334,11 +1345,7 @@ void sh_destroy_l2_shadow(struct domain *d, mfn_t smfn)
 
     SHADOW_DEBUG(DESTROY_SHADOW, "%"PRI_mfn"\n", mfn_x(smfn));
 
-#if GUEST_PAGING_LEVELS >= 4
-    ASSERT(t == SH_type_l2_shadow || t == SH_type_l2h_shadow);
-#else
-    ASSERT(t == SH_type_l2_shadow);
-#endif
+    ASSERT_VALID_L2(t);
     ASSERT(sp->u.sh.head);
 
     /* Record that the guest page isn't shadowed any more (in this type) */
@@ -1862,7 +1869,7 @@ int
 sh_map_and_validate_gl2he(struct vcpu *v, mfn_t gl2mfn,
                            void *new_gl2p, u32 size)
 {
-#if GUEST_PAGING_LEVELS >= 4
+#if GUEST_PAGING_LEVELS >= 4 && defined(CONFIG_PV32)
     return sh_map_and_validate(v, gl2mfn, new_gl2p, size,
                                 SH_type_l2h_shadow,
                                 shadow_l2_index,
@@ -3647,7 +3654,7 @@ void sh_clear_shadow_entry(struct domain *d, void *ep, mfn_t smfn)
         shadow_set_l1e(d, ep, shadow_l1e_empty(), p2m_invalid, smfn);
         break;
     case SH_type_l2_shadow:
-#if GUEST_PAGING_LEVELS >= 4
+#if GUEST_PAGING_LEVELS >= 4 && defined(CONFIG_PV32)
     case SH_type_l2h_shadow:
 #endif
         shadow_set_l2e(d, ep, shadow_l2e_empty(), smfn);
@@ -4100,14 +4107,16 @@ int cf_check sh_audit_l3_table(struct vcpu *v, mfn_t sl3mfn, mfn_t x)
 
         if ( SHADOW_AUDIT & SHADOW_AUDIT_ENTRIES_MFNS )
         {
+            unsigned int t = SH_type_l2_shadow;
+
             gfn = guest_l3e_get_gfn(*gl3e);
             mfn = shadow_l3e_get_mfn(*sl3e);
-            gmfn = get_shadow_status(d, get_gfn_query_unlocked(
-                                        d, gfn_x(gfn), &p2mt),
-                                     (is_pv_32bit_domain(d) &&
-                                      guest_index(gl3e) == 3)
-                                     ? SH_type_l2h_shadow
-                                     : SH_type_l2_shadow);
+#ifdef CONFIG_PV32
+            if ( guest_index(gl3e) == 3 && is_pv_32bit_domain(d) )
+                t = SH_type_l2h_shadow;
+#endif
+            gmfn = get_shadow_status(
+                       d, get_gfn_query_unlocked(d, gfn_x(gfn), &p2mt), t);
             if ( !mfn_eq(gmfn, mfn) )
                 AUDIT_FAIL(3, "bad translation: gfn %" SH_PRI_gfn
                            " --> %" PRI_mfn " != mfn %" PRI_mfn,
diff --git a/xen/arch/x86/mm/shadow/private.h b/xen/arch/x86/mm/shadow/private.h
index f080baff79..7d6c846c80 100644
--- a/xen/arch/x86/mm/shadow/private.h
+++ b/xen/arch/x86/mm/shadow/private.h
@@ -209,6 +209,10 @@ extern void shadow_audit_tables(struct vcpu *v);
 #define SH_type_unused        10U
 #endif
 
+#ifndef CONFIG_PV32 /* Unused (but uglier to #ifdef above): */
+#undef SH_type_l2h_64_shadow
+#endif
+
 /*
  * What counts as a pinnable shadow?
  */
@@ -286,7 +290,11 @@ static inline void sh_terminate_list(struct page_list_head *tmp_list)
 #define SHF_L1_64   (1u << SH_type_l1_64_shadow)
 #define SHF_FL1_64  (1u << SH_type_fl1_64_shadow)
 #define SHF_L2_64   (1u << SH_type_l2_64_shadow)
+#ifdef CONFIG_PV32
 #define SHF_L2H_64  (1u << SH_type_l2h_64_shadow)
+#else
+#define SHF_L2H_64  0
+#endif
 #define SHF_L3_64   (1u << SH_type_l3_64_shadow)
 #define SHF_L4_64   (1u << SH_type_l4_64_shadow)
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sun Feb 05 04:11:24 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 05 Feb 2023 04:11:24 +0000
Received: from list by lists.xenproject.org with outflank-mailman.489679.758021 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pOWNA-0007ry-Oq; Sun, 05 Feb 2023 04:11:24 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 489679.758021; Sun, 05 Feb 2023 04:11:24 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pOWNA-0007rq-M2; Sun, 05 Feb 2023 04:11:24 +0000
Received: by outflank-mailman (input) for mailman id 489679;
 Sun, 05 Feb 2023 04:11:22 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pOWN8-0007rR-TB
 for xen-changelog@lists.xenproject.org; Sun, 05 Feb 2023 04:11:22 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pOWN8-0000r2-SP
 for xen-changelog@lists.xenproject.org; Sun, 05 Feb 2023 04:11:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pOWN8-0008Do-Ro
 for xen-changelog@lists.xenproject.org; Sun, 05 Feb 2023 04:11:22 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=kIxVOX0sNubq5nox51HTa2YOJgwuT30J77EfhXLKEvU=; b=fz83MDAq+3n9/10rXpdBNRHv5l
	UHUGA0e4mGecfwzaeFnXg+7wr6BBB0C6Z3tucr0I8lP8JWy5V3EikezUVQVfNvWqtVHPSp7BQtHFa
	SIZKC4wQ9ZWOgoxgVrefw8cnmj0cWgm8wQPHRdkHqlMmL2N1+4xXjodjxiJltZ4R8Agk=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] include/types: move stddef.h-kind types to common header
Message-Id: <E1pOWN8-0008Do-Ro@xenbits.xenproject.org>
Date: Sun, 05 Feb 2023 04:11:22 +0000

commit 321b1b5eb351a5836d26817d7db48052e623b411
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Fri Jan 20 09:18:39 2023 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Jan 20 09:18:39 2023 +0100

    include/types: move stddef.h-kind types to common header
    
    size_t, ssize_t, and ptrdiff_t are all expected to be uniformly defined
    on any ports Xen might gain. In particular I hope new ports can rely on
    __SIZE_TYPE__ and __PTRDIFF_TYPE__ being made available by the compiler.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
---
 xen/arch/arm/include/asm/types.h | 13 -------------
 xen/arch/x86/include/asm/types.h | 13 -------------
 xen/include/xen/types.h          | 13 +++++++++++++
 3 files changed, 13 insertions(+), 26 deletions(-)

diff --git a/xen/arch/arm/include/asm/types.h b/xen/arch/arm/include/asm/types.h
index 083acbd151..576e971fe1 100644
--- a/xen/arch/arm/include/asm/types.h
+++ b/xen/arch/arm/include/asm/types.h
@@ -54,19 +54,6 @@ typedef u64 register_t;
 #define PRIregister "016lx"
 #endif
 
-#if defined(__SIZE_TYPE__)
-typedef __SIZE_TYPE__ size_t;
-#else
-typedef unsigned long size_t;
-#endif
-typedef signed long ssize_t;
-
-#if defined(__PTRDIFF_TYPE__)
-typedef __PTRDIFF_TYPE__ ptrdiff_t;
-#else
-typedef signed long ptrdiff_t;
-#endif
-
 #endif /* __ASSEMBLY__ */
 
 #endif /* __ARM_TYPES_H__ */
diff --git a/xen/arch/x86/include/asm/types.h b/xen/arch/x86/include/asm/types.h
index 7817132048..0e9cfdece8 100644
--- a/xen/arch/x86/include/asm/types.h
+++ b/xen/arch/x86/include/asm/types.h
@@ -32,19 +32,6 @@ typedef unsigned long paddr_t;
 #define INVALID_PADDR (~0UL)
 #define PRIpaddr "016lx"
 
-#if defined(__SIZE_TYPE__)
-typedef __SIZE_TYPE__ size_t;
-#else
-typedef unsigned long size_t;
-#endif
-typedef signed long ssize_t;
-
-#if defined(__PTRDIFF_TYPE__)
-typedef __PTRDIFF_TYPE__ ptrdiff_t;
-#else
-typedef signed long ptrdiff_t;
-#endif
-
 #endif /* __ASSEMBLY__ */
 
 #endif /* __X86_TYPES_H__ */
diff --git a/xen/include/xen/types.h b/xen/include/xen/types.h
index 03f0fe612e..6aba80500a 100644
--- a/xen/include/xen/types.h
+++ b/xen/include/xen/types.h
@@ -5,6 +5,19 @@
 
 #include <asm/types.h>
 
+#if defined(__SIZE_TYPE__)
+typedef __SIZE_TYPE__ size_t;
+#else
+typedef unsigned long size_t;
+#endif
+typedef signed long ssize_t;
+
+#if defined(__PTRDIFF_TYPE__)
+typedef __PTRDIFF_TYPE__ ptrdiff_t;
+#else
+typedef signed long ptrdiff_t;
+#endif
+
 #define BITS_TO_LONGS(bits) \
     (((bits)+BITS_PER_LONG-1)/BITS_PER_LONG)
 #define DECLARE_BITMAP(name,bits) \
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sun Feb 05 04:11:34 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 05 Feb 2023 04:11:34 +0000
Received: from list by lists.xenproject.org with outflank-mailman.489680.758026 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pOWNK-0007v6-Ri; Sun, 05 Feb 2023 04:11:34 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 489680.758026; Sun, 05 Feb 2023 04:11:34 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pOWNK-0007uy-Ow; Sun, 05 Feb 2023 04:11:34 +0000
Received: by outflank-mailman (input) for mailman id 489680;
 Sun, 05 Feb 2023 04:11:33 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pOWNJ-0007ud-0m
 for xen-changelog@lists.xenproject.org; Sun, 05 Feb 2023 04:11:33 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pOWNI-0000rH-Vs
 for xen-changelog@lists.xenproject.org; Sun, 05 Feb 2023 04:11:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pOWNI-0008EF-Uo
 for xen-changelog@lists.xenproject.org; Sun, 05 Feb 2023 04:11:32 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=gkCn2Rp+KR8woUtLzfKnBSrH+lJcc+I2MX5HpY7mUuM=; b=QdpSoNAVZEztRQLamieETtFDHS
	tK7kPaWq2hdRI3hIru5ZlBVGyCrv6QxttvknxGsVUjTw8MGE5QcTnDJ72Ykm9N73xsidUwUauAoth
	/Bzg7Tb5kSqVx41xWGw+Xt0ZQMDpzgySqJ/C3zSYlixjTu7z5p+TRVlhlny6tSIgi9EM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/shadow: further correct MMIO handling in _sh_propagate()
Message-Id: <E1pOWNI-0008EF-Uo@xenbits.xenproject.org>
Date: Sun, 05 Feb 2023 04:11:32 +0000

commit 1d99732f2b092173d8600fa818aee3fa51046bb0
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Fri Jan 20 09:20:26 2023 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Jan 20 09:20:26 2023 +0100

    x86/shadow: further correct MMIO handling in _sh_propagate()
    
    While c61a6f74f80e ("x86: enforce consistent cachability of MMIO
    mappings") correctly converted one !mfn_valid() check there, two others
    were wrongly left untouched: Both cachability control and log-dirty
    tracking ought to be uniformly handled/excluded for all (non-)MMIO
    ranges, not just ones qualifiable by mfn_valid().
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/mm/shadow/multi.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/xen/arch/x86/mm/shadow/multi.c b/xen/arch/x86/mm/shadow/multi.c
index eb90bf2b15..98c0b7302a 100644
--- a/xen/arch/x86/mm/shadow/multi.c
+++ b/xen/arch/x86/mm/shadow/multi.c
@@ -550,8 +550,7 @@ _sh_propagate(struct vcpu *v,
      * caching attributes in the shadows to match what was asked for.
      */
     if ( (level == 1) && is_hvm_domain(d) &&
-         (!mfn_valid(target_mfn) ||
-          !is_special_page(mfn_to_page(target_mfn))) )
+         (mmio_mfn || !is_special_page(mfn_to_page(target_mfn))) )
     {
         int type;
 
@@ -662,8 +661,7 @@ _sh_propagate(struct vcpu *v,
      * (We handle log-dirty entirely inside the shadow code, without using the
      * p2m_ram_logdirty p2m type: only HAP uses that.)
      */
-    if ( level == 1 && unlikely(shadow_mode_log_dirty(d)) &&
-         mfn_valid(target_mfn) )
+    if ( level == 1 && unlikely(shadow_mode_log_dirty(d)) && !mmio_mfn )
     {
         if ( ft & FETCH_TYPE_WRITE )
             paging_mark_dirty(d, target_mfn);
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sun Feb 05 04:11:45 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 05 Feb 2023 04:11:45 +0000
Received: from list by lists.xenproject.org with outflank-mailman.489681.758030 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pOWNU-0007xh-Sz; Sun, 05 Feb 2023 04:11:44 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 489681.758030; Sun, 05 Feb 2023 04:11:44 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pOWNU-0007xZ-QM; Sun, 05 Feb 2023 04:11:44 +0000
Received: by outflank-mailman (input) for mailman id 489681;
 Sun, 05 Feb 2023 04:11:43 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pOWNT-0007xP-3S
 for xen-changelog@lists.xenproject.org; Sun, 05 Feb 2023 04:11:43 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pOWNT-0000rf-2d
 for xen-changelog@lists.xenproject.org; Sun, 05 Feb 2023 04:11:43 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pOWNT-0008Eh-1w
 for xen-changelog@lists.xenproject.org; Sun, 05 Feb 2023 04:11:43 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=8DarLTcerqkJoYmx9LOWi8r/2RtnpXOGh4/+3098F8I=; b=JBG56DxzktAi5j6CU2l1NOEdGR
	ExmWEIlLrHdTvoI+YbeYKo+5YFHyznfDUQ1A5W8qpm22/6zvyTUim+Z0js7zNmqqZ8LCXWBm+Gq6e
	BVAIBngv7HmiXvtgjZFUHlfKE1BvD1KhMMMxUVJRo811GyPLuMFjp70Q87p7E2gTz3yQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/iommu: amd_iommu_perdev_intremap is AMD-Vi specific
Message-Id: <E1pOWNT-0008Eh-1w@xenbits.xenproject.org>
Date: Sun, 05 Feb 2023 04:11:43 +0000

commit 0b5475996ca9cd8e69e586dcc9e649ba84e62add
Author:     Xenia Ragiadakou <burzalodowa@gmail.com>
AuthorDate: Fri Jan 20 09:21:37 2023 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Jan 20 09:21:37 2023 +0100

    x86/iommu: amd_iommu_perdev_intremap is AMD-Vi specific
    
    Move its definition to the AMD-Vi driver and use CONFIG_AMD_IOMMU
    to guard its usage in common code.
    
    Take the opportunity to replace bool_t with bool and 1 with true.
    
    No functional change intended.
    
    Signed-off-by: Xenia Ragiadakou <burzalodowa@gmail.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/drivers/passthrough/amd/iommu_init.c | 2 ++
 xen/drivers/passthrough/iommu.c          | 5 ++++-
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/xen/drivers/passthrough/amd/iommu_init.c b/xen/drivers/passthrough/amd/iommu_init.c
index 1f14aaf49e..9773ccfcb4 100644
--- a/xen/drivers/passthrough/amd/iommu_init.c
+++ b/xen/drivers/passthrough/amd/iommu_init.c
@@ -36,6 +36,8 @@ static struct radix_tree_root ivrs_maps;
 LIST_HEAD_READ_MOSTLY(amd_iommu_head);
 bool_t iommuv2_enabled;
 
+bool __ro_after_init amd_iommu_perdev_intremap = true;
+
 static bool iommu_has_ht_flag(struct amd_iommu *iommu, u8 mask)
 {
     return iommu->ht_flags & mask;
diff --git a/xen/drivers/passthrough/iommu.c b/xen/drivers/passthrough/iommu.c
index 5e2a720d29..9d95fb27d0 100644
--- a/xen/drivers/passthrough/iommu.c
+++ b/xen/drivers/passthrough/iommu.c
@@ -58,7 +58,6 @@ bool __read_mostly iommu_hap_pt_share = true;
 #endif
 
 bool_t __read_mostly iommu_debug;
-bool_t __read_mostly amd_iommu_perdev_intremap = 1;
 
 DEFINE_PER_CPU(bool_t, iommu_dont_flush_iotlb);
 
@@ -116,7 +115,11 @@ static int __init cf_check parse_iommu_param(const char *s)
                 iommu_verbose = 1;
         }
         else if ( (val = parse_boolean("amd-iommu-perdev-intremap", s, ss)) >= 0 )
+#ifdef CONFIG_AMD_IOMMU
             amd_iommu_perdev_intremap = val;
+#else
+            no_config_param("AMD_IOMMU", "iommu", s, ss);
+#endif
         else if ( (val = parse_boolean("dom0-passthrough", s, ss)) >= 0 )
             iommu_hwdom_passthrough = val;
         else if ( (val = parse_boolean("dom0-strict", s, ss)) >= 0 )
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sun Feb 05 04:11:54 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 05 Feb 2023 04:11:54 +0000
Received: from list by lists.xenproject.org with outflank-mailman.489682.758033 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pOWNe-00080O-UV; Sun, 05 Feb 2023 04:11:54 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 489682.758033; Sun, 05 Feb 2023 04:11:54 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pOWNe-00080G-Rl; Sun, 05 Feb 2023 04:11:54 +0000
Received: by outflank-mailman (input) for mailman id 489682;
 Sun, 05 Feb 2023 04:11:53 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pOWNd-0007zs-6B
 for xen-changelog@lists.xenproject.org; Sun, 05 Feb 2023 04:11:53 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pOWNd-0000s8-5U
 for xen-changelog@lists.xenproject.org; Sun, 05 Feb 2023 04:11:53 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pOWNd-0008F6-4r
 for xen-changelog@lists.xenproject.org; Sun, 05 Feb 2023 04:11:53 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=sBut7nPJmQ7NyemHhKWWPEc1KVuQBiW8N36Zu+j/6IE=; b=TXvdsxbqJNeSCk5QWMg0zNv4MR
	xq42HHIIXdFSZeoD2zv5tiB1mapC91bvAheaRFNcMpRkqkzAtGoUwb/zscwclvsXInlci91n1agcd
	uz/IbyicWIa/+OJaFk1SqbuUYWSjkNFXysJw2QfFCVutY3YrC8uHADxaVxt5QLYoDFUE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/iommu: iommu_igfx and iommu_qinval are Intel VT-d specific
Message-Id: <E1pOWNd-0008F6-4r@xenbits.xenproject.org>
Date: Sun, 05 Feb 2023 04:11:53 +0000

commit 686b80c1ae4cc338334eb5df4836df526109377a
Author:     Xenia Ragiadakou <burzalodowa@gmail.com>
AuthorDate: Fri Jan 20 09:22:13 2023 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Jan 20 09:22:13 2023 +0100

    x86/iommu: iommu_igfx and iommu_qinval are Intel VT-d specific
    
    Use CONFIG_INTEL_IOMMU to guard the usage of iommu_igfx and iommu_qinval
    in common code.
    
    No functional change intended.
    
    Signed-off-by: Xenia Ragiadakou <burzalodowa@gmail.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/drivers/passthrough/iommu.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/xen/drivers/passthrough/iommu.c b/xen/drivers/passthrough/iommu.c
index 9d95fb27d0..b4dfa95dfd 100644
--- a/xen/drivers/passthrough/iommu.c
+++ b/xen/drivers/passthrough/iommu.c
@@ -82,11 +82,19 @@ static int __init cf_check parse_iommu_param(const char *s)
         else if ( ss == s + 23 && !strncmp(s, "quarantine=scratch-page", 23) )
             iommu_quarantine = IOMMU_quarantine_scratch_page;
 #endif
-#ifdef CONFIG_X86
         else if ( (val = parse_boolean("igfx", s, ss)) >= 0 )
+#ifdef CONFIG_INTEL_IOMMU
             iommu_igfx = val;
+#else
+            no_config_param("INTEL_IOMMU", "iommu", s, ss);
+#endif
         else if ( (val = parse_boolean("qinval", s, ss)) >= 0 )
+#ifdef CONFIG_INTEL_IOMMU
             iommu_qinval = val;
+#else
+            no_config_param("INTEL_IOMMU", "iommu", s, ss);
+#endif
+#ifdef CONFIG_X86
         else if ( (val = parse_boolean("superpages", s, ss)) >= 0 )
             iommu_superpages = val;
 #endif
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sun Feb 05 04:12:05 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 05 Feb 2023 04:12:05 +0000
Received: from list by lists.xenproject.org with outflank-mailman.489683.758038 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pOWNp-00082y-01; Sun, 05 Feb 2023 04:12:05 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 489683.758038; Sun, 05 Feb 2023 04:12:04 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pOWNo-00082k-TN; Sun, 05 Feb 2023 04:12:04 +0000
Received: by outflank-mailman (input) for mailman id 489683;
 Sun, 05 Feb 2023 04:12:03 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pOWNn-00082Z-9I
 for xen-changelog@lists.xenproject.org; Sun, 05 Feb 2023 04:12:03 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pOWNn-0000sX-8d
 for xen-changelog@lists.xenproject.org; Sun, 05 Feb 2023 04:12:03 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pOWNn-0008Fe-7n
 for xen-changelog@lists.xenproject.org; Sun, 05 Feb 2023 04:12:03 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=GqHGsaBLGN1INGilq6iQlAxmnMfewhsfCAJklmoE/vo=; b=vibZn8qfB+NtEFdkrpcAMGzr67
	4UCwtYBpBnkPdpIRUVdZXHF/gZIqAK1ALcGDBjZuOZ6S1ZIjbFKDKNIIzTxBTbiHRbhfG8ESfeKoH
	YUWEY9+L34HLKdihvpwR0xpPv0AEvtS2CInxyTZH5iWEaJNwEcL/N+043+ELbPr+nll4=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/acpi: separate AMD-Vi and VT-d specific functions
Message-Id: <E1pOWNn-0008Fe-7n@xenbits.xenproject.org>
Date: Sun, 05 Feb 2023 04:12:03 +0000

commit 41dbbfb5966f2517916333d1885ee68018161f48
Author:     Xenia Ragiadakou <burzalodowa@gmail.com>
AuthorDate: Fri Jan 20 09:22:42 2023 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Jan 20 09:22:42 2023 +0100

    x86/acpi: separate AMD-Vi and VT-d specific functions
    
    The functions acpi_dmar_init() and acpi_dmar_zap/reinstate() are
    VT-d specific while the function acpi_ivrs_init() is AMD-Vi specific.
    To eliminate dead code, they need to be guarded under CONFIG_INTEL_IOMMU
    and CONFIG_AMD_IOMMU, respectively.
    
    Instead of adding #ifdef guards around the function calls, implement them
    as empty static inline functions.
    
    Take the opportunity to move the declaration of acpi_dmar_init from the
    x86 arch-specific header to the common header, since Intel VT-d has been
    also used on IA-64 platforms.
    
    No functional change intended.
    
    Signed-off-by: Xenia Ragiadakou <burzalodowa@gmail.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/include/asm/acpi.h | 6 +++++-
 xen/include/xen/acpi.h          | 7 +++++++
 2 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/xen/arch/x86/include/asm/acpi.h b/xen/arch/x86/include/asm/acpi.h
index c453450a74..6ce79ce465 100644
--- a/xen/arch/x86/include/asm/acpi.h
+++ b/xen/arch/x86/include/asm/acpi.h
@@ -140,8 +140,12 @@ extern u32 pmtmr_ioport;
 extern unsigned int pmtmr_width;
 
 void acpi_iommu_init(void);
-int acpi_dmar_init(void);
+
+#ifdef CONFIG_AMD_IOMMU
 int acpi_ivrs_init(void);
+#else
+static inline int acpi_ivrs_init(void) { return -ENODEV; }
+#endif
 
 void acpi_mmcfg_init(void);
 
diff --git a/xen/include/xen/acpi.h b/xen/include/xen/acpi.h
index 1b9c75e68f..352f27f6a7 100644
--- a/xen/include/xen/acpi.h
+++ b/xen/include/xen/acpi.h
@@ -206,8 +206,15 @@ static inline int acpi_get_pxm(acpi_handle handle)
 
 void acpi_reboot(void);
 
+#ifdef CONFIG_INTEL_IOMMU
+int acpi_dmar_init(void);
 void acpi_dmar_zap(void);
 void acpi_dmar_reinstate(void);
+#else
+static inline int acpi_dmar_init(void) { return -ENODEV; }
+static inline void acpi_dmar_zap(void) {}
+static inline void acpi_dmar_reinstate(void) {}
+#endif
 
 #endif /* __ASSEMBLY__ */
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sun Feb 05 04:12:14 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 05 Feb 2023 04:12:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.489684.758041 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pOWNy-00085v-1I; Sun, 05 Feb 2023 04:12:14 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 489684.758041; Sun, 05 Feb 2023 04:12:14 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pOWNx-00085o-Ux; Sun, 05 Feb 2023 04:12:13 +0000
Received: by outflank-mailman (input) for mailman id 489684;
 Sun, 05 Feb 2023 04:12:13 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pOWNx-00085X-Cg
 for xen-changelog@lists.xenproject.org; Sun, 05 Feb 2023 04:12:13 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pOWNx-0000sk-Bp
 for xen-changelog@lists.xenproject.org; Sun, 05 Feb 2023 04:12:13 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pOWNx-0008G3-B3
 for xen-changelog@lists.xenproject.org; Sun, 05 Feb 2023 04:12:13 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=BE6az6ZMqydIYg2+KXov/iUhHjZB6gVL8LXYYTEzfw4=; b=amv+m96oXeN/v6XqKADpwY5lXm
	6zADdgf22qjuBTpMlX7Crva6TUKUFWNyMO7ttZTEx9YU4sLF4DjhNPESEXXOswGUxsR0DixeOomiZ
	NA+yoCIAiwYpS0F7gZRY0WmkTBb0HwlTEDv/d8zOgfnR1P+/RkvTrOJORMf3Zq9qKp98=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/shadow: fix PAE check for top-level table unshadowing
Message-Id: <E1pOWNx-0008G3-B3@xenbits.xenproject.org>
Date: Sun, 05 Feb 2023 04:12:13 +0000

commit f8fdceefbb1193ec81667eb40b83bc525cb71204
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Fri Jan 20 09:23:42 2023 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Jan 20 09:23:42 2023 +0100

    x86/shadow: fix PAE check for top-level table unshadowing
    
    Clearly within the for_each_vcpu() the vCPU of this loop is meant, not
    the (loop invariant) one the fault occurred on.
    
    Fixes: 3d5e6a3ff383 ("x86 hvm: implement HVMOP_pagetable_dying")
    Fixes: ef3b0d8d2c39 ("x86/shadow: shadow_table[] needs only one entry for PV-only configs")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/mm/shadow/multi.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/mm/shadow/multi.c b/xen/arch/x86/mm/shadow/multi.c
index 98c0b7302a..8b3e678fa0 100644
--- a/xen/arch/x86/mm/shadow/multi.c
+++ b/xen/arch/x86/mm/shadow/multi.c
@@ -2677,10 +2677,10 @@ static int cf_check sh_page_fault(
 #if GUEST_PAGING_LEVELS == 3
             unsigned int i;
 
-            for_each_shadow_table(v, i)
+            for_each_shadow_table(tmp, i)
             {
                 mfn_t smfn = pagetable_get_mfn(
-                                 v->arch.paging.shadow.shadow_table[i]);
+                                 tmp->arch.paging.shadow.shadow_table[i]);
 
                 if ( mfn_x(smfn) )
                 {
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sun Feb 05 04:12:24 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 05 Feb 2023 04:12:24 +0000
Received: from list by lists.xenproject.org with outflank-mailman.489685.758046 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pOWO8-000895-32; Sun, 05 Feb 2023 04:12:24 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 489685.758046; Sun, 05 Feb 2023 04:12:24 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pOWO8-00088x-0L; Sun, 05 Feb 2023 04:12:24 +0000
Received: by outflank-mailman (input) for mailman id 489685;
 Sun, 05 Feb 2023 04:12:23 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pOWO7-00088p-GJ
 for xen-changelog@lists.xenproject.org; Sun, 05 Feb 2023 04:12:23 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pOWO7-0000sz-Ei
 for xen-changelog@lists.xenproject.org; Sun, 05 Feb 2023 04:12:23 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pOWO7-0008GU-E6
 for xen-changelog@lists.xenproject.org; Sun, 05 Feb 2023 04:12:23 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Iz91euESOb3hBZ89tkVqO9xQYBfgse/0Vep+HSZ1FJM=; b=0QFBG8wmRNx9Wo8lebmx+d47Bi
	NCxW817DS+xQOo3d7gPlYQHyepDnxVkxem7gwvpQGTOuQT+QluWmTlT0KiT2yVVMnvYSni+KpVhbJ
	SDpq1XRWbqLjkD1fDifgucbFvCh+qH1mdiwTA39vuWwdWAZ1E4u7D13fBnphRHAwRkcg=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/include: change <asm/types.h> to <xen/types.h> in early_printk.h
Message-Id: <E1pOWO7-0008GU-E6@xenbits.xenproject.org>
Date: Sun, 05 Feb 2023 04:12:23 +0000

commit ee8c636dd4e8782116b1644e1cd209dbe4125c7d
Author:     Oleksii Kurochko <oleksii.kurochko@gmail.com>
AuthorDate: Fri Jan 20 09:24:20 2023 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Jan 20 09:24:20 2023 +0100

    xen/include: change <asm/types.h> to <xen/types.h> in early_printk.h
    
    In the patch "include/types: move stddef.h-kind types to common
    header" [1] size_t was moved from <asm/types.h> to <xen/types.h>
    so early_printk should be updated correspondingly.
    
    [1] https://lore.kernel.org/xen-devel/5a0a9e2a-c116-21b5-8081-db75fe4178d7@suse.com/
    
    Signed-off-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/include/xen/early_printk.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/include/xen/early_printk.h b/xen/include/xen/early_printk.h
index abb34687da..5d72293793 100644
--- a/xen/include/xen/early_printk.h
+++ b/xen/include/xen/early_printk.h
@@ -4,7 +4,7 @@
 #ifndef __XEN_EARLY_PRINTK_H__
 #define __XEN_EARLY_PRINTK_H__
 
-#include <asm/types.h>
+#include <xen/types.h>
 
 #ifdef CONFIG_EARLY_PRINTK
 void early_puts(const char *s, size_t nr);
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sun Feb 05 04:12:34 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 05 Feb 2023 04:12:34 +0000
Received: from list by lists.xenproject.org with outflank-mailman.489686.758049 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pOWOI-0008Bu-4P; Sun, 05 Feb 2023 04:12:34 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 489686.758049; Sun, 05 Feb 2023 04:12:34 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pOWOI-0008Bn-1u; Sun, 05 Feb 2023 04:12:34 +0000
Received: by outflank-mailman (input) for mailman id 489686;
 Sun, 05 Feb 2023 04:12:33 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pOWOH-0008Bc-Is
 for xen-changelog@lists.xenproject.org; Sun, 05 Feb 2023 04:12:33 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pOWOH-0000tA-I8
 for xen-changelog@lists.xenproject.org; Sun, 05 Feb 2023 04:12:33 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pOWOH-0008H5-Gt
 for xen-changelog@lists.xenproject.org; Sun, 05 Feb 2023 04:12:33 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=eWG8Qqcf9WEfMAWBZw6A4l2IvPasogNEJ88PBJiy570=; b=paGJKoa6DElc1NtBOKCvUmDFim
	sg3Ft4V1wJ0gR2plGKZtIydGqe+WKw6g2CXtEJrKyavrmI9fzVHGefT2QQtxfkZaVNMoLKNq5fp6b
	/YCH63W6LQqs/mgWRfvacCor1+iyDP1+4cznJP2km9BKDnXEYBbIeMGRDxoFXt/g9jfU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/riscv: introduce asm/types.h header file
Message-Id: <E1pOWOH-0008H5-Gt@xenbits.xenproject.org>
Date: Sun, 05 Feb 2023 04:12:33 +0000

commit 0c9c951e6fba035c53a79832ed20c21824bef6af
Author:     Oleksii Kurochko <oleksii.kurochko@gmail.com>
AuthorDate: Fri Jan 20 09:25:44 2023 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Jan 20 09:25:44 2023 +0100

    xen/riscv: introduce asm/types.h header file
    
    Signed-off-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
    Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
---
 xen/arch/riscv/include/asm/types.h | 70 ++++++++++++++++++++++++++++++++++++++
 1 file changed, 70 insertions(+)

diff --git a/xen/arch/riscv/include/asm/types.h b/xen/arch/riscv/include/asm/types.h
new file mode 100644
index 0000000000..64976f118d
--- /dev/null
+++ b/xen/arch/riscv/include/asm/types.h
@@ -0,0 +1,70 @@
+#ifndef __RISCV_TYPES_H__
+#define __RISCV_TYPES_H__
+
+#ifndef __ASSEMBLY__
+
+typedef __signed__ char __s8;
+typedef unsigned char __u8;
+
+typedef __signed__ short __s16;
+typedef unsigned short __u16;
+
+typedef __signed__ int __s32;
+typedef unsigned int __u32;
+
+#if defined(__GNUC__) && !defined(__STRICT_ANSI__)
+#if defined(CONFIG_RISCV_32)
+typedef __signed__ long long __s64;
+typedef unsigned long long __u64;
+#elif defined (CONFIG_RISCV_64)
+typedef __signed__ long __s64;
+typedef unsigned long __u64;
+#endif
+#endif
+
+typedef signed char s8;
+typedef unsigned char u8;
+
+typedef signed short s16;
+typedef unsigned short u16;
+
+typedef signed int s32;
+typedef unsigned int u32;
+
+#if defined(CONFIG_RISCV_32)
+
+typedef signed long long s64;
+typedef unsigned long long u64;
+typedef u32 vaddr_t;
+#define PRIvaddr PRIx32
+typedef u64 paddr_t;
+#define INVALID_PADDR (~0ULL)
+#define PRIpaddr "016llx"
+typedef u32 register_t;
+#define PRIregister "x"
+
+#elif defined (CONFIG_RISCV_64)
+
+typedef signed long s64;
+typedef unsigned long u64;
+typedef u64 vaddr_t;
+#define PRIvaddr PRIx64
+typedef u64 paddr_t;
+#define INVALID_PADDR (~0UL)
+#define PRIpaddr "016lx"
+typedef u64 register_t;
+#define PRIregister "lx"
+
+#endif
+
+#endif /* __ASSEMBLY__ */
+
+#endif /* __RISCV_TYPES_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 Sun Feb 05 04:12:44 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 05 Feb 2023 04:12:44 +0000
Received: from list by lists.xenproject.org with outflank-mailman.489687.758054 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pOWOS-0008EZ-6Q; Sun, 05 Feb 2023 04:12:44 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 489687.758054; Sun, 05 Feb 2023 04:12:44 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pOWOS-0008EP-3R; Sun, 05 Feb 2023 04:12:44 +0000
Received: by outflank-mailman (input) for mailman id 489687;
 Sun, 05 Feb 2023 04:12:43 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pOWOR-0008EJ-MG
 for xen-changelog@lists.xenproject.org; Sun, 05 Feb 2023 04:12:43 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pOWOR-0000tL-LU
 for xen-changelog@lists.xenproject.org; Sun, 05 Feb 2023 04:12:43 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pOWOR-0008Hh-Ki
 for xen-changelog@lists.xenproject.org; Sun, 05 Feb 2023 04:12:43 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=E25m57zDxPMBLBi1AstMPsC/i1Z8bkDwPhOCcJM2ltY=; b=zUkogNziQRXicNViOG87TsCoE9
	6fehbNkVg1BwbUBNyvzo8iK57u8FpxBOe/lmqyLTYYHSVp70oEwi0tUZ9JQZ22IRcdKjSFaGmlbI4
	sC5vmsWxi/ypDBOUkpkydGrPM4yv7VH6lMsjnsnFveefD0NhHyfI3JhaZKENQNXxKBb8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/riscv: introduce sbi call to putchar to console
Message-Id: <E1pOWOR-0008Hh-Ki@xenbits.xenproject.org>
Date: Sun, 05 Feb 2023 04:12:43 +0000

commit 90caa47aa33efb6408514ce09721624a2bdf6694
Author:     Bobby Eshleman <bobby.eshleman@gmail.com>
AuthorDate: Fri Jan 20 09:26:31 2023 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Jan 20 09:26:31 2023 +0100

    xen/riscv: introduce sbi call to putchar to console
    
    Originally SBI implementation for Xen was introduced by
    Bobby Eshleman <bobby.eshleman@gmail.com> but it was removed
    all the stuff for simplicity  except SBI call for putting
    character to console.
    
    The patch introduces sbi_putchar() SBI call which is necessary
    to implement initial early_printk.
    
    Signed-off-by: Bobby Eshleman <bobby.eshleman@gmail.com>
    Signed-off-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
    Reviewed-by: Bobby Eshleman <bobby.eshleman@gmail.com>
    Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
---
 xen/arch/riscv/Makefile          |  1 +
 xen/arch/riscv/include/asm/sbi.h | 34 +++++++++++++++++++++++++++++++
 xen/arch/riscv/sbi.c             | 44 ++++++++++++++++++++++++++++++++++++++++
 3 files changed, 79 insertions(+)

diff --git a/xen/arch/riscv/Makefile b/xen/arch/riscv/Makefile
index 5a67a3f493..fd916e1004 100644
--- a/xen/arch/riscv/Makefile
+++ b/xen/arch/riscv/Makefile
@@ -1,4 +1,5 @@
 obj-$(CONFIG_RISCV_64) += riscv64/
+obj-y += sbi.o
 obj-y += setup.o
 
 $(TARGET): $(TARGET)-syms
diff --git a/xen/arch/riscv/include/asm/sbi.h b/xen/arch/riscv/include/asm/sbi.h
new file mode 100644
index 0000000000..0e6820a4ed
--- /dev/null
+++ b/xen/arch/riscv/include/asm/sbi.h
@@ -0,0 +1,34 @@
+/* SPDX-License-Identifier: (GPL-2.0-or-later) */
+/*
+ * Copyright (c) 2021-2023 Vates SAS.
+ *
+ * Taken from xvisor, modified by Bobby Eshleman (bobby.eshleman@gmail.com).
+ *
+ * Taken/modified from Xvisor project with the following copyright:
+ *
+ * Copyright (c) 2019 Western Digital Corporation or its affiliates.
+ */
+
+#ifndef __ASM_RISCV_SBI_H__
+#define __ASM_RISCV_SBI_H__
+
+#define SBI_EXT_0_1_CONSOLE_PUTCHAR		0x1
+
+struct sbiret {
+    long error;
+    long value;
+};
+
+struct sbiret sbi_ecall(unsigned long ext, unsigned long fid,
+                        unsigned long arg0, unsigned long arg1,
+                        unsigned long arg2, unsigned long arg3,
+                        unsigned long arg4, unsigned long arg5);
+
+/**
+ * Writes given character to the console device.
+ *
+ * @param ch The data to be written to the console.
+ */
+void sbi_console_putchar(int ch);
+
+#endif /* __ASM_RISCV_SBI_H__ */
diff --git a/xen/arch/riscv/sbi.c b/xen/arch/riscv/sbi.c
new file mode 100644
index 0000000000..0ae166c861
--- /dev/null
+++ b/xen/arch/riscv/sbi.c
@@ -0,0 +1,44 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
+/*
+ * Taken and modified from the xvisor project with the copyright Copyright (c)
+ * 2019 Western Digital Corporation or its affiliates and author Anup Patel
+ * (anup.patel@wdc.com).
+ *
+ * Modified by Bobby Eshleman (bobby.eshleman@gmail.com).
+ *
+ * Copyright (c) 2019 Western Digital Corporation or its affiliates.
+ * Copyright (c) 2021-2023 Vates SAS.
+ */
+
+#include <asm/sbi.h>
+
+struct sbiret sbi_ecall(unsigned long ext, unsigned long fid,
+                        unsigned long arg0, unsigned long arg1,
+                        unsigned long arg2, unsigned long arg3,
+                        unsigned long arg4, unsigned long arg5)
+{
+    struct sbiret ret;
+
+    register unsigned long a0 asm ("a0") = arg0;
+    register unsigned long a1 asm ("a1") = arg1;
+    register unsigned long a2 asm ("a2") = arg2;
+    register unsigned long a3 asm ("a3") = arg3;
+    register unsigned long a4 asm ("a4") = arg4;
+    register unsigned long a5 asm ("a5") = arg5;
+    register unsigned long a6 asm ("a6") = fid;
+    register unsigned long a7 asm ("a7") = ext;
+
+    asm volatile (  "ecall"
+                    : "+r" (a0), "+r" (a1)
+                    : "r" (a2), "r" (a3), "r" (a4), "r" (a5), "r" (a6), "r" (a7)
+                    : "memory");
+    ret.error = a0;
+    ret.value = a1;
+
+    return ret;
+}
+
+void sbi_console_putchar(int ch)
+{
+    sbi_ecall(SBI_EXT_0_1_CONSOLE_PUTCHAR, 0, ch, 0, 0, 0, 0, 0);
+}
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sun Feb 05 04:12:54 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 05 Feb 2023 04:12:54 +0000
Received: from list by lists.xenproject.org with outflank-mailman.489688.758058 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pOWOc-0008Hk-9E; Sun, 05 Feb 2023 04:12:54 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 489688.758058; Sun, 05 Feb 2023 04:12:54 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pOWOc-0008Hc-6R; Sun, 05 Feb 2023 04:12:54 +0000
Received: by outflank-mailman (input) for mailman id 489688;
 Sun, 05 Feb 2023 04:12:53 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pOWOb-0008HW-PN
 for xen-changelog@lists.xenproject.org; Sun, 05 Feb 2023 04:12:53 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pOWOb-0000tk-Oi
 for xen-changelog@lists.xenproject.org; Sun, 05 Feb 2023 04:12:53 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pOWOb-0008Jf-Ny
 for xen-changelog@lists.xenproject.org; Sun, 05 Feb 2023 04:12:53 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=5IC1Ha/RN3mQWQ1eUHwJdNsIkAWNULooLzi65V8w8/I=; b=Gl0C8e2cNP4X0Q0L9n26fkEWDB
	bUKgN3EoajDBdw5yskT21MoS3Zm4SQ6UNDHRwaeN5EaYgpqelK5fi2Werckf6tNDOD3bUZcgEpyjA
	Zrp2N5ghEEcTV8tpo2N4950m5SpwNp9ZO6sTYUju/r3fpGAyS8VRwoIDw2QC7DlpDIxg=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools/xenstore: let talloc_free() preserve errno
Message-Id: <E1pOWOb-0008Jf-Ny@xenbits.xenproject.org>
Date: Sun, 05 Feb 2023 04:12:53 +0000

commit 1d4994ac79ed96550f8e8c9a682d468e83db4dfe
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Wed Jan 18 10:50:00 2023 +0100
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Fri Jan 20 09:23:51 2023 +0000

    tools/xenstore: let talloc_free() preserve errno
    
    Today talloc_free() is not guaranteed to preserve errno, especially in
    case a custom destructor is being used.
    
    So preserve errno in talloc_free().
    
    This allows to remove some errno saving outside of talloc.c.
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Julien Grall <jgrall@amazon.com>
---
 tools/xenstore/talloc.c         | 21 +++++++++++++--------
 tools/xenstore/xenstored_core.c |  2 --
 2 files changed, 13 insertions(+), 10 deletions(-)

diff --git a/tools/xenstore/talloc.c b/tools/xenstore/talloc.c
index d7edcf3a93..23c3a23b19 100644
--- a/tools/xenstore/talloc.c
+++ b/tools/xenstore/talloc.c
@@ -541,38 +541,39 @@ static void talloc_free_children(void *ptr)
 */
 int talloc_free(void *ptr)
 {
+	int saved_errno = errno;
 	struct talloc_chunk *tc;
 
 	if (ptr == NULL) {
-		return -1;
+		goto err;
 	}
 
 	tc = talloc_chunk_from_ptr(ptr);
 
 	if (tc->null_refs) {
 		tc->null_refs--;
-		return -1;
+		goto err;
 	}
 
 	if (tc->refs) {
 		talloc_reference_destructor(tc->refs);
-		return -1;
+		goto err;
 	}
 
 	if (tc->flags & TALLOC_FLAG_LOOP) {
 		/* we have a free loop - stop looping */
-		return 0;
+		goto success;
 	}
 
 	if (tc->destructor) {
 		talloc_destructor_t d = tc->destructor;
 		if (d == (talloc_destructor_t)-1) {
-			return -1;
+			goto err;
 		}
 		tc->destructor = (talloc_destructor_t)-1;
 		if (d(ptr) == -1) {
 			tc->destructor = d;
-			return -1;
+			goto err;
 		}
 		tc->destructor = NULL;
 	}
@@ -594,10 +595,14 @@ int talloc_free(void *ptr)
 	tc->flags |= TALLOC_FLAG_FREE;
 
 	free(tc);
+ success:
+	errno = saved_errno;
 	return 0;
-}
-
 
+ err:
+	errno = saved_errno;
+	return -1;
+}
 
 /*
   A talloc version of realloc. The context argument is only used if
diff --git a/tools/xenstore/xenstored_core.c b/tools/xenstore/xenstored_core.c
index 78a3edaa4e..1650821922 100644
--- a/tools/xenstore/xenstored_core.c
+++ b/tools/xenstore/xenstored_core.c
@@ -771,9 +771,7 @@ struct node *read_node(struct connection *conn, const void *ctx,
 	return node;
 
  error:
-	err = errno;
 	talloc_free(node);
-	errno = err;
 	return NULL;
 }
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sun Feb 05 04:13:05 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 05 Feb 2023 04:13:05 +0000
Received: from list by lists.xenproject.org with outflank-mailman.489689.758062 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pOWOn-0008Kl-Ao; Sun, 05 Feb 2023 04:13:05 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 489689.758062; Sun, 05 Feb 2023 04:13:05 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pOWOn-0008Kd-80; Sun, 05 Feb 2023 04:13:05 +0000
Received: by outflank-mailman (input) for mailman id 489689;
 Sun, 05 Feb 2023 04:13:03 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pOWOl-0008K9-SU
 for xen-changelog@lists.xenproject.org; Sun, 05 Feb 2023 04:13:03 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pOWOl-0000u1-Rj
 for xen-changelog@lists.xenproject.org; Sun, 05 Feb 2023 04:13:03 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pOWOl-0008KF-R1
 for xen-changelog@lists.xenproject.org; Sun, 05 Feb 2023 04:13:03 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=b3/TIfvdcVqZ2eNMbk3eU9wQJYrS34e/Qa05W02Id5g=; b=ydP88tLbp+j1m+4Sl9+VG3lZL9
	5VrD8Qq8/bxbx1DdoyK/eGRUCKlYd8PODbKf/K38ULcHeThISJU82szeZ5ztMWRpPz8TtK5M6hf4O
	DgVBbHjrce/948R2Qrc9zKg01EJ6KtkUuTECEa6lpnuxYkSbjM0i9eWY0dN9Y0s+ZKKU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools/xenstore: remove all watches when a domain has stopped
Message-Id: <E1pOWOl-0008KF-R1@xenbits.xenproject.org>
Date: Sun, 05 Feb 2023 04:13:03 +0000

commit 9260e41e73ddd9872825cd4ed836fd0dcfd5cb98
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Wed Jan 18 10:50:01 2023 +0100
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Fri Jan 20 09:23:51 2023 +0000

    tools/xenstore: remove all watches when a domain has stopped
    
    When a domain has been released by Xen tools, remove all its
    registered watches. This avoids sending watch events to the dead domain
    when all the nodes related to it are being removed by the Xen tools.
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Julien Grall <jgrall@amazon.com>
---
 tools/xenstore/xenstored_domain.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/tools/xenstore/xenstored_domain.c b/tools/xenstore/xenstored_domain.c
index aa86892fed..e669c89e94 100644
--- a/tools/xenstore/xenstored_domain.c
+++ b/tools/xenstore/xenstored_domain.c
@@ -740,6 +740,9 @@ int do_release(const void *ctx, struct connection *conn,
 	if (IS_ERR(domain))
 		return -PTR_ERR(domain);
 
+	/* Avoid triggering watch events when the domain's nodes are deleted. */
+	conn_delete_all_watches(domain->conn);
+
 	talloc_free(domain->conn);
 
 	send_ack(conn, XS_RELEASE);
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sun Feb 05 04:13:15 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 05 Feb 2023 04:13:15 +0000
Received: from list by lists.xenproject.org with outflank-mailman.489690.758066 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pOWOx-0008Ni-CD; Sun, 05 Feb 2023 04:13:15 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 489690.758066; Sun, 05 Feb 2023 04:13:15 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pOWOx-0008Na-9Y; Sun, 05 Feb 2023 04:13:15 +0000
Received: by outflank-mailman (input) for mailman id 489690;
 Sun, 05 Feb 2023 04:13:14 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pOWOv-0008NN-VX
 for xen-changelog@lists.xenproject.org; Sun, 05 Feb 2023 04:13:13 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pOWOv-0000uC-Uv
 for xen-changelog@lists.xenproject.org; Sun, 05 Feb 2023 04:13:13 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pOWOv-0008Ki-U6
 for xen-changelog@lists.xenproject.org; Sun, 05 Feb 2023 04:13:13 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=OVWld+lrw9WCG5lpxrcmXm2AkwnPTVCxHtl6zDOzoU8=; b=E5cAUm+AAp3ydIpdLKSbN8EPtq
	BuNhv+aafJ7KE+B8p5pgGu8i7cYYGMS4KS2po20IbHifFScZ4YqwJY65QBZri68s1z09/XBSlNNC0
	PsojgGjQxWYANMN2Cffr+ouToALiqgLpsHJqChZ9pkYvu1ebsRMQsxB0YwamGxzarHv4=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools/xenstore: add hashlist for finding struct domain by domid
Message-Id: <E1pOWOv-0008Ki-U6@xenbits.xenproject.org>
Date: Sun, 05 Feb 2023 04:13:13 +0000

commit a1a618208bf53469f5e3eaa14202ba777d33f442
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Wed Jan 18 10:50:02 2023 +0100
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Fri Jan 20 09:23:51 2023 +0000

    tools/xenstore: add hashlist for finding struct domain by domid
    
    Today finding a struct domain by its domain id requires to scan the
    list of domains until finding the correct domid.
    
    Add a hashlist for being able to speed this up. This allows to remove
    the linking of struct domain in a list. Note that the list of changed
    domains per transaction is kept as a list, as there are no known use
    cases with more than 4 domains being touched in a single transaction
    (this would be a device handled by a driver domain and being assigned
    to a HVM domain with device model in a stubdom, plus the control
    domain).
    
    Some simple performance tests comparing the scanning and hashlist have
    shown that the hashlist will win as soon as more than 6 entries need
    to be scanned.
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Julien Grall <jgrall@amazon.com>
---
 tools/xenstore/xenstored_domain.c | 102 ++++++++++++++++++++++----------------
 1 file changed, 60 insertions(+), 42 deletions(-)

diff --git a/tools/xenstore/xenstored_domain.c b/tools/xenstore/xenstored_domain.c
index e669c89e94..3ad1028edb 100644
--- a/tools/xenstore/xenstored_domain.c
+++ b/tools/xenstore/xenstored_domain.c
@@ -48,8 +48,6 @@ static struct node_perms dom_introduce_perms;
 
 struct domain
 {
-	struct list_head list;
-
 	/* The id of this domain */
 	unsigned int domid;
 
@@ -96,7 +94,7 @@ struct domain
 	bool wrl_delay_logged;
 };
 
-static LIST_HEAD(domains);
+static struct hashtable *domhash;
 
 static bool check_indexes(XENSTORE_RING_IDX cons, XENSTORE_RING_IDX prod)
 {
@@ -309,7 +307,7 @@ static int destroy_domain(void *_domain)
 
 	domain_tree_remove(domain);
 
-	list_del(&domain->list);
+	hashtable_remove(domhash, &domain->domid);
 
 	if (!domain->introduced)
 		return 0;
@@ -341,43 +339,50 @@ static bool get_domain_info(unsigned int domid, xc_dominfo_t *dominfo)
 	       dominfo->domid == domid;
 }
 
-void check_domains(void)
+static int check_domain(const void *k, void *v, void *arg)
 {
 	xc_dominfo_t dominfo;
-	struct domain *domain;
 	struct connection *conn;
-	int notify = 0;
 	bool dom_valid;
+	struct domain *domain = v;
+	bool *notify = arg;
 
- again:
-	list_for_each_entry(domain, &domains, list) {
-		dom_valid = get_domain_info(domain->domid, &dominfo);
-		if (!domain->introduced) {
-			if (!dom_valid) {
-				talloc_free(domain);
-				goto again;
-			}
-			continue;
-		}
-		if (dom_valid) {
-			if ((dominfo.crashed || dominfo.shutdown)
-			    && !domain->shutdown) {
-				domain->shutdown = true;
-				notify = 1;
-			}
-			if (!dominfo.dying)
-				continue;
-		}
-		if (domain->conn) {
-			/* domain is a talloc child of domain->conn. */
-			conn = domain->conn;
-			domain->conn = NULL;
-			talloc_unlink(talloc_autofree_context(), conn);
-			notify = 0; /* destroy_domain() fires the watch */
-			goto again;
+	dom_valid = get_domain_info(domain->domid, &dominfo);
+	if (!domain->introduced) {
+		if (!dom_valid)
+			talloc_free(domain);
+		return 0;
+	}
+	if (dom_valid) {
+		if ((dominfo.crashed || dominfo.shutdown)
+		    && !domain->shutdown) {
+			domain->shutdown = true;
+			*notify = true;
 		}
+		if (!dominfo.dying)
+			return 0;
+	}
+	if (domain->conn) {
+		/* domain is a talloc child of domain->conn. */
+		conn = domain->conn;
+		domain->conn = NULL;
+		talloc_unlink(talloc_autofree_context(), conn);
+		*notify = false; /* destroy_domain() fires the watch */
+
+		/* Above unlink might result in 2 domains being freed! */
+		return 1;
 	}
 
+	return 0;
+}
+
+void check_domains(void)
+{
+	bool notify = false;
+
+	while (hashtable_iterate(domhash, check_domain, &notify))
+		;
+
 	if (notify)
 		fire_watches(NULL, NULL, "@releaseDomain", NULL, true, NULL);
 }
@@ -415,13 +420,7 @@ static char *talloc_domain_path(const void *context, unsigned int domid)
 
 static struct domain *find_domain_struct(unsigned int domid)
 {
-	struct domain *i;
-
-	list_for_each_entry(i, &domains, list) {
-		if (i->domid == domid)
-			return i;
-	}
-	return NULL;
+	return hashtable_search(domhash, &domid);
 }
 
 int domain_get_quota(const void *ctx, struct connection *conn,
@@ -470,9 +469,13 @@ static struct domain *alloc_domain(const void *context, unsigned int domid)
 	domain->generation = generation;
 	domain->introduced = false;
 
-	talloc_set_destructor(domain, destroy_domain);
+	if (!hashtable_insert(domhash, &domain->domid, domain)) {
+		talloc_free(domain);
+		errno = ENOMEM;
+		return NULL;
+	}
 
-	list_add(&domain->list, &domains);
+	talloc_set_destructor(domain, destroy_domain);
 
 	return domain;
 }
@@ -906,10 +909,25 @@ void dom0_init(void)
 	xenevtchn_notify(xce_handle, dom0->port);
 }
 
+static unsigned int domhash_fn(void *k)
+{
+	return *(unsigned int *)k;
+}
+
+static int domeq_fn(void *key1, void *key2)
+{
+	return *(unsigned int *)key1 == *(unsigned int *)key2;
+}
+
 void domain_init(int evtfd)
 {
 	int rc;
 
+	/* Start with a random rather low domain count for the hashtable. */
+	domhash = create_hashtable(8, domhash_fn, domeq_fn, 0);
+	if (!domhash)
+		barf_perror("Failed to allocate domain hashtable");
+
 	xc_handle = talloc(talloc_autofree_context(), xc_interface*);
 	if (!xc_handle)
 		barf_perror("Failed to allocate domain handle");
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sun Feb 05 04:13:25 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 05 Feb 2023 04:13:25 +0000
Received: from list by lists.xenproject.org with outflank-mailman.489691.758070 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pOWP7-0008Rx-Dm; Sun, 05 Feb 2023 04:13:25 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 489691.758070; Sun, 05 Feb 2023 04:13:25 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pOWP7-0008Ro-B1; Sun, 05 Feb 2023 04:13:25 +0000
Received: by outflank-mailman (input) for mailman id 489691;
 Sun, 05 Feb 2023 04:13:24 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pOWP6-0008RU-2h
 for xen-changelog@lists.xenproject.org; Sun, 05 Feb 2023 04:13:24 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pOWP6-0000uV-1u
 for xen-changelog@lists.xenproject.org; Sun, 05 Feb 2023 04:13:24 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pOWP6-0008LE-11
 for xen-changelog@lists.xenproject.org; Sun, 05 Feb 2023 04:13:24 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=iE7jCNe0Nzil6S6GL7DWdpOd2yPTdm610CDRCGVw6Dc=; b=K648l6m4FJgAYsmUWkfqooGGKD
	M1nRQS6AslyfJv5qTA/Erd2gIpkzmQ2oq7BxbAd8zcDHSxdS+Yz1mWvDugklxZPCjRlBu4IIArRkQ
	bXDHvD2kVeljk/u0bHxqNzbCk0Jllhtuo9yzmV4JCYHyoNvJCxI5BMvQtH3AfScpa1uc=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools/xenstore: make log macro globally available
Message-Id: <E1pOWP6-0008LE-11@xenbits.xenproject.org>
Date: Sun, 05 Feb 2023 04:13:24 +0000

commit ab5fa21c8d91f7057f0373ac63abc659f05b0c69
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Wed Jan 18 10:50:03 2023 +0100
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Fri Jan 20 09:23:51 2023 +0000

    tools/xenstore: make log macro globally available
    
    Move the definition of the log() macro to xenstored_core.h in order
    to make it usable from other source files, too.
    
    While at it preserve errno from being modified.
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Julien Grall <jgrall@amazon.com>
---
 tools/xenstore/xenstored_core.c | 14 --------------
 tools/xenstore/xenstored_core.h | 15 +++++++++++++++
 2 files changed, 15 insertions(+), 14 deletions(-)

diff --git a/tools/xenstore/xenstored_core.c b/tools/xenstore/xenstored_core.c
index 1650821922..d30f35e642 100644
--- a/tools/xenstore/xenstored_core.c
+++ b/tools/xenstore/xenstored_core.c
@@ -88,20 +88,6 @@ TDB_CONTEXT *tdb_ctx = NULL;
 
 static const char *sockmsg_string(enum xsd_sockmsg_type type);
 
-#define log(...)							\
-	do {								\
-		char *s = talloc_asprintf(NULL, __VA_ARGS__);		\
-		if (s) {						\
-			trace("%s\n", s);				\
-			syslog(LOG_ERR, "%s\n",  s);			\
-			talloc_free(s);					\
-		} else {						\
-			trace("talloc failure during logging\n");	\
-			syslog(LOG_ERR, "talloc failure during logging\n"); \
-		}							\
-	} while (0)
-
-
 int quota_nb_entry_per_domain = 1000;
 int quota_nb_watch_per_domain = 128;
 int quota_max_entry_size = 2048; /* 2K */
diff --git a/tools/xenstore/xenstored_core.h b/tools/xenstore/xenstored_core.h
index 37006d508d..89055cbb21 100644
--- a/tools/xenstore/xenstored_core.h
+++ b/tools/xenstore/xenstored_core.h
@@ -267,6 +267,21 @@ void trace(const char *fmt, ...) __attribute__ ((format (printf, 1, 2)));
 void reopen_log(void);
 void close_log(void);
 
+#define log(...)							\
+	do {								\
+		int _saved_errno = errno;				\
+		char *s = talloc_asprintf(NULL, __VA_ARGS__);		\
+		if (s) {						\
+			trace("%s\n", s);				\
+			syslog(LOG_ERR, "%s\n",	s);			\
+			talloc_free(s);					\
+		} else {						\
+			trace("talloc failure during logging\n");	\
+			syslog(LOG_ERR, "talloc failure during logging\n"); \
+		}							\
+		errno = _saved_errno;					\
+	} while (0)
+
 extern int orig_argc;
 extern char **orig_argv;
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sun Feb 05 04:13:35 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 05 Feb 2023 04:13:35 +0000
Received: from list by lists.xenproject.org with outflank-mailman.489692.758074 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pOWPH-0008Uj-FT; Sun, 05 Feb 2023 04:13:35 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 489692.758074; Sun, 05 Feb 2023 04:13:35 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pOWPH-0008Uc-Cc; Sun, 05 Feb 2023 04:13:35 +0000
Received: by outflank-mailman (input) for mailman id 489692;
 Sun, 05 Feb 2023 04:13:34 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pOWPG-0008UQ-5n
 for xen-changelog@lists.xenproject.org; Sun, 05 Feb 2023 04:13:34 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pOWPG-0000ub-57
 for xen-changelog@lists.xenproject.org; Sun, 05 Feb 2023 04:13:34 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pOWPG-0008Lj-4W
 for xen-changelog@lists.xenproject.org; Sun, 05 Feb 2023 04:13:34 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=eROQADuV+Jzv5LLmmrufAaXcIVEPbZQLKoF9VvcEMtE=; b=3zj0ODgLuqnr23BsxtG1Yp04eA
	7IRm8EOnorvKpdWjK6ZcoH3kiV89Wrb7L+bPo9DmoJ6wKoDT5JKvmsZ1hCYL6gzE3w4KdvS45t2yD
	XSQPRncYPsZT9WevZCHdmlyYjPucX6LRbHTgY9oI3HEv575NtnHhTQjab00/uV3uCNno=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools/xenstore: introduce dummy nodes for special watch paths
Message-Id: <E1pOWPG-0008Lj-4W@xenbits.xenproject.org>
Date: Sun, 05 Feb 2023 04:13:34 +0000

commit d6bb63924fc28a5bba53f5151db5c77f937879a5
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Wed Jan 18 10:50:04 2023 +0100
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Fri Jan 20 09:23:51 2023 +0000

    tools/xenstore: introduce dummy nodes for special watch paths
    
    Instead of special casing the permission handling and watch event
    firing for the special watch paths "@introduceDomain" and
    "@releaseDomain", use static dummy nodes added to the data base when
    starting Xenstore.
    
    The node accounting needs to reflect that change by adding the special
    nodes in the domain_entry_fix() call in setup_structure().
    
    Note that this requires to rework the calls of fire_watches() for the
    special events in order to avoid leaking memory.
    
    Move the check for a valid node name from get_node() to
    get_node_canonicalized(), as it allows to use get_node() for the
    special nodes, too.
    
    In order to avoid read and write accesses to the special nodes use a
    special variant for obtaining the current node data for the permission
    handling.
    
    This allows to simplify quite some code. In future sub-nodes of the
    special nodes will be possible due to this change, allowing more fine
    grained permission control of special events for specific domains.
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Julien Grall <jgrall@amazon.com>
---
 tools/xenstore/xenstored_control.c |   3 -
 tools/xenstore/xenstored_core.c    |  94 +++++++++++++--------
 tools/xenstore/xenstored_domain.c  | 164 ++++++-------------------------------
 tools/xenstore/xenstored_domain.h  |   6 --
 tools/xenstore/xenstored_watch.c   |  17 +---
 5 files changed, 83 insertions(+), 201 deletions(-)

diff --git a/tools/xenstore/xenstored_control.c b/tools/xenstore/xenstored_control.c
index d1aaa00bf4..41e6992591 100644
--- a/tools/xenstore/xenstored_control.c
+++ b/tools/xenstore/xenstored_control.c
@@ -676,9 +676,6 @@ static const char *lu_dump_state(const void *ctx, struct connection *conn)
 	if (ret)
 		goto out;
 	ret = dump_state_connections(fp);
-	if (ret)
-		goto out;
-	ret = dump_state_special_nodes(fp);
 	if (ret)
 		goto out;
 	ret = dump_state_nodes(fp, ctx);
diff --git a/tools/xenstore/xenstored_core.c b/tools/xenstore/xenstored_core.c
index d30f35e642..c82fb6e3d5 100644
--- a/tools/xenstore/xenstored_core.c
+++ b/tools/xenstore/xenstored_core.c
@@ -597,12 +597,13 @@ static void get_acc_data(TDB_DATA *key, struct node_account_data *acc)
  * Per-transaction nodes need to be accounted for the transaction owner.
  * Those nodes are stored in the data base with the transaction generation
  * count prepended (e.g. 123/local/domain/...). So testing for the node's
- * key not to start with "/" is sufficient.
+ * key not to start with "/" or "@" is sufficient.
  */
 static unsigned int get_acc_domid(struct connection *conn, TDB_DATA *key,
 				  unsigned int domid)
 {
-	return (!conn || key->dptr[0] == '/') ? domid : conn->id;
+	return (!conn || key->dptr[0] == '/' || key->dptr[0] == '@')
+	       ? domid : conn->id;
 }
 
 int do_tdb_write(struct connection *conn, TDB_DATA *key, TDB_DATA *data,
@@ -944,10 +945,6 @@ static struct node *get_node(struct connection *conn,
 {
 	struct node *node;
 
-	if (!name || !is_valid_nodename(name)) {
-		errno = EINVAL;
-		return NULL;
-	}
 	node = read_node(conn, ctx, name);
 	/* If we don't have permission, we don't have node. */
 	if (node) {
@@ -1236,9 +1233,23 @@ static struct node *get_node_canonicalized(struct connection *conn,
 	*canonical_name = canonicalize(conn, ctx, name);
 	if (!*canonical_name)
 		return NULL;
+	if (!is_valid_nodename(*canonical_name)) {
+		errno = EINVAL;
+		return NULL;
+	}
 	return get_node(conn, ctx, *canonical_name, perm);
 }
 
+static struct node *get_spec_node(struct connection *conn, const void *ctx,
+				  const char *name, char **canonical_name,
+				  unsigned int perm)
+{
+	if (name[0] == '@')
+		return get_node(conn, ctx, name, perm);
+
+	return get_node_canonicalized(conn, ctx, name, canonical_name, perm);
+}
+
 static int send_directory(const void *ctx, struct connection *conn,
 			  struct buffered_data *in)
 {
@@ -1723,8 +1734,7 @@ static int do_get_perms(const void *ctx, struct connection *conn,
 	char *strings;
 	unsigned int len;
 
-	node = get_node_canonicalized(conn, ctx, onearg(in), NULL,
-				      XS_PERM_READ);
+	node = get_spec_node(conn, ctx, onearg(in), NULL, XS_PERM_READ);
 	if (!node)
 		return errno;
 
@@ -1766,17 +1776,9 @@ static int do_set_perms(const void *ctx, struct connection *conn,
 	if (perms.p[0].perms & XS_PERM_IGNORE)
 		return ENOENT;
 
-	/* First arg is node name. */
-	if (strstarts(in->buffer, "@")) {
-		if (set_perms_special(conn, in->buffer, &perms))
-			return errno;
-		send_ack(conn, XS_SET_PERMS);
-		return 0;
-	}
-
 	/* We must own node to do this (tools can do this too). */
-	node = get_node_canonicalized(conn, ctx, in->buffer, &name,
-				      XS_PERM_WRITE | XS_PERM_OWNER);
+	node = get_spec_node(conn, ctx, in->buffer, &name,
+			     XS_PERM_WRITE | XS_PERM_OWNER);
 	if (!node)
 		return errno;
 
@@ -2374,7 +2376,9 @@ void setup_structure(bool live_update)
 		manual_node("/", "tool");
 		manual_node("/tool", "xenstored");
 		manual_node("/tool/xenstored", NULL);
-		domain_entry_fix(dom0_domid, 3, true);
+		manual_node("@releaseDomain", NULL);
+		manual_node("@introduceDomain", NULL);
+		domain_entry_fix(dom0_domid, 5, true);
 	}
 
 	check_store();
@@ -3156,6 +3160,23 @@ static int dump_state_node(const void *ctx, struct connection *conn,
 	return WALK_TREE_OK;
 }
 
+static int dump_state_special_node(FILE *fp, const void *ctx,
+				   struct dump_node_data *data,
+				   const char *name)
+{
+	struct node *node;
+	int ret;
+
+	node = read_node(NULL, ctx, name);
+	if (!node)
+		return dump_state_node_err(data, "Dump node read node error");
+
+	ret = dump_state_node(ctx, NULL, node, data);
+	talloc_free(node);
+
+	return ret;
+}
+
 const char *dump_state_nodes(FILE *fp, const void *ctx)
 {
 	struct dump_node_data data = {
@@ -3167,6 +3188,11 @@ const char *dump_state_nodes(FILE *fp, const void *ctx)
 	if (walk_node_tree(ctx, NULL, "/", &walkfuncs, &data))
 		return data.err;
 
+	if (dump_state_special_node(fp, ctx, &data, "@releaseDomain"))
+		return data.err;
+	if (dump_state_special_node(fp, ctx, &data, "@introduceDomain"))
+		return data.err;
+
 	return NULL;
 }
 
@@ -3340,25 +3366,21 @@ void read_state_node(const void *ctx, const void *state)
 		node->perms.p[i].id = sn->perms[i].domid;
 	}
 
-	if (strstarts(name, "@")) {
-		set_perms_special(&conn, name, &node->perms);
-		talloc_free(node);
-		return;
-	}
-
-	parentname = get_parent(node, name);
-	if (!parentname)
-		barf("allocation error restoring node");
-	parent = read_node(NULL, node, parentname);
-	if (!parent)
-		barf("read parent error restoring node");
+	if (!strstarts(name, "@")) {
+		parentname = get_parent(node, name);
+		if (!parentname)
+			barf("allocation error restoring node");
+		parent = read_node(NULL, node, parentname);
+		if (!parent)
+			barf("read parent error restoring node");
 
-	if (add_child(node, parent, name))
-		barf("allocation error restoring node");
+		if (add_child(node, parent, name))
+			barf("allocation error restoring node");
 
-	set_tdb_key(parentname, &key);
-	if (write_node_raw(NULL, &key, parent, true))
-		barf("write parent error restoring node");
+		set_tdb_key(parentname, &key);
+		if (write_node_raw(NULL, &key, parent, true))
+			barf("write parent error restoring node");
+	}
 
 	set_tdb_key(name, &key);
 	if (write_node_raw(NULL, &key, node, true))
diff --git a/tools/xenstore/xenstored_domain.c b/tools/xenstore/xenstored_domain.c
index 3ad1028edb..494694fd30 100644
--- a/tools/xenstore/xenstored_domain.c
+++ b/tools/xenstore/xenstored_domain.c
@@ -43,9 +43,6 @@ static evtchn_port_t virq_port;
 
 xenevtchn_handle *xce_handle = NULL;
 
-static struct node_perms dom_release_perms;
-static struct node_perms dom_introduce_perms;
-
 struct domain
 {
 	/* The id of this domain */
@@ -225,27 +222,6 @@ static void unmap_interface(void *interface)
 	xengnttab_unmap(*xgt_handle, interface, 1);
 }
 
-static void remove_domid_from_perm(struct node_perms *perms,
-				   struct domain *domain)
-{
-	unsigned int cur, new;
-
-	if (perms->p[0].id == domain->domid)
-		perms->p[0].id = priv_domid;
-
-	for (cur = new = 1; cur < perms->num; cur++) {
-		if (perms->p[cur].id == domain->domid)
-			continue;
-
-		if (new != cur)
-			perms->p[new] = perms->p[cur];
-
-		new++;
-	}
-
-	perms->num = new;
-}
-
 static int domain_tree_remove_sub(const void *ctx, struct connection *conn,
 				  struct node *node, void *arg)
 {
@@ -297,8 +273,26 @@ static void domain_tree_remove(struct domain *domain)
 			       "error when looking for orphaned nodes\n");
 	}
 
-	remove_domid_from_perm(&dom_release_perms, domain);
-	remove_domid_from_perm(&dom_introduce_perms, domain);
+	walk_node_tree(domain, NULL, "@releaseDomain", &walkfuncs, domain);
+	walk_node_tree(domain, NULL, "@introduceDomain", &walkfuncs, domain);
+}
+
+static void fire_special_watches(const char *name)
+{
+	void *ctx = talloc_new(NULL);
+	struct node *node;
+
+	if (!ctx)
+		return;
+
+	node = read_node(NULL, ctx, name);
+
+	if (node)
+		fire_watches(NULL, ctx, name, node, true, NULL);
+	else
+		log("special node %s not found\n", name);
+
+	talloc_free(ctx);
 }
 
 static int destroy_domain(void *_domain)
@@ -326,7 +320,7 @@ static int destroy_domain(void *_domain)
 			unmap_interface(domain->interface);
 	}
 
-	fire_watches(NULL, domain, "@releaseDomain", NULL, true, NULL);
+	fire_special_watches("@releaseDomain");
 
 	wrl_domain_destroy(domain);
 
@@ -384,7 +378,7 @@ void check_domains(void)
 		;
 
 	if (notify)
-		fire_watches(NULL, NULL, "@releaseDomain", NULL, true, NULL);
+		fire_special_watches("@releaseDomain");
 }
 
 /* We scan all domains rather than use the information given here. */
@@ -633,8 +627,7 @@ static struct domain *introduce_domain(const void *ctx,
 		}
 
 		if (!is_master_domain && !restore)
-			fire_watches(NULL, ctx, "@introduceDomain", NULL,
-				     true, NULL);
+			fire_special_watches("@introduceDomain");
 	} else {
 		/* Use XS_INTRODUCE for recreating the xenbus event-channel. */
 		if (domain->port)
@@ -840,59 +833,6 @@ const char *get_implicit_path(const struct connection *conn)
 	return conn->domain->path;
 }
 
-static int set_dom_perms_default(struct node_perms *perms)
-{
-	perms->num = 1;
-	perms->p = talloc_array(NULL, struct xs_permissions, perms->num);
-	if (!perms->p)
-		return -1;
-	perms->p->id = 0;
-	perms->p->perms = XS_PERM_NONE;
-
-	return 0;
-}
-
-static struct node_perms *get_perms_special(const char *name)
-{
-	if (!strcmp(name, "@releaseDomain"))
-		return &dom_release_perms;
-	if (!strcmp(name, "@introduceDomain"))
-		return &dom_introduce_perms;
-	return NULL;
-}
-
-int set_perms_special(struct connection *conn, const char *name,
-		      struct node_perms *perms)
-{
-	struct node_perms *p;
-
-	p = get_perms_special(name);
-	if (!p)
-		return EINVAL;
-
-	if ((perm_for_conn(conn, p) & (XS_PERM_WRITE | XS_PERM_OWNER)) !=
-	    (XS_PERM_WRITE | XS_PERM_OWNER))
-		return EACCES;
-
-	p->num = perms->num;
-	talloc_free(p->p);
-	p->p = perms->p;
-	talloc_steal(NULL, perms->p);
-
-	return 0;
-}
-
-bool check_perms_special(const char *name, struct connection *conn)
-{
-	struct node_perms *p;
-
-	p = get_perms_special(name);
-	if (!p)
-		return false;
-
-	return perm_for_conn(conn, p) & XS_PERM_READ;
-}
-
 void dom0_init(void)
 {
 	evtchn_port_t port;
@@ -962,10 +902,6 @@ void domain_init(int evtfd)
 	if (xce_handle == NULL)
 		barf_perror("Failed to open evtchn device");
 
-	if (set_dom_perms_default(&dom_release_perms) ||
-	    set_dom_perms_default(&dom_introduce_perms))
-		barf_perror("Failed to set special permissions");
-
 	if ((rc = xenevtchn_bind_virq(xce_handle, VIRQ_DOM_EXC)) == -1)
 		barf_perror("Failed to bind to domain exception virq port");
 	virq_port = rc;
@@ -1535,60 +1471,6 @@ const char *dump_state_connections(FILE *fp)
 	return ret;
 }
 
-static const char *dump_state_special_node(FILE *fp, const char *name,
-					   const struct node_perms *perms)
-{
-	struct xs_state_record_header head;
-	struct xs_state_node sn;
-	unsigned int pathlen;
-	const char *ret;
-
-	pathlen = strlen(name) + 1;
-
-	head.type = XS_STATE_TYPE_NODE;
-	head.length = sizeof(sn);
-
-	sn.conn_id = 0;
-	sn.ta_id = 0;
-	sn.ta_access = 0;
-	sn.perm_n = perms->num;
-	sn.path_len = pathlen;
-	sn.data_len = 0;
-	head.length += perms->num * sizeof(*sn.perms);
-	head.length += pathlen;
-	head.length = ROUNDUP(head.length, 3);
-	if (fwrite(&head, sizeof(head), 1, fp) != 1)
-		return "Dump special node error";
-	if (fwrite(&sn, sizeof(sn), 1, fp) != 1)
-		return "Dump special node error";
-
-	ret = dump_state_node_perms(fp, perms->p, perms->num);
-	if (ret)
-		return ret;
-
-	if (fwrite(name, pathlen, 1, fp) != 1)
-		return "Dump special node path error";
-
-	ret = dump_state_align(fp);
-
-	return ret;
-}
-
-const char *dump_state_special_nodes(FILE *fp)
-{
-	const char *ret;
-
-	ret = dump_state_special_node(fp, "@releaseDomain",
-				      &dom_release_perms);
-	if (ret)
-		return ret;
-
-	ret = dump_state_special_node(fp, "@introduceDomain",
-				      &dom_introduce_perms);
-
-	return ret;
-}
-
 void read_state_connection(const void *ctx, const void *state)
 {
 	const struct xs_state_connection *sc = state;
diff --git a/tools/xenstore/xenstored_domain.h b/tools/xenstore/xenstored_domain.h
index b38c82991d..630641d620 100644
--- a/tools/xenstore/xenstored_domain.h
+++ b/tools/xenstore/xenstored_domain.h
@@ -99,11 +99,6 @@ void domain_outstanding_domid_dec(unsigned int domid);
 int domain_get_quota(const void *ctx, struct connection *conn,
 		     unsigned int domid);
 
-/* Special node permission handling. */
-int set_perms_special(struct connection *conn, const char *name,
-		      struct node_perms *perms);
-bool check_perms_special(const char *name, struct connection *conn);
-
 /* Write rate limiting */
 
 #define WRL_FACTOR   1000 /* for fixed-point arithmetic */
@@ -132,7 +127,6 @@ void wrl_apply_debit_direct(struct connection *conn);
 void wrl_apply_debit_trans_commit(struct connection *conn);
 
 const char *dump_state_connections(FILE *fp);
-const char *dump_state_special_nodes(FILE *fp);
 
 void read_state_connection(const void *ctx, const void *state);
 
diff --git a/tools/xenstore/xenstored_watch.c b/tools/xenstore/xenstored_watch.c
index 316c08b7f7..75748ac109 100644
--- a/tools/xenstore/xenstored_watch.c
+++ b/tools/xenstore/xenstored_watch.c
@@ -46,13 +46,6 @@ struct watch
 	char *node;
 };
 
-static bool check_special_event(const char *name)
-{
-	assert(name);
-
-	return strstarts(name, "@");
-}
-
 /* Is child a subnode of parent, or equal? */
 static bool is_child(const char *child, const char *parent)
 {
@@ -153,14 +146,8 @@ void fire_watches(struct connection *conn, const void *ctx, const char *name,
 
 	/* Create an event for each watch. */
 	list_for_each_entry(i, &connections, list) {
-		/* introduce/release domain watches */
-		if (check_special_event(name)) {
-			if (!check_perms_special(name, i))
-				continue;
-		} else {
-			if (!watch_permitted(i, ctx, name, node, perms))
-				continue;
-		}
+		if (!watch_permitted(i, ctx, name, node, perms))
+			continue;
 
 		list_for_each_entry(watch, &i->watches, list) {
 			if (exact) {
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sun Feb 05 04:13:45 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 05 Feb 2023 04:13:45 +0000
Received: from list by lists.xenproject.org with outflank-mailman.489693.758078 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pOWPR-00006g-J1; Sun, 05 Feb 2023 04:13:45 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 489693.758078; Sun, 05 Feb 2023 04:13:45 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pOWPR-00006X-GC; Sun, 05 Feb 2023 04:13:45 +0000
Received: by outflank-mailman (input) for mailman id 489693;
 Sun, 05 Feb 2023 04:13:44 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pOWPQ-00006N-8f
 for xen-changelog@lists.xenproject.org; Sun, 05 Feb 2023 04:13:44 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pOWPQ-0000um-7u
 for xen-changelog@lists.xenproject.org; Sun, 05 Feb 2023 04:13:44 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pOWPQ-0008MA-7N
 for xen-changelog@lists.xenproject.org; Sun, 05 Feb 2023 04:13:44 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=x4/+UoDKXfa+v4JwxHBPMwtFl3bB4Wor5Svo7r7Ry3c=; b=tu5g71ORl7REEmiPCIwO/QLNdR
	ssEmG6fKUfa5gzxSicL2NIRfrX2ajtqs1ISv/Ve1TS79NH7htABqXRn0L5TC2GWRg7AUE1aRYv/q/
	jj0VXsROsftA3LJxMm5mFetKtidw8lx+AA7UEX+1UpEpO4rtm4zthxUummbrxWPI6WQY=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools/xenstore: replace watch->relative_path with a prefix length
Message-Id: <E1pOWPQ-0008MA-7N@xenbits.xenproject.org>
Date: Sun, 05 Feb 2023 04:13:44 +0000

commit 4db46b04956272f11a588e183653a13c2dd2e422
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Wed Jan 18 10:50:05 2023 +0100
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Fri Jan 20 09:23:51 2023 +0000

    tools/xenstore: replace watch->relative_path with a prefix length
    
    Instead of storing a pointer to the path which is prepended to
    relative paths in struct watch, just use the length of the prepended
    path.
    
    It should be noted that the now removed special case of the
    relative path being "" in get_watch_path() can't happen at all.
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Julien Grall <jgrall@amazon.com>
---
 tools/xenstore/xenstored_watch.c | 19 ++++---------------
 1 file changed, 4 insertions(+), 15 deletions(-)

diff --git a/tools/xenstore/xenstored_watch.c b/tools/xenstore/xenstored_watch.c
index 75748ac109..8ad0229df6 100644
--- a/tools/xenstore/xenstored_watch.c
+++ b/tools/xenstore/xenstored_watch.c
@@ -39,8 +39,8 @@ struct watch
 	/* Current outstanding events applying to this watch. */
 	struct list_head events;
 
-	/* Is this relative to connnection's implicit path? */
-	const char *relative_path;
+	/* Offset into path for skipping prefix (used for relative paths). */
+	unsigned int prefix_len;
 
 	char *token;
 	char *node;
@@ -66,15 +66,7 @@ static bool is_child(const char *child, const char *parent)
 
 static const char *get_watch_path(const struct watch *watch, const char *name)
 {
-	const char *path = name;
-
-	if (watch->relative_path) {
-		path += strlen(watch->relative_path);
-		if (*path == '/') /* Could be "" */
-			path++;
-	}
-
-	return path;
+	return name + watch->prefix_len;
 }
 
 /*
@@ -211,10 +203,7 @@ static struct watch *add_watch(struct connection *conn, char *path, char *token,
 			      no_quota_check))
 		goto nomem;
 
-	if (relative)
-		watch->relative_path = get_implicit_path(conn);
-	else
-		watch->relative_path = NULL;
+	watch->prefix_len = relative ? strlen(get_implicit_path(conn)) + 1 : 0;
 
 	INIT_LIST_HEAD(&watch->events);
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sun Feb 05 04:13:55 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 05 Feb 2023 04:13:55 +0000
Received: from list by lists.xenproject.org with outflank-mailman.489694.758082 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pOWPb-00009p-Ka; Sun, 05 Feb 2023 04:13:55 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 489694.758082; Sun, 05 Feb 2023 04:13:55 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pOWPb-00009f-Hh; Sun, 05 Feb 2023 04:13:55 +0000
Received: by outflank-mailman (input) for mailman id 489694;
 Sun, 05 Feb 2023 04:13:54 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pOWPa-00009R-BW
 for xen-changelog@lists.xenproject.org; Sun, 05 Feb 2023 04:13:54 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pOWPa-0000v8-Ao
 for xen-changelog@lists.xenproject.org; Sun, 05 Feb 2023 04:13:54 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pOWPa-0008Mm-AC
 for xen-changelog@lists.xenproject.org; Sun, 05 Feb 2023 04:13:54 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=cvZSbjdi9/w0kXhjYXhGxxX554b9nxEZoYWnMhcZzWI=; b=0q8LKViCnkBiWCFJCbb4uDofyk
	vOLk34HybeR63y9j8ZaBAgLL9BLyPbQ+oQqqIVKNPpXcp/Zo8Apfnr36Ruw+UlZ5rf5S7xtNikNgZ
	u6Z8I1bxNaoP+zXyz111zF4XxHs6Z9SyrFsfUbVznVDDAZw1JAoaOlTSMzzdNmKIVwwU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools/xenstore: move changed domain handling
Message-Id: <E1pOWPa-0008Mm-AC@xenbits.xenproject.org>
Date: Sun, 05 Feb 2023 04:13:54 +0000

commit c5bbae7bc59cc43d5f880dac25177315549f8c79
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Wed Jan 18 10:50:06 2023 +0100
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Fri Jan 20 09:23:51 2023 +0000

    tools/xenstore: move changed domain handling
    
    Move all code related to struct changed_domain from
    xenstored_transaction.c to xenstored_domain.c.
    
    This will be needed later in order to simplify the accounting data
    updates in cases of errors during a request.
    
    Split the code to have a more generic base framework.
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Julien Grall <jgrall@amazon.com>
---
 tools/xenstore/xenstored_domain.c      | 78 ++++++++++++++++++++++++++++++++++
 tools/xenstore/xenstored_domain.h      |  3 ++
 tools/xenstore/xenstored_transaction.c | 64 ++--------------------------
 3 files changed, 85 insertions(+), 60 deletions(-)

diff --git a/tools/xenstore/xenstored_domain.c b/tools/xenstore/xenstored_domain.c
index 494694fd30..1d765ceffa 100644
--- a/tools/xenstore/xenstored_domain.c
+++ b/tools/xenstore/xenstored_domain.c
@@ -91,6 +91,18 @@ struct domain
 	bool wrl_delay_logged;
 };
 
+struct changed_domain
+{
+	/* List of all changed domains. */
+	struct list_head list;
+
+	/* Identifier of the changed domain. */
+	unsigned int domid;
+
+	/* Amount by which this domain's nbentry field has changed. */
+	int nbentry;
+};
+
 static struct hashtable *domhash;
 
 static bool check_indexes(XENSTORE_RING_IDX cons, XENSTORE_RING_IDX prod)
@@ -543,6 +555,72 @@ static struct domain *find_domain_by_domid(unsigned int domid)
 	return (d && d->introduced) ? d : NULL;
 }
 
+int acc_fix_domains(struct list_head *head, bool update)
+{
+	struct changed_domain *cd;
+	int cnt;
+
+	list_for_each_entry(cd, head, list) {
+		cnt = domain_entry_fix(cd->domid, cd->nbentry, update);
+		if (!update) {
+			if (cnt >= quota_nb_entry_per_domain)
+				return ENOSPC;
+			if (cnt < 0)
+				return ENOMEM;
+		}
+	}
+
+	return 0;
+}
+
+static struct changed_domain *acc_find_changed_domain(struct list_head *head,
+						      unsigned int domid)
+{
+	struct changed_domain *cd;
+
+	list_for_each_entry(cd, head, list) {
+		if (cd->domid == domid)
+			return cd;
+	}
+
+	return NULL;
+}
+
+static struct changed_domain *acc_get_changed_domain(const void *ctx,
+						     struct list_head *head,
+						     unsigned int domid)
+{
+	struct changed_domain *cd;
+
+	cd = acc_find_changed_domain(head, domid);
+	if (cd)
+		return cd;
+
+	cd = talloc_zero(ctx, struct changed_domain);
+	if (!cd)
+		return NULL;
+
+	cd->domid = domid;
+	list_add_tail(&cd->list, head);
+
+	return cd;
+}
+
+int acc_add_dom_nbentry(const void *ctx, struct list_head *head, int val,
+			unsigned int domid)
+{
+	struct changed_domain *cd;
+
+	cd = acc_get_changed_domain(ctx, head, domid);
+	if (!cd)
+		return 0;
+
+	errno = 0;
+	cd->nbentry += val;
+
+	return cd->nbentry;
+}
+
 static void domain_conn_reset(struct domain *domain)
 {
 	struct connection *conn = domain->conn;
diff --git a/tools/xenstore/xenstored_domain.h b/tools/xenstore/xenstored_domain.h
index 630641d620..9e20d2b17d 100644
--- a/tools/xenstore/xenstored_domain.h
+++ b/tools/xenstore/xenstored_domain.h
@@ -98,6 +98,9 @@ void domain_outstanding_dec(struct connection *conn);
 void domain_outstanding_domid_dec(unsigned int domid);
 int domain_get_quota(const void *ctx, struct connection *conn,
 		     unsigned int domid);
+int acc_fix_domains(struct list_head *head, bool update);
+int acc_add_dom_nbentry(const void *ctx, struct list_head *head, int val,
+			unsigned int domid);
 
 /* Write rate limiting */
 
diff --git a/tools/xenstore/xenstored_transaction.c b/tools/xenstore/xenstored_transaction.c
index ac854197ca..c009c67989 100644
--- a/tools/xenstore/xenstored_transaction.c
+++ b/tools/xenstore/xenstored_transaction.c
@@ -137,18 +137,6 @@ struct accessed_node
 	bool watch_exact;
 };
 
-struct changed_domain
-{
-	/* List of all changed domains in the context of this transaction. */
-	struct list_head list;
-
-	/* Identifier of the changed domain. */
-	unsigned int domid;
-
-	/* Amount by which this domain's nbentry field has changed. */
-	int nbentry;
-};
-
 struct transaction
 {
 	/* List of all transactions active on this connection. */
@@ -514,24 +502,6 @@ int do_transaction_start(const void *ctx, struct connection *conn,
 	return 0;
 }
 
-static int transaction_fix_domains(struct transaction *trans, bool update)
-{
-	struct changed_domain *d;
-	int cnt;
-
-	list_for_each_entry(d, &trans->changed_domains, list) {
-		cnt = domain_entry_fix(d->domid, d->nbentry, update);
-		if (!update) {
-			if (cnt >= quota_nb_entry_per_domain)
-				return ENOSPC;
-			if (cnt < 0)
-				return ENOMEM;
-		}
-	}
-
-	return 0;
-}
-
 int do_transaction_end(const void *ctx, struct connection *conn,
 		       struct buffered_data *in)
 {
@@ -558,7 +528,7 @@ int do_transaction_end(const void *ctx, struct connection *conn,
 	if (streq(arg, "T")) {
 		if (trans->fail)
 			return ENOMEM;
-		ret = transaction_fix_domains(trans, false);
+		ret = acc_fix_domains(&trans->changed_domains, false);
 		if (ret)
 			return ret;
 		ret = finalize_transaction(conn, trans, &is_corrupt);
@@ -568,7 +538,7 @@ int do_transaction_end(const void *ctx, struct connection *conn,
 		wrl_apply_debit_trans_commit(conn);
 
 		/* fix domain entry for each changed domain */
-		transaction_fix_domains(trans, true);
+		acc_fix_domains(&trans->changed_domains, true);
 
 		if (is_corrupt)
 			corrupt(conn, "transaction inconsistency");
@@ -580,44 +550,18 @@ int do_transaction_end(const void *ctx, struct connection *conn,
 
 void transaction_entry_inc(struct transaction *trans, unsigned int domid)
 {
-	struct changed_domain *d;
-
-	list_for_each_entry(d, &trans->changed_domains, list)
-		if (d->domid == domid) {
-			d->nbentry++;
-			return;
-		}
-
-	d = talloc(trans, struct changed_domain);
-	if (!d) {
+	if (!acc_add_dom_nbentry(trans, &trans->changed_domains, 1, domid)) {
 		/* Let the transaction fail. */
 		trans->fail = true;
-		return;
 	}
-	d->domid = domid;
-	d->nbentry = 1;
-	list_add_tail(&d->list, &trans->changed_domains);
 }
 
 void transaction_entry_dec(struct transaction *trans, unsigned int domid)
 {
-	struct changed_domain *d;
-
-	list_for_each_entry(d, &trans->changed_domains, list)
-		if (d->domid == domid) {
-			d->nbentry--;
-			return;
-		}
-
-	d = talloc(trans, struct changed_domain);
-	if (!d) {
+	if (!acc_add_dom_nbentry(trans, &trans->changed_domains, -1, domid)) {
 		/* Let the transaction fail. */
 		trans->fail = true;
-		return;
 	}
-	d->domid = domid;
-	d->nbentry = -1;
-	list_add_tail(&d->list, &trans->changed_domains);
 }
 
 void fail_transaction(struct transaction *trans)
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sun Feb 05 04:14:06 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 05 Feb 2023 04:14:06 +0000
Received: from list by lists.xenproject.org with outflank-mailman.489697.758090 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pOWPl-0000FV-Vs; Sun, 05 Feb 2023 04:14:05 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 489697.758090; Sun, 05 Feb 2023 04:14:05 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pOWPl-0000Er-Ql; Sun, 05 Feb 2023 04:14:05 +0000
Received: by outflank-mailman (input) for mailman id 489697;
 Sun, 05 Feb 2023 04:14:04 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pOWPk-0000CX-Eo
 for xen-changelog@lists.xenproject.org; Sun, 05 Feb 2023 04:14:04 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pOWPk-0000vU-EA
 for xen-changelog@lists.xenproject.org; Sun, 05 Feb 2023 04:14:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pOWPk-0008Nj-DS
 for xen-changelog@lists.xenproject.org; Sun, 05 Feb 2023 04:14:04 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=3uf39IgJHzrVp0/46ORk7BYNbHegXaMZVDuVvTohsFs=; b=MiphgRPZ3IFGhHvnWuepB/lqfp
	5W2PF1tFh42V2YOZ4WkhcUp1leFWij6fRrw9bd51/giT62+va9swYgfjMHI4D8Pf+9M9ad6rD9rqC
	YpOogm+/X26+pFFie/JB+MPTq6KRsM3vtzT9Tbz/H8M/+aySO7gjGlRIs5ohQLRYx6Xc=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools/xenstore: change per-domain node accounting interface
Message-Id: <E1pOWPk-0008Nj-DS@xenbits.xenproject.org>
Date: Sun, 05 Feb 2023 04:14:04 +0000

commit 4c1f92d664c49442af8c743bd06360bda3412b3c
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Wed Jan 18 10:50:07 2023 +0100
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Fri Jan 20 09:23:51 2023 +0000

    tools/xenstore: change per-domain node accounting interface
    
    Rework the interface and the internals of the per-domain node
    accounting:
    
    - rename the functions to domain_nbentry_*() in order to better match
      the related counter name
    
    - switch from node pointer to domid as interface, as all nodes have the
      owner filled in
    
    - use a common internal function for adding a value to the counter
    
    For the transaction case add a helper function to get the list head
    of the per-transaction changed domains, enabling to eliminate the
    transaction_entry_*() functions.
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Julien Grall <jgrall@amazon.com>
---
 tools/xenstore/xenstored_core.c        |  28 ++++----
 tools/xenstore/xenstored_core.h        |   6 ++
 tools/xenstore/xenstored_domain.c      | 126 +++++++++++++++------------------
 tools/xenstore/xenstored_domain.h      |  10 ++-
 tools/xenstore/xenstored_transaction.c |  15 +---
 tools/xenstore/xenstored_transaction.h |   7 +-
 6 files changed, 87 insertions(+), 105 deletions(-)

diff --git a/tools/xenstore/xenstored_core.c b/tools/xenstore/xenstored_core.c
index c82fb6e3d5..4582ee39e1 100644
--- a/tools/xenstore/xenstored_core.c
+++ b/tools/xenstore/xenstored_core.c
@@ -738,13 +738,13 @@ struct node *read_node(struct connection *conn, const void *ctx,
 
 	/* Permissions are struct xs_permissions. */
 	node->perms.p = hdr->perms;
-	node->acc.domid = node->perms.p[0].id;
+	node->acc.domid = get_node_owner(node);
 	node->acc.memory = data.dsize;
 	if (domain_adjust_node_perms(node))
 		goto error;
 
 	/* If owner is gone reset currently accounted memory size. */
-	if (node->acc.domid != node->perms.p[0].id)
+	if (node->acc.domid != get_node_owner(node))
 		node->acc.memory = 0;
 
 	/* Data is binary blob (usually ascii, no nul). */
@@ -1445,7 +1445,7 @@ static void destroy_node_rm(struct connection *conn, struct node *node)
 static int destroy_node(struct connection *conn, struct node *node)
 {
 	destroy_node_rm(conn, node);
-	domain_entry_dec(conn, node);
+	domain_nbentry_dec(conn, get_node_owner(node));
 
 	/*
 	 * It is not possible to easily revert the changes in a transaction.
@@ -1484,7 +1484,7 @@ static struct node *create_node(struct connection *conn, const void *ctx,
 	for (i = node; i; i = i->parent) {
 		/* i->parent is set for each new node, so check quota. */
 		if (i->parent &&
-		    domain_entry(conn) >= quota_nb_entry_per_domain) {
+		    domain_nbentry(conn) >= quota_nb_entry_per_domain) {
 			ret = ENOSPC;
 			goto err;
 		}
@@ -1495,7 +1495,7 @@ static struct node *create_node(struct connection *conn, const void *ctx,
 
 		/* Account for new node */
 		if (i->parent) {
-			if (domain_entry_inc(conn, i)) {
+			if (domain_nbentry_inc(conn, get_node_owner(i))) {
 				destroy_node_rm(conn, i);
 				return NULL;
 			}
@@ -1648,7 +1648,7 @@ static int delnode_sub(const void *ctx, struct connection *conn,
 	watch_exact = strcmp(root, node->name);
 	fire_watches(conn, ctx, node->name, node, watch_exact, NULL);
 
-	domain_entry_dec(conn, node);
+	domain_nbentry_dec(conn, get_node_owner(node));
 
 	return WALK_TREE_RM_CHILDENTRY;
 }
@@ -1784,29 +1784,29 @@ static int do_set_perms(const void *ctx, struct connection *conn,
 
 	/* Unprivileged domains may not change the owner. */
 	if (domain_is_unprivileged(conn) &&
-	    perms.p[0].id != node->perms.p[0].id)
+	    perms.p[0].id != get_node_owner(node))
 		return EPERM;
 
 	old_perms = node->perms;
-	domain_entry_dec(conn, node);
+	domain_nbentry_dec(conn, get_node_owner(node));
 	node->perms = perms;
-	if (domain_entry_inc(conn, node)) {
+	if (domain_nbentry_inc(conn, get_node_owner(node))) {
 		node->perms = old_perms;
 		/*
 		 * This should never fail because we had a reference on the
 		 * domain before and Xenstored is single-threaded.
 		 */
-		domain_entry_inc(conn, node);
+		domain_nbentry_inc(conn, get_node_owner(node));
 		return ENOMEM;
 	}
 
 	if (write_node(conn, node, false)) {
 		int saved_errno = errno;
 
-		domain_entry_dec(conn, node);
+		domain_nbentry_dec(conn, get_node_owner(node));
 		node->perms = old_perms;
 		/* No failure possible as above. */
-		domain_entry_inc(conn, node);
+		domain_nbentry_inc(conn, get_node_owner(node));
 
 		errno = saved_errno;
 		return errno;
@@ -2378,7 +2378,7 @@ void setup_structure(bool live_update)
 		manual_node("/tool/xenstored", NULL);
 		manual_node("@releaseDomain", NULL);
 		manual_node("@introduceDomain", NULL);
-		domain_entry_fix(dom0_domid, 5, true);
+		domain_nbentry_fix(dom0_domid, 5, true);
 	}
 
 	check_store();
@@ -3386,7 +3386,7 @@ void read_state_node(const void *ctx, const void *state)
 	if (write_node_raw(NULL, &key, node, true))
 		barf("write node error restoring node");
 
-	if (domain_entry_inc(&conn, node))
+	if (domain_nbentry_inc(&conn, get_node_owner(node)))
 		barf("node accounting error restoring node");
 
 	talloc_free(node);
diff --git a/tools/xenstore/xenstored_core.h b/tools/xenstore/xenstored_core.h
index 89055cbb21..62d8ee96bd 100644
--- a/tools/xenstore/xenstored_core.h
+++ b/tools/xenstore/xenstored_core.h
@@ -232,6 +232,12 @@ char *canonicalize(struct connection *conn, const void *ctx, const char *node);
 unsigned int perm_for_conn(struct connection *conn,
 			   const struct node_perms *perms);
 
+/* Get owner of a node. */
+static inline unsigned int get_node_owner(const struct node *node)
+{
+	return node->perms.p[0].id;
+}
+
 /* Write a node to the tdb data base. */
 int write_node_raw(struct connection *conn, TDB_DATA *key, struct node *node,
 		   bool no_quota_check);
diff --git a/tools/xenstore/xenstored_domain.c b/tools/xenstore/xenstored_domain.c
index 1d765ceffa..703ddeec4e 100644
--- a/tools/xenstore/xenstored_domain.c
+++ b/tools/xenstore/xenstored_domain.c
@@ -249,7 +249,7 @@ static int domain_tree_remove_sub(const void *ctx, struct connection *conn,
 		domain->nbentry--;
 		node->perms.p[0].id = priv_domid;
 		node->acc.memory = 0;
-		domain_entry_inc(NULL, node);
+		domain_nbentry_inc(NULL, priv_domid);
 		if (write_node_raw(NULL, &key, node, true)) {
 			/* That's unfortunate. We only can try to continue. */
 			syslog(LOG_ERR,
@@ -561,7 +561,7 @@ int acc_fix_domains(struct list_head *head, bool update)
 	int cnt;
 
 	list_for_each_entry(cd, head, list) {
-		cnt = domain_entry_fix(cd->domid, cd->nbentry, update);
+		cnt = domain_nbentry_fix(cd->domid, cd->nbentry, update);
 		if (!update) {
 			if (cnt >= quota_nb_entry_per_domain)
 				return ENOSPC;
@@ -606,8 +606,8 @@ static struct changed_domain *acc_get_changed_domain(const void *ctx,
 	return cd;
 }
 
-int acc_add_dom_nbentry(const void *ctx, struct list_head *head, int val,
-			unsigned int domid)
+static int acc_add_dom_nbentry(const void *ctx, struct list_head *head, int val,
+			       unsigned int domid)
 {
 	struct changed_domain *cd;
 
@@ -991,30 +991,6 @@ void domain_deinit(void)
 		xenevtchn_unbind(xce_handle, virq_port);
 }
 
-int domain_entry_inc(struct connection *conn, struct node *node)
-{
-	struct domain *d;
-	unsigned int domid;
-
-	if (!node->perms.p)
-		return 0;
-
-	domid = node->perms.p[0].id;
-
-	if (conn && conn->transaction) {
-		transaction_entry_inc(conn->transaction, domid);
-	} else {
-		d = (conn && domid == conn->id && conn->domain) ? conn->domain
-		    : find_or_alloc_existing_domain(domid);
-		if (d)
-			d->nbentry++;
-		else
-			return ENOMEM;
-	}
-
-	return 0;
-}
-
 /*
  * Check whether a domain was created before or after a specific generation
  * count (used for testing whether a node permission is older than a domain).
@@ -1082,62 +1058,76 @@ int domain_adjust_node_perms(struct node *node)
 	return 0;
 }
 
-void domain_entry_dec(struct connection *conn, struct node *node)
+static int domain_nbentry_add(struct connection *conn, unsigned int domid,
+			      int add, bool no_dom_alloc)
 {
 	struct domain *d;
-	unsigned int domid;
-
-	if (!node->perms.p)
-		return;
+	struct list_head *head;
+	int ret;
 
-	domid = node->perms.p ? node->perms.p[0].id : conn->id;
+	if (conn && domid == conn->id && conn->domain)
+		d = conn->domain;
+	else if (no_dom_alloc) {
+		d = find_domain_struct(domid);
+		if (!d) {
+			errno = ENOENT;
+			corrupt(conn, "Missing domain %u\n", domid);
+			return -1;
+		}
+	} else {
+		d = find_or_alloc_existing_domain(domid);
+		if (!d) {
+			errno = ENOMEM;
+			return -1;
+		}
+	}
 
 	if (conn && conn->transaction) {
-		transaction_entry_dec(conn->transaction, domid);
-	} else {
-		d = (conn && domid == conn->id && conn->domain) ? conn->domain
-		    : find_domain_struct(domid);
-		if (d) {
-			d->nbentry--;
-		} else {
-			errno = ENOENT;
-			corrupt(conn,
-				"Node \"%s\" owned by non-existing domain %u\n",
-				node->name, domid);
+		head = transaction_get_changed_domains(conn->transaction);
+		ret = acc_add_dom_nbentry(conn->transaction, head, add, domid);
+		if (errno) {
+			fail_transaction(conn->transaction);
+			return -1;
 		}
+		/*
+		 * In a transaction when a node is being added/removed AND the
+		 * same node has been added/removed outside the transaction in
+		 * parallel, the resulting number of nodes will be wrong. This
+		 * is no problem, as the transaction will fail due to the
+		 * resulting conflict.
+		 * In the node remove case the resulting number can be even
+		 * negative, which should be avoided.
+		 */
+		return max(d->nbentry + ret, 0);
 	}
+
+	d->nbentry += add;
+
+	return d->nbentry;
 }
 
-int domain_entry_fix(unsigned int domid, int num, bool update)
+int domain_nbentry_inc(struct connection *conn, unsigned int domid)
 {
-	struct domain *d;
-	int cnt;
+	return (domain_nbentry_add(conn, domid, 1, false) < 0) ? errno : 0;
+}
 
-	if (update) {
-		d = find_domain_struct(domid);
-		assert(d);
-	} else {
-		/*
-		 * We are called first with update == false in order to catch
-		 * any error. So do a possible allocation and check for error
-		 * only in this case, as in the case of update == true nothing
-		 * can go wrong anymore as the allocation already happened.
-		 */
-		d = find_or_alloc_existing_domain(domid);
-		if (!d)
-			return -1;
-	}
+int domain_nbentry_dec(struct connection *conn, unsigned int domid)
+{
+	return (domain_nbentry_add(conn, domid, -1, true) < 0) ? errno : 0;
+}
 
-	cnt = d->nbentry + num;
-	assert(cnt >= 0);
+int domain_nbentry_fix(unsigned int domid, int num, bool update)
+{
+	int ret;
 
-	if (update)
-		d->nbentry = cnt;
+	ret = domain_nbentry_add(NULL, domid, update ? num : 0, update);
+	if (ret < 0 || update)
+		return ret;
 
-	return domid_is_unprivileged(domid) ? cnt : 0;
+	return domid_is_unprivileged(domid) ? ret + num : 0;
 }
 
-int domain_entry(struct connection *conn)
+int domain_nbentry(struct connection *conn)
 {
 	return (domain_is_unprivileged(conn))
 		? conn->domain->nbentry
diff --git a/tools/xenstore/xenstored_domain.h b/tools/xenstore/xenstored_domain.h
index 9e20d2b17d..1e402f2609 100644
--- a/tools/xenstore/xenstored_domain.h
+++ b/tools/xenstore/xenstored_domain.h
@@ -66,10 +66,10 @@ int domain_adjust_node_perms(struct node *node);
 int domain_alloc_permrefs(struct node_perms *perms);
 
 /* Quota manipulation */
-int domain_entry_inc(struct connection *conn, struct node *);
-void domain_entry_dec(struct connection *conn, struct node *);
-int domain_entry_fix(unsigned int domid, int num, bool update);
-int domain_entry(struct connection *conn);
+int domain_nbentry_inc(struct connection *conn, unsigned int domid);
+int domain_nbentry_dec(struct connection *conn, unsigned int domid);
+int domain_nbentry_fix(unsigned int domid, int num, bool update);
+int domain_nbentry(struct connection *conn);
 int domain_memory_add(unsigned int domid, int mem, bool no_quota_check);
 
 /*
@@ -99,8 +99,6 @@ void domain_outstanding_domid_dec(unsigned int domid);
 int domain_get_quota(const void *ctx, struct connection *conn,
 		     unsigned int domid);
 int acc_fix_domains(struct list_head *head, bool update);
-int acc_add_dom_nbentry(const void *ctx, struct list_head *head, int val,
-			unsigned int domid);
 
 /* Write rate limiting */
 
diff --git a/tools/xenstore/xenstored_transaction.c b/tools/xenstore/xenstored_transaction.c
index c009c67989..82e5e66c18 100644
--- a/tools/xenstore/xenstored_transaction.c
+++ b/tools/xenstore/xenstored_transaction.c
@@ -548,20 +548,9 @@ int do_transaction_end(const void *ctx, struct connection *conn,
 	return 0;
 }
 
-void transaction_entry_inc(struct transaction *trans, unsigned int domid)
+struct list_head *transaction_get_changed_domains(struct transaction *trans)
 {
-	if (!acc_add_dom_nbentry(trans, &trans->changed_domains, 1, domid)) {
-		/* Let the transaction fail. */
-		trans->fail = true;
-	}
-}
-
-void transaction_entry_dec(struct transaction *trans, unsigned int domid)
-{
-	if (!acc_add_dom_nbentry(trans, &trans->changed_domains, -1, domid)) {
-		/* Let the transaction fail. */
-		trans->fail = true;
-	}
+	return &trans->changed_domains;
 }
 
 void fail_transaction(struct transaction *trans)
diff --git a/tools/xenstore/xenstored_transaction.h b/tools/xenstore/xenstored_transaction.h
index 3417303f94..b6f8cb7d0a 100644
--- a/tools/xenstore/xenstored_transaction.h
+++ b/tools/xenstore/xenstored_transaction.h
@@ -36,10 +36,6 @@ int do_transaction_end(const void *ctx, struct connection *conn,
 
 struct transaction *transaction_lookup(struct connection *conn, uint32_t id);
 
-/* inc/dec entry number local to trans while changing a node */
-void transaction_entry_inc(struct transaction *trans, unsigned int domid);
-void transaction_entry_dec(struct transaction *trans, unsigned int domid);
-
 /* This node was accessed. */
 int __must_check access_node(struct connection *conn, struct node *node,
                              enum node_access_type type, TDB_DATA *key);
@@ -54,6 +50,9 @@ void transaction_prepend(struct connection *conn, const char *name,
 /* Mark the transaction as failed. This will prevent it to be committed. */
 void fail_transaction(struct transaction *trans);
 
+/* Get the list head of the changed domains. */
+struct list_head *transaction_get_changed_domains(struct transaction *trans);
+
 void conn_delete_all_transactions(struct connection *conn);
 int check_transactions(struct hashtable *hash);
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sun Feb 05 04:14:16 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 05 Feb 2023 04:14:16 +0000
Received: from list by lists.xenproject.org with outflank-mailman.489699.758101 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pOWPv-0000ZW-WB; Sun, 05 Feb 2023 04:14:15 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 489699.758101; Sun, 05 Feb 2023 04:14:15 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pOWPv-0000ZO-TJ; Sun, 05 Feb 2023 04:14:15 +0000
Received: by outflank-mailman (input) for mailman id 489699;
 Sun, 05 Feb 2023 04:14:14 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pOWPu-0000Ya-IN
 for xen-changelog@lists.xenproject.org; Sun, 05 Feb 2023 04:14:14 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pOWPu-0000ve-Hb
 for xen-changelog@lists.xenproject.org; Sun, 05 Feb 2023 04:14:14 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pOWPu-0008Oh-Gk
 for xen-changelog@lists.xenproject.org; Sun, 05 Feb 2023 04:14:14 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=1xBgfPHwD4I9UiEIaMGX8ku8Pq7EPeWze3X7KcKtFXw=; b=Xrfrm/zWTRZYCNufPPc8DrcLC+
	Ug8sG4JyA/ljiO6skkcJDoB9QF3wXE8TuNRh0Q1kORm66q8J30nWIUubi9/svmEtCX5yKXtSXn9SP
	PZoBoBQRvA0x70LsQ2onA2fVXbSH5ftLkDlZOjPpkRiUYLJH6NeTkZXv3hBh0OFDbUEI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools/xenstore: replace literal domid 0 with dom0_domid
Message-Id: <E1pOWPu-0008Oh-Gk@xenbits.xenproject.org>
Date: Sun, 05 Feb 2023 04:14:14 +0000

commit a401b48f378f7b29c7b1f4ea0dc4262aef42bd00
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Wed Jan 18 10:50:08 2023 +0100
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Fri Jan 20 09:23:51 2023 +0000

    tools/xenstore: replace literal domid 0 with dom0_domid
    
    There are some places left where dom0 is associated with domid 0.
    
    Use dom0_domid instead.
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Julien Grall <jgrall@amazon.com>
---
 tools/xenstore/xenstored_core.c   | 5 +++--
 tools/xenstore/xenstored_domain.c | 8 ++++----
 2 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/tools/xenstore/xenstored_core.c b/tools/xenstore/xenstored_core.c
index 4582ee39e1..9cfde76898 100644
--- a/tools/xenstore/xenstored_core.c
+++ b/tools/xenstore/xenstored_core.c
@@ -2297,9 +2297,10 @@ static void accept_connection(int sock)
 		return;
 
 	conn = new_connection(&socket_funcs);
-	if (conn)
+	if (conn) {
 		conn->fd = fd;
-	else
+		conn->id = dom0_domid;
+	} else
 		close(fd);
 }
 #endif
diff --git a/tools/xenstore/xenstored_domain.c b/tools/xenstore/xenstored_domain.c
index 703ddeec4e..a703c0ef47 100644
--- a/tools/xenstore/xenstored_domain.c
+++ b/tools/xenstore/xenstored_domain.c
@@ -326,7 +326,7 @@ static int destroy_domain(void *_domain)
 	if (domain->interface) {
 		/* Domain 0 was mapped by dom0_init, so it must be unmapped
 		   using munmap() and not the grant unmap call. */
-		if (domain->domid == 0)
+		if (domain->domid == dom0_domid)
 			unmap_xenbus(domain->interface);
 		else
 			unmap_interface(domain->interface);
@@ -410,7 +410,7 @@ void handle_event(void)
 
 static bool domid_is_unprivileged(unsigned int domid)
 {
-	return domid != 0 && domid != priv_domid;
+	return domid != dom0_domid && domid != priv_domid;
 }
 
 bool domain_is_unprivileged(struct connection *conn)
@@ -798,7 +798,7 @@ static struct domain *onearg_domain(struct connection *conn,
 		return ERR_PTR(-EINVAL);
 
 	domid = atoi(domid_str);
-	if (!domid)
+	if (domid == dom0_domid)
 		return ERR_PTR(-EINVAL);
 
 	return find_connected_domain(domid);
@@ -1004,7 +1004,7 @@ static int chk_domain_generation(unsigned int domid, uint64_t gen)
 {
 	struct domain *d;
 
-	if (!xc_handle && domid == 0)
+	if (!xc_handle && domid == dom0_domid)
 		return 1;
 
 	d = find_domain_struct(domid);
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sun Feb 05 04:14:26 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 05 Feb 2023 04:14:26 +0000
Received: from list by lists.xenproject.org with outflank-mailman.489702.758105 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pOWQ6-0000ke-30; Sun, 05 Feb 2023 04:14:26 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 489702.758105; Sun, 05 Feb 2023 04:14:26 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pOWQ6-0000kU-0E; Sun, 05 Feb 2023 04:14:26 +0000
Received: by outflank-mailman (input) for mailman id 489702;
 Sun, 05 Feb 2023 04:14:24 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pOWQ4-0000k5-LG
 for xen-changelog@lists.xenproject.org; Sun, 05 Feb 2023 04:14:24 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pOWQ4-0000vk-KZ
 for xen-changelog@lists.xenproject.org; Sun, 05 Feb 2023 04:14:24 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pOWQ4-0008PJ-K1
 for xen-changelog@lists.xenproject.org; Sun, 05 Feb 2023 04:14:24 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=rndhZKk3qqjXBEgUoJEnznNp0wVGYMvTTKKkKJ0oFaA=; b=m/61N8VSyLBY1tj56HN+VulHjD
	7GXhEAZwyzxlldDY50GhPt6lXB/j/jvYO8H9lRfH9jjvKmiXDT9VK6IRm3VO8brIvo7lbFv8dwZOR
	ylHRWw9RO3YkoQS15lJcQOXC/NIY1XGKZO9v1Nm/WvHr1Ia7xvp270Mxx9gAsEvofQ1c=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools/xenstore: make domain_is_unprivileged() an inline function
Message-Id: <E1pOWQ4-0008PJ-K1@xenbits.xenproject.org>
Date: Sun, 05 Feb 2023 04:14:24 +0000

commit e91406f56a7ea1b09e4f265d34f3404c7ceb7316
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Wed Jan 18 10:50:09 2023 +0100
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Fri Jan 20 09:23:51 2023 +0000

    tools/xenstore: make domain_is_unprivileged() an inline function
    
    clang 14 is complaining about a NULL dereference for constructs like:
    
      domain_is_unprivileged(conn) ? conn->in : NULL
    
    as it can't know that domain_is_unprivileged(conn) will return false
    if conn is NULL.
    
    Fix that by making domain_is_unprivileged() an inline function (and
    related to that domid_is_unprivileged(), too).
    
    In order not having to make struct domain public, use conn->id instead
    of conn->domain->domid for the test.
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
---
 tools/xenstore/xenstored_core.h   | 10 ++++++++++
 tools/xenstore/xenstored_domain.c | 11 -----------
 tools/xenstore/xenstored_domain.h |  2 --
 3 files changed, 10 insertions(+), 13 deletions(-)

diff --git a/tools/xenstore/xenstored_core.h b/tools/xenstore/xenstored_core.h
index 62d8ee96bd..6548200d8e 100644
--- a/tools/xenstore/xenstored_core.h
+++ b/tools/xenstore/xenstored_core.h
@@ -318,6 +318,16 @@ void unmap_xenbus(void *interface);
 
 static inline int xenbus_master_domid(void) { return dom0_domid; }
 
+static inline bool domid_is_unprivileged(unsigned int domid)
+{
+	return domid != dom0_domid && domid != priv_domid;
+}
+
+static inline bool domain_is_unprivileged(const struct connection *conn)
+{
+	return conn && domid_is_unprivileged(conn->id);
+}
+
 /* Return the event channel used by xenbus. */
 evtchn_port_t xenbus_evtchn(void);
 
diff --git a/tools/xenstore/xenstored_domain.c b/tools/xenstore/xenstored_domain.c
index a703c0ef47..10880a32d9 100644
--- a/tools/xenstore/xenstored_domain.c
+++ b/tools/xenstore/xenstored_domain.c
@@ -408,17 +408,6 @@ void handle_event(void)
 		barf_perror("Failed to write to event fd");
 }
 
-static bool domid_is_unprivileged(unsigned int domid)
-{
-	return domid != dom0_domid && domid != priv_domid;
-}
-
-bool domain_is_unprivileged(struct connection *conn)
-{
-	return conn && conn->domain &&
-	       domid_is_unprivileged(conn->domain->domid);
-}
-
 static char *talloc_domain_path(const void *context, unsigned int domid)
 {
 	return talloc_asprintf(context, "/local/domain/%u", domid);
diff --git a/tools/xenstore/xenstored_domain.h b/tools/xenstore/xenstored_domain.h
index 1e402f2609..22996e2576 100644
--- a/tools/xenstore/xenstored_domain.h
+++ b/tools/xenstore/xenstored_domain.h
@@ -59,8 +59,6 @@ void ignore_connection(struct connection *conn, unsigned int err);
 /* Returns the implicit path of a connection (only domains have this) */
 const char *get_implicit_path(const struct connection *conn);
 
-bool domain_is_unprivileged(struct connection *conn);
-
 /* Remove node permissions for no longer existing domains. */
 int domain_adjust_node_perms(struct node *node);
 int domain_alloc_permrefs(struct node_perms *perms);
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sun Feb 05 04:14:37 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 05 Feb 2023 04:14:37 +0000
Received: from list by lists.xenproject.org with outflank-mailman.489706.758112 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pOWQG-0000rf-5D; Sun, 05 Feb 2023 04:14:36 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 489706.758112; Sun, 05 Feb 2023 04:14:36 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pOWQG-0000rX-2S; Sun, 05 Feb 2023 04:14:36 +0000
Received: by outflank-mailman (input) for mailman id 489706;
 Sun, 05 Feb 2023 04:14:34 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pOWQE-0000rJ-OG
 for xen-changelog@lists.xenproject.org; Sun, 05 Feb 2023 04:14:34 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pOWQE-0000vs-NV
 for xen-changelog@lists.xenproject.org; Sun, 05 Feb 2023 04:14:34 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pOWQE-0008Pr-Mx
 for xen-changelog@lists.xenproject.org; Sun, 05 Feb 2023 04:14:34 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=CeiU/Fz9fkEa4blES2tkTBotPvy2iDmEXoajSQqxLLE=; b=cxB0YjGRQAXt5dpGW8ZYvn2He8
	zD3OYU0xnRNpMAXK+brMV9mKDvk022+XI988L7TP1B7flxlmeUcdM1LywI7cyQF6Yo4CVaYOT/wy0
	h8Ug86zIusoSTXAkr2rmfvD2rPUB20+2i/Q+qs2PZxjVNyZswJJTbkhMvuKbGztZ2OYE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools/xenstore: let chk_domain_generation() return a bool
Message-Id: <E1pOWQE-0008Pr-Mx@xenbits.xenproject.org>
Date: Sun, 05 Feb 2023 04:14:34 +0000

commit 22f3c41dd73d78350437c0fc0968f67977ab97dd
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Wed Jan 18 10:50:10 2023 +0100
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Fri Jan 20 09:23:51 2023 +0000

    tools/xenstore: let chk_domain_generation() return a bool
    
    Instead of returning 0 or 1 let chk_domain_generation() return a
    boolean value.
    
    Simplify the only caller by removing the ret variable.
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Julien Grall <jgrall@amazon.com>
---
 tools/xenstore/xenstored_domain.c | 18 ++++++++----------
 1 file changed, 8 insertions(+), 10 deletions(-)

diff --git a/tools/xenstore/xenstored_domain.c b/tools/xenstore/xenstored_domain.c
index 10880a32d9..391395060e 100644
--- a/tools/xenstore/xenstored_domain.c
+++ b/tools/xenstore/xenstored_domain.c
@@ -985,20 +985,20 @@ void domain_deinit(void)
  * count (used for testing whether a node permission is older than a domain).
  *
  * Return values:
- *  0: domain has higher generation count (it is younger than a node with the
- *     given count), or domain isn't existing any longer
- *  1: domain is older than the node
+ *  false: domain has higher generation count (it is younger than a node with
+ *     the given count), or domain isn't existing any longer
+ *  true: domain is older than the node
  */
-static int chk_domain_generation(unsigned int domid, uint64_t gen)
+static bool chk_domain_generation(unsigned int domid, uint64_t gen)
 {
 	struct domain *d;
 
 	if (!xc_handle && domid == dom0_domid)
-		return 1;
+		return true;
 
 	d = find_domain_struct(domid);
 
-	return (d && d->generation <= gen) ? 1 : 0;
+	return d && d->generation <= gen;
 }
 
 /*
@@ -1033,14 +1033,12 @@ int domain_alloc_permrefs(struct node_perms *perms)
 int domain_adjust_node_perms(struct node *node)
 {
 	unsigned int i;
-	int ret;
 
 	for (i = 1; i < node->perms.num; i++) {
 		if (node->perms.p[i].perms & XS_PERM_IGNORE)
 			continue;
-		ret = chk_domain_generation(node->perms.p[i].id,
-					    node->generation);
-		if (!ret)
+		if (!chk_domain_generation(node->perms.p[i].id,
+					   node->generation))
 			node->perms.p[i].perms |= XS_PERM_IGNORE;
 	}
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sun Feb 05 04:14:46 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 05 Feb 2023 04:14:46 +0000
Received: from list by lists.xenproject.org with outflank-mailman.489707.758116 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pOWQQ-0000uw-6a; Sun, 05 Feb 2023 04:14:46 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 489707.758116; Sun, 05 Feb 2023 04:14:46 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pOWQQ-0000uo-3w; Sun, 05 Feb 2023 04:14:46 +0000
Received: by outflank-mailman (input) for mailman id 489707;
 Sun, 05 Feb 2023 04:14:44 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pOWQO-0000uW-R7
 for xen-changelog@lists.xenproject.org; Sun, 05 Feb 2023 04:14:44 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pOWQO-0000vw-QT
 for xen-changelog@lists.xenproject.org; Sun, 05 Feb 2023 04:14:44 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pOWQO-0008QM-Pr
 for xen-changelog@lists.xenproject.org; Sun, 05 Feb 2023 04:14:44 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=fO9q78spvCDo8bajFkB5phigeNG4HaBB/BfvnpWDl58=; b=GLmwr5zVTK/1QBwUDuSMXBBbzr
	0StLmE8352Vj6tSflbVO0KkbftUIf2HSIn3/+w19g5jGRjhPS5U8na8CbvaYiMEvi5b5qBHZPNtcG
	6UFmd1mgQ+i5syoUfst84dIkFxAjp9IDR04X0luyHMILUGoD0dYCR+ivsBmL093klrNE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools/xenstore: don't let hashtable_remove() return the removed value
Message-Id: <E1pOWQO-0008QM-Pr@xenbits.xenproject.org>
Date: Sun, 05 Feb 2023 04:14:44 +0000

commit 473ae5b7f3038c17b8205b65b741f9e2e9dcdc4a
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Wed Jan 18 10:50:11 2023 +0100
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Fri Jan 20 09:23:51 2023 +0000

    tools/xenstore: don't let hashtable_remove() return the removed value
    
    Letting hashtable_remove() return the value of the removed element is
    not used anywhere in Xenstore, and it conflicts with a hashtable
    created specifying the HASHTABLE_FREE_VALUE flag.
    
    So just drop returning the value.
    
    This of course requires to free the value if the HASHTABLE_FREE_VALUE
    was specified, as otherwise it would be a memory leak.
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Julien Grall <jgrall@amazon.com>
---
 tools/xenstore/hashtable.c | 9 ++++-----
 tools/xenstore/hashtable.h | 3 +--
 2 files changed, 5 insertions(+), 7 deletions(-)

diff --git a/tools/xenstore/hashtable.c b/tools/xenstore/hashtable.c
index 299549c51e..ddca1591a2 100644
--- a/tools/xenstore/hashtable.c
+++ b/tools/xenstore/hashtable.c
@@ -214,7 +214,7 @@ hashtable_search(struct hashtable *h, void *k)
 }
 
 /*****************************************************************************/
-void * /* returns value associated with key */
+void
 hashtable_remove(struct hashtable *h, void *k)
 {
     /* TODO: consider compacting the table when the load factor drops enough,
@@ -222,7 +222,6 @@ hashtable_remove(struct hashtable *h, void *k)
 
     struct entry *e;
     struct entry **pE;
-    void *v;
     unsigned int hashvalue, index;
 
     hashvalue = hash(h,k);
@@ -236,16 +235,16 @@ hashtable_remove(struct hashtable *h, void *k)
         {
             *pE = e->next;
             h->entrycount--;
-            v = e->v;
             if (h->flags & HASHTABLE_FREE_KEY)
                 free(e->k);
+            if (h->flags & HASHTABLE_FREE_VALUE)
+                free(e->v);
             free(e);
-            return v;
+            return;
         }
         pE = &(e->next);
         e = e->next;
     }
-    return NULL;
 }
 
 /*****************************************************************************/
diff --git a/tools/xenstore/hashtable.h b/tools/xenstore/hashtable.h
index 6d65431f96..780ad3c8f7 100644
--- a/tools/xenstore/hashtable.h
+++ b/tools/xenstore/hashtable.h
@@ -68,10 +68,9 @@ hashtable_search(struct hashtable *h, void *k);
  * @name        hashtable_remove
  * @param   h   the hashtable to remove the item from
  * @param   k   the key to search for  - does not claim ownership
- * @return      the value associated with the key, or NULL if none found
  */
 
-void * /* returns value */
+void
 hashtable_remove(struct hashtable *h, void *k);
 
 /*****************************************************************************
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sun Feb 05 04:14:56 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 05 Feb 2023 04:14:56 +0000
Received: from list by lists.xenproject.org with outflank-mailman.489708.758120 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pOWQa-0000z1-8H; Sun, 05 Feb 2023 04:14:56 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 489708.758120; Sun, 05 Feb 2023 04:14:56 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pOWQa-0000yt-5Q; Sun, 05 Feb 2023 04:14:56 +0000
Received: by outflank-mailman (input) for mailman id 489708;
 Sun, 05 Feb 2023 04:14:54 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pOWQY-0000yh-UI
 for xen-changelog@lists.xenproject.org; Sun, 05 Feb 2023 04:14:54 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pOWQY-0000wN-Tc
 for xen-changelog@lists.xenproject.org; Sun, 05 Feb 2023 04:14:54 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pOWQY-0008Qu-Sy
 for xen-changelog@lists.xenproject.org; Sun, 05 Feb 2023 04:14:54 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=QU38SgD70ja8XXPVMEHW/znnt9xydXdeU1z4wmzduPI=; b=iDZjyQIDL/gMLLOStXtmtm789S
	5sKJjFBhoABQUtCeLQmR4MHC59ac1OEenHkYPn0LuJborJdJKagZSTdwZOjhoq9cLDm4HHmUjy1v7
	NDQk/ElY3uhm3ByIOCWSSGUtKujYStQ6TShE1WLDToQFJAP+VnGdMtxlbZPp80zOrQu8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools/xenstore: switch hashtable to use the talloc framework
Message-Id: <E1pOWQY-0008Qu-Sy@xenbits.xenproject.org>
Date: Sun, 05 Feb 2023 04:14:54 +0000

commit 46d960890605f0ebc257ac89050105fe012ee2cd
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Wed Jan 18 10:50:12 2023 +0100
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Fri Jan 20 09:23:51 2023 +0000

    tools/xenstore: switch hashtable to use the talloc framework
    
    Instead of using malloc() and friends, let the hashtable implementation
    use the talloc framework.
    
    This is more consistent with the rest of xenstored and it allows to
    track memory usage via "xenstore-control memreport".
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Julien Grall <jgrall@amazon.com>
---
 tools/xenstore/hashtable.c        | 98 +++++++++++++--------------------------
 tools/xenstore/hashtable.h        |  3 +-
 tools/xenstore/xenstored_core.c   |  5 +-
 tools/xenstore/xenstored_domain.c |  2 +-
 4 files changed, 38 insertions(+), 70 deletions(-)

diff --git a/tools/xenstore/hashtable.c b/tools/xenstore/hashtable.c
index ddca1591a2..30eb9f21d2 100644
--- a/tools/xenstore/hashtable.c
+++ b/tools/xenstore/hashtable.c
@@ -6,6 +6,8 @@
 #include <string.h>
 #include <math.h>
 #include <stdint.h>
+#include <stdarg.h>
+#include "talloc.h"
 
 struct entry
 {
@@ -50,7 +52,7 @@ indexFor(unsigned int tablelength, unsigned int hashvalue) {
 
 /*****************************************************************************/
 struct hashtable *
-create_hashtable(unsigned int minsize,
+create_hashtable(const void *ctx, unsigned int minsize,
                  unsigned int (*hashf) (void*),
                  int (*eqf) (void*,void*),
                  unsigned int flags)
@@ -66,10 +68,10 @@ create_hashtable(unsigned int minsize,
         if (primes[pindex] > minsize) { size = primes[pindex]; break; }
     }
 
-    h = (struct hashtable *)calloc(1, sizeof(struct hashtable));
+    h = talloc_zero(ctx, struct hashtable);
     if (NULL == h)
         goto err0;
-    h->table = (struct entry **)calloc(size, sizeof(struct entry *));
+    h->table = talloc_zero_array(h, struct entry *, size);
     if (NULL == h->table)
         goto err1;
 
@@ -83,7 +85,7 @@ create_hashtable(unsigned int minsize,
     return h;
 
 err1:
-   free(h);
+   talloc_free(h);
 err0:
    return NULL;
 }
@@ -115,47 +117,32 @@ hashtable_expand(struct hashtable *h)
     if (h->primeindex == (prime_table_length - 1)) return 0;
     newsize = primes[++(h->primeindex)];
 
-    newtable = (struct entry **)calloc(newsize, sizeof(struct entry*));
-    if (NULL != newtable)
+    newtable = talloc_realloc(h, h->table, struct entry *, newsize);
+    if (!newtable)
     {
-        /* This algorithm is not 'stable'. ie. it reverses the list
-         * when it transfers entries between the tables */
-        for (i = 0; i < h->tablelength; i++) {
-            while (NULL != (e = h->table[i])) {
-                h->table[i] = e->next;
-                index = indexFor(newsize,e->h);
+        h->primeindex--;
+        return 0;
+    }
+
+    h->table = newtable;
+    memset(newtable + h->tablelength, 0,
+           (newsize - h->tablelength) * sizeof(*newtable));
+    for (i = 0; i < h->tablelength; i++) {
+        for (pE = &(newtable[i]), e = *pE; e != NULL; e = *pE) {
+            index = indexFor(newsize, e->h);
+            if (index == i)
+            {
+                pE = &(e->next);
+            }
+            else
+            {
+                *pE = e->next;
                 e->next = newtable[index];
                 newtable[index] = e;
             }
         }
-        free(h->table);
-        h->table = newtable;
-    }
-    /* Plan B: realloc instead */
-    else 
-    {
-        newtable = (struct entry **)
-                   realloc(h->table, newsize * sizeof(struct entry *));
-        if (NULL == newtable) { (h->primeindex)--; return 0; }
-        h->table = newtable;
-        memset(newtable + h->tablelength, 0,
-               (newsize - h->tablelength) * sizeof(*newtable));
-        for (i = 0; i < h->tablelength; i++) {
-            for (pE = &(newtable[i]), e = *pE; e != NULL; e = *pE) {
-                index = indexFor(newsize,e->h);
-                if (index == i)
-                {
-                    pE = &(e->next);
-                }
-                else
-                {
-                    *pE = e->next;
-                    e->next = newtable[index];
-                    newtable[index] = e;
-                }
-            }
-        }
     }
+
     h->tablelength = newsize;
     h->loadlimit   = (unsigned int)
         (((uint64_t)newsize * max_load_factor) / 100);
@@ -184,12 +171,16 @@ hashtable_insert(struct hashtable *h, void *k, void *v)
          * element may be ok. Next time we insert, we'll try expanding again.*/
         hashtable_expand(h);
     }
-    e = (struct entry *)calloc(1, sizeof(struct entry));
+    e = talloc_zero(h, struct entry);
     if (NULL == e) { --(h->entrycount); return 0; } /*oom*/
     e->h = hash(h,k);
     index = indexFor(h->tablelength,e->h);
     e->k = k;
+    if (h->flags & HASHTABLE_FREE_KEY)
+        talloc_steal(e, k);
     e->v = v;
+    if (h->flags & HASHTABLE_FREE_VALUE)
+        talloc_steal(e, v);
     e->next = h->table[index];
     h->table[index] = e;
     return -1;
@@ -235,11 +226,7 @@ hashtable_remove(struct hashtable *h, void *k)
         {
             *pE = e->next;
             h->entrycount--;
-            if (h->flags & HASHTABLE_FREE_KEY)
-                free(e->k);
-            if (h->flags & HASHTABLE_FREE_VALUE)
-                free(e->v);
-            free(e);
+            talloc_free(e);
             return;
         }
         pE = &(e->next);
@@ -278,26 +265,7 @@ hashtable_iterate(struct hashtable *h,
 void
 hashtable_destroy(struct hashtable *h)
 {
-    unsigned int i;
-    struct entry *e, *f;
-    struct entry **table = h->table;
-
-    for (i = 0; i < h->tablelength; i++)
-    {
-        e = table[i];
-        while (NULL != e)
-        {
-            f = e;
-            e = e->next;
-            if (h->flags & HASHTABLE_FREE_KEY)
-                free(f->k);
-            if (h->flags & HASHTABLE_FREE_VALUE)
-                free(f->v);
-            free(f);
-        }
-    }
-    free(h->table);
-    free(h);
+    talloc_free(h);
 }
 
 /*
diff --git a/tools/xenstore/hashtable.h b/tools/xenstore/hashtable.h
index 780ad3c8f7..4e2823134e 100644
--- a/tools/xenstore/hashtable.h
+++ b/tools/xenstore/hashtable.h
@@ -9,6 +9,7 @@ struct hashtable;
  * create_hashtable
    
  * @name                    create_hashtable
+ * @param   ctx             talloc context to use for allocations
  * @param   minsize         minimum initial size of hashtable
  * @param   hashfunction    function for hashing keys
  * @param   key_eq_fn       function for determining key equality
@@ -22,7 +23,7 @@ struct hashtable;
 #define HASHTABLE_FREE_KEY   (1U << 1)
 
 struct hashtable *
-create_hashtable(unsigned int minsize,
+create_hashtable(const void *ctx, unsigned int minsize,
                  unsigned int (*hashfunction) (void*),
                  int (*key_eq_fn) (void*,void*),
                  unsigned int flags
diff --git a/tools/xenstore/xenstored_core.c b/tools/xenstore/xenstored_core.c
index 9cfde76898..17e678256e 100644
--- a/tools/xenstore/xenstored_core.c
+++ b/tools/xenstore/xenstored_core.c
@@ -2405,11 +2405,10 @@ static int keys_equal_fn(void *key1, void *key2)
 
 int remember_string(struct hashtable *hash, const char *str)
 {
-	char *k = malloc(strlen(str) + 1);
+	char *k = talloc_strdup(NULL, str);
 
 	if (!k)
 		return 0;
-	strcpy(k, str);
 	return hashtable_insert(hash, k, (void *)1);
 }
 
@@ -2504,7 +2503,7 @@ void check_store(void)
 	};
 
 	/* Don't free values (they are all void *1) */
-	reachable = create_hashtable(16, hash_from_key_fn, keys_equal_fn,
+	reachable = create_hashtable(NULL, 16, hash_from_key_fn, keys_equal_fn,
 				     HASHTABLE_FREE_KEY);
 	if (!reachable) {
 		log("check_store: ENOMEM");
diff --git a/tools/xenstore/xenstored_domain.c b/tools/xenstore/xenstored_domain.c
index 391395060e..4f4c0a727c 100644
--- a/tools/xenstore/xenstored_domain.c
+++ b/tools/xenstore/xenstored_domain.c
@@ -931,7 +931,7 @@ void domain_init(int evtfd)
 	int rc;
 
 	/* Start with a random rather low domain count for the hashtable. */
-	domhash = create_hashtable(8, domhash_fn, domeq_fn, 0);
+	domhash = create_hashtable(NULL, 8, domhash_fn, domeq_fn, 0);
 	if (!domhash)
 		barf_perror("Failed to allocate domain hashtable");
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sun Feb 05 04:15:06 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 05 Feb 2023 04:15:06 +0000
Received: from list by lists.xenproject.org with outflank-mailman.489709.758124 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pOWQk-000127-AS; Sun, 05 Feb 2023 04:15:06 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 489709.758124; Sun, 05 Feb 2023 04:15:06 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pOWQk-000120-6x; Sun, 05 Feb 2023 04:15:06 +0000
Received: by outflank-mailman (input) for mailman id 489709;
 Sun, 05 Feb 2023 04:15:05 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pOWQj-00011s-1l
 for xen-changelog@lists.xenproject.org; Sun, 05 Feb 2023 04:15:05 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pOWQj-0000wr-0y
 for xen-changelog@lists.xenproject.org; Sun, 05 Feb 2023 04:15:05 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pOWQj-0008RZ-06
 for xen-changelog@lists.xenproject.org; Sun, 05 Feb 2023 04:15:05 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=QflcNqd/k0j6wgLzercUwps43JCHWkWH+MumyJVmuTk=; b=pWoCQY5XvvNcjqWGm5IPeaq0SN
	G/Kjels4x37yN3Hn9RUlkkIaRKUioKU7Vu1GAYl6IRLxjH4IUnMxNqZJKOIGyIgnzjUc1rCdMTVZ4
	sw3f6J48WeL4IxoQQ1UgcQpM8nVRWwhazJfNokfjfgk7LkmXabeuxcifiRxb/mBpiJ9M=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools/xenstore: introduce trace classes
Message-Id: <E1pOWQj-0008RZ-06@xenbits.xenproject.org>
Date: Sun, 05 Feb 2023 04:15:05 +0000

commit 1d2355d1c64a73bbf456a3a0215e22e5ad54abeb
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Wed Jan 18 10:50:13 2023 +0100
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Fri Jan 20 09:23:51 2023 +0000

    tools/xenstore: introduce trace classes
    
    Make the xenstored internal trace configurable by adding classes
    which can be switched on and off independently from each other.
    
    Define the following classes:
    
    - obj: Creation and deletion of interesting "objects" (watch,
      transaction, connection)
    - io: incoming requests and outgoing responses
    - wrl: write limiting
    
    Per default "obj" and "io" are switched on.
    
    Entries written via trace() will always be printed (if tracing is on
    at all).
    
    Add the capability to control the trace settings via the "log"
    command and via a new "--log-control" command line option.
    
    Add a missing trace_create() call for creating a transaction.
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Julien Grall <jgrall@amazon.com>
---
 docs/misc/xenstore.txt                 | 10 ++++---
 tools/xenstore/xenstored_control.c     | 31 +++++++++++++++++--
 tools/xenstore/xenstored_core.c        | 55 +++++++++++++++++++++++++++++++---
 tools/xenstore/xenstored_core.h        |  8 +++++
 tools/xenstore/xenstored_domain.c      | 27 +++++++++--------
 tools/xenstore/xenstored_transaction.c |  1 +
 6 files changed, 108 insertions(+), 24 deletions(-)

diff --git a/docs/misc/xenstore.txt b/docs/misc/xenstore.txt
index 44428ae3a7..8887e7df88 100644
--- a/docs/misc/xenstore.txt
+++ b/docs/misc/xenstore.txt
@@ -409,10 +409,12 @@ CONTROL			<command>|[<parameters>|]
 		error string in case of failure. -s can return "BUSY" in case
 		of an active transaction, a retry of -s can be done in that
 		case.
-	log|on
-		turn xenstore logging on
-	log|off
-		turn xenstore logging off
+	log|[on|off|+<switch>|-<switch>]
+		without parameters: show possible log switches
+		on: turn xenstore logging on
+		off: turn xenstore logging off
+		+<switch>: activates log entries for <switch>,
+		-<switch>: deactivates log entries for <switch>
 	logfile|<file-name>
 		log to specified file
 	memreport|[<file-name>]
diff --git a/tools/xenstore/xenstored_control.c b/tools/xenstore/xenstored_control.c
index 41e6992591..000b2bb8c7 100644
--- a/tools/xenstore/xenstored_control.c
+++ b/tools/xenstore/xenstored_control.c
@@ -182,6 +182,28 @@ static int do_control_check(const void *ctx, struct connection *conn,
 static int do_control_log(const void *ctx, struct connection *conn,
 			  char **vec, int num)
 {
+	int ret;
+
+	if (num == 0) {
+		char *resp = talloc_asprintf(ctx, "Log switch settings:\n");
+		unsigned int idx;
+		bool on;
+
+		if (!resp)
+			return ENOMEM;
+		for (idx = 0; trace_switches[idx]; idx++) {
+			on = trace_flags & (1u << idx);
+			resp = talloc_asprintf_append(resp, "%-8s: %s\n",
+						      trace_switches[idx],
+						      on ? "on" : "off");
+			if (!resp)
+				return ENOMEM;
+		}
+
+		send_reply(conn, XS_CONTROL, resp, strlen(resp) + 1);
+		return 0;
+	}
+
 	if (num != 1)
 		return EINVAL;
 
@@ -189,8 +211,11 @@ static int do_control_log(const void *ctx, struct connection *conn,
 		reopen_log();
 	else if (!strcmp(vec[0], "off"))
 		close_log();
-	else
-		return EINVAL;
+	else {
+		ret = set_trace_switch(vec[0]);
+		if (ret)
+			return ret;
+	}
 
 	send_ack(conn, XS_CONTROL);
 	return 0;
@@ -923,7 +948,7 @@ static int do_control_help(const void *, struct connection *, char **, int);
 
 static struct cmd_s cmds[] = {
 	{ "check", do_control_check, "" },
-	{ "log", do_control_log, "on|off" },
+	{ "log", do_control_log, "[on|off|+<switch>|-<switch>]" },
 
 #ifndef NO_LIVE_UPDATE
 	/*
diff --git a/tools/xenstore/xenstored_core.c b/tools/xenstore/xenstored_core.c
index 17e678256e..c2c2c342de 100644
--- a/tools/xenstore/xenstored_core.c
+++ b/tools/xenstore/xenstored_core.c
@@ -85,6 +85,7 @@ static int reopen_log_pipe[2];
 static int reopen_log_pipe0_pollfd_idx = -1;
 char *tracefile = NULL;
 TDB_CONTEXT *tdb_ctx = NULL;
+unsigned int trace_flags = TRACE_OBJ | TRACE_IO;
 
 static const char *sockmsg_string(enum xsd_sockmsg_type type);
 
@@ -139,13 +140,13 @@ static void trace_io(const struct connection *conn,
 	time_t now;
 	struct tm *tm;
 
-	if (tracefd < 0)
+	if (tracefd < 0 || !(trace_flags & TRACE_IO))
 		return;
 
 	now = time(NULL);
 	tm = localtime(&now);
 
-	trace("%s %p %04d%02d%02d %02d:%02d:%02d %s (",
+	trace("io: %s %p %04d%02d%02d %02d:%02d:%02d %s (",
 	      out ? "OUT" : "IN", conn,
 	      tm->tm_year + 1900, tm->tm_mon + 1,
 	      tm->tm_mday, tm->tm_hour, tm->tm_min, tm->tm_sec,
@@ -158,12 +159,14 @@ static void trace_io(const struct connection *conn,
 
 void trace_create(const void *data, const char *type)
 {
-	trace("CREATE %s %p\n", type, data);
+	if (trace_flags & TRACE_OBJ)
+		trace("obj: CREATE %s %p\n", type, data);
 }
 
 void trace_destroy(const void *data, const char *type)
 {
-	trace("DESTROY %s %p\n", type, data);
+	if (trace_flags & TRACE_OBJ)
+		trace("obj: DESTROY %s %p\n", type, data);
 }
 
 /**
@@ -2599,6 +2602,8 @@ static void usage(void)
 "  -N, --no-fork           to request that the daemon does not fork,\n"
 "  -P, --output-pid        to request that the pid of the daemon is output,\n"
 "  -T, --trace-file <file> giving the file for logging, and\n"
+"      --trace-control=+<switch> activate a specific <switch>\n"
+"      --trace-control=-<switch> deactivate a specific <switch>\n"
 "  -E, --entry-nb <nb>     limit the number of entries per domain,\n"
 "  -S, --entry-size <size> limit the size of entry per domain, and\n"
 "  -W, --watch-nb <nb>     limit the number of watches per domain,\n"
@@ -2642,6 +2647,7 @@ static struct option options[] = {
 	{ "output-pid", 0, NULL, 'P' },
 	{ "entry-size", 1, NULL, 'S' },
 	{ "trace-file", 1, NULL, 'T' },
+	{ "trace-control", 1, NULL, 1 },
 	{ "transaction", 1, NULL, 't' },
 	{ "perm-nb", 1, NULL, 'A' },
 	{ "path-max", 1, NULL, 'M' },
@@ -2716,6 +2722,43 @@ static void set_quota(const char *arg, bool soft)
 		barf("unknown quota \"%s\"\n", arg);
 }
 
+/* Sorted by bit values of TRACE_* flags. Flag is (1u << index). */
+const char *const trace_switches[] = {
+	"obj", "io", "wrl",
+	NULL
+};
+
+int set_trace_switch(const char *arg)
+{
+	bool remove = (arg[0] == '-');
+	unsigned int idx;
+
+	switch (arg[0]) {
+	case '-':
+		remove = true;
+		break;
+	case '+':
+		remove = false;
+		break;
+	default:
+		return EINVAL;
+	}
+
+	arg++;
+
+	for (idx = 0; trace_switches[idx]; idx++) {
+		if (!strcmp(arg, trace_switches[idx])) {
+			if (remove)
+				trace_flags &= ~(1u << idx);
+			else
+				trace_flags |= 1u << idx;
+			return 0;
+		}
+	}
+
+	return EINVAL;
+}
+
 int main(int argc, char *argv[])
 {
 	int opt;
@@ -2764,6 +2807,10 @@ int main(int argc, char *argv[])
 		case 'T':
 			tracefile = optarg;
 			break;
+		case 1:
+			if (set_trace_switch(optarg))
+				barf("Illegal trace switch \"%s\"\n", optarg);
+			break;
 		case 'I':
 			if (optarg && !strcmp(optarg, "off"))
 				tdb_flags = 0;
diff --git a/tools/xenstore/xenstored_core.h b/tools/xenstore/xenstored_core.h
index 6548200d8e..c59b06551f 100644
--- a/tools/xenstore/xenstored_core.h
+++ b/tools/xenstore/xenstored_core.h
@@ -294,6 +294,14 @@ extern char **orig_argv;
 extern char *tracefile;
 extern int tracefd;
 
+/* Trace flag values must be kept in sync with trace_switches[] contents. */
+extern unsigned int trace_flags;
+#define TRACE_OBJ	0x00000001
+#define TRACE_IO	0x00000002
+#define TRACE_WRL	0x00000004
+extern const char *const trace_switches[];
+int set_trace_switch(const char *arg);
+
 extern TDB_CONTEXT *tdb_ctx;
 extern int dom0_domid;
 extern int dom0_event;
diff --git a/tools/xenstore/xenstored_domain.c b/tools/xenstore/xenstored_domain.c
index 4f4c0a727c..e9d84d7c24 100644
--- a/tools/xenstore/xenstored_domain.c
+++ b/tools/xenstore/xenstored_domain.c
@@ -1261,6 +1261,12 @@ static long wrl_ndomains;
 static wrl_creditt wrl_reserve; /* [-wrl_config_newdoms_dburst, +_gburst ] */
 static time_t wrl_log_last_warning; /* 0: no previous warning */
 
+#define trace_wrl(...)				\
+do {						\
+	if (trace_flags & TRACE_WRL)		\
+		trace("wrl: " __VA_ARGS__);	\
+} while (0)
+
 void wrl_gettime_now(struct wrl_timestampt *now_wt)
 {
 	struct timespec now_ts;
@@ -1366,12 +1372,9 @@ void wrl_credit_update(struct domain *domain, struct wrl_timestampt now)
 
 	domain->wrl_timestamp = now;
 
-	trace("wrl: dom %4d %6ld  msec  %9ld credit   %9ld reserve"
-	      "  %9ld discard\n",
-	      domain->domid,
-	      msec,
-	      (long)domain->wrl_credit, (long)wrl_reserve,
-	      (long)surplus);
+	trace_wrl("dom %4d %6ld msec %9ld credit %9ld reserve %9ld discard\n",
+		  domain->domid, msec, (long)domain->wrl_credit,
+		  (long)wrl_reserve, (long)surplus);
 }
 
 void wrl_check_timeout(struct domain *domain,
@@ -1403,10 +1406,9 @@ void wrl_check_timeout(struct domain *domain,
 	if (*ptimeout==-1 || wakeup < *ptimeout)
 		*ptimeout = wakeup;
 
-	trace("wrl: domain %u credit=%ld (reserve=%ld) SLEEPING for %d\n",
-	      domain->domid,
-	      (long)domain->wrl_credit, (long)wrl_reserve,
-	      wakeup);
+	trace_wrl("domain %u credit=%ld (reserve=%ld) SLEEPING for %d\n",
+		  domain->domid, (long)domain->wrl_credit, (long)wrl_reserve,
+		  wakeup);
 }
 
 #define WRL_LOG(now, ...) \
@@ -1424,9 +1426,8 @@ void wrl_apply_debit_actual(struct domain *domain)
 	wrl_credit_update(domain, now);
 
 	domain->wrl_credit -= wrl_config_writecost;
-	trace("wrl: domain %u credit=%ld (reserve=%ld)\n",
-	      domain->domid,
-	      (long)domain->wrl_credit, (long)wrl_reserve);
+	trace_wrl("domain %u credit=%ld (reserve=%ld)\n", domain->domid,
+		  (long)domain->wrl_credit, (long)wrl_reserve);
 
 	if (domain->wrl_credit < 0) {
 		if (!domain->wrl_delay_logged) {
diff --git a/tools/xenstore/xenstored_transaction.c b/tools/xenstore/xenstored_transaction.c
index 82e5e66c18..1aa9d3cb3d 100644
--- a/tools/xenstore/xenstored_transaction.c
+++ b/tools/xenstore/xenstored_transaction.c
@@ -475,6 +475,7 @@ int do_transaction_start(const void *ctx, struct connection *conn,
 	if (!trans)
 		return ENOMEM;
 
+	trace_create(trans, "transaction");
 	INIT_LIST_HEAD(&trans->accessed);
 	INIT_LIST_HEAD(&trans->changed_domains);
 	trans->conn = conn;
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sun Feb 05 04:15:16 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 05 Feb 2023 04:15:16 +0000
Received: from list by lists.xenproject.org with outflank-mailman.489711.758129 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pOWQu-00018A-Db; Sun, 05 Feb 2023 04:15:16 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 489711.758129; Sun, 05 Feb 2023 04:15:16 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pOWQu-000182-Al; Sun, 05 Feb 2023 04:15:16 +0000
Received: by outflank-mailman (input) for mailman id 489711;
 Sun, 05 Feb 2023 04:15:15 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pOWQt-00017m-4q
 for xen-changelog@lists.xenproject.org; Sun, 05 Feb 2023 04:15:15 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pOWQt-0000wv-46
 for xen-changelog@lists.xenproject.org; Sun, 05 Feb 2023 04:15:15 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pOWQt-0008S0-3X
 for xen-changelog@lists.xenproject.org; Sun, 05 Feb 2023 04:15:15 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=mWxHL2KL1cle8lgpkcVgRgqvgrQfg5eN+4hA92AiSLc=; b=gAamU+K4VBJw2AQDgA/M86WICE
	/SemvVfsN754oUAacXBI4PCv9zeUSHXy6zbrvFggbvA+L00wt3Un/1ixm91Yytey8MZ04JgeYu9oY
	UEow6KNXprm3mRCCcMby3zzkGz8hTMNtWDZr6hp1LhX4DOaRqQoIeZ3GoHO7qfEEMziI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools/xenstore: let check_store() check the accounting data
Message-Id: <E1pOWQt-0008S0-3X@xenbits.xenproject.org>
Date: Sun, 05 Feb 2023 04:15:15 +0000

commit 67617067f0b681dd17d24bc2197cc9a30f8a7c3b
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Wed Jan 18 10:50:14 2023 +0100
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Fri Jan 20 09:23:51 2023 +0000

    tools/xenstore: let check_store() check the accounting data
    
    Today check_store() is only testing the correctness of the node tree.
    
    Add verification of the accounting data (number of nodes) and correct
    the data if it is wrong.
    
    Do the initial check_store() call only after Xenstore entries of a
    live update have been read. This is wanted to make sure the accounting
    data is correct after a live update.
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Julien Grall <jgrall@amazon.com>
---
 tools/xenstore/xenstored_core.c   | 62 +++++++++++++++++++++-------
 tools/xenstore/xenstored_domain.c | 86 +++++++++++++++++++++++++++++++++++++++
 tools/xenstore/xenstored_domain.h |  4 ++
 3 files changed, 137 insertions(+), 15 deletions(-)

diff --git a/tools/xenstore/xenstored_core.c b/tools/xenstore/xenstored_core.c
index c2c2c342de..27dfbe9593 100644
--- a/tools/xenstore/xenstored_core.c
+++ b/tools/xenstore/xenstored_core.c
@@ -2384,8 +2384,6 @@ void setup_structure(bool live_update)
 		manual_node("@introduceDomain", NULL);
 		domain_nbentry_fix(dom0_domid, 5, true);
 	}
-
-	check_store();
 }
 
 static unsigned int hash_from_key_fn(void *k)
@@ -2428,20 +2426,28 @@ int remember_string(struct hashtable *hash, const char *str)
  * As we go, we record each node in the given reachable hashtable.  These
  * entries will be used later in clean_store.
  */
+
+struct check_store_data {
+	struct hashtable *reachable;
+	struct hashtable *domains;
+};
+
 static int check_store_step(const void *ctx, struct connection *conn,
 			    struct node *node, void *arg)
 {
-	struct hashtable *reachable = arg;
+	struct check_store_data *data = arg;
 
-	if (hashtable_search(reachable, (void *)node->name)) {
+	if (hashtable_search(data->reachable, (void *)node->name)) {
 		log("check_store: '%s' is duplicated!", node->name);
 		return recovery ? WALK_TREE_RM_CHILDENTRY
 				: WALK_TREE_SKIP_CHILDREN;
 	}
 
-	if (!remember_string(reachable, node->name))
+	if (!remember_string(data->reachable, node->name))
 		return WALK_TREE_ERROR_STOP;
 
+	domain_check_acc_add(node, data->domains);
+
 	return WALK_TREE_OK;
 }
 
@@ -2491,37 +2497,61 @@ static int clean_store_(TDB_CONTEXT *tdb, TDB_DATA key, TDB_DATA val,
  * Given the list of reachable nodes, iterate over the whole store, and
  * remove any that were not reached.
  */
-static void clean_store(struct hashtable *reachable)
+static void clean_store(struct check_store_data *data)
 {
-	tdb_traverse(tdb_ctx, &clean_store_, reachable);
+	tdb_traverse(tdb_ctx, &clean_store_, data->reachable);
+	domain_check_acc(data->domains);
 }
 
+int check_store_path(const char *name, struct check_store_data *data)
+{
+	struct node *node;
+
+	node = read_node(NULL, NULL, name);
+	if (!node) {
+		log("check_store: error %d reading special node '%s'", errno,
+		    name);
+		return errno;
+	}
+
+	return check_store_step(NULL, NULL, node, data);
+}
 
 void check_store(void)
 {
-	struct hashtable *reachable;
 	struct walk_funcs walkfuncs = {
 		.enter = check_store_step,
 		.enoent = check_store_enoent,
 	};
+	struct check_store_data data;
 
 	/* Don't free values (they are all void *1) */
-	reachable = create_hashtable(NULL, 16, hash_from_key_fn, keys_equal_fn,
-				     HASHTABLE_FREE_KEY);
-	if (!reachable) {
+	data.reachable = create_hashtable(NULL, 16, hash_from_key_fn,
+					  keys_equal_fn, HASHTABLE_FREE_KEY);
+	if (!data.reachable) {
 		log("check_store: ENOMEM");
 		return;
 	}
 
+	data.domains = domain_check_acc_init();
+	if (!data.domains) {
+		log("check_store: ENOMEM");
+		goto out_hash;
+	}
+
 	log("Checking store ...");
-	if (walk_node_tree(NULL, NULL, "/", &walkfuncs, reachable)) {
+	if (walk_node_tree(NULL, NULL, "/", &walkfuncs, &data)) {
 		if (errno == ENOMEM)
 			log("check_store: ENOMEM");
-	} else if (!check_transactions(reachable))
-		clean_store(reachable);
+	} else if (!check_store_path("@introduceDomain", &data) &&
+		   !check_store_path("@releaseDomain", &data) &&
+		   !check_transactions(data.reachable))
+		clean_store(&data);
 	log("Checking store complete.");
 
-	hashtable_destroy(reachable);
+	hashtable_destroy(data.domains);
+ out_hash:
+	hashtable_destroy(data.reachable);
 }
 
 
@@ -2920,6 +2950,8 @@ int main(int argc, char *argv[])
 		lu_read_state();
 #endif
 
+	check_store();
+
 	/* Get ready to listen to the tools. */
 	initialize_fds(&sock_pollfd_idx, &timeout);
 
diff --git a/tools/xenstore/xenstored_domain.c b/tools/xenstore/xenstored_domain.c
index e9d84d7c24..9ef41ede03 100644
--- a/tools/xenstore/xenstored_domain.c
+++ b/tools/xenstore/xenstored_domain.c
@@ -1574,6 +1574,92 @@ void read_state_connection(const void *ctx, const void *state)
 	read_state_buffered_data(ctx, conn, sc);
 }
 
+struct domain_acc {
+	unsigned int domid;
+	int nodes;
+};
+
+static int domain_check_acc_init_sub(const void *k, void *v, void *arg)
+{
+	struct hashtable *domains = arg;
+	struct domain *d = v;
+	struct domain_acc *dom;
+
+	dom = talloc_zero(NULL, struct domain_acc);
+	if (!dom)
+		return -1;
+
+	dom->domid = d->domid;
+	/*
+	 * Set the initial value to the negative one of the current domain.
+	 * If everything is correct incrementing the value for each node will
+	 * result in dom->nodes being 0 at the end.
+	 */
+	dom->nodes = -d->nbentry;
+
+	if (!hashtable_insert(domains, &dom->domid, dom)) {
+		talloc_free(dom);
+		return -1;
+	}
+
+	return 0;
+}
+
+struct hashtable *domain_check_acc_init(void)
+{
+	struct hashtable *domains;
+
+	domains = create_hashtable(NULL, 8, domhash_fn, domeq_fn,
+				   HASHTABLE_FREE_VALUE);
+	if (!domains)
+		return NULL;
+
+	if (hashtable_iterate(domhash, domain_check_acc_init_sub, domains)) {
+		hashtable_destroy(domains);
+		return NULL;
+	}
+
+	return domains;
+}
+
+void domain_check_acc_add(const struct node *node, struct hashtable *domains)
+{
+	struct domain_acc *dom;
+	unsigned int domid;
+
+	domid = get_node_owner(node);
+	dom = hashtable_search(domains, &domid);
+	if (!dom)
+		log("Node %s owned by unknown domain %u", node->name, domid);
+	else
+		dom->nodes++;
+}
+
+static int domain_check_acc_cb(const void *k, void *v, void *arg)
+{
+	struct domain_acc *dom = v;
+	struct domain *d;
+
+	if (!dom->nodes)
+		return 0;
+
+	log("Correct accounting data for domain %u: nodes are %d off",
+	    dom->domid, dom->nodes);
+
+	d = find_domain_struct(dom->domid);
+	if (!d)
+		return 0;
+
+	d->nbentry += dom->nodes;
+
+	return 0;
+}
+
+void domain_check_acc(struct hashtable *domains)
+{
+	hashtable_iterate(domains, domain_check_acc_cb, NULL);
+}
+
 /*
  * Local variables:
  *  mode: C
diff --git a/tools/xenstore/xenstored_domain.h b/tools/xenstore/xenstored_domain.h
index 22996e2576..dc4660861e 100644
--- a/tools/xenstore/xenstored_domain.h
+++ b/tools/xenstore/xenstored_domain.h
@@ -129,4 +129,8 @@ const char *dump_state_connections(FILE *fp);
 
 void read_state_connection(const void *ctx, const void *state);
 
+struct hashtable *domain_check_acc_init(void);
+void domain_check_acc_add(const struct node *node, struct hashtable *domains);
+void domain_check_acc(struct hashtable *domains);
+
 #endif /* _XENSTORED_DOMAIN_H */
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sun Feb 05 04:15:26 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 05 Feb 2023 04:15:26 +0000
Received: from list by lists.xenproject.org with outflank-mailman.489713.758132 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pOWR4-0001Bt-FD; Sun, 05 Feb 2023 04:15:26 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 489713.758132; Sun, 05 Feb 2023 04:15:26 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pOWR4-0001Bm-CH; Sun, 05 Feb 2023 04:15:26 +0000
Received: by outflank-mailman (input) for mailman id 489713;
 Sun, 05 Feb 2023 04:15:25 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pOWR3-0001B5-7f
 for xen-changelog@lists.xenproject.org; Sun, 05 Feb 2023 04:15:25 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pOWR3-0000yW-6z
 for xen-changelog@lists.xenproject.org; Sun, 05 Feb 2023 04:15:25 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pOWR3-0008SP-6Q
 for xen-changelog@lists.xenproject.org; Sun, 05 Feb 2023 04:15:25 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=eXKxp/CECiRaPmCGhE6o6/mWIx+zxUlFb5vvHFknXGM=; b=p8nOpXqr6S5tI1e260njbFiWJH
	JdZV19TEUEjKi75BCtQXCERcbqgl1F0KDH80s6cE4FVa5fKIa1JfFZmi7RnMiW2+qAWA6FO7P83So
	tuc9GrJCq1ftuHUHGeTwTr2ds2lycG1Po4PKr50I+MUHjfP5wRdWEa5nK2xAds0DR5CU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools/xenstore: make output of "xenstore-control help" more pretty
Message-Id: <E1pOWR3-0008SP-6Q@xenbits.xenproject.org>
Date: Sun, 05 Feb 2023 04:15:25 +0000

commit 5f5d25c84c0d3e0c6bdce2e135262ea913a4dd76
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Wed Jan 18 10:50:15 2023 +0100
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Fri Jan 20 09:23:51 2023 +0000

    tools/xenstore: make output of "xenstore-control help" more pretty
    
    Using a tab for separating the command from the options in the output
    of "xenstore-control help" results in a rather ugly list.
    
    Use a fixed size for the command instead.
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Julien Grall <jgrall@amazon.com>
---
 tools/xenstore/xenstored_control.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/xenstore/xenstored_control.c b/tools/xenstore/xenstored_control.c
index 000b2bb8c7..cbd62556c3 100644
--- a/tools/xenstore/xenstored_control.c
+++ b/tools/xenstore/xenstored_control.c
@@ -996,7 +996,7 @@ static int do_control_help(const void *ctx, struct connection *conn,
 	if (!resp)
 		return ENOMEM;
 	for (cmd = 0; cmd < ARRAY_SIZE(cmds); cmd++) {
-		resp = talloc_asprintf_append(resp, "%s\t%s\n",
+		resp = talloc_asprintf_append(resp, "%-15s %s\n",
 					      cmds[cmd].cmd, cmds[cmd].pars);
 		if (!resp)
 			return ENOMEM;
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sun Feb 05 04:15:36 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 05 Feb 2023 04:15:36 +0000
Received: from list by lists.xenproject.org with outflank-mailman.489714.758135 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pOWRE-0001IJ-Gb; Sun, 05 Feb 2023 04:15:36 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 489714.758135; Sun, 05 Feb 2023 04:15:36 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pOWRE-0001IB-Dt; Sun, 05 Feb 2023 04:15:36 +0000
Received: by outflank-mailman (input) for mailman id 489714;
 Sun, 05 Feb 2023 04:15:35 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pOWRD-0001HG-B5
 for xen-changelog@lists.xenproject.org; Sun, 05 Feb 2023 04:15:35 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pOWRD-0000ye-AQ
 for xen-changelog@lists.xenproject.org; Sun, 05 Feb 2023 04:15:35 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pOWRD-0008TF-9d
 for xen-changelog@lists.xenproject.org; Sun, 05 Feb 2023 04:15:35 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Hl0AXKd6H4g5OxY+T/CNX3MAt26X0F2+SVdKWkpnv2w=; b=Gw0neJlO6WqRtXjoPjPwHRbdVJ
	sgKHEVlkbT9rfiAkFeAl/yLsQnkAC/BTGfQb4yfTabbt4VviLjwq2Gc4UM9XECN828LNZWkCacxj7
	+zUm+SN2FAmib2naxf46s/lUss8FmYGEty0Ex3ygSGiZ03npFVDiLO4G5eS9PXFGJL8U=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/arm: Use the correct format specifier
Message-Id: <E1pOWRD-0008TF-9d@xenbits.xenproject.org>
Date: Sun, 05 Feb 2023 04:15:35 +0000

commit 13bfdceda0991214854f3e563a36f621e9da3bec
Author:     Ayan Kumar Halder <ayan.kumar.halder@amd.com>
AuthorDate: Tue Jan 17 17:43:49 2023 +0000
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Fri Jan 20 09:31:59 2023 +0000

    xen/arm: Use the correct format specifier
    
    1. One should use 'PRIpaddr' to display 'paddr_t' variables.
    2. One should use 'PRIx64' to display 'u64' in hex format. The current
    use of 'PRIpaddr' for printing PTE is buggy as this is not a physical
    address.
    
    Signed-off-by: Ayan Kumar Halder <ayan.kumar.halder@amd.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
---
 xen/arch/arm/domain_build.c | 10 +++++-----
 xen/arch/arm/gic-v2.c       |  6 +++---
 xen/arch/arm/mm.c           |  2 +-
 3 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c
index f35f4d2456..5608b290b5 100644
--- a/xen/arch/arm/domain_build.c
+++ b/xen/arch/arm/domain_build.c
@@ -1315,7 +1315,7 @@ static int __init make_memory_node(const struct domain *d,
     dt_dprintk("Create memory node\n");
 
     /* ePAPR 3.4 */
-    snprintf(buf, sizeof(buf), "memory@%"PRIx64, mem->bank[i].start);
+    snprintf(buf, sizeof(buf), "memory@%"PRIpaddr, mem->bank[i].start);
     res = fdt_begin_node(fdt, buf);
     if ( res )
         return res;
@@ -1383,7 +1383,7 @@ static int __init make_shm_memory_node(const struct domain *d,
         __be32 *cells;
         unsigned int len = (addrcells + sizecells) * sizeof(__be32);
 
-        snprintf(buf, sizeof(buf), "xen-shmem@%"PRIx64, mem->bank[i].start);
+        snprintf(buf, sizeof(buf), "xen-shmem@%"PRIpaddr, mem->bank[i].start);
         res = fdt_begin_node(fdt, buf);
         if ( res )
             return res;
@@ -2719,7 +2719,7 @@ static int __init make_gicv2_domU_node(struct kernel_info *kinfo)
     /* Placeholder for interrupt-controller@ + a 64-bit number + \0 */
     char buf[38];
 
-    snprintf(buf, sizeof(buf), "interrupt-controller@%"PRIx64,
+    snprintf(buf, sizeof(buf), "interrupt-controller@%"PRIpaddr,
              vgic_dist_base(&d->arch.vgic));
     res = fdt_begin_node(fdt, buf);
     if ( res )
@@ -2775,7 +2775,7 @@ static int __init make_gicv3_domU_node(struct kernel_info *kinfo)
     char buf[38];
     unsigned int i, len = 0;
 
-    snprintf(buf, sizeof(buf), "interrupt-controller@%"PRIx64,
+    snprintf(buf, sizeof(buf), "interrupt-controller@%"PRIpaddr,
              vgic_dist_base(&d->arch.vgic));
 
     res = fdt_begin_node(fdt, buf);
@@ -2861,7 +2861,7 @@ static int __init make_vpl011_uart_node(struct kernel_info *kinfo)
     /* Placeholder for sbsa-uart@ + a 64-bit number + \0 */
     char buf[27];
 
-    snprintf(buf, sizeof(buf), "sbsa-uart@%"PRIx64, d->arch.vpl011.base_addr);
+    snprintf(buf, sizeof(buf), "sbsa-uart@%"PRIpaddr, d->arch.vpl011.base_addr);
     res = fdt_begin_node(fdt, buf);
     if ( res )
         return res;
diff --git a/xen/arch/arm/gic-v2.c b/xen/arch/arm/gic-v2.c
index 61802839cb..5d4d298b86 100644
--- a/xen/arch/arm/gic-v2.c
+++ b/xen/arch/arm/gic-v2.c
@@ -1049,7 +1049,7 @@ static void __init gicv2_dt_init(void)
     if ( csize < SZ_8K )
     {
         printk(XENLOG_WARNING "GICv2: WARNING: "
-               "The GICC size is too small: %#"PRIx64" expected %#x\n",
+               "The GICC size is too small: %#"PRIpaddr" expected %#x\n",
                csize, SZ_8K);
         if ( platform_has_quirk(PLATFORM_QUIRK_GIC_64K_STRIDE) )
         {
@@ -1280,11 +1280,11 @@ static int __init gicv2_init(void)
         gicv2.map_cbase += aliased_offset;
 
         printk(XENLOG_WARNING
-               "GICv2: Adjusting CPU interface base to %#"PRIx64"\n",
+               "GICv2: Adjusting CPU interface base to %#"PRIpaddr"\n",
                cbase + aliased_offset);
     } else if ( csize == SZ_128K )
         printk(XENLOG_WARNING
-               "GICv2: GICC size=%#"PRIx64" but not aliased\n",
+               "GICv2: GICC size=%#"PRIpaddr" but not aliased\n",
                csize);
 
     gicv2.map_hbase = ioremap_nocache(hbase, PAGE_SIZE);
diff --git a/xen/arch/arm/mm.c b/xen/arch/arm/mm.c
index 0fc6f2992d..fab54618ab 100644
--- a/xen/arch/arm/mm.c
+++ b/xen/arch/arm/mm.c
@@ -249,7 +249,7 @@ void dump_pt_walk(paddr_t ttbr, paddr_t addr,
 
         pte = mapping[offsets[level]];
 
-        printk("%s[0x%03x] = 0x%"PRIpaddr"\n",
+        printk("%s[0x%03x] = 0x%"PRIx64"\n",
                level_strs[level], offsets[level], pte.bits);
 
         if ( level == 3 || !pte.walk.valid || !pte.walk.table )
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sun Feb 05 04:15:46 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 05 Feb 2023 04:15:46 +0000
Received: from list by lists.xenproject.org with outflank-mailman.489715.758140 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pOWRO-0001LY-Hu; Sun, 05 Feb 2023 04:15:46 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 489715.758140; Sun, 05 Feb 2023 04:15:46 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pOWRO-0001LR-FM; Sun, 05 Feb 2023 04:15:46 +0000
Received: by outflank-mailman (input) for mailman id 489715;
 Sun, 05 Feb 2023 04:15:45 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pOWRN-0001LH-EO
 for xen-changelog@lists.xenproject.org; Sun, 05 Feb 2023 04:15:45 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pOWRN-0000ys-Dm
 for xen-changelog@lists.xenproject.org; Sun, 05 Feb 2023 04:15:45 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pOWRN-0008Ts-Cu
 for xen-changelog@lists.xenproject.org; Sun, 05 Feb 2023 04:15:45 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Kf55le0pVxKD8wGzshtiqb3LFdj8UrhjroNFKuSrdvc=; b=0FACXM8aAdXQKLQqwogzQJgoH2
	5kNgkvUy2ZxOCmCNIadZ+4OpBBX4Wpd05Xi6vIILj7VkrmYwXhMmuYrqZyklhK+TInQbuPG51vgYE
	vhtVrQ7DjTTvWD2jsm9IL9Kxjyo1fvQCKEWEvswkn0yuViZlVyjlSD7yYRRKvg6uBHPw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/arm: domain_build: Replace use of paddr_t in find_domU_holes()
Message-Id: <E1pOWRN-0008Ts-Cu@xenbits.xenproject.org>
Date: Sun, 05 Feb 2023 04:15:45 +0000

commit 89cc5d96a9d1fce81cf58b6814dac62a9e07fbee
Author:     Ayan Kumar Halder <ayan.kumar.halder@amd.com>
AuthorDate: Tue Jan 17 17:43:50 2023 +0000
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Fri Jan 20 09:51:15 2023 +0000

    xen/arm: domain_build: Replace use of paddr_t in find_domU_holes()
    
    bankbase, banksize and bankend are used to hold values of type 'unsigned
    long long'. This can be represented as 'uint64_t' instead of 'paddr_t'.
    This will ensure consistency with allocate_static_memory() (where we use
    'uint64_t' for rambase and ramsize).
    
    In future, paddr_t can be used for 'uin32_t' as well to represent 32bit
    physical addresses.
    
    Signed-off-by: Ayan Kumar Halder <ayan.kumar.halder@amd.com>
    Acked-by: Stefano Stabellini <sstabellini@kernel.org>
---
 xen/arch/arm/domain_build.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c
index 5608b290b5..9116452d0c 100644
--- a/xen/arch/arm/domain_build.c
+++ b/xen/arch/arm/domain_build.c
@@ -1726,9 +1726,9 @@ static int __init find_domU_holes(const struct kernel_info *kinfo,
                                   struct meminfo *ext_regions)
 {
     unsigned int i;
-    paddr_t bankend;
-    const paddr_t bankbase[] = GUEST_RAM_BANK_BASES;
-    const paddr_t banksize[] = GUEST_RAM_BANK_SIZES;
+    uint64_t bankend;
+    const uint64_t bankbase[] = GUEST_RAM_BANK_BASES;
+    const uint64_t banksize[] = GUEST_RAM_BANK_SIZES;
     int res = -ENOENT;
 
     for ( i = 0; i < GUEST_RAM_BANKS; i++ )
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sun Feb 05 04:15:56 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 05 Feb 2023 04:15:56 +0000
Received: from list by lists.xenproject.org with outflank-mailman.489716.758143 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pOWRY-0001On-JH; Sun, 05 Feb 2023 04:15:56 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 489716.758143; Sun, 05 Feb 2023 04:15:56 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pOWRY-0001Og-Go; Sun, 05 Feb 2023 04:15:56 +0000
Received: by outflank-mailman (input) for mailman id 489716;
 Sun, 05 Feb 2023 04:15:55 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pOWRX-0001ON-HY
 for xen-changelog@lists.xenproject.org; Sun, 05 Feb 2023 04:15:55 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pOWRX-0000zC-Gt
 for xen-changelog@lists.xenproject.org; Sun, 05 Feb 2023 04:15:55 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pOWRX-0008UH-GC
 for xen-changelog@lists.xenproject.org; Sun, 05 Feb 2023 04:15:55 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=KKL6jhIGWTn1N/0Hk380za6+WmYgyoZ5/nps5P8e1/I=; b=HQ1o4CbRc/ougqCX6hK0wSMi4c
	No9Z2E2mm3pMdIeh19zOh87nEQP9j7M0Gy57L1T9ZZvyzqNZtvMFdsXgyOac0eWmfQik120LWiYEA
	RPZTGgER4ooLIVphPwOoC4cokGtcIFFJ9sqJg5bq089PNMy0DeTzDOsHQVadvw4EdTZ0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/arm64: Fix incorrect DIRECTMAP_SIZE calculation
Message-Id: <E1pOWRX-0008UH-GC@xenbits.xenproject.org>
Date: Sun, 05 Feb 2023 04:15:55 +0000

commit 1b9d4ec26b01c5cde17153b27f1038a24e6d8b27
Author:     Michal Orzel <michal.orzel@amd.com>
AuthorDate: Tue Jan 17 12:43:30 2023 +0100
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Fri Jan 20 13:44:05 2023 +0000

    xen/arm64: Fix incorrect DIRECTMAP_SIZE calculation
    
    The direct mapped area occupies L0 slots from 256 to 265 included
    (i.e. 10 slots), resulting in 5TB (512GB * 10) of virtual address space.
    However, due to incorrect slot subtraction (we take 9 slots into account)
    we set DIRECTMAP_SIZE to 4.5TB instead. Fix it.
    
    Note that we only support up to 2TB of physical memory so this is
    a latent issue.
    
    Fixes: 5263507b1b4a ("xen: arm: Use a direct mapping of RAM on arm64")
    Signed-off-by: Michal Orzel <michal.orzel@amd.com>
    Reviewed-by: Julien Grall <jgrall@amazon.com>
---
 xen/arch/arm/include/asm/config.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/arch/arm/include/asm/config.h b/xen/arch/arm/include/asm/config.h
index 0fefed1b8a..16213c8b67 100644
--- a/xen/arch/arm/include/asm/config.h
+++ b/xen/arch/arm/include/asm/config.h
@@ -157,7 +157,7 @@
 #define FRAMETABLE_NR          (FRAMETABLE_SIZE / sizeof(*frame_table))
 
 #define DIRECTMAP_VIRT_START   SLOT0(256)
-#define DIRECTMAP_SIZE         (SLOT0_ENTRY_SIZE * (265-256))
+#define DIRECTMAP_SIZE         (SLOT0_ENTRY_SIZE * (266 - 256))
 #define DIRECTMAP_VIRT_END     (DIRECTMAP_VIRT_START + DIRECTMAP_SIZE - 1)
 
 #define XENHEAP_VIRT_START     directmap_virt_start
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sun Feb 05 04:16:09 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 05 Feb 2023 04:16:09 +0000
Received: from list by lists.xenproject.org with outflank-mailman.489717.758147 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pOWRj-0001Rx-LO; Sun, 05 Feb 2023 04:16:07 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 489717.758147; Sun, 05 Feb 2023 04:16: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 1pOWRj-0001Rp-II; Sun, 05 Feb 2023 04:16:07 +0000
Received: by outflank-mailman (input) for mailman id 489717;
 Sun, 05 Feb 2023 04:16:05 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pOWRh-0001Ra-La
 for xen-changelog@lists.xenproject.org; Sun, 05 Feb 2023 04:16:05 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pOWRh-00011O-Jy
 for xen-changelog@lists.xenproject.org; Sun, 05 Feb 2023 04:16:05 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pOWRh-0008Ux-JH
 for xen-changelog@lists.xenproject.org; Sun, 05 Feb 2023 04:16:05 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=1EfMeB0gCB9JYn7LklqtJMU18Uxp2ZW6TehahNB+k9g=; b=f7KN491/7tuF8O+HW2TLe8qjk4
	X5uZVunV0VJZ77WVQ5Ue+KPDiuGvf9li4dLazkZNBKmq20loscCfeaFQQijANj3R3J9qNZEr0pun7
	AcwvGZBehn2rA1gy0VYYDpwXDiJ4LrcP3O6f6acRQrtlyaZh1CgCdownoObBB7hCDbjM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/arm32: Remove unused macro FRAMETABLE_VIRT_END
Message-Id: <E1pOWRh-0008Ux-JH@xenbits.xenproject.org>
Date: Sun, 05 Feb 2023 04:16:05 +0000

commit b2220f85256a9209560586c25e37d7ad860fa1e2
Author:     Michal Orzel <michal.orzel@amd.com>
AuthorDate: Tue Jan 17 12:43:31 2023 +0100
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Fri Jan 20 13:44:05 2023 +0000

    xen/arm32: Remove unused macro FRAMETABLE_VIRT_END
    
    This macro is unused and the corresponding one for arm64 has already
    been removed as part of the commit 6dc9a1fe982f ("xen/arm: Remove most
    of the *_VIRT_END defines").
    
    Signed-off-by: Michal Orzel <michal.orzel@amd.com>
    Reviewed-by: Julien Grall <jgrall@amazon.com>
---
 xen/arch/arm/include/asm/config.h | 1 -
 1 file changed, 1 deletion(-)

diff --git a/xen/arch/arm/include/asm/config.h b/xen/arch/arm/include/asm/config.h
index 16213c8b67..6661a41583 100644
--- a/xen/arch/arm/include/asm/config.h
+++ b/xen/arch/arm/include/asm/config.h
@@ -127,7 +127,6 @@
 #define FRAMETABLE_VIRT_START  _AT(vaddr_t,0x02000000)
 #define FRAMETABLE_SIZE        MB(128-32)
 #define FRAMETABLE_NR          (FRAMETABLE_SIZE / sizeof(*frame_table))
-#define FRAMETABLE_VIRT_END    (FRAMETABLE_VIRT_START + FRAMETABLE_SIZE - 1)
 
 #define VMAP_VIRT_START        _AT(vaddr_t,0x10000000)
 #define VMAP_VIRT_SIZE         _AT(vaddr_t, GB(1) - MB(256))
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sun Feb 05 04:16:17 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 05 Feb 2023 04:16:17 +0000
Received: from list by lists.xenproject.org with outflank-mailman.489719.758152 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pOWRt-0001Vb-Nv; Sun, 05 Feb 2023 04:16:17 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 489719.758152; Sun, 05 Feb 2023 04:16:17 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pOWRt-0001VT-LK; Sun, 05 Feb 2023 04:16:17 +0000
Received: by outflank-mailman (input) for mailman id 489719;
 Sun, 05 Feb 2023 04:16:15 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pOWRr-0001VE-Ng
 for xen-changelog@lists.xenproject.org; Sun, 05 Feb 2023 04:16:15 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pOWRr-0001BX-N1
 for xen-changelog@lists.xenproject.org; Sun, 05 Feb 2023 04:16:15 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pOWRr-0008VU-ML
 for xen-changelog@lists.xenproject.org; Sun, 05 Feb 2023 04:16:15 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=05gvYVaIKwe0h39nkU1UUlzHyal097z+y64i1STtEJU=; b=hHVoQ+Hr161IKIt6v+ukx3eMOK
	uovcnmth8jhxyM5DjNd7dSbTIgPdfdQIcbVVhUT8w5UJ2VyQgIBQ5timGr097gOuprkjf21q31Pjx
	lzweLccTfjYPn9249YgLez0Ep5XSkhtGh1WYH5W9HXm0Np/XbMGXAHFil17uHrtVoUQk=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/arm: Harden setup_frametable_mappings
Message-Id: <E1pOWRr-0008VU-ML@xenbits.xenproject.org>
Date: Sun, 05 Feb 2023 04:16:15 +0000

commit 93017efd7c441420318e46443a06e40fa6f1b6d4
Author:     Michal Orzel <michal.orzel@amd.com>
AuthorDate: Tue Jan 17 12:43:32 2023 +0100
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Fri Jan 20 13:44:05 2023 +0000

    xen/arm: Harden setup_frametable_mappings
    
    The amount of supported physical memory depends on the frametable size
    and the number of struct page_info entries that can fit into it. Define
    a macro PAGE_INFO_SIZE to store the current size of the struct page_info
    (i.e. 56B for arm64 and 32B for arm32) and add a sanity check in
    setup_frametable_mappings to be notified whenever the size of the
    structure changes. Also call a panic if the calculated frametable_size
    exceeds the limit defined by FRAMETABLE_SIZE macro.
    
    Update the comments regarding the frametable in asm/config.h.
    
    Signed-off-by: Michal Orzel <michal.orzel@amd.com>
    Reviewed-by: Julien Grall <jgrall@amazon.com>
---
 xen/arch/arm/include/asm/config.h |  4 ++--
 xen/arch/arm/include/asm/mm.h     | 11 +++++++++++
 xen/arch/arm/mm.c                 |  6 ++++++
 3 files changed, 19 insertions(+), 2 deletions(-)

diff --git a/xen/arch/arm/include/asm/config.h b/xen/arch/arm/include/asm/config.h
index 6661a41583..d8f9977698 100644
--- a/xen/arch/arm/include/asm/config.h
+++ b/xen/arch/arm/include/asm/config.h
@@ -82,7 +82,7 @@
  * ARM32 layout:
  *   0  -  12M   <COMMON>
  *
- *  32M - 128M   Frametable: 24 bytes per page for 16GB of RAM
+ *  32M - 128M   Frametable: 32 bytes per page for 12GB of RAM
  * 256M -   1G   VMAP: ioremap and early_ioremap use this virtual address
  *                    space
  *
@@ -95,7 +95,7 @@
  *
  *   1G -   2G   VMAP: ioremap and early_ioremap
  *
- *  32G -  64G   Frametable: 24 bytes per page for 5.3TB of RAM
+ *  32G -  64G   Frametable: 56 bytes per page for 2TB of RAM
  *
  * 0x0000008000000000 - 0x00007fffffffffff (127.5TB, L0 slots [1..255])
  *  Unused
diff --git a/xen/arch/arm/include/asm/mm.h b/xen/arch/arm/include/asm/mm.h
index 68adcac9fa..23dec574eb 100644
--- a/xen/arch/arm/include/asm/mm.h
+++ b/xen/arch/arm/include/asm/mm.h
@@ -26,6 +26,17 @@
  */
 #define PFN_ORDER(_pfn) ((_pfn)->v.free.order)
 
+/*
+ * The size of struct page_info impacts the number of entries that can fit
+ * into the frametable area and thus it affects the amount of physical memory
+ * we claim to support. Define PAGE_INFO_SIZE to be used for sanity checking.
+*/
+#ifdef CONFIG_ARM_64
+#define PAGE_INFO_SIZE 56
+#else
+#define PAGE_INFO_SIZE 32
+#endif
+
 struct page_info
 {
     /* Each frame can be threaded onto a doubly-linked list. */
diff --git a/xen/arch/arm/mm.c b/xen/arch/arm/mm.c
index fab54618ab..1d2d58fa0a 100644
--- a/xen/arch/arm/mm.c
+++ b/xen/arch/arm/mm.c
@@ -676,6 +676,12 @@ void __init setup_frametable_mappings(paddr_t ps, paddr_t pe)
     const unsigned long mapping_size = frametable_size < MB(32) ? MB(2) : MB(32);
     int rc;
 
+    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);
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sun Feb 05 04:16:27 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 05 Feb 2023 04:16:27 +0000
Received: from list by lists.xenproject.org with outflank-mailman.489720.758156 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pOWS3-0001YN-PV; Sun, 05 Feb 2023 04:16:27 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 489720.758156; Sun, 05 Feb 2023 04:16:27 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pOWS3-0001YF-Ml; Sun, 05 Feb 2023 04:16:27 +0000
Received: by outflank-mailman (input) for mailman id 489720;
 Sun, 05 Feb 2023 04:16:25 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pOWS1-0001Y3-RT
 for xen-changelog@lists.xenproject.org; Sun, 05 Feb 2023 04:16:25 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pOWS1-0001Bb-QF
 for xen-changelog@lists.xenproject.org; Sun, 05 Feb 2023 04:16:25 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pOWS1-0008W0-Pc
 for xen-changelog@lists.xenproject.org; Sun, 05 Feb 2023 04:16:25 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=fLKPqGmXrY/MvdiXbwCv4icXK/kc2FgLScFpPubSTVE=; b=1N86lz7caUuWhAlMq52pGjyVdo
	n0pMvHZ2FdKwy98508w2tMZM4gcs/aXe++gbKqzDU/mE9prmU/zE8jZXJmu6+c+rG5H8srw5ulhDb
	CunopiZBTIsrWiMHIhxpWa1GIMJy+VzLQekUU7PbAoUHVNvbi91GodaAyLOsQuoD1GBM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] Revert "xen/arm: Use the correct format specifier"
Message-Id: <E1pOWS1-0008W0-Pc@xenbits.xenproject.org>
Date: Sun, 05 Feb 2023 04:16:25 +0000

commit 56f3782633c252dcec9c96eb345f95fb9557cea7
Author:     Julien Grall <jgrall@amazon.com>
AuthorDate: Fri Jan 20 17:32:00 2023 +0000
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Fri Jan 20 17:33:45 2023 +0000

    Revert "xen/arm: Use the correct format specifier"
    
    This is breaking the CI. See:
    
    https://lore.kernel.org/all/ba37ee02-c07c-2803-0867-149c779890b6@amd.com/
    
    This reverts commit 13bfdceda0991214854f3e563a36f621e9da3bec.
    
    Signed-off-by: Julien Grall <jgrall@amazon.com>
---
 xen/arch/arm/domain_build.c | 10 +++++-----
 xen/arch/arm/gic-v2.c       |  6 +++---
 xen/arch/arm/mm.c           |  2 +-
 3 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c
index 9116452d0c..c2b97fa21e 100644
--- a/xen/arch/arm/domain_build.c
+++ b/xen/arch/arm/domain_build.c
@@ -1315,7 +1315,7 @@ static int __init make_memory_node(const struct domain *d,
     dt_dprintk("Create memory node\n");
 
     /* ePAPR 3.4 */
-    snprintf(buf, sizeof(buf), "memory@%"PRIpaddr, mem->bank[i].start);
+    snprintf(buf, sizeof(buf), "memory@%"PRIx64, mem->bank[i].start);
     res = fdt_begin_node(fdt, buf);
     if ( res )
         return res;
@@ -1383,7 +1383,7 @@ static int __init make_shm_memory_node(const struct domain *d,
         __be32 *cells;
         unsigned int len = (addrcells + sizecells) * sizeof(__be32);
 
-        snprintf(buf, sizeof(buf), "xen-shmem@%"PRIpaddr, mem->bank[i].start);
+        snprintf(buf, sizeof(buf), "xen-shmem@%"PRIx64, mem->bank[i].start);
         res = fdt_begin_node(fdt, buf);
         if ( res )
             return res;
@@ -2719,7 +2719,7 @@ static int __init make_gicv2_domU_node(struct kernel_info *kinfo)
     /* Placeholder for interrupt-controller@ + a 64-bit number + \0 */
     char buf[38];
 
-    snprintf(buf, sizeof(buf), "interrupt-controller@%"PRIpaddr,
+    snprintf(buf, sizeof(buf), "interrupt-controller@%"PRIx64,
              vgic_dist_base(&d->arch.vgic));
     res = fdt_begin_node(fdt, buf);
     if ( res )
@@ -2775,7 +2775,7 @@ static int __init make_gicv3_domU_node(struct kernel_info *kinfo)
     char buf[38];
     unsigned int i, len = 0;
 
-    snprintf(buf, sizeof(buf), "interrupt-controller@%"PRIpaddr,
+    snprintf(buf, sizeof(buf), "interrupt-controller@%"PRIx64,
              vgic_dist_base(&d->arch.vgic));
 
     res = fdt_begin_node(fdt, buf);
@@ -2861,7 +2861,7 @@ static int __init make_vpl011_uart_node(struct kernel_info *kinfo)
     /* Placeholder for sbsa-uart@ + a 64-bit number + \0 */
     char buf[27];
 
-    snprintf(buf, sizeof(buf), "sbsa-uart@%"PRIpaddr, d->arch.vpl011.base_addr);
+    snprintf(buf, sizeof(buf), "sbsa-uart@%"PRIx64, d->arch.vpl011.base_addr);
     res = fdt_begin_node(fdt, buf);
     if ( res )
         return res;
diff --git a/xen/arch/arm/gic-v2.c b/xen/arch/arm/gic-v2.c
index 5d4d298b86..61802839cb 100644
--- a/xen/arch/arm/gic-v2.c
+++ b/xen/arch/arm/gic-v2.c
@@ -1049,7 +1049,7 @@ static void __init gicv2_dt_init(void)
     if ( csize < SZ_8K )
     {
         printk(XENLOG_WARNING "GICv2: WARNING: "
-               "The GICC size is too small: %#"PRIpaddr" expected %#x\n",
+               "The GICC size is too small: %#"PRIx64" expected %#x\n",
                csize, SZ_8K);
         if ( platform_has_quirk(PLATFORM_QUIRK_GIC_64K_STRIDE) )
         {
@@ -1280,11 +1280,11 @@ static int __init gicv2_init(void)
         gicv2.map_cbase += aliased_offset;
 
         printk(XENLOG_WARNING
-               "GICv2: Adjusting CPU interface base to %#"PRIpaddr"\n",
+               "GICv2: Adjusting CPU interface base to %#"PRIx64"\n",
                cbase + aliased_offset);
     } else if ( csize == SZ_128K )
         printk(XENLOG_WARNING
-               "GICv2: GICC size=%#"PRIpaddr" but not aliased\n",
+               "GICv2: GICC size=%#"PRIx64" but not aliased\n",
                csize);
 
     gicv2.map_hbase = ioremap_nocache(hbase, PAGE_SIZE);
diff --git a/xen/arch/arm/mm.c b/xen/arch/arm/mm.c
index 1d2d58fa0a..1a94b52cce 100644
--- a/xen/arch/arm/mm.c
+++ b/xen/arch/arm/mm.c
@@ -249,7 +249,7 @@ void dump_pt_walk(paddr_t ttbr, paddr_t addr,
 
         pte = mapping[offsets[level]];
 
-        printk("%s[0x%03x] = 0x%"PRIx64"\n",
+        printk("%s[0x%03x] = 0x%"PRIpaddr"\n",
                level_strs[level], offsets[level], pte.bits);
 
         if ( level == 3 || !pte.walk.valid || !pte.walk.table )
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sun Feb 05 04:16:37 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 05 Feb 2023 04:16:37 +0000
Received: from list by lists.xenproject.org with outflank-mailman.489721.758160 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pOWSD-0001bO-R0; Sun, 05 Feb 2023 04:16:37 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 489721.758160; Sun, 05 Feb 2023 04:16:37 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pOWSD-0001bG-OD; Sun, 05 Feb 2023 04:16:37 +0000
Received: by outflank-mailman (input) for mailman id 489721;
 Sun, 05 Feb 2023 04:16:35 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pOWSB-0001az-Tn
 for xen-changelog@lists.xenproject.org; Sun, 05 Feb 2023 04:16:35 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pOWSB-0001Bp-T9
 for xen-changelog@lists.xenproject.org; Sun, 05 Feb 2023 04:16:35 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pOWSB-0008WP-SU
 for xen-changelog@lists.xenproject.org; Sun, 05 Feb 2023 04:16:35 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=MvbaoAWco2GTIhcqqf2jKKY/nfEYxK7pphAs9e/Tl0A=; b=mD2G1pCxgPtLhrbnyFFkh1Ka8j
	qA1smuc/LfhqAgXnd/pxh7JzrtgCWTYc9z7Z1BGrsGRv/pmP5NQ1ouM2eEPUK9QJ+yCBjoQp4qjuL
	IZkJH+C7W59ODhJrwKfUDOE/5Ch8KuF0gmDuF+i9udU3TIvpQxFTEWTMiSlrTKaKkZc8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/version: Drop bogus return values for XENVER_platform_parameters
Message-Id: <E1pOWSB-0008WP-SU@xenbits.xenproject.org>
Date: Sun, 05 Feb 2023 04:16:35 +0000

commit 273bde319fe039083a90f1aae211815d90a0a36e
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Tue Jan 3 13:45:48 2023 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Jan 20 19:39:32 2023 +0000

    xen/version: Drop bogus return values for XENVER_platform_parameters
    
    A split in virtual address space is only applicable for x86 PV guests.
    Furthermore, the information returned for x86 64bit PV guests is wrong.
    
    Explain the problem in version.h, stating the other information that PV guests
    need to know.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/common/kernel.c          | 20 +++++++++++++++++---
 xen/include/public/version.h | 27 +++++++++++++++++++++++++++
 2 files changed, 44 insertions(+), 3 deletions(-)

diff --git a/xen/common/kernel.c b/xen/common/kernel.c
index 4f268d83e3..f7b1f65f37 100644
--- a/xen/common/kernel.c
+++ b/xen/common/kernel.c
@@ -518,11 +518,15 @@ long do_xen_version(int cmd, XEN_GUEST_HANDLE_PARAM(void) arg)
     
     case XENVER_platform_parameters:
     {
+        const struct vcpu *curr = current;
+
 #ifdef CONFIG_COMPAT
-        if ( current->hcall_compat )
+        if ( curr->hcall_compat )
         {
             compat_platform_parameters_t params = {
-                .virt_start = HYPERVISOR_COMPAT_VIRT_START(current->domain),
+                .virt_start = is_pv_vcpu(curr)
+                            ? HYPERVISOR_COMPAT_VIRT_START(curr->domain)
+                            : 0,
             };
 
             if ( copy_to_guest(arg, &params, 1) )
@@ -532,7 +536,17 @@ long do_xen_version(int cmd, XEN_GUEST_HANDLE_PARAM(void) arg)
 #endif
         {
             xen_platform_parameters_t params = {
-                .virt_start = HYPERVISOR_VIRT_START,
+                /*
+                 * Out of an abundance of caution, retain the useless return
+                 * value for 64bit PV guests, but in release builds only.
+                 *
+                 * This is not expected to cause any problems, but if it does,
+                 * the developer impacted will be the one best suited to fix
+                 * the caller not to issue this hypercall.
+                 */
+                .virt_start = !IS_ENABLED(CONFIG_DEBUG) && is_pv_vcpu(curr)
+                              ? HYPERVISOR_VIRT_START
+                              : 0,
             };
 
             if ( copy_to_guest(arg, &params, 1) )
diff --git a/xen/include/public/version.h b/xen/include/public/version.h
index 0ff8bd9077..cbc4ef7a46 100644
--- a/xen/include/public/version.h
+++ b/xen/include/public/version.h
@@ -42,6 +42,33 @@ typedef char xen_capabilities_info_t[1024];
 typedef char xen_changeset_info_t[64];
 #define XEN_CHANGESET_INFO_LEN (sizeof(xen_changeset_info_t))
 
+/*
+ * This API is problematic.
+ *
+ * It is only applicable to guests which share pagetables with Xen (x86 PV
+ * guests), but unfortunately has leaked into other guest types and
+ * architectures with an expectation of never failing.
+ *
+ * It is intended to identify the virtual address split between guest kernel
+ * and Xen.
+ *
+ * For 32bit PV guests, there is a split, and it is variable (between two
+ * fixed bounds), and this boundary is reported to guests.  The detail missing
+ * from the hypercall is that the second boundary is the 32bit architectural
+ * boundary at 4G.
+ *
+ * For 64bit PV guests, Xen lives at the bottom of the upper canonical range.
+ * This hypercall happens to report the architectural boundary, not the one
+ * which would be necessary to make a variable split work.  As such, this
+ * hypercall entirely useless for 64bit PV guests, and all inspected
+ * implementations at the time of writing were found to have compile time
+ * expectations about the split.
+ *
+ * For architectures where this hypercall is implemented, for backwards
+ * compatibility with the expectation of the hypercall never failing Xen will
+ * return 0 instead of failing with -ENOSYS in cases where the guest should
+ * not be making the hypercall.
+ */
 #define XENVER_platform_parameters 5
 struct xen_platform_parameters {
     xen_ulong_t virt_start;
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sun Feb 05 04:16:48 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 05 Feb 2023 04:16:48 +0000
Received: from list by lists.xenproject.org with outflank-mailman.489722.758163 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pOWSN-0001dl-SP; Sun, 05 Feb 2023 04:16:47 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 489722.758163; Sun, 05 Feb 2023 04:16:47 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pOWSN-0001de-Pr; Sun, 05 Feb 2023 04:16:47 +0000
Received: by outflank-mailman (input) for mailman id 489722;
 Sun, 05 Feb 2023 04:16:46 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pOWSM-0001dU-0h
 for xen-changelog@lists.xenproject.org; Sun, 05 Feb 2023 04:16:46 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pOWSL-0001C0-WE
 for xen-changelog@lists.xenproject.org; Sun, 05 Feb 2023 04:16:46 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pOWSL-00005C-VW
 for xen-changelog@lists.xenproject.org; Sun, 05 Feb 2023 04:16:45 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Zi43ywqtZkn9aApJWwdOXPZDzr6UDyRmpAVN9CGLNu8=; b=tr/vPnnGfr4KiirpauTSM40H+3
	n3fdjMnUTUJuwqbW9sAfVXvWjS8UBJmOvFlCAdnrk3yFMRXczEm56HWX/xz/beql7GpsG3oGa72cm
	qMMFQf90QM+8L2SGUXluPRSQThuXuVBmOez8O03/gmbKmKvbgY07+8BWdQs0jjeX0vac=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/hvm: Drop pat_entry_2_pte_flags
Message-Id: <E1pOWSL-00005C-VW@xenbits.xenproject.org>
Date: Sun, 05 Feb 2023 04:16:45 +0000

commit 848ca4e75f972e1d6ddae110965b2cc24997544f
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Mon Jan 16 11:01:26 2023 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Jan 20 19:39:32 2023 +0000

    x86/hvm: Drop pat_entry_2_pte_flags
    
    Converting from PAT to PTE is trivial, and shorter to encode with bitwise
    logic than the space taken by a table counting from 0 to 7 in non-adjacent
    bits.
    
    No functional change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/hvm/mtrr.c | 9 +--------
 1 file changed, 1 insertion(+), 8 deletions(-)

diff --git a/xen/arch/x86/hvm/mtrr.c b/xen/arch/x86/hvm/mtrr.c
index 093103f6c7..344edc2d6a 100644
--- a/xen/arch/x86/hvm/mtrr.c
+++ b/xen/arch/x86/hvm/mtrr.c
@@ -29,13 +29,6 @@
 /* Get page attribute fields (PAn) from PAT MSR. */
 #define pat_cr_2_paf(pat_cr,n)  ((((uint64_t)pat_cr) >> ((n)<<3)) & 0xff)
 
-/* PAT entry to PTE flags (PAT, PCD, PWT bits). */
-static const uint8_t pat_entry_2_pte_flags[8] = {
-    0,           _PAGE_PWT,
-    _PAGE_PCD,   _PAGE_PCD | _PAGE_PWT,
-    _PAGE_PAT,   _PAGE_PAT | _PAGE_PWT,
-    _PAGE_PAT | _PAGE_PCD, _PAGE_PAT | _PAGE_PCD | _PAGE_PWT };
-
 /* Effective mm type lookup table, according to MTRR and PAT. */
 static const uint8_t mm_type_tbl[MTRR_NUM_TYPES][X86_NUM_MT] = {
 #define RS MEMORY_NUM_TYPES
@@ -117,7 +110,7 @@ uint8_t pat_type_2_pte_flags(uint8_t pat_type)
     if ( unlikely(pat_entry == INVALID_MEM_TYPE) )
         pat_entry = pat_entry_tbl[X86_MT_UC];
 
-    return pat_entry_2_pte_flags[pat_entry];
+    return cacheattr_to_pte_flags(pat_entry);
 }
 
 int hvm_vcpu_cacheattr_init(struct vcpu *v)
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sun Feb 05 04:16:57 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 05 Feb 2023 04:16:57 +0000
Received: from list by lists.xenproject.org with outflank-mailman.489723.758168 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pOWSX-0001gj-U6; Sun, 05 Feb 2023 04:16:57 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 489723.758168; Sun, 05 Feb 2023 04:16:57 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pOWSX-0001gc-RR; Sun, 05 Feb 2023 04:16:57 +0000
Received: by outflank-mailman (input) for mailman id 489723;
 Sun, 05 Feb 2023 04:16:56 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pOWSW-0001gO-3g
 for xen-changelog@lists.xenproject.org; Sun, 05 Feb 2023 04:16:56 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pOWSW-0001CN-2u
 for xen-changelog@lists.xenproject.org; Sun, 05 Feb 2023 04:16:56 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pOWSW-00005b-2M
 for xen-changelog@lists.xenproject.org; Sun, 05 Feb 2023 04:16:56 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=cGiW4LRBDjxGqXVA74n8NuXmXkqi/RXDPqSUtvq8wSs=; b=DQbFJ+aUV+hhUktEmtrBIfZ5ys
	IfifWfTlXR7qY42gV8rtwRnZeBYjKy5klmeJqs2wu0M6RiIB0FYUCCQYEFB485VjiLC/o8l+2mQcC
	o0kP4ngp9hjVBt8XD8LKxTIQOqei20O3v7HuN/jJ9FafwSvLxUZvDOFwZvPEOGIegBRA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/shadow: Drop dubious lastpage diagnostic
Message-Id: <E1pOWSW-00005b-2M@xenbits.xenproject.org>
Date: Sun, 05 Feb 2023 04:16:56 +0000

commit b5d8b03db136dca2c7e755cd227265b5be451c88
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Fri Jan 20 11:01:52 2023 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Jan 20 19:39:32 2023 +0000

    x86/shadow: Drop dubious lastpage diagnostic
    
    This is a global variable (actually 3, one per GUEST_PAGING_LEVEL), operated
    on using atomics only (with no regard to what else shares the same cacheline),
    which emits a diagnostic (in debug builds only) without changing any program
    behaviour.
    
    It is presumably left-over debugging, as it interlinks the behaviour of all
    vCPUs in chronological order.  Based on the read-only p2m types, this
    diagnostic can be tripped by entirely legitimate guest behaviour.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/mm/shadow/multi.c | 7 -------
 1 file changed, 7 deletions(-)

diff --git a/xen/arch/x86/mm/shadow/multi.c b/xen/arch/x86/mm/shadow/multi.c
index 8b3e678fa0..3b06cfaf9a 100644
--- a/xen/arch/x86/mm/shadow/multi.c
+++ b/xen/arch/x86/mm/shadow/multi.c
@@ -2597,14 +2597,7 @@ static int cf_check sh_page_fault(
 
     /* Ignore attempts to write to read-only memory. */
     if ( p2m_is_readonly(p2mt) && (ft == ft_demand_write) )
-    {
-        static unsigned long lastpage;
-        if ( xchg(&lastpage, va & PAGE_MASK) != (va & PAGE_MASK) )
-            gdprintk(XENLOG_DEBUG, "guest attempted write to read-only memory"
-                     " page. va page=%#lx, mfn=%#lx\n",
-                     va & PAGE_MASK, mfn_x(gmfn));
         goto emulate_readonly; /* skip over the instruction */
-    }
 
     /* In HVM guests, we force CR0.WP always to be set, so that the
      * pagetables are always write-protected.  If the guest thinks
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sun Feb 05 04:17:08 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 05 Feb 2023 04:17:08 +0000
Received: from list by lists.xenproject.org with outflank-mailman.489724.758172 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pOWSh-0001js-W1; Sun, 05 Feb 2023 04:17:07 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 489724.758172; Sun, 05 Feb 2023 04:17: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 1pOWSh-0001jk-Sx; Sun, 05 Feb 2023 04:17:07 +0000
Received: by outflank-mailman (input) for mailman id 489724;
 Sun, 05 Feb 2023 04:17:06 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pOWSg-0001jM-6m
 for xen-changelog@lists.xenproject.org; Sun, 05 Feb 2023 04:17:06 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pOWSg-0001Cf-69
 for xen-changelog@lists.xenproject.org; Sun, 05 Feb 2023 04:17:06 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pOWSg-00006E-5X
 for xen-changelog@lists.xenproject.org; Sun, 05 Feb 2023 04:17:06 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=ur1NaKj1Q9Jw37blGlbQvBqFPRL2NchuEGX6DGVzM38=; b=sNkCpOzP5jiPMpXuMVIBglklZk
	xfykYcGXhMmgHtY2Hivvwv32LMhQ+K8oy/4bSrQ7xO0j1ZUwEFTPzKY8VSCXMXvvi+xT/L2zMmYph
	rxov3zb/4FMMyuB5njZw+HDwnC0hXkZb89mjt1D4nIp4SaeF01YBqk1lD2d/utafB/I8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/vmx: Partially revert "x86/vmx: implement Notify VM Exit"
Message-Id: <E1pOWSg-00006E-5X@xenbits.xenproject.org>
Date: Sun, 05 Feb 2023 04:17:06 +0000

commit 5f08bc9404c7cfa8131e262c7dbcb4d96c752686
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Wed Jan 18 19:20:05 2023 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Jan 20 19:39:32 2023 +0000

    x86/vmx: Partially revert "x86/vmx: implement Notify VM Exit"
    
    The original patch tried to do two things - implement VMNotify, and
    re-optimise VT-x to not intercept #DB/#AC by default.
    
    The second part is buggy in multiple ways.  Both GDBSX and Introspection need
    to conditionally intercept #DB, which was not accounted for.  Also, #DB
    interception has nothing at all to do with cpu_has_monitor_trap_flag.
    
    Revert the second half, leaving #DB/#AC intercepted unilaterally, but with
    VMNotify active by default when available.
    
    Fixes: 573279cde1c4 ("x86/vmx: implement Notify VM Exit")
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Kevin Tian <kevin.tian@intel.com>
---
 xen/arch/x86/hvm/vmx/vmcs.c | 11 ++---------
 xen/arch/x86/hvm/vmx/vmx.c  | 16 ++--------------
 2 files changed, 4 insertions(+), 23 deletions(-)

diff --git a/xen/arch/x86/hvm/vmx/vmcs.c b/xen/arch/x86/hvm/vmx/vmcs.c
index 8992f4e0ae..7d8bfeb539 100644
--- a/xen/arch/x86/hvm/vmx/vmcs.c
+++ b/xen/arch/x86/hvm/vmx/vmcs.c
@@ -1296,17 +1296,10 @@ static int construct_vmcs(struct vcpu *v)
     v->arch.hvm.vmx.exception_bitmap = HVM_TRAP_MASK
               | (paging_mode_hap(d) ? 0 : (1U << TRAP_page_fault))
               | (v->arch.fully_eager_fpu ? 0 : (1U << TRAP_no_device));
+
     if ( cpu_has_vmx_notify_vm_exiting )
-    {
         __vmwrite(NOTIFY_WINDOW, vm_notify_window);
-        /*
-         * Disable #AC and #DB interception: by using VM Notify Xen is
-         * guaranteed to get a VM exit even if the guest manages to lock the
-         * CPU.
-         */
-        v->arch.hvm.vmx.exception_bitmap &= ~((1U << TRAP_debug) |
-                                              (1U << TRAP_alignment_check));
-    }
+
     vmx_update_exception_bitmap(v);
 
     v->arch.hvm.guest_cr[0] = X86_CR0_PE | X86_CR0_ET;
diff --git a/xen/arch/x86/hvm/vmx/vmx.c b/xen/arch/x86/hvm/vmx/vmx.c
index 15a07933ee..2e2ab0ac0e 100644
--- a/xen/arch/x86/hvm/vmx/vmx.c
+++ b/xen/arch/x86/hvm/vmx/vmx.c
@@ -1564,19 +1564,10 @@ static void cf_check vmx_update_host_cr3(struct vcpu *v)
 
 void vmx_update_debug_state(struct vcpu *v)
 {
-    unsigned int mask = 1u << TRAP_int3;
-
-    if ( !cpu_has_monitor_trap_flag && cpu_has_vmx_notify_vm_exiting )
-        /*
-         * Only allow toggling TRAP_debug if notify VM exit is enabled, as
-         * unconditionally setting TRAP_debug is part of the XSA-156 fix.
-         */
-        mask |= 1u << TRAP_debug;
-
     if ( v->arch.hvm.debug_state_latch )
-        v->arch.hvm.vmx.exception_bitmap |= mask;
+        v->arch.hvm.vmx.exception_bitmap |= 1U << TRAP_int3;
     else
-        v->arch.hvm.vmx.exception_bitmap &= ~mask;
+        v->arch.hvm.vmx.exception_bitmap &= ~(1U << TRAP_int3);
 
     vmx_vmcs_enter(v);
     vmx_update_exception_bitmap(v);
@@ -4192,9 +4183,6 @@ void vmx_vmexit_handler(struct cpu_user_regs *regs)
         switch ( vector )
         {
         case TRAP_debug:
-            if ( cpu_has_monitor_trap_flag && cpu_has_vmx_notify_vm_exiting )
-                goto exit_and_crash;
-
             /*
              * Updates DR6 where debugger can peek (See 3B 23.2.1,
              * Table 23-1, "Exit Qualification for Debug Exceptions").
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sun Feb 05 04:17:17 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 05 Feb 2023 04:17:17 +0000
Received: from list by lists.xenproject.org with outflank-mailman.489725.758176 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pOWSr-0001n3-2w; Sun, 05 Feb 2023 04:17:17 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 489725.758176; Sun, 05 Feb 2023 04:17:17 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pOWSr-0001mt-0D; Sun, 05 Feb 2023 04:17:17 +0000
Received: by outflank-mailman (input) for mailman id 489725;
 Sun, 05 Feb 2023 04:17:16 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pOWSq-0001mb-A5
 for xen-changelog@lists.xenproject.org; Sun, 05 Feb 2023 04:17:16 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pOWSq-0001Cx-9O
 for xen-changelog@lists.xenproject.org; Sun, 05 Feb 2023 04:17:16 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pOWSq-00006f-8f
 for xen-changelog@lists.xenproject.org; Sun, 05 Feb 2023 04:17:16 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Z1pRP0p3pruhQjLIkRCDT5Syi9bWsdRLdYDqxMUD/24=; b=QfoOU9k35e/U/3spIVBnp1Y2tb
	VIzfVvBeu/bMrHiRHDnODtOty7A/lf269IUAnyjsGwJqTNmznG72xOOVRCF689PHVOcrU4+HlLfF6
	tb36rnaWWgcGb1bfFm7vjHTpNuft94w6pFUcdVYn4fD9XOOKCwete6UtUalyCNaUwl5Y=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/boot: Sanitise PKRU on boot
Message-Id: <E1pOWSq-00006f-8f@xenbits.xenproject.org>
Date: Sun, 05 Feb 2023 04:17:16 +0000

commit c4f9a3bad3f1c6e34c61ad8103a4145f2d6f9c68
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Tue Jan 10 10:57:21 2023 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Jan 20 19:39:32 2023 +0000

    x86/boot: Sanitise PKRU on boot
    
    While the reset value of the register is 0, it might not be after kexec/etc.
    If PKEY0.{WD,AD} have leaked in from an earlier context, construction of a PV
    dom0 will explode.
    
    Sequencing wise, this must come after setting CR4.PKE, and before we touch any
    user mappings.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/cpu/common.c             | 3 +++
 xen/arch/x86/include/asm/cpufeature.h | 1 +
 xen/arch/x86/setup.c                  | 2 +-
 3 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/xen/arch/x86/cpu/common.c b/xen/arch/x86/cpu/common.c
index 0412dbc915..fe92f29c2d 100644
--- a/xen/arch/x86/cpu/common.c
+++ b/xen/arch/x86/cpu/common.c
@@ -936,6 +936,9 @@ void cpu_init(void)
 	write_debugreg(6, X86_DR6_DEFAULT);
 	write_debugreg(7, X86_DR7_DEFAULT);
 
+	if (cpu_has_pku)
+		wrpkru(0);
+
 	/*
 	 * If the platform is performing a Secure Launch via SKINIT, GIF is
 	 * clear to prevent external interrupts interfering with Secure
diff --git a/xen/arch/x86/include/asm/cpufeature.h b/xen/arch/x86/include/asm/cpufeature.h
index a3ad9ebee4..044cfd9f88 100644
--- a/xen/arch/x86/include/asm/cpufeature.h
+++ b/xen/arch/x86/include/asm/cpufeature.h
@@ -109,6 +109,7 @@
 
 /* CPUID level 0x00000007:0.ecx */
 #define cpu_has_avx512_vbmi     boot_cpu_has(X86_FEATURE_AVX512_VBMI)
+#define cpu_has_pku             boot_cpu_has(X86_FEATURE_PKU)
 #define cpu_has_avx512_vbmi2    boot_cpu_has(X86_FEATURE_AVX512_VBMI2)
 #define cpu_has_gfni            boot_cpu_has(X86_FEATURE_GFNI)
 #define cpu_has_vaes            boot_cpu_has(X86_FEATURE_VAES)
diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c
index 566422600d..6deadcf747 100644
--- a/xen/arch/x86/setup.c
+++ b/xen/arch/x86/setup.c
@@ -1798,7 +1798,7 @@ void __init noreturn __start_xen(unsigned long mbi_p)
     if ( boot_cpu_has(X86_FEATURE_FSGSBASE) )
         set_in_cr4(X86_CR4_FSGSBASE);
 
-    if ( boot_cpu_has(X86_FEATURE_PKU) )
+    if ( cpu_has_pku )
         set_in_cr4(X86_CR4_PKE);
 
     if ( opt_invpcid && cpu_has_invpcid )
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sun Feb 05 04:17:27 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 05 Feb 2023 04:17:27 +0000
Received: from list by lists.xenproject.org with outflank-mailman.489726.758180 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pOWT1-0001qA-4I; Sun, 05 Feb 2023 04:17:27 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 489726.758180; Sun, 05 Feb 2023 04:17:27 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pOWT1-0001q2-1h; Sun, 05 Feb 2023 04:17:27 +0000
Received: by outflank-mailman (input) for mailman id 489726;
 Sun, 05 Feb 2023 04:17:26 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pOWT0-0001ps-D6
 for xen-changelog@lists.xenproject.org; Sun, 05 Feb 2023 04:17:26 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pOWT0-0001D2-CV
 for xen-changelog@lists.xenproject.org; Sun, 05 Feb 2023 04:17:26 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pOWT0-000074-Bo
 for xen-changelog@lists.xenproject.org; Sun, 05 Feb 2023 04:17:26 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=uxLdiSUniRc5gup1WjVKd4ZQB2erOe4c663vAeLeV2E=; b=taysGfq47EdvrADrl3Fl0J6aY/
	fUF+kPfyQdg280EowWR6bSPmERRduhGy3fjQuBDTMfSexIy/rVJlVUGYEL7BYSDzaAchojogXG6PD
	tl39od2fNS+paGcIqSXtcONfz92RsxRIVKrBXh9pvRqGyX7qihguQmiWowe1BSzgFPg8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/prot-key: Enumeration for Protection Key Supervisor
Message-Id: <E1pOWT0-000074-Bo@xenbits.xenproject.org>
Date: Sun, 05 Feb 2023 04:17:26 +0000

commit cd8fc0e9f313bb59d496a777c4af206b21c33296
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Tue Dec 14 16:51:28 2021 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Jan 20 19:39:33 2023 +0000

    x86/prot-key: Enumeration for Protection Key Supervisor
    
    Protection Key Supervisor works in a very similar way to Protection Key User,
    except that instead of a PKRU register used by the {RD,WR}PKRU instructions,
    the supervisor protection settings live in MSR_PKRS and is accessed using
    normal {RD,WR}MSR instructions.
    
    PKS has the same problematic interactions with PV guests as PKU (more infact,
    given the guest kernel's CPL), so we'll only support this for HVM guests for
    now.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 tools/libs/light/libxl_cpuid.c              | 1 +
 tools/misc/xen-cpuid.c                      | 2 +-
 xen/arch/x86/include/asm/cpufeature.h       | 1 +
 xen/arch/x86/include/asm/msr-index.h        | 2 ++
 xen/arch/x86/include/asm/x86-defns.h        | 1 +
 xen/include/public/arch-x86/cpufeatureset.h | 1 +
 6 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/tools/libs/light/libxl_cpuid.c b/tools/libs/light/libxl_cpuid.c
index 2aa23225f4..cbd4e511e8 100644
--- a/tools/libs/light/libxl_cpuid.c
+++ b/tools/libs/light/libxl_cpuid.c
@@ -211,6 +211,7 @@ int libxl_cpuid_parse_config(libxl_cpuid_policy_list *cpuid, const char* str)
         {"avx512-vpopcntdq",0x00000007,0,CPUID_REG_ECX, 14,  1},
         {"rdpid",        0x00000007,  0, CPUID_REG_ECX, 22,  1},
         {"cldemote",     0x00000007,  0, CPUID_REG_ECX, 25,  1},
+        {"pks",          0x00000007,  0, CPUID_REG_ECX, 31,  1},
 
         {"avx512-4vnniw",0x00000007,  0, CPUID_REG_EDX,  2,  1},
         {"avx512-4fmaps",0x00000007,  0, CPUID_REG_EDX,  3,  1},
diff --git a/tools/misc/xen-cpuid.c b/tools/misc/xen-cpuid.c
index d5833e9ce8..ea7ff320e0 100644
--- a/tools/misc/xen-cpuid.c
+++ b/tools/misc/xen-cpuid.c
@@ -134,7 +134,7 @@ static const char *const str_7c0[32] =
     /* 24 */                   [25] = "cldemote",
     /* 26 */                   [27] = "movdiri",
     [28] = "movdir64b",        [29] = "enqcmd",
-    [30] = "sgx-lc",
+    [30] = "sgx-lc",           [31] = "pks",
 };
 
 static const char *const str_e7d[32] =
diff --git a/xen/arch/x86/include/asm/cpufeature.h b/xen/arch/x86/include/asm/cpufeature.h
index 044cfd9f88..0a301013c3 100644
--- a/xen/arch/x86/include/asm/cpufeature.h
+++ b/xen/arch/x86/include/asm/cpufeature.h
@@ -121,6 +121,7 @@
 #define cpu_has_movdiri         boot_cpu_has(X86_FEATURE_MOVDIRI)
 #define cpu_has_movdir64b       boot_cpu_has(X86_FEATURE_MOVDIR64B)
 #define cpu_has_enqcmd          boot_cpu_has(X86_FEATURE_ENQCMD)
+#define cpu_has_pks             boot_cpu_has(X86_FEATURE_PKS)
 
 /* CPUID level 0x80000007.edx */
 #define cpu_has_hw_pstate       boot_cpu_has(X86_FEATURE_HW_PSTATE)
diff --git a/xen/arch/x86/include/asm/msr-index.h b/xen/arch/x86/include/asm/msr-index.h
index 0a8852f3c2..7615d8087f 100644
--- a/xen/arch/x86/include/asm/msr-index.h
+++ b/xen/arch/x86/include/asm/msr-index.h
@@ -148,6 +148,8 @@
 #define MSR_PL3_SSP                         0x000006a7
 #define MSR_INTERRUPT_SSP_TABLE             0x000006a8
 
+#define MSR_PKRS                            0x000006e1
+
 #define MSR_X2APIC_FIRST                    0x00000800
 #define MSR_X2APIC_LAST                     0x000008ff
 
diff --git a/xen/arch/x86/include/asm/x86-defns.h b/xen/arch/x86/include/asm/x86-defns.h
index 42b5f382d4..fe1caba6f8 100644
--- a/xen/arch/x86/include/asm/x86-defns.h
+++ b/xen/arch/x86/include/asm/x86-defns.h
@@ -74,6 +74,7 @@
 #define X86_CR4_SMAP       0x00200000 /* enable SMAP */
 #define X86_CR4_PKE        0x00400000 /* enable PKE */
 #define X86_CR4_CET        0x00800000 /* Control-flow Enforcement Technology */
+#define X86_CR4_PKS        0x01000000 /* Protection Key Supervisor */
 
 /*
  * XSTATE component flags in XCR0
diff --git a/xen/include/public/arch-x86/cpufeatureset.h b/xen/include/public/arch-x86/cpufeatureset.h
index 7915f5826f..ad7e89dd4c 100644
--- a/xen/include/public/arch-x86/cpufeatureset.h
+++ b/xen/include/public/arch-x86/cpufeatureset.h
@@ -227,6 +227,7 @@ XEN_CPUFEATURE(CLDEMOTE,      6*32+25) /*A  CLDEMOTE instruction */
 XEN_CPUFEATURE(MOVDIRI,       6*32+27) /*a  MOVDIRI instruction */
 XEN_CPUFEATURE(MOVDIR64B,     6*32+28) /*a  MOVDIR64B instruction */
 XEN_CPUFEATURE(ENQCMD,        6*32+29) /*   ENQCMD{,S} instructions */
+XEN_CPUFEATURE(PKS,           6*32+31) /*   Protection Key for Supervisor */
 
 /* AMD-defined CPU features, CPUID level 0x80000007.edx, word 7 */
 XEN_CPUFEATURE(HW_PSTATE,     7*32+ 7) /*   Hardware Pstates */
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sun Feb 05 04:17:37 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 05 Feb 2023 04:17:37 +0000
Received: from list by lists.xenproject.org with outflank-mailman.489727.758184 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pOWTB-0001sv-68; Sun, 05 Feb 2023 04:17:37 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 489727.758184; Sun, 05 Feb 2023 04:17:37 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pOWTB-0001sn-3F; Sun, 05 Feb 2023 04:17:37 +0000
Received: by outflank-mailman (input) for mailman id 489727;
 Sun, 05 Feb 2023 04:17:36 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pOWTA-0001sg-GC
 for xen-changelog@lists.xenproject.org; Sun, 05 Feb 2023 04:17:36 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pOWTA-0001DJ-FU
 for xen-changelog@lists.xenproject.org; Sun, 05 Feb 2023 04:17:36 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pOWTA-00007i-Eq
 for xen-changelog@lists.xenproject.org; Sun, 05 Feb 2023 04:17:36 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=S/iFPMV+4BVV1nWns/JtnWVTMS8ALDQldRf78ESGDlw=; b=FozIymB6GubMTlAASauTB1zce5
	O9FWv7wgBVKA61m9w4RhNEHpoC8K5TmI3Mwiu+L6S1voczotFrkuhMncCkpP/WUDcw2jaw2cYdoMX
	V8YQF1yZdklyOZRPqxlwEOcbe9XmkgfBKGTJrPiQp5kdpkxS/M52vaYr8Er5CZaeyMaI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/prot-key: Split PKRU infrastructure out of asm/processor.h
Message-Id: <E1pOWTA-00007i-Eq@xenbits.xenproject.org>
Date: Sun, 05 Feb 2023 04:17:36 +0000

commit c04b84ec74a47b13f7e0869f35983dbb026a9b9d
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Tue Dec 14 16:51:28 2021 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Jan 20 19:39:33 2023 +0000

    x86/prot-key: Split PKRU infrastructure out of asm/processor.h
    
    asm/processor.h is in desperate need of splitting up, and protection key
    functionality in only used in the emulator and pagewalk.  Introduce a new
    asm/prot-key.h and move the relevant content over.
    
    Rename the PKRU_* constants to drop the user part and to use the architectural
    terminology.
    
    Drop the read_pkru_{ad,wd}() helpers entirely.  The pkru infix is about to
    become wrong, and the sole user is shorter and easier to follow without the
    helpers.
    
    No functional change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/cpu/common.c            |  1 +
 xen/arch/x86/include/asm/processor.h | 38 ------------------------------------
 xen/arch/x86/include/asm/prot-key.h  | 31 +++++++++++++++++++++++++++++
 xen/arch/x86/mm/guest_walk.c         |  9 ++++++---
 xen/arch/x86/x86_emulate.c           |  2 ++
 5 files changed, 40 insertions(+), 41 deletions(-)

diff --git a/xen/arch/x86/cpu/common.c b/xen/arch/x86/cpu/common.c
index fe92f29c2d..2bcdd08b2f 100644
--- a/xen/arch/x86/cpu/common.c
+++ b/xen/arch/x86/cpu/common.c
@@ -11,6 +11,7 @@
 #include <asm/io.h>
 #include <asm/mpspec.h>
 #include <asm/apic.h>
+#include <asm/prot-key.h>
 #include <asm/random.h>
 #include <asm/setup.h>
 #include <asm/shstk.h>
diff --git a/xen/arch/x86/include/asm/processor.h b/xen/arch/x86/include/asm/processor.h
index 60b9020609..b95d248321 100644
--- a/xen/arch/x86/include/asm/processor.h
+++ b/xen/arch/x86/include/asm/processor.h
@@ -374,44 +374,6 @@ static always_inline void set_in_cr4 (unsigned long mask)
     write_cr4(read_cr4() | mask);
 }
 
-static inline unsigned int rdpkru(void)
-{
-    unsigned int pkru;
-
-    asm volatile (".byte 0x0f,0x01,0xee"
-        : "=a" (pkru) : "c" (0) : "dx");
-
-    return pkru;
-}
-
-static inline void wrpkru(unsigned int pkru)
-{
-    asm volatile ( ".byte 0x0f, 0x01, 0xef"
-                   :: "a" (pkru), "d" (0), "c" (0) );
-}
-
-/* Macros for PKRU domain */
-#define PKRU_READ  (0)
-#define PKRU_WRITE (1)
-#define PKRU_ATTRS (2)
-
-/*
- * PKRU defines 32 bits, there are 16 domains and 2 attribute bits per
- * domain in pkru, pkeys is index to a defined domain, so the value of
- * pte_pkeys * PKRU_ATTRS + R/W is offset of a defined domain attribute.
- */
-static inline bool_t read_pkru_ad(uint32_t pkru, unsigned int pkey)
-{
-    ASSERT(pkey < 16);
-    return (pkru >> (pkey * PKRU_ATTRS + PKRU_READ)) & 1;
-}
-
-static inline bool_t read_pkru_wd(uint32_t pkru, unsigned int pkey)
-{
-    ASSERT(pkey < 16);
-    return (pkru >> (pkey * PKRU_ATTRS + PKRU_WRITE)) & 1;
-}
-
 static always_inline void __monitor(const void *eax, unsigned long ecx,
                                     unsigned long edx)
 {
diff --git a/xen/arch/x86/include/asm/prot-key.h b/xen/arch/x86/include/asm/prot-key.h
new file mode 100644
index 0000000000..63a2e22f3f
--- /dev/null
+++ b/xen/arch/x86/include/asm/prot-key.h
@@ -0,0 +1,31 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Copyright (c) 2021-2022 Citrix Systems Ltd.
+ */
+#ifndef ASM_PROT_KEY_H
+#define ASM_PROT_KEY_H
+
+#include <xen/types.h>
+
+#define PKEY_AD 1 /* Access Disable */
+#define PKEY_WD 2 /* Write Disable */
+
+#define PKEY_WIDTH 2 /* Two bits per protection key */
+
+static inline uint32_t rdpkru(void)
+{
+    uint32_t pkru;
+
+    asm volatile ( ".byte 0x0f,0x01,0xee"
+                   : "=a" (pkru) : "c" (0) : "dx" );
+
+    return pkru;
+}
+
+static inline void wrpkru(uint32_t pkru)
+{
+    asm volatile ( ".byte 0x0f,0x01,0xef"
+                   :: "a" (pkru), "d" (0), "c" (0) );
+}
+
+#endif /* ASM_PROT_KEY_H */
diff --git a/xen/arch/x86/mm/guest_walk.c b/xen/arch/x86/mm/guest_walk.c
index 70dacc477f..161a61b8f5 100644
--- a/xen/arch/x86/mm/guest_walk.c
+++ b/xen/arch/x86/mm/guest_walk.c
@@ -26,7 +26,9 @@
 #include <xen/paging.h>
 #include <xen/domain_page.h>
 #include <xen/sched.h>
+
 #include <asm/page.h>
+#include <asm/prot-key.h>
 #include <asm/guest_pt.h>
 #include <asm/hvm/emulate.h>
 
@@ -413,10 +415,11 @@ guest_walk_tables(const struct vcpu *v, struct p2m_domain *p2m,
          guest_pku_enabled(v) )
     {
         unsigned int pkey = guest_l1e_get_pkey(gw->l1e);
-        unsigned int pkru = rdpkru();
+        unsigned int pkr = rdpkru();
+        unsigned int pk_ar = (pkr >> (pkey * PKEY_WIDTH)) & (PKEY_AD | PKEY_WD);
 
-        if ( read_pkru_ad(pkru, pkey) ||
-             ((walk & PFEC_write_access) && read_pkru_wd(pkru, pkey) &&
+        if ( (pk_ar & PKEY_AD) ||
+             ((walk & PFEC_write_access) && (pk_ar & PKEY_WD) &&
               ((walk & PFEC_user_mode) || guest_wp_enabled(v))) )
         {
             gw->pfec |= PFEC_prot_key;
diff --git a/xen/arch/x86/x86_emulate.c b/xen/arch/x86/x86_emulate.c
index 720740f29b..8c7d185218 100644
--- a/xen/arch/x86/x86_emulate.c
+++ b/xen/arch/x86/x86_emulate.c
@@ -12,8 +12,10 @@
 #include <xen/domain_page.h>
 #include <xen/err.h>
 #include <xen/event.h>
+
 #include <asm/x86_emulate.h>
 #include <asm/processor.h> /* current_cpu_info */
+#include <asm/prot-key.h>
 #include <asm/xstate.h>
 #include <asm/amd.h> /* cpu_has_amd_erratum() */
 #include <asm/debugreg.h>
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sun Feb 05 04:17:47 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 05 Feb 2023 04:17:47 +0000
Received: from list by lists.xenproject.org with outflank-mailman.489728.758188 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pOWTL-0001vP-7f; Sun, 05 Feb 2023 04:17:47 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 489728.758188; Sun, 05 Feb 2023 04:17:47 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pOWTL-0001vH-4r; Sun, 05 Feb 2023 04:17:47 +0000
Received: by outflank-mailman (input) for mailman id 489728;
 Sun, 05 Feb 2023 04:17:46 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pOWTK-0001vB-J6
 for xen-changelog@lists.xenproject.org; Sun, 05 Feb 2023 04:17:46 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pOWTK-0001DU-IO
 for xen-changelog@lists.xenproject.org; Sun, 05 Feb 2023 04:17:46 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pOWTK-00008O-Hm
 for xen-changelog@lists.xenproject.org; Sun, 05 Feb 2023 04:17:46 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=fyw3RD4hdbfJv5coAYuNIlhGMajre5Np2zkrHAVFRC0=; b=ZeqBf5XZfJ9kOgjf37qINnW1HB
	GGe3PT/YXMvi6LI5PunXBZxvhVBhG77Nf5F1gYV/SBdPLPS7jAEJqh7Ec1Jz/dPWE9+m74M+BZyM8
	FROjyxB+3bYvqW40/NOjUuoIUkBASJW7ixWwMSOfTGKxIc20Ih/oQ5M9Aui7C2Kzhjj8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86: Initial support for WRMSRNS
Message-Id: <E1pOWTK-00008O-Hm@xenbits.xenproject.org>
Date: Sun, 05 Feb 2023 04:17:46 +0000

commit 80ff09ffe2fcbac1f2c52ac2bdfd0252ec08a6f8
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Mon Jan 9 15:25:11 2023 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Jan 20 19:39:33 2023 +0000

    x86: Initial support for WRMSRNS
    
    WRMSR Non-Serialising is an optimisation intended for cases where an MSR needs
    updating, but architectural serialising properties are not needed.
    
    In is anticipated that this will apply to most if not all MSRs modified on
    context switch paths.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 tools/libs/light/libxl_cpuid.c              |  1 +
 tools/misc/xen-cpuid.c                      |  2 ++
 xen/arch/x86/include/asm/msr.h              | 12 ++++++++++++
 xen/include/public/arch-x86/cpufeatureset.h |  1 +
 4 files changed, 16 insertions(+)

diff --git a/tools/libs/light/libxl_cpuid.c b/tools/libs/light/libxl_cpuid.c
index cbd4e511e8..8da78773a8 100644
--- a/tools/libs/light/libxl_cpuid.c
+++ b/tools/libs/light/libxl_cpuid.c
@@ -235,6 +235,7 @@ int libxl_cpuid_parse_config(libxl_cpuid_policy_list *cpuid, const char* str)
         {"fzrm",         0x00000007,  1, CPUID_REG_EAX, 10,  1},
         {"fsrs",         0x00000007,  1, CPUID_REG_EAX, 11,  1},
         {"fsrcs",        0x00000007,  1, CPUID_REG_EAX, 12,  1},
+        {"wrmsrns",      0x00000007,  1, CPUID_REG_EAX, 19,  1},
 
         {"intel-psfd",   0x00000007,  2, CPUID_REG_EDX,  0,  1},
         {"mcdt-no",      0x00000007,  2, CPUID_REG_EDX,  5,  1},
diff --git a/tools/misc/xen-cpuid.c b/tools/misc/xen-cpuid.c
index ea7ff320e0..08831af46c 100644
--- a/tools/misc/xen-cpuid.c
+++ b/tools/misc/xen-cpuid.c
@@ -189,6 +189,8 @@ static const char *const str_7a1[32] =
 
     [10] = "fzrm",          [11] = "fsrs",
     [12] = "fsrcs",
+
+    /* 18 */                [19] = "wrmsrns",
 };
 
 static const char *const str_e21a[32] =
diff --git a/xen/arch/x86/include/asm/msr.h b/xen/arch/x86/include/asm/msr.h
index dd1eee04a6..191e540688 100644
--- a/xen/arch/x86/include/asm/msr.h
+++ b/xen/arch/x86/include/asm/msr.h
@@ -38,6 +38,18 @@ static inline void wrmsrl(unsigned int msr, __u64 val)
         wrmsr(msr, lo, hi);
 }
 
+/* Non-serialising WRMSR, when available.  Falls back to a serialising WRMSR. */
+static inline void wrmsr_ns(uint32_t msr, uint32_t lo, uint32_t hi)
+{
+    /*
+     * WRMSR is 2 bytes.  WRMSRNS is 3 bytes.  Pad WRMSR with a redundant CS
+     * prefix to avoid a trailing NOP.
+     */
+    alternative_input(".byte 0x2e; wrmsr",
+                      ".byte 0x0f,0x01,0xc6", X86_FEATURE_WRMSRNS,
+                      "c" (msr), "a" (lo), "d" (hi));
+}
+
 /* rdmsr with exception handling */
 #define rdmsr_safe(msr,val) ({\
     int rc_; \
diff --git a/xen/include/public/arch-x86/cpufeatureset.h b/xen/include/public/arch-x86/cpufeatureset.h
index ad7e89dd4c..5444bc5d83 100644
--- a/xen/include/public/arch-x86/cpufeatureset.h
+++ b/xen/include/public/arch-x86/cpufeatureset.h
@@ -281,6 +281,7 @@ XEN_CPUFEATURE(AVX512_BF16,  10*32+ 5) /*A  AVX512 BFloat16 Instructions */
 XEN_CPUFEATURE(FZRM,         10*32+10) /*A  Fast Zero-length REP MOVSB */
 XEN_CPUFEATURE(FSRS,         10*32+11) /*A  Fast Short REP STOSB */
 XEN_CPUFEATURE(FSRCS,        10*32+12) /*A  Fast Short REP CMPSB/SCASB */
+XEN_CPUFEATURE(WRMSRNS,      10*32+19) /*   WRMSR Non-Serialising */
 
 /* AMD-defined CPU features, CPUID level 0x80000021.eax, word 11 */
 XEN_CPUFEATURE(LFENCE_DISPATCH,    11*32+ 2) /*A  LFENCE always serializing */
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sun Feb 05 04:17:57 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 05 Feb 2023 04:17:57 +0000
Received: from list by lists.xenproject.org with outflank-mailman.489729.758192 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pOWTV-0001yY-9e; Sun, 05 Feb 2023 04:17:57 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 489729.758192; Sun, 05 Feb 2023 04:17:57 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pOWTV-0001yP-6O; Sun, 05 Feb 2023 04:17:57 +0000
Received: by outflank-mailman (input) for mailman id 489729;
 Sun, 05 Feb 2023 04:17:56 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pOWTU-0001yH-Mg
 for xen-changelog@lists.xenproject.org; Sun, 05 Feb 2023 04:17:56 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pOWTU-0001Dr-Ls
 for xen-changelog@lists.xenproject.org; Sun, 05 Feb 2023 04:17:56 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pOWTU-0000AT-LB
 for xen-changelog@lists.xenproject.org; Sun, 05 Feb 2023 04:17:56 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=c2QiDkWS+hy5CXA2wUzONdAc8NE563kRNzCSWr+qMTs=; b=OaQMbykqdm+vkXcCcFg1zVzqgH
	CLBqnFMJUe3zjAMRqce1KpwxL58I9sm6XpnKIJQI3Td2vWG0Sp0KeCgwMC+XrgDVR/15d5sJjye9s
	ffYMOQ8yCwMLde1D8/vZCZlfLxG9ZaOb7JK1+fmeQe1kbZ6CUWAp38+rNM7s1ItOxexs=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/hvm: Context switch MSR_PKRS
Message-Id: <E1pOWTU-0000AT-LB@xenbits.xenproject.org>
Date: Sun, 05 Feb 2023 04:17:56 +0000

commit b5afdd2e1b7381a0a5f7fde0b40755d8088b6433
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Tue Dec 14 16:51:28 2021 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Jan 20 19:39:33 2023 +0000

    x86/hvm: Context switch MSR_PKRS
    
    Under PKS, MSR_PKRS is available and based on the CPUID policy alone, and
    usable independently of CR4.PKS.  See the large comment in prot-key.h for
    details of the context switching arrangement.
    
    Use WRMSRNS right away, as we don't care about serialsing properties for
    context switching this MSR.
    
    Sanitise MSR_PKRS on boot.  In anticipation of wanting to use PKS for Xen in
    the future, arrange for the sanitisation to occur prior to potentially setting
    CR4.PKS; if PKEY0.{AD,WD} leak in from a previous context, we will triple
    fault immediately on setting CR4.PKS.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Jan Beulich <JBeulich@suse.com>
---
 xen/arch/x86/acpi/power.c           | 10 +++++++
 xen/arch/x86/cpu/common.c           |  2 ++
 xen/arch/x86/hvm/vmx/vmx.c          |  9 +++++++
 xen/arch/x86/include/asm/msr.h      |  9 +++++++
 xen/arch/x86/include/asm/prot-key.h | 54 +++++++++++++++++++++++++++++++++++++
 xen/arch/x86/setup.c                |  4 +++
 xen/arch/x86/smpboot.c              |  4 +++
 7 files changed, 92 insertions(+)

diff --git a/xen/arch/x86/acpi/power.c b/xen/arch/x86/acpi/power.c
index d23335391c..81233738b1 100644
--- a/xen/arch/x86/acpi/power.c
+++ b/xen/arch/x86/acpi/power.c
@@ -29,6 +29,7 @@
 #include <asm/apic.h>
 #include <asm/io_apic.h>
 #include <asm/microcode.h>
+#include <asm/prot-key.h>
 #include <asm/spec_ctrl.h>
 #include <acpi/cpufreq/cpufreq.h>
 
@@ -299,6 +300,15 @@ static int enter_state(u32 state)
 
     update_mcu_opt_ctrl();
 
+    /*
+     * This should be before restoring CR4, but that is earlier in asm and
+     * awkward.  Instead, we rely on MSR_PKRS being something sane out of S3
+     * (0, or Xen's previous value) until this point, where we need to become
+     * certain that Xen's cache matches reality.
+     */
+    if ( cpu_has_pks )
+        wrpkrs_and_cache(0);
+
     /* (re)initialise SYSCALL/SYSENTER state, amongst other things. */
     percpu_traps_init();
 
diff --git a/xen/arch/x86/cpu/common.c b/xen/arch/x86/cpu/common.c
index 2bcdd08b2f..f44c907e8a 100644
--- a/xen/arch/x86/cpu/common.c
+++ b/xen/arch/x86/cpu/common.c
@@ -58,6 +58,8 @@ static unsigned int forced_caps[NCAPINTS];
 
 DEFINE_PER_CPU(bool, full_gdt_loaded);
 
+DEFINE_PER_CPU(uint32_t, pkrs);
+
 void __init setup_clear_cpu_cap(unsigned int cap)
 {
 	const uint32_t *dfs;
diff --git a/xen/arch/x86/hvm/vmx/vmx.c b/xen/arch/x86/hvm/vmx/vmx.c
index 2e2ab0ac0e..d8525d3d3d 100644
--- a/xen/arch/x86/hvm/vmx/vmx.c
+++ b/xen/arch/x86/hvm/vmx/vmx.c
@@ -58,6 +58,7 @@
 #include <asm/event.h>
 #include <asm/mce.h>
 #include <asm/monitor.h>
+#include <asm/prot-key.h>
 #include <public/arch-x86/cpuid.h>
 
 static bool_t __initdata opt_force_ept;
@@ -672,6 +673,7 @@ static void vmx_restore_host_msrs(void)
 
 static void vmx_save_guest_msrs(struct vcpu *v)
 {
+    const struct cpuid_policy *cp = v->domain->arch.cpuid;
     struct vcpu_msrs *msrs = v->arch.msrs;
 
     /*
@@ -685,10 +687,14 @@ static void vmx_save_guest_msrs(struct vcpu *v)
         rdmsrl(MSR_RTIT_OUTPUT_MASK, msrs->rtit.output_mask);
         rdmsrl(MSR_RTIT_STATUS, msrs->rtit.status);
     }
+
+    if ( cp->feat.pks )
+        msrs->pkrs = rdpkrs_and_cache();
 }
 
 static void vmx_restore_guest_msrs(struct vcpu *v)
 {
+    const struct cpuid_policy *cp = v->domain->arch.cpuid;
     const struct vcpu_msrs *msrs = v->arch.msrs;
 
     write_gs_shadow(v->arch.hvm.vmx.shadow_gs);
@@ -705,6 +711,9 @@ static void vmx_restore_guest_msrs(struct vcpu *v)
         wrmsrl(MSR_RTIT_OUTPUT_MASK, msrs->rtit.output_mask);
         wrmsrl(MSR_RTIT_STATUS, msrs->rtit.status);
     }
+
+    if ( cp->feat.pks )
+        wrpkrs(msrs->pkrs);
 }
 
 void vmx_update_cpu_exec_control(struct vcpu *v)
diff --git a/xen/arch/x86/include/asm/msr.h b/xen/arch/x86/include/asm/msr.h
index 191e540688..7946b6b24c 100644
--- a/xen/arch/x86/include/asm/msr.h
+++ b/xen/arch/x86/include/asm/msr.h
@@ -373,6 +373,15 @@ struct vcpu_msrs
         };
     } rtit;
 
+    /*
+     * 0x000006e1 - MSR_PKRS - Protection Key Supervisor.
+     *
+     * Exposed R/W to guests.  Xen doesn't use PKS yet, so only context
+     * switched per vcpu.  When in current context, live value is in hardware,
+     * and this value is stale.
+     */
+    uint32_t pkrs;
+
     /* 0x00000da0 - MSR_IA32_XSS */
     struct {
         uint64_t raw;
diff --git a/xen/arch/x86/include/asm/prot-key.h b/xen/arch/x86/include/asm/prot-key.h
index 63a2e22f3f..0dcd31b7ea 100644
--- a/xen/arch/x86/include/asm/prot-key.h
+++ b/xen/arch/x86/include/asm/prot-key.h
@@ -5,8 +5,11 @@
 #ifndef ASM_PROT_KEY_H
 #define ASM_PROT_KEY_H
 
+#include <xen/percpu.h>
 #include <xen/types.h>
 
+#include <asm/msr.h>
+
 #define PKEY_AD 1 /* Access Disable */
 #define PKEY_WD 2 /* Write Disable */
 
@@ -28,4 +31,55 @@ static inline void wrpkru(uint32_t pkru)
                    :: "a" (pkru), "d" (0), "c" (0) );
 }
 
+/*
+ * Xen does not use PKS.
+ *
+ * Guest kernel use is expected to be one default key, except for tiny windows
+ * with a double write to switch to a non-default key in a permitted critical
+ * section.
+ *
+ * As such, we want MSR_PKRS un-intercepted.  Furthermore, as we only need it
+ * in Xen for emulation or migration purposes (i.e. possibly never in a
+ * domain's lifetime), we don't want to re-sync the hardware value on every
+ * vmexit.
+ *
+ * Therefore, we read and cache the guest value in ctxt_switch_from(), in the
+ * expectation that we can short-circuit the write in ctxt_switch_to().
+ * During regular operations in current context, the guest value is in
+ * hardware and the per-cpu cache is stale.
+ */
+DECLARE_PER_CPU(uint32_t, pkrs);
+
+static inline uint32_t rdpkrs(void)
+{
+    uint32_t pkrs, tmp;
+
+    rdmsr(MSR_PKRS, pkrs, tmp);
+
+    return pkrs;
+}
+
+static inline uint32_t rdpkrs_and_cache(void)
+{
+    return this_cpu(pkrs) = rdpkrs();
+}
+
+static inline void wrpkrs(uint32_t pkrs)
+{
+    uint32_t *this_pkrs = &this_cpu(pkrs);
+
+    if ( *this_pkrs != pkrs )
+    {
+        *this_pkrs = pkrs;
+
+        wrmsr_ns(MSR_PKRS, pkrs, 0);
+    }
+}
+
+static inline void wrpkrs_and_cache(uint32_t pkrs)
+{
+    this_cpu(pkrs) = pkrs;
+    wrmsr_ns(MSR_PKRS, pkrs, 0);
+}
+
 #endif /* ASM_PROT_KEY_H */
diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c
index 6deadcf747..567a0a42ac 100644
--- a/xen/arch/x86/setup.c
+++ b/xen/arch/x86/setup.c
@@ -54,6 +54,7 @@
 #include <asm/spec_ctrl.h>
 #include <asm/guest.h>
 #include <asm/microcode.h>
+#include <asm/prot-key.h>
 #include <asm/pv/domain.h>
 
 /* opt_nosmp: If true, secondary processors are ignored. */
@@ -1804,6 +1805,9 @@ void __init noreturn __start_xen(unsigned long mbi_p)
     if ( opt_invpcid && cpu_has_invpcid )
         use_invpcid = true;
 
+    if ( cpu_has_pks )
+        wrpkrs_and_cache(0); /* Must be before setting CR4.PKS */
+
     init_speculation_mitigations();
 
     init_idle_domain();
diff --git a/xen/arch/x86/smpboot.c b/xen/arch/x86/smpboot.c
index 52beed9d8d..b26758c2c8 100644
--- a/xen/arch/x86/smpboot.c
+++ b/xen/arch/x86/smpboot.c
@@ -42,6 +42,7 @@
 #include <asm/microcode.h>
 #include <asm/msr.h>
 #include <asm/mtrr.h>
+#include <asm/prot-key.h>
 #include <asm/setup.h>
 #include <asm/spec_ctrl.h>
 #include <asm/time.h>
@@ -364,6 +365,9 @@ void start_secondary(void *unused)
 
     /* Full exception support from here on in. */
 
+    if ( cpu_has_pks )
+        wrpkrs_and_cache(0); /* Must be before setting CR4.PKS */
+
     /* Safe to enable feature such as CR4.MCE with the IDT set up now. */
     write_cr4(mmu_cr4_features);
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sun Feb 05 04:18:07 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 05 Feb 2023 04:18:07 +0000
Received: from list by lists.xenproject.org with outflank-mailman.489730.758195 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pOWTf-00022N-CC; Sun, 05 Feb 2023 04:18:07 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 489730.758195; Sun, 05 Feb 2023 04:18: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 1pOWTf-00022G-9W; Sun, 05 Feb 2023 04:18:07 +0000
Received: by outflank-mailman (input) for mailman id 489730;
 Sun, 05 Feb 2023 04:18:06 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pOWTe-000226-QA
 for xen-changelog@lists.xenproject.org; Sun, 05 Feb 2023 04:18:06 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pOWTe-0001E8-PP
 for xen-changelog@lists.xenproject.org; Sun, 05 Feb 2023 04:18:06 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pOWTe-0000B4-Og
 for xen-changelog@lists.xenproject.org; Sun, 05 Feb 2023 04:18:06 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=vIFuM9XQJ9LGmqiJHgZ1uf43eChqb9ogFLqq400O148=; b=Jgj9UJ8OIm4LBzR5mCxsdaNglJ
	CWFhu/yKZdyHq9N+zV3UzvYFoB9wDTi+K+ZbctlHPwWYa5TkeZH+/8AUpVqADuNElYTvQvIJWuqSF
	AQ5mep1efGprK3udKEo15eD0R/d+gPs3ci3Xszb9g9cAXZXEsUYlRXG0FHVucqHB2qpI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/hvm: Enable guest access to MSR_PKRS
Message-Id: <E1pOWTe-0000B4-Og@xenbits.xenproject.org>
Date: Sun, 05 Feb 2023 04:18:06 +0000

commit 59bbbb823d3d8aeff5615f7c9e2c2bd8a18b4ad5
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Tue Dec 14 16:51:28 2021 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Jan 20 19:39:33 2023 +0000

    x86/hvm: Enable guest access to MSR_PKRS
    
    Have guest_{rd,wr}msr(), via hvm_{get,set}_reg(), access either the live
    register, or stashed state, depending on context.  Include MSR_PKRS for
    migration, and let the guest have full access.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/hvm/hvm.c     |  2 ++
 xen/arch/x86/hvm/vmx/vmx.c | 17 +++++++++++++++++
 xen/arch/x86/msr.c         | 10 ++++++++++
 3 files changed, 29 insertions(+)

diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c
index 927a221660..86cab7aa26 100644
--- a/xen/arch/x86/hvm/hvm.c
+++ b/xen/arch/x86/hvm/hvm.c
@@ -1333,6 +1333,7 @@ static int cf_check hvm_load_cpu_xsave_states(
 static const uint32_t msrs_to_send[] = {
     MSR_SPEC_CTRL,
     MSR_INTEL_MISC_FEATURES_ENABLES,
+    MSR_PKRS,
     MSR_IA32_BNDCFGS,
     MSR_IA32_XSS,
     MSR_VIRT_SPEC_CTRL,
@@ -1486,6 +1487,7 @@ static int cf_check hvm_load_cpu_msrs(struct domain *d, hvm_domain_context_t *h)
 
         case MSR_SPEC_CTRL:
         case MSR_INTEL_MISC_FEATURES_ENABLES:
+        case MSR_PKRS:
         case MSR_IA32_BNDCFGS:
         case MSR_IA32_XSS:
         case MSR_VIRT_SPEC_CTRL:
diff --git a/xen/arch/x86/hvm/vmx/vmx.c b/xen/arch/x86/hvm/vmx/vmx.c
index d8525d3d3d..ade2a25ce7 100644
--- a/xen/arch/x86/hvm/vmx/vmx.c
+++ b/xen/arch/x86/hvm/vmx/vmx.c
@@ -793,6 +793,11 @@ static void cf_check vmx_cpuid_policy_changed(struct vcpu *v)
     else
         vmx_set_msr_intercept(v, MSR_FLUSH_CMD, VMX_MSR_RW);
 
+    if ( cp->feat.pks )
+        vmx_clear_msr_intercept(v, MSR_PKRS, VMX_MSR_RW);
+    else
+        vmx_set_msr_intercept(v, MSR_PKRS, VMX_MSR_RW);
+
  out:
     vmx_vmcs_exit(v);
 
@@ -2582,6 +2587,7 @@ static uint64_t cf_check vmx_get_reg(struct vcpu *v, unsigned int reg)
 {
     const struct vcpu *curr = current;
     struct domain *d = v->domain;
+    const struct vcpu_msrs *msrs = v->arch.msrs;
     uint64_t val = 0;
     int rc;
 
@@ -2598,6 +2604,9 @@ static uint64_t cf_check vmx_get_reg(struct vcpu *v, unsigned int reg)
         }
         return val;
 
+    case MSR_PKRS:
+        return (v == curr) ? rdpkrs() : msrs->pkrs;
+
     case MSR_SHADOW_GS_BASE:
         if ( v != curr )
             return v->arch.hvm.vmx.shadow_gs;
@@ -2626,6 +2635,8 @@ static uint64_t cf_check vmx_get_reg(struct vcpu *v, unsigned int reg)
 
 static void cf_check vmx_set_reg(struct vcpu *v, unsigned int reg, uint64_t val)
 {
+    const struct vcpu *curr = current;
+    struct vcpu_msrs *msrs = v->arch.msrs;
     struct domain *d = v->domain;
     int rc;
 
@@ -2641,6 +2652,12 @@ static void cf_check vmx_set_reg(struct vcpu *v, unsigned int reg, uint64_t val)
             domain_crash(d);
         }
         return;
+
+    case MSR_PKRS:
+        msrs->pkrs = val;
+        if ( v == curr )
+            wrpkrs(val);
+        return;
     }
 
     /* Logic which maybe requires remote VMCS acquisition. */
diff --git a/xen/arch/x86/msr.c b/xen/arch/x86/msr.c
index 317b154d24..7ddf0078c3 100644
--- a/xen/arch/x86/msr.c
+++ b/xen/arch/x86/msr.c
@@ -325,6 +325,11 @@ int guest_rdmsr(struct vcpu *v, uint32_t msr, uint64_t *val)
         *val = 0;
         break;
 
+    case MSR_PKRS:
+        if ( !cp->feat.pks )
+            goto gp_fault;
+        goto get_reg;
+
     case MSR_X2APIC_FIRST ... MSR_X2APIC_LAST:
         if ( !is_hvm_domain(d) || v != curr )
             goto gp_fault;
@@ -616,6 +621,11 @@ int guest_wrmsr(struct vcpu *v, uint32_t msr, uint64_t val)
             break;
         goto gp_fault;
 
+    case MSR_PKRS:
+        if ( !cp->feat.pks || val != (uint32_t)val )
+            goto gp_fault;
+        goto set_reg;
+
     case MSR_X2APIC_FIRST ... MSR_X2APIC_LAST:
         if ( !is_hvm_domain(d) || v != curr )
             goto gp_fault;
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sun Feb 05 04:18:17 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 05 Feb 2023 04:18:17 +0000
Received: from list by lists.xenproject.org with outflank-mailman.489731.758200 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pOWTp-00025A-Dx; Sun, 05 Feb 2023 04:18:17 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 489731.758200; Sun, 05 Feb 2023 04:18:17 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pOWTp-000252-B9; Sun, 05 Feb 2023 04:18:17 +0000
Received: by outflank-mailman (input) for mailman id 489731;
 Sun, 05 Feb 2023 04:18:16 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pOWTo-00024v-T1
 for xen-changelog@lists.xenproject.org; Sun, 05 Feb 2023 04:18:16 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pOWTo-0001EM-SL
 for xen-changelog@lists.xenproject.org; Sun, 05 Feb 2023 04:18:16 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pOWTo-0000Bb-Rk
 for xen-changelog@lists.xenproject.org; Sun, 05 Feb 2023 04:18:16 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=85rhUpvLDvjpOOMnfDswZ3v0b94gB3NE70Mvz6MKFI0=; b=JGQbVllAbxmFkcP4BZFGXBou6/
	57vgL2iwU0Es1hZzGyy2Ed/2+cG9YULnWQIHeh4fu2RxTXWRqQbIJxFY0Jzl5ktfzy3ZweCTCd3p6
	bRRENACBMr8KlCsbai4cnHBqJy1lSeNsYp8Mwu432dVirfjA9q9YEBLQYhaZvh+HAWN0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/pagewalk: Support PKS
Message-Id: <E1pOWTo-0000Bb-Rk@xenbits.xenproject.org>
Date: Sun, 05 Feb 2023 04:18:16 +0000

commit e96f634b3dbbf98eaa261bcb8b33743a03afc20e
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Tue Dec 14 16:51:28 2021 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Jan 20 19:39:34 2023 +0000

    x86/pagewalk: Support PKS
    
    PKS is very similar to the existing PKU behaviour, operating on pagewalks for
    any supervisor mapping.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/include/asm/guest_pt.h | 5 +++++
 xen/arch/x86/include/asm/hvm/hvm.h  | 3 +++
 xen/arch/x86/mm/guest_walk.c        | 9 +++++----
 3 files changed, 13 insertions(+), 4 deletions(-)

diff --git a/xen/arch/x86/include/asm/guest_pt.h b/xen/arch/x86/include/asm/guest_pt.h
index 6647ccfb85..6802db2a41 100644
--- a/xen/arch/x86/include/asm/guest_pt.h
+++ b/xen/arch/x86/include/asm/guest_pt.h
@@ -282,6 +282,11 @@ static always_inline bool guest_pku_enabled(const struct vcpu *v)
     return !is_pv_vcpu(v) && hvm_pku_enabled(v);
 }
 
+static always_inline bool guest_pks_enabled(const struct vcpu *v)
+{
+    return !is_pv_vcpu(v) && hvm_pks_enabled(v);
+}
+
 /* Helpers for identifying whether guest entries have reserved bits set. */
 
 /* Bits reserved because of maxphysaddr, and (lack of) EFER.NX */
diff --git a/xen/arch/x86/include/asm/hvm/hvm.h b/xen/arch/x86/include/asm/hvm/hvm.h
index 93254651f2..65768c797e 100644
--- a/xen/arch/x86/include/asm/hvm/hvm.h
+++ b/xen/arch/x86/include/asm/hvm/hvm.h
@@ -407,6 +407,8 @@ int hvm_get_param(struct domain *d, uint32_t index, uint64_t *value);
     ((v)->arch.hvm.guest_efer & EFER_NXE)
 #define hvm_pku_enabled(v) \
     (hvm_paging_enabled(v) && ((v)->arch.hvm.guest_cr[4] & X86_CR4_PKE))
+#define hvm_pks_enabled(v) \
+    (hvm_paging_enabled(v) && ((v)->arch.hvm.guest_cr[4] & X86_CR4_PKS))
 
 /* Can we use superpages in the HAP p2m table? */
 #define hap_has_1gb (!!(hvm_funcs.hap_capabilities & HVM_HAP_SUPERPAGE_1GB))
@@ -911,6 +913,7 @@ static inline void hvm_set_reg(struct vcpu *v, unsigned int reg, uint64_t val)
 #define hvm_smap_enabled(v) ((void)(v), false)
 #define hvm_nx_enabled(v) ((void)(v), false)
 #define hvm_pku_enabled(v) ((void)(v), false)
+#define hvm_pks_enabled(v) ((void)(v), false)
 
 #define arch_vcpu_block(v) ((void)(v))
 
diff --git a/xen/arch/x86/mm/guest_walk.c b/xen/arch/x86/mm/guest_walk.c
index 161a61b8f5..76b4e04258 100644
--- a/xen/arch/x86/mm/guest_walk.c
+++ b/xen/arch/x86/mm/guest_walk.c
@@ -406,16 +406,17 @@ guest_walk_tables(const struct vcpu *v, struct p2m_domain *p2m,
 #if GUEST_PAGING_LEVELS >= 4 /* 64-bit only... */
     /*
      * If all access checks are thus far ok, check Protection Key for 64bit
-     * data accesses to user mappings.
+     * data accesses.
      *
      * N.B. In the case that the walk ended with a superpage, the fabricated
      * gw->l1e contains the appropriate leaf pkey.
      */
-    if ( (ar & _PAGE_USER) && !(walk & PFEC_insn_fetch) &&
-         guest_pku_enabled(v) )
+    if ( !(walk & PFEC_insn_fetch) &&
+         ((ar & _PAGE_USER) ? guest_pku_enabled(v)
+                            : guest_pks_enabled(v)) )
     {
         unsigned int pkey = guest_l1e_get_pkey(gw->l1e);
-        unsigned int pkr = rdpkru();
+        unsigned int pkr = (ar & _PAGE_USER) ? rdpkru() : rdpkrs();
         unsigned int pk_ar = (pkr >> (pkey * PKEY_WIDTH)) & (PKEY_AD | PKEY_WD);
 
         if ( (pk_ar & PKEY_AD) ||
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sun Feb 05 04:18:28 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 05 Feb 2023 04:18:28 +0000
Received: from list by lists.xenproject.org with outflank-mailman.489732.758203 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pOWU0-00029a-FK; Sun, 05 Feb 2023 04:18:28 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 489732.758203; Sun, 05 Feb 2023 04:18: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 1pOWU0-00029S-Cd; Sun, 05 Feb 2023 04:18:28 +0000
Received: by outflank-mailman (input) for mailman id 489732;
 Sun, 05 Feb 2023 04:18: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 1pOWTz-00029H-01
 for xen-changelog@lists.xenproject.org; Sun, 05 Feb 2023 04:18:27 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pOWTy-0001ES-Va
 for xen-changelog@lists.xenproject.org; Sun, 05 Feb 2023 04:18:26 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pOWTy-0000C9-Ut
 for xen-changelog@lists.xenproject.org; Sun, 05 Feb 2023 04:18:26 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=dERMXDX2eBFpUjC+0ITsnEYmnkqJ5zbtLmbbR3Rg950=; b=mcXeKhaSEKOB3E9Vq9RJAIganr
	Q+D6ePpyzL7QdZD9klrdUjT4/3UiY7czQxusMKqMJM7w/qaANOELP8+i5cwCSsinqP7u610QxzTEK
	GSM7mMf2HZfkUN57JA9lpzaWFLINk9KQiYQ5QokqMpMyJJbfMJYxT15Pbi8UcLV2KjUU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/hvm: Support PKS for HAP guests
Message-Id: <E1pOWTy-0000C9-Ut@xenbits.xenproject.org>
Date: Sun, 05 Feb 2023 04:18:26 +0000

commit 1d60c20260c7e82fe5344d06c20d718e0cc03b8b
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Tue Dec 14 16:51:28 2021 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Jan 20 19:39:34 2023 +0000

    x86/hvm: Support PKS for HAP guests
    
    With all infrastructure in place, advertise the PKS CPUID bit to HAP guests,
    and let them set CR4.PKS.
    
    Experiment with a tweak to the layout of hvm_cr4_guest_valid_bits() so future
    additions will be just a single added line.
    
    The current context switching behaviour is tied to how VT-x works, so leave a
    safety check in the short term.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/cpuid.c                        | 9 +++++++++
 xen/arch/x86/hvm/hvm.c                      | 4 +++-
 xen/include/public/arch-x86/cpufeatureset.h | 2 +-
 3 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/cpuid.c b/xen/arch/x86/cpuid.c
index acc2f606ce..b22725c492 100644
--- a/xen/arch/x86/cpuid.c
+++ b/xen/arch/x86/cpuid.c
@@ -579,6 +579,15 @@ static void __init calculate_hvm_max_policy(void)
             __clear_bit(X86_FEATURE_XSAVES, hvm_featureset);
     }
 
+    /*
+     * Xen doesn't use PKS, so the guest support for it has opted to not use
+     * the VMCS load/save controls for efficiency reasons.  This depends on
+     * the exact vmentry/exit behaviour, so don't expose PKS in other
+     * situations until someone has cross-checked the behaviour for safety.
+     */
+    if ( !cpu_has_vmx )
+        __clear_bit(X86_FEATURE_PKS, hvm_featureset);
+
     guest_common_feature_adjustments(hvm_featureset);
 
     sanitise_featureset(hvm_featureset);
diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c
index 86cab7aa26..5c1e641896 100644
--- a/xen/arch/x86/hvm/hvm.c
+++ b/xen/arch/x86/hvm/hvm.c
@@ -969,7 +969,9 @@ unsigned long hvm_cr4_guest_valid_bits(const struct domain *d)
             (p->feat.smep     ? X86_CR4_SMEP              : 0) |
             (p->feat.smap     ? X86_CR4_SMAP              : 0) |
             (p->feat.pku      ? X86_CR4_PKE               : 0) |
-            (cet              ? X86_CR4_CET               : 0));
+            (cet              ? X86_CR4_CET               : 0) |
+            (p->feat.pks      ? X86_CR4_PKS               : 0) |
+            0);
 }
 
 static int cf_check hvm_load_cpu_ctxt(struct domain *d, hvm_domain_context_t *h)
diff --git a/xen/include/public/arch-x86/cpufeatureset.h b/xen/include/public/arch-x86/cpufeatureset.h
index 5444bc5d83..3b85bcca15 100644
--- a/xen/include/public/arch-x86/cpufeatureset.h
+++ b/xen/include/public/arch-x86/cpufeatureset.h
@@ -227,7 +227,7 @@ XEN_CPUFEATURE(CLDEMOTE,      6*32+25) /*A  CLDEMOTE instruction */
 XEN_CPUFEATURE(MOVDIRI,       6*32+27) /*a  MOVDIRI instruction */
 XEN_CPUFEATURE(MOVDIR64B,     6*32+28) /*a  MOVDIR64B instruction */
 XEN_CPUFEATURE(ENQCMD,        6*32+29) /*   ENQCMD{,S} instructions */
-XEN_CPUFEATURE(PKS,           6*32+31) /*   Protection Key for Supervisor */
+XEN_CPUFEATURE(PKS,           6*32+31) /*H  Protection Key for Supervisor */
 
 /* AMD-defined CPU features, CPUID level 0x80000007.edx, word 7 */
 XEN_CPUFEATURE(HW_PSTATE,     7*32+ 7) /*   Hardware Pstates */
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sun Feb 05 04:18:38 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 05 Feb 2023 04:18:38 +0000
Received: from list by lists.xenproject.org with outflank-mailman.489733.758208 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pOWUA-0002CS-Gs; Sun, 05 Feb 2023 04:18:38 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 489733.758208; Sun, 05 Feb 2023 04:18: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 1pOWUA-0002CK-E9; Sun, 05 Feb 2023 04:18:38 +0000
Received: by outflank-mailman (input) for mailman id 489733;
 Sun, 05 Feb 2023 04:18: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 1pOWU9-0002By-2x
 for xen-changelog@lists.xenproject.org; Sun, 05 Feb 2023 04:18:37 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pOWU9-0001EW-2H
 for xen-changelog@lists.xenproject.org; Sun, 05 Feb 2023 04:18:37 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pOWU9-0000CY-1Y
 for xen-changelog@lists.xenproject.org; Sun, 05 Feb 2023 04:18: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=z+4Fr+qUeZfsBhi7DF4AGURui1kPNDrIv4zS/XFnTZY=; b=kfnlgHK9DAukmfWKsNbQbfdJaA
	kXrb/pNtRVuXXYZ/9ZC4Gtmdtm8cVmUw/3Tx/PO9jCv9YvS007Iu+JeFn2kngC1ctGNNuYoLVQn3h
	0p6YGWOQYrEFpf3j5zXBaN+KB3jszarMjwD1LoJshK6+r4mMQkS8GfV7tNkt4PXxwge4=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] build: fix building flask headers before descending in flask/ss/
Message-Id: <E1pOWU9-0000CY-1Y@xenbits.xenproject.org>
Date: Sun, 05 Feb 2023 04:18:37 +0000

commit d60324d8af9404014cfcc37bba09e9facfd02fcf
Author:     Anthony PERARD <anthony.perard@citrix.com>
AuthorDate: Mon Jan 23 15:03:58 2023 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Jan 23 15:03:58 2023 +0100

    build: fix building flask headers before descending in flask/ss/
    
    Unfortunatly, adding prerequisite to "$(obj)/ss/built_in.o" doesn't
    work because we have "$(obj)/%/built_in.o: $(obj)/% ;" in Rules.mk.
    So, make is allow to try to build objects in "xsm/flask/ss/" before
    generating the headers.
    
    Adding a prerequisite on "$(obj)/ss" instead will fix the issue as
    that's the target used to run make in this subdirectory.
    
    Unfortunatly, that target is also used when running `make clean`, so
    we want to ignore it in this case. $(MAKECMDGOALS) can't be used in
    this case as it is empty, but we can guess which operation is done by
    looking at the list of loaded makefiles.
    
    Fixes: 7a3bcd2babcc ("build: build everything from the root dir, use obj=$subdir")
    Reported-by: "Daniel P. Smith" <dpsmith@apertussolutions.com>
    Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
    Acked-by: Daniel P. Smith <dpsmith@apertussolutions.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/xsm/flask/Makefile | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/xen/xsm/flask/Makefile b/xen/xsm/flask/Makefile
index d25312f4fa..3fdcf7727e 100644
--- a/xen/xsm/flask/Makefile
+++ b/xen/xsm/flask/Makefile
@@ -16,7 +16,11 @@ FLASK_H_FILES := flask.h class_to_string.h initial_sid_to_string.h
 AV_H_FILES := av_perm_to_string.h av_permissions.h
 ALL_H_FILES := $(addprefix include/,$(FLASK_H_FILES) $(AV_H_FILES))
 
-$(addprefix $(obj)/,$(obj-y)) $(obj)/ss/built_in.o: $(addprefix $(obj)/,$(ALL_H_FILES))
+# Adding prerequisite to descending into ss/ folder only when not running
+# `make *clean`.
+ifeq ($(filter %/Makefile.clean,$(MAKEFILE_LIST)),)
+$(addprefix $(obj)/,$(obj-y)) $(obj)/ss: $(addprefix $(obj)/,$(ALL_H_FILES))
+endif
 extra-y += $(ALL_H_FILES)
 
 mkflask := $(srcdir)/policy/mkflask.sh
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sun Feb 05 04:18:48 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 05 Feb 2023 04:18:48 +0000
Received: from list by lists.xenproject.org with outflank-mailman.489734.758212 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pOWUK-0002FF-IG; Sun, 05 Feb 2023 04:18:48 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 489734.758212; Sun, 05 Feb 2023 04:18:48 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pOWUK-0002F8-Fg; Sun, 05 Feb 2023 04:18:48 +0000
Received: by outflank-mailman (input) for mailman id 489734;
 Sun, 05 Feb 2023 04:18:47 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pOWUJ-0002Ey-5p
 for xen-changelog@lists.xenproject.org; Sun, 05 Feb 2023 04:18:47 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pOWUJ-0001Ec-53
 for xen-changelog@lists.xenproject.org; Sun, 05 Feb 2023 04:18:47 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pOWUJ-0000Cz-4T
 for xen-changelog@lists.xenproject.org; Sun, 05 Feb 2023 04:18: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=IFy1y9AexRHg4x4krxXTg2lt9INZyZvGXlOgQ2LKY38=; b=0auo0ecxXWWZQV2Fh9MN1YrjEf
	PRHVZ0get6Hs8X/yteIC7KUwidqIUWnpXWpn72vaZwoG8/k3sXF4ccrTnMBMXn/EID1CVeTWNe7vi
	z6wfQMnm56nb5KofTVMT63X55xXp6H7GzJ2NmUF1XUa77J5MpJkE6eXLFyata0Dbci5A=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] ns16550: fix the use of simple_strtoul() for parsing u64
Message-Id: <E1pOWUJ-0000Cz-4T@xenbits.xenproject.org>
Date: Sun, 05 Feb 2023 04:18:47 +0000

commit aa7d3432caf02b6c8b60476fb54197c28f3b5e03
Author:     Ayan Kumar Halder <ayan.kumar.halder@amd.com>
AuthorDate: Tue Jan 24 16:53:13 2023 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jan 24 16:53:13 2023 +0100

    ns16550: fix the use of simple_strtoul() for parsing u64
    
    One should be using simple_strtoull() ( instead of simple_strtoul() )
    to assign value to 'u64' variable. The reason being u64 can be
    represented by 'unsigned long long' on all the platforms (ie Arm32,
    Arm64 and x86).
    
    Suggested-by: Jan Beulich <jbeulich@suse.com>
    Signed-off-by: Ayan Kumar Halder <ayan.kumar.halder@amd.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/drivers/char/ns16550.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/xen/drivers/char/ns16550.c b/xen/drivers/char/ns16550.c
index 01a05c9aa8..7e22e687fb 100644
--- a/xen/drivers/char/ns16550.c
+++ b/xen/drivers/char/ns16550.c
@@ -1532,7 +1532,7 @@ static bool __init parse_positional(struct ns16550 *uart, char **str)
         else
 #endif
         {
-            uart->io_base = simple_strtoul(conf, &conf, 0);
+            uart->io_base = simple_strtoull(conf, &conf, 0);
         }
     }
 
@@ -1603,7 +1603,7 @@ static bool __init parse_namevalue_pairs(char *str, struct ns16550 *uart)
                        "Can't use io_base with dev=pci or dev=amt options\n");
                 break;
             }
-            uart->io_base = simple_strtoul(param_value, NULL, 0);
+            uart->io_base = simple_strtoull(param_value, NULL, 0);
             break;
 
         case irq:
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sun Feb 05 04:18:58 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 05 Feb 2023 04:18:58 +0000
Received: from list by lists.xenproject.org with outflank-mailman.489735.758216 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pOWUU-0002Hs-Jg; Sun, 05 Feb 2023 04:18:58 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 489735.758216; Sun, 05 Feb 2023 04:18: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 1pOWUU-0002Hk-H8; Sun, 05 Feb 2023 04:18:58 +0000
Received: by outflank-mailman (input) for mailman id 489735;
 Sun, 05 Feb 2023 04:18:57 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pOWUT-0002HV-8i
 for xen-changelog@lists.xenproject.org; Sun, 05 Feb 2023 04:18:57 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pOWUT-0001F9-7s
 for xen-changelog@lists.xenproject.org; Sun, 05 Feb 2023 04:18:57 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pOWUT-0000DT-7H
 for xen-changelog@lists.xenproject.org; Sun, 05 Feb 2023 04:18:57 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=YyINUQ0bX4FVDGVLm99bZctmOTg98guJofi9nk8ImBM=; b=2ro/2uXFPeVtCihs+PEel+BKdH
	Hu902UtwoUtKT5HMxHTrn2SeFeJq9VdiQX21q85tcdkh7OIUXn2zXIE0ToY2OQPZBxneTrtWIPPP1
	4a7+gHFI/R45ultXbDSzDmAY0dZ8DxmmigeFuUFPkEDKzccTZf4Ha4WRjyVcxja7zFOc=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] ns16550: fix an incorrect assignment to uart->io_size
Message-Id: <E1pOWUT-0000DT-7H@xenbits.xenproject.org>
Date: Sun, 05 Feb 2023 04:18:57 +0000

commit 352c89f72ddb67b8d9d4e492203f8c77f85c8df1
Author:     Ayan Kumar Halder <ayan.kumar.halder@amd.com>
AuthorDate: Tue Jan 24 16:54:38 2023 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Jan 24 16:54:38 2023 +0100

    ns16550: fix an incorrect assignment to uart->io_size
    
    uart->io_size represents the size in bytes. Thus, when serial_port.bit_width
    is assigned to it, it should be converted to size in bytes.
    
    Fixes: 17b516196c ("ns16550: add ACPI support for ARM only")
    Reported-by: Jan Beulich <jbeulich@suse.com>
    Signed-off-by: Ayan Kumar Halder <ayan.kumar.halder@amd.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
---
 xen/drivers/char/ns16550.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/drivers/char/ns16550.c b/xen/drivers/char/ns16550.c
index 7e22e687fb..4ce74b3cd3 100644
--- a/xen/drivers/char/ns16550.c
+++ b/xen/drivers/char/ns16550.c
@@ -1875,7 +1875,7 @@ static int __init ns16550_acpi_uart_init(const void *data)
     uart->parity = spcr->parity;
     uart->stop_bits = spcr->stop_bits;
     uart->io_base = spcr->serial_port.address;
-    uart->io_size = spcr->serial_port.bit_width;
+    uart->io_size = DIV_ROUND_UP(spcr->serial_port.bit_width, BITS_PER_BYTE);
     uart->reg_shift = spcr->serial_port.bit_offset;
     uart->reg_width = spcr->serial_port.access_width;
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sun Feb 05 04:19:08 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 05 Feb 2023 04:19:08 +0000
Received: from list by lists.xenproject.org with outflank-mailman.489736.758221 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pOWUe-0002Kr-Lq; Sun, 05 Feb 2023 04:19:08 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 489736.758221; Sun, 05 Feb 2023 04:19: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 1pOWUe-0002Kj-Ia; Sun, 05 Feb 2023 04:19:08 +0000
Received: by outflank-mailman (input) for mailman id 489736;
 Sun, 05 Feb 2023 04:19: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 1pOWUd-0002KX-BV
 for xen-changelog@lists.xenproject.org; Sun, 05 Feb 2023 04:19:07 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pOWUd-0001FX-Ak
 for xen-changelog@lists.xenproject.org; Sun, 05 Feb 2023 04:19:07 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pOWUd-0000EN-A4
 for xen-changelog@lists.xenproject.org; Sun, 05 Feb 2023 04:19: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=AocxNpjYqkyM/CJmRTmvaHVsWlHJScRWKQLO/HP/5es=; b=t+dnzvfFh753jA6d2FfyQKS3Yn
	F7Pq+eK9d+egu5hdka0gBQs1qSMCkg1quBXlO6AJH13sxyaL+NfWx+qlqaUvHxks6h7jox4DjBDZi
	U8GwBMoJ6QIG+uNWU8M7MtiE7Qk11cEd+VS+0M0v2OWWVRZcD901UbBjQwj8bkKRchPU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/arm64: flushtlb: Reduce scope of barrier for local TLB flush
Message-Id: <E1pOWUd-0000EN-A4@xenbits.xenproject.org>
Date: Sun, 05 Feb 2023 04:19:07 +0000

commit 7c438851475482bf73fcf451551d1cb718d4904c
Author:     Julien Grall <jgrall@amazon.com>
AuthorDate: Tue Jan 24 19:25:19 2023 +0000
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Tue Jan 24 19:34:44 2023 +0000

    xen/arm64: flushtlb: Reduce scope of barrier for local TLB flush
    
    Per D5-4929 in ARM DDI 0487H.a:
    "A DSB NSH is sufficient to ensure completion of TLB maintenance
     instructions that apply to a single PE. A DSB ISH is sufficient to
     ensure completion of TLB maintenance instructions that apply to PEs
     in the same Inner Shareable domain.
    "
    
    This means barrier after local TLB flushes could be reduced to
    non-shareable.
    
    Note that the scope of the barrier in the workaround has not been
    changed because Linux v6.1-rc8 is also using 'ish' and I couldn't
    find anything in the Neoverse N1 suggesting that a 'nsh' would
    be sufficient.
    
    Signed-off-by: Julien Grall <jgrall@amazon.com>
    Reviewed-by: Michal Orzel <michal.orzel@amd.com>
    Tested-by: Henry Wang <Henry.Wang@arm.com>
---
 xen/arch/arm/include/asm/arm64/flushtlb.h | 26 ++++++++++++++++----------
 1 file changed, 16 insertions(+), 10 deletions(-)

diff --git a/xen/arch/arm/include/asm/arm64/flushtlb.h b/xen/arch/arm/include/asm/arm64/flushtlb.h
index 7c54315187..001ae4d1c3 100644
--- a/xen/arch/arm/include/asm/arm64/flushtlb.h
+++ b/xen/arch/arm/include/asm/arm64/flushtlb.h
@@ -12,8 +12,9 @@
  * ARM64_WORKAROUND_REPEAT_TLBI:
  * Modification of the translation table for a virtual address might lead to
  * read-after-read ordering violation.
- * The workaround repeats TLBI+DSB operation for all the TLB flush operations.
- * While this is stricly not necessary, we don't want to take any risk.
+ * The workaround repeats TLBI+DSB ISH operation for all the TLB flush
+ * operations. While this is strictly not necessary, we don't want to
+ * take any risk.
  *
  * For Xen page-tables the ISB will discard any instructions fetched
  * from the old mappings.
@@ -21,12 +22,17 @@
  * For the Stage-2 page-tables the ISB ensures the completion of the DSB
  * (and therefore the TLB invalidation) before continuing. So we know
  * the TLBs cannot contain an entry for a mapping we may have removed.
+ *
+ * Note that for local TLB flush, using non-shareable (nsh) is sufficient
+ * (see D5-4929 in ARM DDI 0487H.a). Although, the memory barrier in
+ * for the workaround is left as inner-shareable to match with Linux
+ * v6.1-rc8.
  */
-#define TLB_HELPER(name, tlbop)                  \
+#define TLB_HELPER(name, tlbop, sh)              \
 static inline void name(void)                    \
 {                                                \
     asm volatile(                                \
-        "dsb  ishst;"                            \
+        "dsb  "  # sh  "st;"                     \
         "tlbi "  # tlbop  ";"                    \
         ALTERNATIVE(                             \
             "nop; nop;",                         \
@@ -34,25 +40,25 @@ static inline void name(void)                    \
             "tlbi "  # tlbop  ";",               \
             ARM64_WORKAROUND_REPEAT_TLBI,        \
             CONFIG_ARM64_WORKAROUND_REPEAT_TLBI) \
-        "dsb  ish;"                              \
+        "dsb  "  # sh  ";"                       \
         "isb;"                                   \
         : : : "memory");                         \
 }
 
 /* Flush local TLBs, current VMID only. */
-TLB_HELPER(flush_guest_tlb_local, vmalls12e1);
+TLB_HELPER(flush_guest_tlb_local, vmalls12e1, nsh);
 
 /* Flush innershareable TLBs, current VMID only */
-TLB_HELPER(flush_guest_tlb, vmalls12e1is);
+TLB_HELPER(flush_guest_tlb, vmalls12e1is, ish);
 
 /* Flush local TLBs, all VMIDs, non-hypervisor mode */
-TLB_HELPER(flush_all_guests_tlb_local, alle1);
+TLB_HELPER(flush_all_guests_tlb_local, alle1, nsh);
 
 /* Flush innershareable TLBs, all VMIDs, non-hypervisor mode */
-TLB_HELPER(flush_all_guests_tlb, alle1is);
+TLB_HELPER(flush_all_guests_tlb, alle1is, ish);
 
 /* Flush all hypervisor mappings from the TLB of the local processor. */
-TLB_HELPER(flush_xen_tlb_local, alle2);
+TLB_HELPER(flush_xen_tlb_local, alle2, nsh);
 
 /* Flush TLB of local processor for address va. */
 static inline void  __flush_xen_tlb_one_local(vaddr_t va)
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sun Feb 05 04:19:19 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 05 Feb 2023 04:19:19 +0000
Received: from list by lists.xenproject.org with outflank-mailman.489737.758224 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pOWUo-0002O6-PW; Sun, 05 Feb 2023 04:19:18 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 489737.758224; Sun, 05 Feb 2023 04:19: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 1pOWUo-0002Nx-Mu; Sun, 05 Feb 2023 04:19:18 +0000
Received: by outflank-mailman (input) for mailman id 489737;
 Sun, 05 Feb 2023 04:19: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 1pOWUn-0002Nn-FI
 for xen-changelog@lists.xenproject.org; Sun, 05 Feb 2023 04:19:17 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pOWUn-0001Fq-DO
 for xen-changelog@lists.xenproject.org; Sun, 05 Feb 2023 04:19:17 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pOWUn-0000Er-Cs
 for xen-changelog@lists.xenproject.org; Sun, 05 Feb 2023 04:19: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=wGZO/QQ6AqSg52vG3YtMBa+wWtJQr9NDTAWuAUW4JVU=; b=EJRzKgi4jy/Mg8EDjW6Ifxx+nv
	GuseNXVybA2FIHUE8OJ1ukTwG0ypyAMPkdbg0oJG3ZpXivUGPhzRN8oBz2zPcqLGK01nTPf/r/PKX
	vWJpZ+le0JYsU/iT2uJGvDyG2UI+3abhsE6lV/5A4n4RiNjrazaKoUQrb59Viq95vK2M=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/arm64: flushtlb: Implement the TLBI repeat workaround for TLB flush by VA
Message-Id: <E1pOWUn-0000Er-Cs@xenbits.xenproject.org>
Date: Sun, 05 Feb 2023 04:19:17 +0000

commit cbfaf6ccd2cb5d1b2bc6efe5c6f4ba5cccce5689
Author:     Julien Grall <jgrall@amazon.com>
AuthorDate: Tue Jan 24 19:25:50 2023 +0000
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Tue Jan 24 19:34:44 2023 +0000

    xen/arm64: flushtlb: Implement the TLBI repeat workaround for TLB flush by VA
    
    Looking at the Neoverse N1 errata document, it is not clear to me
    why the TLBI repeat workaround is not applied for TLB flush by VA.
    
    The TLB flush by VA helpers are used in flush_xen_tlb_range_va_local()
    and flush_xen_tlb_range_va(). So if the range size is a fixed size smaller
    than a PAGE_SIZE, it would be possible that the compiler remove the loop
    and therefore replicate the sequence described in the erratum 1286807.
    
    So the TLBI repeat workaround should also be applied for the TLB flush
    by VA helpers.
    
    Fixes: 22e323d115d8 ("xen/arm: Add workaround for Cortex-A76/Neoverse-N1 erratum #1286807")
    Signed-off-by: Julien Grall <jgrall@amazon.com>
    Reviewed-by: Michal Orzel <michal.orzel@amd.com>
    Tested-by: Henry Wang <Henry.Wang@arm.com>
---
 xen/arch/arm/include/asm/arm64/flushtlb.h | 31 +++++++++++++++++++++++--------
 1 file changed, 23 insertions(+), 8 deletions(-)

diff --git a/xen/arch/arm/include/asm/arm64/flushtlb.h b/xen/arch/arm/include/asm/arm64/flushtlb.h
index 001ae4d1c3..3a9092b814 100644
--- a/xen/arch/arm/include/asm/arm64/flushtlb.h
+++ b/xen/arch/arm/include/asm/arm64/flushtlb.h
@@ -45,6 +45,27 @@ static inline void name(void)                    \
         : : : "memory");                         \
 }
 
+/*
+ * FLush TLB by VA. This will likely be used in a loop, so the caller
+ * is responsible to use the appropriate memory barriers before/after
+ * the sequence.
+ *
+ * See above about the ARM64_WORKAROUND_REPEAT_TLBI sequence.
+ */
+#define TLB_HELPER_VA(name, tlbop)               \
+static inline void name(vaddr_t va)              \
+{                                                \
+    asm volatile(                                \
+        "tlbi "  # tlbop  ", %0;"                \
+        ALTERNATIVE(                             \
+            "nop; nop;",                         \
+            "dsb  ish;"                          \
+            "tlbi "  # tlbop  ", %0;",           \
+            ARM64_WORKAROUND_REPEAT_TLBI,        \
+            CONFIG_ARM64_WORKAROUND_REPEAT_TLBI) \
+        : : "r" (va >> PAGE_SHIFT) : "memory");  \
+}
+
 /* Flush local TLBs, current VMID only. */
 TLB_HELPER(flush_guest_tlb_local, vmalls12e1, nsh);
 
@@ -61,16 +82,10 @@ TLB_HELPER(flush_all_guests_tlb, alle1is, ish);
 TLB_HELPER(flush_xen_tlb_local, alle2, nsh);
 
 /* Flush TLB of local processor for address va. */
-static inline void  __flush_xen_tlb_one_local(vaddr_t va)
-{
-    asm volatile("tlbi vae2, %0;" : : "r" (va>>PAGE_SHIFT) : "memory");
-}
+TLB_HELPER_VA(__flush_xen_tlb_one_local, vae2);
 
 /* Flush TLB of all processors in the inner-shareable domain for address va. */
-static inline void __flush_xen_tlb_one(vaddr_t va)
-{
-    asm volatile("tlbi vae2is, %0;" : : "r" (va>>PAGE_SHIFT) : "memory");
-}
+TLB_HELPER_VA(__flush_xen_tlb_one, vae2is);
 
 #endif /* __ASM_ARM_ARM64_FLUSHTLB_H__ */
 /*
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sun Feb 05 04:19:28 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 05 Feb 2023 04:19:28 +0000
Received: from list by lists.xenproject.org with outflank-mailman.489738.758227 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pOWUy-0002Qp-R2; Sun, 05 Feb 2023 04:19:28 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 489738.758227; Sun, 05 Feb 2023 04:19: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 1pOWUy-0002Qi-OT; Sun, 05 Feb 2023 04:19:28 +0000
Received: by outflank-mailman (input) for mailman id 489738;
 Sun, 05 Feb 2023 04:19: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 1pOWUx-0002QV-Gl
 for xen-changelog@lists.xenproject.org; Sun, 05 Feb 2023 04:19:27 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pOWUx-0001G2-G4
 for xen-changelog@lists.xenproject.org; Sun, 05 Feb 2023 04:19:27 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pOWUx-0000FR-FX
 for xen-changelog@lists.xenproject.org; Sun, 05 Feb 2023 04:19: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=lLqFK8qfrqoStgwRcCAu9hnWffCY/hPJWtqhxe/WYbQ=; b=K13UFEK4ZWe6u0VsiNAE8LfWqV
	BT8grJHEX7x231DVF5wgsWTFMXH4MH2FvD5hZ+dYkizIqdsgn86lYIJpxbqx37rO8JgxNsZDNRa7f
	N5yKyTooT3NGjRsNqRWGHIP07c1kqkPFeUnkG4A6DdxYXIM1q55F3CKi1WQ2iOJMeiE8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/arm32: flushtlb: Reduce scope of barrier for local TLB flush
Message-Id: <E1pOWUx-0000FR-FX@xenbits.xenproject.org>
Date: Sun, 05 Feb 2023 04:19:27 +0000

commit d56c70b6e1fe2b4ee836ca4449a3277cbbeb0ddc
Author:     Julien Grall <jgrall@amazon.com>
AuthorDate: Tue Jan 24 19:26:09 2023 +0000
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Tue Jan 24 19:34:44 2023 +0000

    xen/arm32: flushtlb: Reduce scope of barrier for local TLB flush
    
    Per G5-9224 in ARM DDI 0487I.a:
    
    "A DSB NSH is sufficient to ensure completion of TLB maintenance
     instructions that apply to a single PE. A DSB ISH is sufficient to
     ensure completion of TLB maintenance instructions that apply to PEs
     in the same Inner Shareable domain.
    "
    
    This is quoting the Armv8 specification because I couldn't find an
    explicit statement in the Armv7 specification. Instead, I could find
    bits in various places that confirm the same implementation.
    
    Furthermore, Linux has been using 'nsh' since 2013 (62cbbc42e001
    "ARM: tlb: reduce scope of barrier domains for TLB invalidation").
    
    This means barrier after local TLB flushes could be reduced to
    non-shareable.
    
    Signed-off-by: Julien Grall <jgrall@amazon.com>
    Reviewed-by: Michal Orzel <michal.orzel@amd.com>
    Tested-by: Henry Wang <Henry.Wang@arm.com>
---
 xen/arch/arm/include/asm/arm32/flushtlb.h | 27 +++++++++++++++------------
 1 file changed, 15 insertions(+), 12 deletions(-)

diff --git a/xen/arch/arm/include/asm/arm32/flushtlb.h b/xen/arch/arm/include/asm/arm32/flushtlb.h
index 9085e65011..7ae6a12f81 100644
--- a/xen/arch/arm/include/asm/arm32/flushtlb.h
+++ b/xen/arch/arm/include/asm/arm32/flushtlb.h
@@ -15,30 +15,33 @@
  * For the Stage-2 page-tables the ISB ensures the completion of the DSB
  * (and therefore the TLB invalidation) before continuing. So we know
  * the TLBs cannot contain an entry for a mapping we may have removed.
+ *
+ * Note that for local TLB flush, using non-shareable (nsh) is sufficient
+ * (see G5-9224 in ARM DDI 0487I.a).
  */
-#define TLB_HELPER(name, tlbop) \
-static inline void name(void)   \
-{                               \
-    dsb(ishst);                 \
-    WRITE_CP32(0, tlbop);       \
-    dsb(ish);                   \
-    isb();                      \
+#define TLB_HELPER(name, tlbop, sh) \
+static inline void name(void)       \
+{                                   \
+    dsb(sh ## st);                  \
+    WRITE_CP32(0, tlbop);           \
+    dsb(sh);                        \
+    isb();                          \
 }
 
 /* Flush local TLBs, current VMID only */
-TLB_HELPER(flush_guest_tlb_local, TLBIALL);
+TLB_HELPER(flush_guest_tlb_local, TLBIALL, nsh);
 
 /* Flush inner shareable TLBs, current VMID only */
-TLB_HELPER(flush_guest_tlb, TLBIALLIS);
+TLB_HELPER(flush_guest_tlb, TLBIALLIS, ish);
 
 /* Flush local TLBs, all VMIDs, non-hypervisor mode */
-TLB_HELPER(flush_all_guests_tlb_local, TLBIALLNSNH);
+TLB_HELPER(flush_all_guests_tlb_local, TLBIALLNSNH, nsh);
 
 /* Flush innershareable TLBs, all VMIDs, non-hypervisor mode */
-TLB_HELPER(flush_all_guests_tlb, TLBIALLNSNHIS);
+TLB_HELPER(flush_all_guests_tlb, TLBIALLNSNHIS, ish);
 
 /* Flush all hypervisor mappings from the TLB of the local processor. */
-TLB_HELPER(flush_xen_tlb_local, TLBIALLH);
+TLB_HELPER(flush_xen_tlb_local, TLBIALLH, nsh);
 
 /* Flush TLB of local processor for address va. */
 static inline void __flush_xen_tlb_one_local(vaddr_t va)
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sun Feb 05 04:19:38 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 05 Feb 2023 04:19:38 +0000
Received: from list by lists.xenproject.org with outflank-mailman.489739.758232 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pOWV8-0002TT-Sw; Sun, 05 Feb 2023 04:19:38 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 489739.758232; Sun, 05 Feb 2023 04:19: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 1pOWV8-0002TL-Pz; Sun, 05 Feb 2023 04:19:38 +0000
Received: by outflank-mailman (input) for mailman id 489739;
 Sun, 05 Feb 2023 04:19: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 1pOWV7-0002T9-Jp
 for xen-changelog@lists.xenproject.org; Sun, 05 Feb 2023 04:19:37 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pOWV7-0001GD-JA
 for xen-changelog@lists.xenproject.org; Sun, 05 Feb 2023 04:19:37 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pOWV7-0000GF-IN
 for xen-changelog@lists.xenproject.org; Sun, 05 Feb 2023 04:19: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=AkW4So5Th8eYHrRpTT51A5143mJOxdxjPGwlZ2Z6kHo=; b=l72/GmZQyrU8QmGUKK4JZGwx7D
	WRAWrIRSnU4J2xpnuMP4+P0/9wDOVLAbil17ZuRraKHECCzpj92fsdlR+dsgAKONiX2Xt8L7HDXYn
	EGOevcdYeqQefvMsMdN4/UYxY/Ck3o74B5Kz7TG8jzSl0cJI2z4ujYd+f+nRqNxCvNTk=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/arm: flushtlb: Reduce scope of barrier for the TLB range flush
Message-Id: <E1pOWV7-0000GF-IN@xenbits.xenproject.org>
Date: Sun, 05 Feb 2023 04:19:37 +0000

commit 5e5d1a43e18468399448ff8dec687342d48f56da
Author:     Julien Grall <jgrall@amazon.com>
AuthorDate: Tue Jan 24 19:26:29 2023 +0000
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Tue Jan 24 19:34:44 2023 +0000

    xen/arm: flushtlb: Reduce scope of barrier for the TLB range flush
    
    At the moment, flush_xen_tlb_range_va{,_local}() are using system
    wide memory barrier. This is quite expensive and unnecessary.
    
    For the local version, a non-shareable barrier is sufficient.
    For the SMP version, an inner-shareable barrier is sufficient.
    
    Furthermore, the initial barrier only needs to a store barrier.
    
    For the full explanation of the sequence see asm/arm{32,64}/flushtlb.h.
    
    Signed-off-by: Julien Grall <jgrall@amazon.com>
    Reviewed-by: Michal Orzel <michal.orzel@amd.com>
    Reviewed-by: Henry Wang <Henry.Wang@arm.com>
---
 xen/arch/arm/include/asm/flushtlb.h | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/xen/arch/arm/include/asm/flushtlb.h b/xen/arch/arm/include/asm/flushtlb.h
index 125a141975..e45fb6d97b 100644
--- a/xen/arch/arm/include/asm/flushtlb.h
+++ b/xen/arch/arm/include/asm/flushtlb.h
@@ -37,13 +37,14 @@ static inline void flush_xen_tlb_range_va_local(vaddr_t va,
 {
     vaddr_t end = va + size;
 
-    dsb(sy); /* Ensure preceding are visible */
+    /* See asm/arm{32,64}/flushtlb.h for the explanation of the sequence. */
+    dsb(nshst); /* Ensure prior page-tables updates have completed */
     while ( va < end )
     {
         __flush_xen_tlb_one_local(va);
         va += PAGE_SIZE;
     }
-    dsb(sy); /* Ensure completion of the TLB flush */
+    dsb(nsh); /* Ensure the TLB invalidation has completed */
     isb();
 }
 
@@ -56,13 +57,14 @@ static inline void flush_xen_tlb_range_va(vaddr_t va,
 {
     vaddr_t end = va + size;
 
-    dsb(sy); /* Ensure preceding are visible */
+    /* See asm/arm{32,64}/flushtlb.h for the explanation of the sequence. */
+    dsb(ishst); /* Ensure prior page-tables updates have completed */
     while ( va < end )
     {
         __flush_xen_tlb_one(va);
         va += PAGE_SIZE;
     }
-    dsb(sy); /* Ensure completion of the TLB flush */
+    dsb(ish); /* Ensure the TLB invalidation has completed */
     isb();
 }
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sun Feb 05 04:19:48 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 05 Feb 2023 04:19:48 +0000
Received: from list by lists.xenproject.org with outflank-mailman.489740.758235 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pOWVI-0002W5-U4; Sun, 05 Feb 2023 04:19:48 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 489740.758235; Sun, 05 Feb 2023 04:19:48 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pOWVI-0002Vx-RX; Sun, 05 Feb 2023 04:19:48 +0000
Received: by outflank-mailman (input) for mailman id 489740;
 Sun, 05 Feb 2023 04:19:47 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pOWVH-0002Vp-Mc
 for xen-changelog@lists.xenproject.org; Sun, 05 Feb 2023 04:19:47 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pOWVH-0001GO-Lz
 for xen-changelog@lists.xenproject.org; Sun, 05 Feb 2023 04:19:47 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pOWVH-0000Ge-LN
 for xen-changelog@lists.xenproject.org; Sun, 05 Feb 2023 04:19: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=GIxi8IeRcWxOVMnA4lcYWLu9X1FKaOttUVHtCReHvXM=; b=s93SGQl9fh06mNFuD8EzPTVKst
	RJllhvLtne5FvAhygFv6Dhrs5F0YQzrahjenQzDr/Dodr6MNQYijIjeAZA6VR/IQyV/JGz/aV7AoZ
	NtlSBpSNgbhBuLxnHxFmNXjw5opqzS0MDqREc5RoU3xgcqyVe8fC73R72mQkSQ7EXaV8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/arm: Clean-up the memory layout
Message-Id: <E1pOWVH-0000Ge-LN@xenbits.xenproject.org>
Date: Sun, 05 Feb 2023 04:19:47 +0000

commit 975bc942427e8173a97634ec9d75237c388c3bf7
Author:     Julien Grall <jgrall@amazon.com>
AuthorDate: Tue Jan 24 19:27:49 2023 +0000
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Tue Jan 24 19:34:44 2023 +0000

    xen/arm: Clean-up the memory layout
    
    In a follow-up patch, the base address for the common mappings will
    vary between arm32 and arm64. To avoid any duplication, define
    every mapping in the common region from the previous one.
    
    Take the opportunity to:
        * add missing *_SIZE for FIXMAP_VIRT_* and XEN_VIRT_*
        * switch to MB()/GB() to avoid hexadecimal (easier to read)
    
    Signed-off-by: Julien Grall <jgrall@amazon.com>
    Reviewed-by: Michal Orzel <michal.orzel@amd.com>
    Reviewed-by: Henry Wang <Henry.Wang@arm.com>
---
 xen/arch/arm/include/asm/config.h | 23 ++++++++++++++---------
 1 file changed, 14 insertions(+), 9 deletions(-)

diff --git a/xen/arch/arm/include/asm/config.h b/xen/arch/arm/include/asm/config.h
index d8f9977698..b541bad609 100644
--- a/xen/arch/arm/include/asm/config.h
+++ b/xen/arch/arm/include/asm/config.h
@@ -107,14 +107,19 @@
  *  Unused
  */
 
-#define XEN_VIRT_START         _AT(vaddr_t,0x00200000)
-#define FIXMAP_ADDR(n)        (_AT(vaddr_t,0x00400000) + (n) * PAGE_SIZE)
+#define XEN_VIRT_START          _AT(vaddr_t, MB(2))
+#define XEN_VIRT_SIZE           _AT(vaddr_t, MB(2))
 
-#define BOOT_FDT_VIRT_START    _AT(vaddr_t,0x00600000)
-#define BOOT_FDT_VIRT_SIZE     _AT(vaddr_t, MB(4))
+#define FIXMAP_VIRT_START       (XEN_VIRT_START + XEN_VIRT_SIZE)
+#define FIXMAP_VIRT_SIZE        _AT(vaddr_t, MB(2))
+
+#define FIXMAP_ADDR(n)          (FIXMAP_VIRT_START + (n) * PAGE_SIZE)
+
+#define BOOT_FDT_VIRT_START     (FIXMAP_VIRT_START + FIXMAP_VIRT_SIZE)
+#define BOOT_FDT_VIRT_SIZE      _AT(vaddr_t, MB(4))
 
 #ifdef CONFIG_LIVEPATCH
-#define LIVEPATCH_VMAP_START   _AT(vaddr_t,0x00a00000)
+#define LIVEPATCH_VMAP_START    (BOOT_FDT_VIRT_START + BOOT_FDT_VIRT_SIZE)
 #define LIVEPATCH_VMAP_SIZE    _AT(vaddr_t, MB(2))
 #endif
 
@@ -124,17 +129,17 @@
 
 #define CONFIG_SEPARATE_XENHEAP 1
 
-#define FRAMETABLE_VIRT_START  _AT(vaddr_t,0x02000000)
+#define FRAMETABLE_VIRT_START  _AT(vaddr_t, MB(32))
 #define FRAMETABLE_SIZE        MB(128-32)
 #define FRAMETABLE_NR          (FRAMETABLE_SIZE / sizeof(*frame_table))
 
-#define VMAP_VIRT_START        _AT(vaddr_t,0x10000000)
+#define VMAP_VIRT_START        _AT(vaddr_t, MB(256))
 #define VMAP_VIRT_SIZE         _AT(vaddr_t, GB(1) - MB(256))
 
-#define XENHEAP_VIRT_START     _AT(vaddr_t,0x40000000)
+#define XENHEAP_VIRT_START     _AT(vaddr_t, GB(1))
 #define XENHEAP_VIRT_SIZE      _AT(vaddr_t, GB(1))
 
-#define DOMHEAP_VIRT_START     _AT(vaddr_t,0x80000000)
+#define DOMHEAP_VIRT_START     _AT(vaddr_t, GB(2))
 #define DOMHEAP_VIRT_SIZE      _AT(vaddr_t, GB(2))
 
 #define DOMHEAP_ENTRIES        1024  /* 1024 2MB mapping slots */
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sun Feb 05 04:19:59 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 05 Feb 2023 04:19:59 +0000
Received: from list by lists.xenproject.org with outflank-mailman.489741.758239 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pOWVS-0002Ys-W1; Sun, 05 Feb 2023 04:19:58 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 489741.758239; Sun, 05 Feb 2023 04:19: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 1pOWVS-0002Yk-T4; Sun, 05 Feb 2023 04:19:58 +0000
Received: by outflank-mailman (input) for mailman id 489741;
 Sun, 05 Feb 2023 04:19:57 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pOWVR-0002Yd-PY
 for xen-changelog@lists.xenproject.org; Sun, 05 Feb 2023 04:19:57 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pOWVR-0001Gp-Oo
 for xen-changelog@lists.xenproject.org; Sun, 05 Feb 2023 04:19:57 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pOWVR-0000HP-OF
 for xen-changelog@lists.xenproject.org; Sun, 05 Feb 2023 04:19:57 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=I7aE9bfT5s/CYTNTjZ2sIdCSQBFkYHNY3fg1B9VVVXY=; b=BT6joO4K97cO9V2PlKjuE5+9S7
	CneUnt8k7rtcBRw+5ndvffCrIx1xxxMoH7F10nG0sczxEZOg1UbWn0C+/ZbfIhdU2nZSAhyTTLwVV
	950KK205vVymowNRwXLV1utMYCR2z/cCzeyobEs/tGCMAjf0Aq/Bt4WH0iQRqUrxblxg=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/arm32: head: Replace "ldr rX, =<label>" with "mov_w rX, <label>"
Message-Id: <E1pOWVR-0000HP-OF@xenbits.xenproject.org>
Date: Sun, 05 Feb 2023 04:19:57 +0000

commit 6a03544e808868884e9fccd9a526d633c5f286ec
Author:     Julien Grall <jgrall@amazon.com>
AuthorDate: Tue Jan 24 19:28:49 2023 +0000
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Tue Jan 24 19:34:44 2023 +0000

    xen/arm32: head: Replace "ldr rX, =<label>" with "mov_w rX, <label>"
    
    "ldr rX, =<label>" is used to load a value from the literal pool. This
    implies a memory access.
    
    This can be avoided by using the macro mov_w which encode the value in
    the immediate of two instructions.
    
    So replace all "ldr rX, =<label>" with "mov_w rX, <label>".
    
    No functional changes intended.
    
    Signed-off-by: Julien Grall <jgrall@amazon.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
    Reviewed-by: Michal Orzel <michal.orzel@amd.com>
---
 xen/arch/arm/arm32/head.S | 38 +++++++++++++++++++-------------------
 1 file changed, 19 insertions(+), 19 deletions(-)

diff --git a/xen/arch/arm/arm32/head.S b/xen/arch/arm/arm32/head.S
index 5c10447103..b680a4553f 100644
--- a/xen/arch/arm/arm32/head.S
+++ b/xen/arch/arm/arm32/head.S
@@ -62,7 +62,7 @@
 .endm
 
 .macro load_paddr rb, sym
-        ldr   \rb, =\sym
+        mov_w \rb, \sym
         add   \rb, \rb, r10
 .endm
 
@@ -149,7 +149,7 @@ past_zImage:
         mov   r8, r2                 /* r8 := DTB base address */
 
         /* Find out where we are */
-        ldr   r0, =start
+        mov_w r0, start
         adr   r9, start              /* r9  := paddr (start) */
         sub   r10, r9, r0            /* r10 := phys-offset */
 
@@ -170,7 +170,7 @@ past_zImage:
         bl    enable_mmu
 
         /* We are still in the 1:1 mapping. Jump to the runtime Virtual Address. */
-        ldr   r0, =primary_switched
+        mov_w r0, primary_switched
         mov   pc, r0
 primary_switched:
         /*
@@ -190,7 +190,7 @@ primary_switched:
         /* Setup the arguments for start_xen and jump to C world */
         mov   r0, r10                /* r0 := Physical offset */
         mov   r1, r8                 /* r1 := paddr(FDT) */
-        ldr   r2, =start_xen
+        mov_w r2, start_xen
         b     launch
 ENDPROC(start)
 
@@ -198,7 +198,7 @@ GLOBAL(init_secondary)
         cpsid aif                    /* Disable all interrupts */
 
         /* Find out where we are */
-        ldr   r0, =start
+        mov_w r0, start
         adr   r9, start              /* r9  := paddr (start) */
         sub   r10, r9, r0            /* r10 := phys-offset */
 
@@ -227,7 +227,7 @@ GLOBAL(init_secondary)
 
 
         /* We are still in the 1:1 mapping. Jump to the runtime Virtual Address. */
-        ldr   r0, =secondary_switched
+        mov_w r0, secondary_switched
         mov   pc, r0
 secondary_switched:
         /*
@@ -236,7 +236,7 @@ secondary_switched:
          *
          * XXX: This is not compliant with the Arm Arm.
          */
-        ldr   r4, =init_ttbr         /* VA of HTTBR value stashed by CPU 0 */
+        mov_w r4, init_ttbr          /* VA of HTTBR value stashed by CPU 0 */
         ldrd  r4, r5, [r4]           /* Actual value */
         dsb
         mcrr  CP64(r4, r5, HTTBR)
@@ -254,7 +254,7 @@ secondary_switched:
 #endif
         PRINT("- Ready -\r\n")
         /* Jump to C world */
-        ldr   r2, =start_secondary
+        mov_w r2, start_secondary
         b     launch
 ENDPROC(init_secondary)
 
@@ -297,8 +297,8 @@ ENDPROC(check_cpu_mode)
  */
 zero_bss:
         PRINT("- Zero BSS -\r\n")
-        ldr   r0, =__bss_start       /* r0 := vaddr(__bss_start) */
-        ldr   r1, =__bss_end         /* r1 := vaddr(__bss_start) */
+        mov_w r0, __bss_start        /* r0 := vaddr(__bss_start) */
+        mov_w r1, __bss_end          /* r1 := vaddr(__bss_start) */
 
         mov   r2, #0
 1:      str   r2, [r0], #4
@@ -330,8 +330,8 @@ cpu_init:
 
 cpu_init_done:
         /* Set up memory attribute type tables */
-        ldr   r0, =MAIR0VAL
-        ldr   r1, =MAIR1VAL
+        mov_w r0, MAIR0VAL
+        mov_w r1, MAIR1VAL
         mcr   CP32(r0, HMAIR0)
         mcr   CP32(r1, HMAIR1)
 
@@ -341,10 +341,10 @@ cpu_init_done:
          * PT walks are write-back, write-allocate in both cache levels,
          * Full 32-bit address space goes through this table.
          */
-        ldr   r0, =(TCR_RES1|TCR_SH0_IS|TCR_ORGN0_WBWA|TCR_IRGN0_WBWA|TCR_T0SZ(0))
+        mov_w r0, (TCR_RES1|TCR_SH0_IS|TCR_ORGN0_WBWA|TCR_IRGN0_WBWA|TCR_T0SZ(0))
         mcr   CP32(r0, HTCR)
 
-        ldr   r0, =HSCTLR_SET
+        mov_w r0, HSCTLR_SET
         mcr   CP32(r0, HSCTLR)
         isb
 
@@ -452,7 +452,7 @@ ENDPROC(cpu_init)
  */
 create_page_tables:
         /* Prepare the page-tables for mapping Xen */
-        ldr   r0, =XEN_VIRT_START
+        mov_w r0, XEN_VIRT_START
         create_table_entry boot_pgtable, boot_second, r0, 1
         create_table_entry boot_second, boot_third, r0, 2
 
@@ -576,7 +576,7 @@ remove_identity_mapping:
         cmp   r1, #XEN_FIRST_SLOT
         beq   1f
         /* It is not in slot 0, remove the entry */
-        ldr   r0, =boot_pgtable      /* r0 := root table */
+        mov_w r0, boot_pgtable       /* r0 := root table */
         lsl   r1, r1, #3             /* r1 := Slot offset */
         strd  r2, r3, [r0, r1]
         b     identity_mapping_removed
@@ -590,7 +590,7 @@ remove_identity_mapping:
         cmp   r1, #XEN_SECOND_SLOT
         beq   identity_mapping_removed
         /* It is not in slot 1, remove the entry */
-        ldr   r0, =boot_second       /* r0 := second table */
+        mov_w r0, boot_second        /* r0 := second table */
         lsl   r1, r1, #3             /* r1 := Slot offset */
         strd  r2, r3, [r0, r1]
 
@@ -620,7 +620,7 @@ ENDPROC(remove_identity_mapping)
 setup_fixmap:
 #if defined(CONFIG_EARLY_PRINTK)
         /* Add UART to the fixmap table */
-        ldr   r0, =EARLY_UART_VIRTUAL_ADDRESS
+        mov_w r0, EARLY_UART_VIRTUAL_ADDRESS
         create_mapping_entry xen_fixmap, r0, r11, type=PT_DEV_L3
 #endif
         /* Map fixmap into boot_second */
@@ -643,7 +643,7 @@ ENDPROC(setup_fixmap)
  * Clobbers r3
  */
 launch:
-        ldr   r3, =init_data
+        mov_w r3, init_data
         add   r3, #INITINFO_stack    /* Find the boot-time stack */
         ldr   sp, [r3]
         add   sp, #STACK_SIZE        /* (which grows down from the top). */
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sun Feb 05 04:20:09 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 05 Feb 2023 04:20:09 +0000
Received: from list by lists.xenproject.org with outflank-mailman.489742.758245 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pOWVd-0003PC-2v; Sun, 05 Feb 2023 04:20:09 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 489742.758245; Sun, 05 Feb 2023 04:20: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 1pOWVc-0003P4-Ui; Sun, 05 Feb 2023 04:20:08 +0000
Received: by outflank-mailman (input) for mailman id 489742;
 Sun, 05 Feb 2023 04:20: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 1pOWVb-0003Oo-SD
 for xen-changelog@lists.xenproject.org; Sun, 05 Feb 2023 04:20:07 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pOWVb-0001HF-Ra
 for xen-changelog@lists.xenproject.org; Sun, 05 Feb 2023 04:20:07 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pOWVb-0000Is-R0
 for xen-changelog@lists.xenproject.org; Sun, 05 Feb 2023 04:20: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=lcz2ELo/+HlYFqJ+F5yMcNb9H/1axtrwf9jvHMApyIg=; b=6vZXP4k3leWvmgMyDpcvrEVwtK
	d7WlgvJ5pj9Qwe4BU1umg3yQwT5svbpiDBppLFKm5FPBY3a7oJS3JEZLXrZInOhh4n92K72IK1fGa
	ekZfSHjXJhucd3bw/55NqO9L6wkKrzvENTdgcsnruJ/H0WAyIt9GkCwOrX1UnjcRdxYo=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/arm32: head: Jump to the runtime mapping in enable_mmu()
Message-Id: <E1pOWVb-0000Is-R0@xenbits.xenproject.org>
Date: Sun, 05 Feb 2023 04:20:07 +0000

commit b0a42e1973d2bf469ed452e6eafa0105073fd382
Author:     Julien Grall <jgrall@amazon.com>
AuthorDate: Tue Jan 24 19:31:08 2023 +0000
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Tue Jan 24 19:34:44 2023 +0000

    xen/arm32: head: Jump to the runtime mapping in enable_mmu()
    
    At the moment, enable_mmu() will return to an address in the 1:1 mapping
    and each path is responsible to switch to the runtime mapping.
    
    In a follow-up patch, the behavior to switch to the runtime mapping
    will become more complex. So to avoid more code/comment duplication,
    move the switch in enable_mmu().
    
    Lastly, take the opportunity to replace load from literal pool with
    mov_w.
    
    Signed-off-by: Julien Grall <jgrall@amazon.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
    Tested-by: Henry Wang <Henry.Wang@arm.com>
---
 xen/arch/arm/arm32/head.S | 50 ++++++++++++++++++++++++++++-------------------
 1 file changed, 30 insertions(+), 20 deletions(-)

diff --git a/xen/arch/arm/arm32/head.S b/xen/arch/arm/arm32/head.S
index b680a4553f..50ad6c948b 100644
--- a/xen/arch/arm/arm32/head.S
+++ b/xen/arch/arm/arm32/head.S
@@ -167,19 +167,11 @@ past_zImage:
         bl    check_cpu_mode
         bl    cpu_init
         bl    create_page_tables
-        bl    enable_mmu
 
-        /* We are still in the 1:1 mapping. Jump to the runtime Virtual Address. */
-        mov_w r0, primary_switched
-        mov   pc, r0
+        /* Address in the runtime mapping to jump to after the MMU is enabled */
+        mov_w lr, primary_switched
+        b     enable_mmu
 primary_switched:
-        /*
-         * The 1:1 map may clash with other parts of the Xen virtual memory
-         * layout. As it is not used anymore, remove it completely to
-         * avoid having to worry about replacing existing mapping
-         * afterwards.
-         */
-        bl    remove_identity_mapping
         bl    setup_fixmap
 #ifdef CONFIG_EARLY_PRINTK
         /* Use a virtual address to access the UART. */
@@ -223,12 +215,10 @@ GLOBAL(init_secondary)
         bl    check_cpu_mode
         bl    cpu_init
         bl    create_page_tables
-        bl    enable_mmu
 
-
-        /* We are still in the 1:1 mapping. Jump to the runtime Virtual Address. */
-        mov_w r0, secondary_switched
-        mov   pc, r0
+        /* Address in the runtime mapping to jump to after the MMU is enabled */
+        mov_w lr, secondary_switched
+        b     enable_mmu
 secondary_switched:
         /*
          * Non-boot CPUs need to move on to the proper pagetables, which were
@@ -523,9 +513,12 @@ virtphys_clash:
 ENDPROC(create_page_tables)
 
 /*
- * Turn on the Data Cache and the MMU. The function will return on the 1:1
- * mapping. In other word, the caller is responsible to switch to the runtime
- * mapping.
+ * Turn on the Data Cache and the MMU. The function will return
+ * to the virtual address provided in LR (e.g. the runtime mapping).
+ *
+ * Inputs:
+ *   r9 : paddr(start)
+ *   lr : Virtual address to return to
  *
  * Clobbers r0 - r3
  */
@@ -551,7 +544,24 @@ enable_mmu:
         dsb                          /* Flush PTE writes and finish reads */
         mcr   CP32(r0, HSCTLR)       /* now paging is enabled */
         isb                          /* Now, flush the icache */
-        mov   pc, lr
+
+        /*
+         * The MMU is turned on and we are in the 1:1 mapping. Switch
+         * to the runtime mapping.
+         */
+        mov_w r0, 1f
+        mov   pc, r0
+1:
+        /*
+         * The 1:1 map may clash with other parts of the Xen virtual memory
+         * layout. As it is not used anymore, remove it completely to
+         * avoid having to worry about replacing existing mapping
+         * afterwards.
+         *
+         * On return this will jump to the virtual address requested by
+         * the caller.
+         */
+        b     remove_identity_mapping
 ENDPROC(enable_mmu)
 
 /*
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sun Feb 05 04:20:19 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 05 Feb 2023 04:20:19 +0000
Received: from list by lists.xenproject.org with outflank-mailman.489743.758248 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pOWVn-0003SX-55; Sun, 05 Feb 2023 04:20:19 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 489743.758248; Sun, 05 Feb 2023 04:20: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 1pOWVn-0003SP-2K; Sun, 05 Feb 2023 04:20:19 +0000
Received: by outflank-mailman (input) for mailman id 489743;
 Sun, 05 Feb 2023 04:20: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 1pOWVl-0003SB-VB
 for xen-changelog@lists.xenproject.org; Sun, 05 Feb 2023 04:20:17 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pOWVl-0001Iz-UR
 for xen-changelog@lists.xenproject.org; Sun, 05 Feb 2023 04:20:17 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pOWVl-0000JR-Tq
 for xen-changelog@lists.xenproject.org; Sun, 05 Feb 2023 04:20: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=NrZB1hfNyc+GmO+lkX5582hmlP2J9e500D5mubFVT3I=; b=DI+wmel4zSUnRtA3x07j3fOJE7
	282LyFVpLRu4ZCve7u2BDPWVW7nGZikWjAFroRvs6+ShkQOdai+m6kg0t+542giZzkj5e6RSk3/eo
	KloyQonXQR+3HTbzpaG/slpc3EiqtC3obv7B18E2fvKpEsJ6rM/70xWBrNbwYDrEum9c=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/arm32: head: Introduce an helper to flush the TLBs
Message-Id: <E1pOWVl-0000JR-Tq@xenbits.xenproject.org>
Date: Sun, 05 Feb 2023 04:20:17 +0000

commit dea9dddeceec8a1d68da24b14d5b2396effe555f
Author:     Julien Grall <jgrall@amazon.com>
AuthorDate: Tue Jan 24 19:31:11 2023 +0000
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Tue Jan 24 19:34:44 2023 +0000

    xen/arm32: head: Introduce an helper to flush the TLBs
    
    The sequence for flushing the TLBs is 4 instruction long and often
    requires an explanation how it works.
    
    So create a helper and use it in the boot code (switch_ttbr() is left
    alone until we decide the semantic of the call).
    
    Note that in secondary_switched, we were also flushing the instruction
    cache and branch predictor. Neither of them was necessary because:
        * We are only supporting IVIPT cache on arm32, so the instruction
          cache flush is only necessary when executable code is modified.
          None of the boot code is doing that.
        * The instruction cache is not invalidated and misprediction is not
          a problem at boot.
    
    Signed-off-by: Julien Grall <jgrall@amazon.com>
    Reviewed-by: Michal Orzel <michal.orzel@amd.com>
    Reviewed-by: Henry Wang <Henry.Wang@arm.com>
    Tested-by: Henry Wang <Henry.Wang@arm.com>
---
 xen/arch/arm/arm32/head.S | 30 +++++++++++++++++-------------
 1 file changed, 17 insertions(+), 13 deletions(-)

diff --git a/xen/arch/arm/arm32/head.S b/xen/arch/arm/arm32/head.S
index 50ad6c948b..67b910808b 100644
--- a/xen/arch/arm/arm32/head.S
+++ b/xen/arch/arm/arm32/head.S
@@ -66,6 +66,20 @@
         add   \rb, \rb, r10
 .endm
 
+/*
+ * Flush local TLBs
+ *
+ * @tmp: Scratch register
+ *
+ * See asm/arm32/flushtlb.h for the explanation of the sequence.
+ */
+.macro flush_xen_tlb_local tmp
+        dsb   nshst
+        mcr   CP32(\tmp, TLBIALLH)
+        dsb   nsh
+        isb
+.endm
+
 /*
  * Common register usage in this file:
  *   r0  -
@@ -232,11 +246,7 @@ secondary_switched:
         mcrr  CP64(r4, r5, HTTBR)
         dsb
         isb
-        mcr   CP32(r0, TLBIALLH)     /* Flush hypervisor TLB */
-        mcr   CP32(r0, ICIALLU)      /* Flush I-cache */
-        mcr   CP32(r0, BPIALL)       /* Flush branch predictor */
-        dsb                          /* Ensure completion of TLB+BP flush */
-        isb
+        flush_xen_tlb_local r0
 
 #ifdef CONFIG_EARLY_PRINTK
         /* Use a virtual address to access the UART. */
@@ -529,8 +539,7 @@ enable_mmu:
          * The state of the TLBs is unknown before turning on the MMU.
          * Flush them to avoid stale one.
          */
-        mcr   CP32(r0, TLBIALLH)     /* Flush hypervisor TLBs */
-        dsb   nsh
+        flush_xen_tlb_local r0
 
         /* Write Xen's PT's paddr into the HTTBR */
         load_paddr r0, boot_pgtable
@@ -605,12 +614,7 @@ remove_identity_mapping:
         strd  r2, r3, [r0, r1]
 
 identity_mapping_removed:
-        /* See asm/arm32/flushtlb.h for the explanation of the sequence. */
-        dsb   nshst
-        mcr   CP32(r0, TLBIALLH)
-        dsb   nsh
-        isb
-
+        flush_xen_tlb_local r0
         mov   pc, lr
 ENDPROC(remove_identity_mapping)
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sun Feb 05 04:20:29 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 05 Feb 2023 04:20:29 +0000
Received: from list by lists.xenproject.org with outflank-mailman.489744.758252 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pOWVx-0003VZ-6n; Sun, 05 Feb 2023 04:20:29 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 489744.758252; Sun, 05 Feb 2023 04:20: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 1pOWVx-0003VR-3y; Sun, 05 Feb 2023 04:20:29 +0000
Received: by outflank-mailman (input) for mailman id 489744;
 Sun, 05 Feb 2023 04:20: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 1pOWVw-0003VC-1m
 for xen-changelog@lists.xenproject.org; Sun, 05 Feb 2023 04:20:28 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pOWVw-0001JE-11
 for xen-changelog@lists.xenproject.org; Sun, 05 Feb 2023 04:20:28 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pOWVw-0000Jr-0U
 for xen-changelog@lists.xenproject.org; Sun, 05 Feb 2023 04:20: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=HPLxt7MkQdSFdRZN3dt057PLjhd4AQd7godKKImtZOg=; b=Km+tt/1iTnMUR3Lcsix9X1W1I4
	5aYko0OrSVXUYG0ppgCq89GjaEUtMes3j0OYTpzyZIdT+294UgxEl+A8Le1Are+rHWA7YW/NIjcQe
	d08N3sMaKeF+Wekrim5gjrazrzr0jlyyBD5UVGmJo9GPMFZ1v06Z3DvPHlAnVQxcE0UM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/arm32: head: Remove restriction where to load Xen
Message-Id: <E1pOWVw-0000Jr-0U@xenbits.xenproject.org>
Date: Sun, 05 Feb 2023 04:20:28 +0000

commit fbd9b5fb4c26546d6f207036917283d2f1569d9c
Author:     Julien Grall <jgrall@amazon.com>
AuthorDate: Tue Jan 24 19:32:14 2023 +0000
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Tue Jan 24 19:34:44 2023 +0000

    xen/arm32: head: Remove restriction where to load Xen
    
    At the moment, bootloaders can load Xen anywhere in memory but the
    region 2MB - 4MB. While I am not aware of any issue, we have no way
    to tell the bootloader to avoid that region.
    
    In addition to that, in the future, Xen may grow over 2MB if we
    enable feature like UBSAN or GCOV. To avoid widening the restriction
    on the load address, it would be better to get rid of it.
    
    When the identity mapping is clashing with the Xen runtime mapping,
    we need an extra indirection to be able to replace the identity
    mapping with the Xen runtime mapping.
    
    Reserve a new memory region that will be used to temporarily map Xen.
    For convenience, the new area is re-using the same first slot as the
    domheap which is used for per-cpu temporary mapping after a CPU has
    booted.
    
    Furthermore, directly map boot_second (which cover Xen and more)
    to the temporary area. This will avoid to allocate an extra page-table
    for the second-level and will helpful for follow-up patches (we will
    want to use the fixmap whilst in the temporary mapping).
    
    Lastly, some part of the code now needs to know whether the temporary
    mapping was created. So reserve r12 to store this information.
    
    Signed-off-by: Julien Grall <jgrall@amazon.com>
    Reviewed-by: Luca Fancellu <luca.fancellu@arm.com>
    Tested-by: Luca Fancellu <luca.fancellu@arm.com>
    Reviewed-by: Michal Orzel <michal.orzel@amd.com>
---
 xen/arch/arm/arm32/head.S         | 139 ++++++++++++++++++++++++++++++++++----
 xen/arch/arm/include/asm/config.h |  14 ++++
 xen/arch/arm/mm.c                 |  14 ++++
 3 files changed, 152 insertions(+), 15 deletions(-)

diff --git a/xen/arch/arm/arm32/head.S b/xen/arch/arm/arm32/head.S
index 67b910808b..df51550baa 100644
--- a/xen/arch/arm/arm32/head.S
+++ b/xen/arch/arm/arm32/head.S
@@ -35,6 +35,9 @@
 #define XEN_FIRST_SLOT      first_table_offset(XEN_VIRT_START)
 #define XEN_SECOND_SLOT     second_table_offset(XEN_VIRT_START)
 
+/* Offset between the early boot xen mapping and the runtime xen mapping */
+#define XEN_TEMPORARY_OFFSET      (TEMPORARY_XEN_VIRT_START - XEN_VIRT_START)
+
 #if defined(CONFIG_EARLY_PRINTK) && defined(CONFIG_EARLY_PRINTK_INC)
 #include CONFIG_EARLY_PRINTK_INC
 #endif
@@ -94,7 +97,7 @@
  *   r9  - paddr(start)
  *   r10 - phys offset
  *   r11 - UART address
- *   r12 -
+ *   r12 - Temporary mapping created
  *   r13 - SP
  *   r14 - LR
  *   r15 - PC
@@ -445,6 +448,9 @@ ENDPROC(cpu_init)
  *   r9 : paddr(start)
  *   r10: phys offset
  *
+ * Output:
+ *   r12: Was a temporary mapping created?
+ *
  * Clobbers r0 - r4, r6
  *
  * Register usage within this function:
@@ -484,7 +490,11 @@ create_page_tables:
         /*
          * Setup the 1:1 mapping so we can turn the MMU on. Note that
          * only the first page of Xen will be part of the 1:1 mapping.
+         *
+         * In all the cases, we will link boot_third_id. So create the
+         * mapping in advance.
          */
+        create_mapping_entry boot_third_id, r9, r9
 
         /*
          * Find the first slot used. If the slot is not XEN_FIRST_SLOT,
@@ -501,8 +511,7 @@ create_page_tables:
         /*
          * Find the second slot used. If the slot is XEN_SECOND_SLOT, then the
          * 1:1 mapping will use its own set of page-tables from the
-         * third level. For slot XEN_SECOND_SLOT, Xen is not yet able to handle
-         * it.
+         * third level.
          */
         get_table_slot r1, r9, 2     /* r1 := second slot */
         cmp   r1, #XEN_SECOND_SLOT
@@ -513,13 +522,33 @@ create_page_tables:
 link_from_second_id:
         create_table_entry boot_second_id, boot_third_id, r9, 2
 link_from_third_id:
-        create_mapping_entry boot_third_id, r9, r9
+        /* Good news, we are not clashing with Xen virtual mapping */
+        mov   r12, #0                /* r12 := temporary mapping not created */
         mov   pc, lr
 
 virtphys_clash:
-        /* Identity map clashes with boot_third, which we cannot handle yet */
-        PRINT("- Unable to build boot page tables - virt and phys addresses clash. -\r\n")
-        b     fail
+        /*
+         * The identity map clashes with boot_third. Link boot_first_id and
+         * map Xen to a temporary mapping. See switch_to_runtime_mapping
+         * for more details.
+         */
+        PRINT("- Virt and Phys addresses clash  -\r\n")
+        PRINT("- Create temporary mapping -\r\n")
+
+        /*
+         * This will override the link to boot_second in XEN_FIRST_SLOT.
+         * The page-tables are not live yet. So no need to use
+         * break-before-make.
+         */
+        create_table_entry boot_pgtable, boot_second_id, r9, 1
+        create_table_entry boot_second_id, boot_third_id, r9, 2
+
+        /* Map boot_second (cover Xen mappings) to the temporary 1st slot */
+        mov_w r0, TEMPORARY_XEN_VIRT_START
+        create_table_entry boot_pgtable, boot_second, r0, 1
+
+        mov   r12, #1                /* r12 := temporary mapping created */
+        mov   pc, lr
 ENDPROC(create_page_tables)
 
 /*
@@ -528,9 +557,10 @@ ENDPROC(create_page_tables)
  *
  * Inputs:
  *   r9 : paddr(start)
+ *  r12 : Was the temporary mapping created?
  *   lr : Virtual address to return to
  *
- * Clobbers r0 - r3
+ * Clobbers r0 - r5
  */
 enable_mmu:
         PRINT("- Turning on paging -\r\n")
@@ -558,21 +588,79 @@ enable_mmu:
          * The MMU is turned on and we are in the 1:1 mapping. Switch
          * to the runtime mapping.
          */
-        mov_w r0, 1f
-        mov   pc, r0
+        mov   r5, lr                /* Save LR before overwritting it */
+        mov_w lr, 1f                /* Virtual address in the runtime mapping */
+        b     switch_to_runtime_mapping
 1:
+        mov   lr, r5                /* Restore LR */
         /*
-         * The 1:1 map may clash with other parts of the Xen virtual memory
-         * layout. As it is not used anymore, remove it completely to
-         * avoid having to worry about replacing existing mapping
-         * afterwards.
+         * At this point, either the 1:1 map or the temporary mapping
+         * will be present. The former may clash with other parts of the
+         * Xen virtual memory layout. As both of them are not used
+         * anymore, remove them completely to avoid having to worry
+         * about replacing existing mapping afterwards.
          *
          * On return this will jump to the virtual address requested by
          * the caller.
          */
-        b     remove_identity_mapping
+        teq   r12, #0
+        beq   remove_identity_mapping
+        b     remove_temporary_mapping
 ENDPROC(enable_mmu)
 
+/*
+ * Switch to the runtime mapping. The logic depends on whether the
+ * runtime virtual region is clashing with the physical address
+ *
+ *  - If it is not clashing, we can directly jump to the address in
+ *    the runtime mapping.
+ *  - If it is clashing, create_page_tables() would have mapped Xen to
+ *    a temporary virtual address. We need to switch to the temporary
+ *    mapping so we can remove the identity mapping and map Xen at the
+ *    correct position.
+ *
+ * Inputs
+ *    r9: paddr(start)
+ *   r12: Was a temporary mapping created?
+ *    lr: Address in the runtime mapping to jump to
+ *
+ * Clobbers r0 - r4
+ */
+switch_to_runtime_mapping:
+        /*
+         * Jump to the runtime mapping if the virt and phys are not
+         * clashing
+         */
+        teq   r12, #0
+        beq   ready_to_switch
+
+        /* We are still in the 1:1 mapping. Jump to the temporary Virtual address. */
+        mov_w r0, 1f
+        add   r0, r0, #XEN_TEMPORARY_OFFSET /* r0 := address in temporary mapping */
+        mov   pc, r0
+
+1:
+        /* Remove boot_second_id */
+        mov   r2, #0
+        mov   r3, #0
+        adr_l r0, boot_pgtable
+        get_table_slot r1, r9, 1            /* r1 := first slot */
+        lsl   r1, r1, #3                    /* r1 := first slot offset */
+        strd  r2, r3, [r0, r1]
+
+        flush_xen_tlb_local r0
+
+        /* Map boot_second into boot_pgtable */
+        mov_w r0, XEN_VIRT_START
+        create_table_entry boot_pgtable, boot_second, r0, 1
+
+        /* Ensure any page table updates are visible before continuing */
+        dsb   nsh
+
+ready_to_switch:
+        mov   pc, lr
+ENDPROC(switch_to_runtime_mapping)
+
 /*
  * Remove the 1:1 map from the page-tables. It is not easy to keep track
  * where the 1:1 map was mapped, so we will look for the top-level entry
@@ -618,6 +706,27 @@ identity_mapping_removed:
         mov   pc, lr
 ENDPROC(remove_identity_mapping)
 
+/*
+ * Remove the temporary mapping of Xen starting at TEMPORARY_XEN_VIRT_START.
+ *
+ * Clobbers r0 - r3
+ */
+remove_temporary_mapping:
+        /* r2:r3 := invalid page-table entry */
+        mov   r2, #0
+        mov   r3, #0
+
+        adr_l r0, boot_pgtable
+        mov_w r1, TEMPORARY_XEN_VIRT_START
+        get_table_slot r1, r1, 1     /* r1 := first slot */
+        lsl   r1, r1, #3             /* r1 := first slot offset */
+        strd  r2, r3, [r0, r1]
+
+        flush_xen_tlb_local r0
+
+        mov  pc, lr
+ENDPROC(remove_temporary_mapping)
+
 /*
  * Map the UART in the fixmap (when earlyprintk is used) and hook the
  * fixmap table in the page tables.
diff --git a/xen/arch/arm/include/asm/config.h b/xen/arch/arm/include/asm/config.h
index b541bad609..5df0e4c495 100644
--- a/xen/arch/arm/include/asm/config.h
+++ b/xen/arch/arm/include/asm/config.h
@@ -147,6 +147,20 @@
 /* Number of domheap pagetable pages required at the second level (2MB mappings) */
 #define DOMHEAP_SECOND_PAGES (DOMHEAP_VIRT_SIZE >> FIRST_SHIFT)
 
+/*
+ * The temporary area is overlapping with the domheap area. This may
+ * be used to create an alias of the first slot containing Xen mappings
+ * when turning on/off the MMU.
+ */
+#define TEMPORARY_AREA_FIRST_SLOT    (first_table_offset(DOMHEAP_VIRT_START))
+
+/* Calculate the address in the temporary area */
+#define TEMPORARY_AREA_ADDR(addr)                           \
+     (((addr) & ~XEN_PT_LEVEL_MASK(1)) |                    \
+      (TEMPORARY_AREA_FIRST_SLOT << XEN_PT_LEVEL_SHIFT(1)))
+
+#define TEMPORARY_XEN_VIRT_START    TEMPORARY_AREA_ADDR(XEN_VIRT_START)
+
 #else /* ARM_64 */
 
 #define SLOT0_ENTRY_BITS  39
diff --git a/xen/arch/arm/mm.c b/xen/arch/arm/mm.c
index 1a94b52cce..f758cad545 100644
--- a/xen/arch/arm/mm.c
+++ b/xen/arch/arm/mm.c
@@ -167,6 +167,9 @@ static void __init __maybe_unused build_assertions(void)
 #define CHECK_SAME_SLOT(level, virt1, virt2) \
     BUILD_BUG_ON(level##_table_offset(virt1) != level##_table_offset(virt2))
 
+#define CHECK_DIFFERENT_SLOT(level, virt1, virt2) \
+    BUILD_BUG_ON(level##_table_offset(virt1) == level##_table_offset(virt2))
+
 #ifdef CONFIG_ARM_64
     CHECK_SAME_SLOT(zeroeth, XEN_VIRT_START, FIXMAP_ADDR(0));
     CHECK_SAME_SLOT(zeroeth, XEN_VIRT_START, BOOT_FDT_VIRT_START);
@@ -174,7 +177,18 @@ static void __init __maybe_unused build_assertions(void)
     CHECK_SAME_SLOT(first, XEN_VIRT_START, FIXMAP_ADDR(0));
     CHECK_SAME_SLOT(first, XEN_VIRT_START, BOOT_FDT_VIRT_START);
 
+    /*
+     * For arm32, the temporary mapping will re-use the domheap
+     * first slot and the second slots will match.
+     */
+#ifdef CONFIG_ARM_32
+    CHECK_SAME_SLOT(first, TEMPORARY_XEN_VIRT_START, DOMHEAP_VIRT_START);
+    CHECK_DIFFERENT_SLOT(first, XEN_VIRT_START, TEMPORARY_XEN_VIRT_START);
+    CHECK_SAME_SLOT(second, XEN_VIRT_START, TEMPORARY_XEN_VIRT_START);
+#endif
+
 #undef CHECK_SAME_SLOT
+#undef CHECK_DIFFERENT_SLOT
 }
 
 static lpae_t *xen_map_table(mfn_t mfn)
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sun Feb 05 04:20:39 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 05 Feb 2023 04:20:39 +0000
Received: from list by lists.xenproject.org with outflank-mailman.489745.758256 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pOWW7-0003Y6-87; Sun, 05 Feb 2023 04:20:39 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 489745.758256; Sun, 05 Feb 2023 04:20: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 1pOWW7-0003Xy-5V; Sun, 05 Feb 2023 04:20:39 +0000
Received: by outflank-mailman (input) for mailman id 489745;
 Sun, 05 Feb 2023 04:20: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 1pOWW6-0003Xq-4c
 for xen-changelog@lists.xenproject.org; Sun, 05 Feb 2023 04:20:38 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pOWW6-0001JI-3n
 for xen-changelog@lists.xenproject.org; Sun, 05 Feb 2023 04:20:38 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pOWW6-0000KI-3G
 for xen-changelog@lists.xenproject.org; Sun, 05 Feb 2023 04:20: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=ZKjeJWjcoKIj9XTmtXpiyjeevwZ7B+8skKuwCysOU1E=; b=hWcbvHEHtTsJmLuPNcRCdxxJBg
	ErzhP0rXnIPDQKy9Gw6d1RSRTPSOfy2Hb0V8pEQjABlyM6gP2InkiFg6L1EPnBY2p+gLW/ZZxfi4/
	WDAiP5rAsaxXWjq9wVchP2REZSIKXLx2CzHUuorA+V28ktftseCQOktxzI7S1yNHMjS8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] automation: rename RISCV_64 container and jobs
Message-Id: <E1pOWW6-0000KI-3G@xenbits.xenproject.org>
Date: Sun, 05 Feb 2023 04:20:38 +0000

commit 87ee7a817d1800dc41e118f4035917b80498433a
Author:     Oleksii Kurochko <oleksii.kurochko@gmail.com>
AuthorDate: Tue Jan 24 14:15:30 2023 -0800
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Tue Jan 24 14:32:10 2023 -0800

    automation: rename RISCV_64 container and jobs
    
    All RISCV_64-related stuff was renamed to be consistent with
    ARM (arm32 is cross build as RISCV_64).
    
    Signed-off-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
    Signed-off-by: Stefano Stabellini <stefano.stabellini@amd.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
---
 .../build/archlinux/current-riscv64.dockerfile      | 21 +++++++++++++++++++++
 automation/build/archlinux/riscv64.dockerfile       | 21 ---------------------
 automation/gitlab-ci/build.yaml                     | 16 ++++++++--------
 automation/scripts/containerize                     |  2 +-
 4 files changed, 30 insertions(+), 30 deletions(-)

diff --git a/automation/build/archlinux/current-riscv64.dockerfile b/automation/build/archlinux/current-riscv64.dockerfile
new file mode 100644
index 0000000000..abf8e7bf0b
--- /dev/null
+++ b/automation/build/archlinux/current-riscv64.dockerfile
@@ -0,0 +1,21 @@
+FROM archlinux
+LABEL maintainer.name="The Xen Project" \
+      maintainer.email="xen-devel@lists.xenproject.org"
+
+# Packages needed for the build
+RUN pacman --noconfirm --needed -Syu \
+    base-devel \
+    git \
+    inetutils \
+    riscv64-linux-gnu-binutils \
+    riscv64-linux-gnu-gcc \
+    riscv64-linux-gnu-glibc \
+    # For test phase
+    qemu-system-riscv
+
+# Add compiler path
+ENV CROSS_COMPILE=riscv64-linux-gnu-
+
+RUN useradd --create-home user
+USER user
+WORKDIR /build
diff --git a/automation/build/archlinux/riscv64.dockerfile b/automation/build/archlinux/riscv64.dockerfile
deleted file mode 100644
index abf8e7bf0b..0000000000
--- a/automation/build/archlinux/riscv64.dockerfile
+++ /dev/null
@@ -1,21 +0,0 @@
-FROM archlinux
-LABEL maintainer.name="The Xen Project" \
-      maintainer.email="xen-devel@lists.xenproject.org"
-
-# Packages needed for the build
-RUN pacman --noconfirm --needed -Syu \
-    base-devel \
-    git \
-    inetutils \
-    riscv64-linux-gnu-binutils \
-    riscv64-linux-gnu-gcc \
-    riscv64-linux-gnu-glibc \
-    # For test phase
-    qemu-system-riscv
-
-# Add compiler path
-ENV CROSS_COMPILE=riscv64-linux-gnu-
-
-RUN useradd --create-home user
-USER user
-WORKDIR /build
diff --git a/automation/gitlab-ci/build.yaml b/automation/gitlab-ci/build.yaml
index a292f0fb18..a053c5c732 100644
--- a/automation/gitlab-ci/build.yaml
+++ b/automation/gitlab-ci/build.yaml
@@ -647,33 +647,33 @@ alpine-3.12-gcc-debug-arm64-boot-cpupools:
       CONFIG_BOOT_TIME_CPUPOOLS=y
 
 # RISC-V 64 cross-build
-riscv64-cross-gcc:
+archlinux-current-gcc-riscv64:
   extends: .gcc-riscv64-cross-build
   variables:
-    CONTAINER: archlinux:riscv64
+    CONTAINER: archlinux:current-riscv64
     KBUILD_DEFCONFIG: tiny64_defconfig
     HYPERVISOR_ONLY: y
 
-riscv64-cross-gcc-debug:
+archlinux-current-gcc-riscv64-debug:
   extends: .gcc-riscv64-cross-build-debug
   variables:
-    CONTAINER: archlinux:riscv64
+    CONTAINER: archlinux:current-riscv64
     KBUILD_DEFCONFIG: tiny64_defconfig
     HYPERVISOR_ONLY: y
 
-riscv64-cross-gcc-randconfig:
+archlinux-current-gcc-riscv64-randconfig:
   extends: .gcc-riscv64-cross-build
   variables:
-    CONTAINER: archlinux:riscv64
+    CONTAINER: archlinux:current-riscv64
     KBUILD_DEFCONFIG: tiny64_defconfig
     RANDCONFIG: y
     EXTRA_FIXED_RANDCONFIG:
       CONFIG_COVERAGE=n
 
-riscv64-cross-gcc-debug-randconfig:
+archlinux-current-gcc-riscv64-debug-randconfig:
   extends: .gcc-riscv64-cross-build-debug
   variables:
-    CONTAINER: archlinux:riscv64
+    CONTAINER: archlinux:current-riscv64
     KBUILD_DEFCONFIG: tiny64_defconfig
     RANDCONFIG: y
     EXTRA_FIXED_RANDCONFIG:
diff --git a/automation/scripts/containerize b/automation/scripts/containerize
index 0f4645c4cc..9e508918bf 100755
--- a/automation/scripts/containerize
+++ b/automation/scripts/containerize
@@ -27,7 +27,7 @@ case "_${CONTAINER}" in
     _alpine) CONTAINER="${BASE}/alpine:3.12" ;;
     _alpine-arm64v8) CONTAINER="${BASE}/alpine:3.12-arm64v8" ;;
     _archlinux|_arch) CONTAINER="${BASE}/archlinux:current" ;;
-    _riscv64) CONTAINER="${BASE}/archlinux:riscv64" ;;
+    _riscv64) CONTAINER="${BASE}/archlinux:current-riscv64" ;;
     _centos7) CONTAINER="${BASE}/centos:7" ;;
     _centos72) CONTAINER="${BASE}/centos:7.2" ;;
     _fedora) CONTAINER="${BASE}/fedora:29";;
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sun Feb 05 04:20:49 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 05 Feb 2023 04:20:49 +0000
Received: from list by lists.xenproject.org with outflank-mailman.489746.758260 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pOWWH-0003ax-AH; Sun, 05 Feb 2023 04:20:49 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 489746.758260; Sun, 05 Feb 2023 04:20: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 1pOWWH-0003aq-6y; Sun, 05 Feb 2023 04:20:49 +0000
Received: by outflank-mailman (input) for mailman id 489746;
 Sun, 05 Feb 2023 04:20: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 1pOWWG-0003ae-79
 for xen-changelog@lists.xenproject.org; Sun, 05 Feb 2023 04:20:48 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pOWWG-0001JT-6W
 for xen-changelog@lists.xenproject.org; Sun, 05 Feb 2023 04:20:48 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pOWWG-0000LB-5z
 for xen-changelog@lists.xenproject.org; Sun, 05 Feb 2023 04:20: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=V9TbGfOiHmXgx7auJKFKGd1DFapDKbcxzzORtpsgi70=; b=P9Z7CMx6jgvJOcWUlv2cUNjwmO
	95p+rfu16sLmlgzlLUWHw83ygIsUxAYSu1TxPiWNltd5gDp6TOkqTMOKtlrZjebvqQT2AGg/iSbXK
	lSmBN1Uc4CQXp9L/zwZoBZmkzyEwlNVfGcn1w++Vey46yRQuGU6O5e4Pem2hSOHpGLdU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] automation: Modify static-mem check in qemu-smoke-dom0less-arm64.sh
Message-Id: <E1pOWWG-0000LB-5z@xenbits.xenproject.org>
Date: Sun, 05 Feb 2023 04:20:48 +0000

commit 3b760245f74ab2022b1aa4da842c4545228c2e83
Author:     Michal Orzel <michal.orzel@amd.com>
AuthorDate: Mon Jan 23 14:10:23 2023 +0100
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Tue Jan 24 16:05:16 2023 -0800

    automation: Modify static-mem check in qemu-smoke-dom0less-arm64.sh
    
    At the moment, the static-mem check relies on the way Xen exposes the
    memory banks in device tree. As this might change, the check should be
    modified to be generic and not to rely on device tree. In this case,
    let's use /proc/iomem which exposes the memory ranges in %08x format
    as follows:
    <start_addr>-<end_addr> : <description>
    
    This way, we can grep in /proc/iomem for an entry containing memory
    region defined by the static-mem configuration with "System RAM"
    description. If it exists, mark the test as passed. Also, take the
    opportunity to add 0x prefix to domu_{base,size} definition rather than
    adding it in front of each occurence.
    
    Signed-off-by: Michal Orzel <michal.orzel@amd.com>
    Reviewed-by: Xenia Ragiadakou <burzalodowa@gmail.com>
    Reviewed-by: Ayan Kumar Halder <ayan.kumar.halder@amd.com>
    Acked-by: Stefano Stabellini <sstabellini@kernel.org>
---
 automation/scripts/qemu-smoke-dom0less-arm64.sh | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/automation/scripts/qemu-smoke-dom0less-arm64.sh b/automation/scripts/qemu-smoke-dom0less-arm64.sh
index 2b59346fdc..182a4b6c18 100755
--- a/automation/scripts/qemu-smoke-dom0less-arm64.sh
+++ b/automation/scripts/qemu-smoke-dom0less-arm64.sh
@@ -16,14 +16,13 @@ fi
 
 if [[ "${test_variant}" == "static-mem" ]]; then
     # Memory range that is statically allocated to DOM1
-    domu_base="50000000"
-    domu_size="10000000"
+    domu_base="0x50000000"
+    domu_size="0x10000000"
     passed="${test_variant} test passed"
     domU_check="
-current=\$(hexdump -e '16/1 \"%02x\"' /proc/device-tree/memory@${domu_base}/reg 2>/dev/null)
-expected=$(printf \"%016x%016x\" 0x${domu_base} 0x${domu_size})
-if [[ \"\${expected}\" == \"\${current}\" ]]; then
-	echo \"${passed}\"
+mem_range=$(printf \"%08x-%08x\" ${domu_base} $(( ${domu_base} + ${domu_size} - 1 )))
+if grep -q -x \"\${mem_range} : System RAM\" /proc/iomem; then
+    echo \"${passed}\"
 fi
 "
 fi
@@ -126,7 +125,7 @@ UBOOT_SOURCE="boot.source"
 UBOOT_SCRIPT="boot.scr"' > binaries/config
 
 if [[ "${test_variant}" == "static-mem" ]]; then
-    echo -e "\nDOMU_STATIC_MEM[0]=\"0x${domu_base} 0x${domu_size}\"" >> binaries/config
+    echo -e "\nDOMU_STATIC_MEM[0]=\"${domu_base} ${domu_size}\"" >> binaries/config
 fi
 
 if [[ "${test_variant}" == "boot-cpupools" ]]; then
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sun Feb 05 04:21:00 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 05 Feb 2023 04:21:00 +0000
Received: from list by lists.xenproject.org with outflank-mailman.489747.758264 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pOWWS-0003dy-D7; Sun, 05 Feb 2023 04:21:00 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 489747.758264; Sun, 05 Feb 2023 04:21: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 1pOWWS-0003dr-AR; Sun, 05 Feb 2023 04:21:00 +0000
Received: by outflank-mailman (input) for mailman id 489747;
 Sun, 05 Feb 2023 04:20: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 1pOWWQ-0003dh-A4
 for xen-changelog@lists.xenproject.org; Sun, 05 Feb 2023 04:20:58 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pOWWQ-0001Jq-9I
 for xen-changelog@lists.xenproject.org; Sun, 05 Feb 2023 04:20:58 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pOWWQ-0000Lc-8k
 for xen-changelog@lists.xenproject.org; Sun, 05 Feb 2023 04:20: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=MhLeqtu68Kp+P12qLqzcvurVK2fiYz2oP6XwUO90cRY=; b=Xb7a5KRPnB61V1A6D0/L/2KEPO
	LefFpDAShD2x4YGz4dGK/It+0g7HxnoNpCtniWizrxoE5PfP7sci67oYPgVENEJ2sHMJ/hBmZkTBW
	ZZJOoSr9VKNE+YYU0+N3HjXygDOOhylmzSJbdzm4ZFfg0LdDvm4olZKJQ1Uuwo4tYWaA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] Revert "tools/xenstore: simplify loop handling connection I/O"
Message-Id: <E1pOWWQ-0000Lc-8k@xenbits.xenproject.org>
Date: Sun, 05 Feb 2023 04:20:58 +0000

commit 10ced96ce9d4cbc140652795fe87af9f83bb1b29
Author:     Jason Andryuk <jandryuk@gmail.com>
AuthorDate: Thu Jan 26 10:57:37 2023 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Jan 26 10:57:37 2023 +0100

    Revert "tools/xenstore: simplify loop handling connection I/O"
    
    I'm observing guest kexec trigger xenstored to abort on a double free.
    
    gdb output:
    Program received signal SIGABRT, Aborted.
    __pthread_kill_implementation (no_tid=0, signo=6, threadid=140645614258112) at ./nptl/pthread_kill.c:44
    44    ./nptl/pthread_kill.c: No such file or directory.
    (gdb) bt
        at ./nptl/pthread_kill.c:44
        at ./nptl/pthread_kill.c:78
        at ./nptl/pthread_kill.c:89
        at ../sysdeps/posix/raise.c:26
        at talloc.c:119
        ptr=ptr@entry=0x559fae724290) at talloc.c:232
        at xenstored_core.c:2945
    (gdb) frame 5
        at talloc.c:119
    119            TALLOC_ABORT("Bad talloc magic value - double free");
    (gdb) frame 7
        at xenstored_core.c:2945
    2945                talloc_increase_ref_count(conn);
    (gdb) p conn
    $1 = (struct connection *) 0x559fae724290
    
    Looking at a xenstore trace, we have:
    IN 0x559fae71f250 20230120 17:40:53 READ (/local/domain/3/image/device-model-dom
    id )
    wrl: dom    0      1  msec      10000 credit     1000000 reserve        100 disc
    ard
    wrl: dom    3      1  msec      10000 credit     1000000 reserve        100 disc
    ard
    wrl: dom    0      0  msec      10000 credit     1000000 reserve          0 disc
    ard
    wrl: dom    3      0  msec      10000 credit     1000000 reserve          0 disc
    ard
    OUT 0x559fae71f250 20230120 17:40:53 ERROR (ENOENT )
    wrl: dom    0      1  msec      10000 credit     1000000 reserve        100 disc
    ard
    wrl: dom    3      1  msec      10000 credit     1000000 reserve        100 disc
    ard
    IN 0x559fae71f250 20230120 17:40:53 RELEASE (3 )
    DESTROY watch 0x559fae73f630
    DESTROY watch 0x559fae75ddf0
    DESTROY watch 0x559fae75ec30
    DESTROY watch 0x559fae75ea60
    DESTROY watch 0x559fae732c00
    DESTROY watch 0x559fae72cea0
    DESTROY watch 0x559fae728fc0
    DESTROY watch 0x559fae729570
    DESTROY connection 0x559fae724290
    orphaned node /local/domain/3/device/suspend/event-channel deleted
    orphaned node /local/domain/3/device/vbd/51712 deleted
    orphaned node /local/domain/3/device/vkbd/0 deleted
    orphaned node /local/domain/3/device/vif/0 deleted
    orphaned node /local/domain/3/control/shutdown deleted
    orphaned node /local/domain/3/control/feature-poweroff deleted
    orphaned node /local/domain/3/control/feature-reboot deleted
    orphaned node /local/domain/3/control/feature-suspend deleted
    orphaned node /local/domain/3/control/feature-s3 deleted
    orphaned node /local/domain/3/control/feature-s4 deleted
    orphaned node /local/domain/3/control/sysrq deleted
    orphaned node /local/domain/3/data deleted
    orphaned node /local/domain/3/drivers deleted
    orphaned node /local/domain/3/feature deleted
    orphaned node /local/domain/3/attr deleted
    orphaned node /local/domain/3/error deleted
    orphaned node /local/domain/3/console/backend-id deleted
    
    and no further output.
    
    The trace shows that DESTROY was called for connection 0x559fae724290,
    but that is the same pointer (conn) main() was looping through from
    connections.  So it wasn't actually removed from the connections list?
    
    Reverting commit e8e6e42279a5 "tools/xenstore: simplify loop handling
    connection I/O" fixes the abort/double free.  I think the use of
    list_for_each_entry_safe is incorrect.  list_for_each_entry_safe makes
    traversal safe for deleting the current iterator, but RELEASE/do_release
    will delete some other entry in the connections list.  I think the
    observed abort is because list_for_each_entry has next pointing to the
    deleted connection, and it is used in the subsequent iteration.
    
    Add a comment explaining the unsuitability of list_for_each_entry_safe.
    Also notice that the old code takes a reference on next which would
    prevents a use-after-free.
    
    This reverts commit e8e6e42279a5723239c5c40ba4c7f579a979465d.
    
    This is XSA-425/CVE-2022-42330.
    
    Fixes: e8e6e42279a5 ("tools/xenstore: simplify loop handling connection I/O")
    Signed-off-by: Jason Andryuk <jandryuk@gmail.com>
    Reviewed-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Julien Grall <jgrall@amazon.com>
---
 tools/xenstore/xenstored_core.c | 19 +++++++++++++++++--
 1 file changed, 17 insertions(+), 2 deletions(-)

diff --git a/tools/xenstore/xenstored_core.c b/tools/xenstore/xenstored_core.c
index 27dfbe9593..4f00e0cdc0 100644
--- a/tools/xenstore/xenstored_core.c
+++ b/tools/xenstore/xenstored_core.c
@@ -3008,8 +3008,23 @@ int main(int argc, char *argv[])
 			}
 		}
 
-		list_for_each_entry_safe(conn, next, &connections, list) {
-			talloc_increase_ref_count(conn);
+		/*
+		 * list_for_each_entry_safe is not suitable here because
+		 * handle_input may delete entries besides the current one, but
+		 * those may be in the temporary next which would trigger a
+		 * use-after-free.  list_for_each_entry_safe is only safe for
+		 * deleting the current entry.
+		 */
+		next = list_entry(connections.next, typeof(*conn), list);
+		if (&next->list != &connections)
+			talloc_increase_ref_count(next);
+		while (&next->list != &connections) {
+			conn = next;
+
+			next = list_entry(conn->list.next,
+					  typeof(*conn), list);
+			if (&next->list != &connections)
+				talloc_increase_ref_count(next);
 
 			if (conn_can_read(conn))
 				handle_input(conn);
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sun Feb 05 04:21:12 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 05 Feb 2023 04:21:12 +0000
Received: from list by lists.xenproject.org with outflank-mailman.489748.758269 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pOWWc-0003hI-FW; Sun, 05 Feb 2023 04:21:10 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 489748.758269; Sun, 05 Feb 2023 04:21: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 1pOWWc-0003hA-CG; Sun, 05 Feb 2023 04:21:10 +0000
Received: by outflank-mailman (input) for mailman id 489748;
 Sun, 05 Feb 2023 04:21: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 1pOWWa-0003gl-E5
 for xen-changelog@lists.xenproject.org; Sun, 05 Feb 2023 04:21:08 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pOWWa-0001KH-CS
 for xen-changelog@lists.xenproject.org; Sun, 05 Feb 2023 04:21:08 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pOWWa-0000MO-Bm
 for xen-changelog@lists.xenproject.org; Sun, 05 Feb 2023 04:21: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=WBO240SFBAjkkinDe5KdqPYCHitbtG226oM3PnmJLF4=; b=LuHAW/im9k6jESzrUIEX+srlwB
	OVGMse4pBA42WR1PdNe0Th6XtRDWGRgLp5zhJ/n1VcW7lrLA5wwTJE8uxszxBdaBIn4Bo8LM+GpsX
	Td17Sh978Hv4dLggy5YGKa1j6/W41G1OSC3qMeAVyz4w06U66b6Ilvr9snq0NoCzGBYQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] libxl: fix guest kexec - skip cpuid policy
Message-Id: <E1pOWWa-0000MO-Bm@xenbits.xenproject.org>
Date: Sun, 05 Feb 2023 04:21:08 +0000

commit 1e454c2b5b1172e0fc7457e411ebaba61db8fc87
Author:     Jason Andryuk <jandryuk@gmail.com>
AuthorDate: Thu Jan 26 10:58:23 2023 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Jan 26 10:58:23 2023 +0100

    libxl: fix guest kexec - skip cpuid policy
    
    When a domain performs a kexec (soft reset), libxl__build_pre() is
    called with the existing domid.  Calling libxl__cpuid_legacy() on the
    existing domain fails since the cpuid policy has already been set, and
    the guest isn't rebuilt and doesn't kexec.
    
    xc: error: Failed to set d1's policy (err leaf 0xffffffff, subleaf 0xffffffff, msr 0xffffffff) (17 = File exists): Internal error
    libxl: error: libxl_cpuid.c:494:libxl__cpuid_legacy: Domain 1:Failed to apply CPUID policy: File exists
    libxl: error: libxl_create.c:1641:domcreate_rebuild_done: Domain 1:cannot (re-)build domain: -3
    libxl: error: libxl_xshelp.c:201:libxl__xs_read_mandatory: xenstore read failed: `/libxl/1/type': No such file or directory
    libxl: warning: libxl_dom.c:49:libxl__domain_type: unable to get domain type for domid=1, assuming HVM
    
    During a soft_reset, skip calling libxl__cpuid_legacy() to avoid the
    issue.  Before commit 34990446ca91, the libxl__cpuid_legacy() failure
    would have been ignored, so kexec would continue.
    
    Fixes: 34990446ca91 ("libxl: don't ignore the return value from xc_cpuid_apply_policy")
    Signed-off-by: Jason Andryuk <jandryuk@gmail.com>
    Reviewed-by: Anthony PERARD <anthony.perard@citrix.com>
---
 tools/libs/light/libxl_create.c   | 2 ++
 tools/libs/light/libxl_dom.c      | 2 +-
 tools/libs/light/libxl_internal.h | 1 +
 3 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/tools/libs/light/libxl_create.c b/tools/libs/light/libxl_create.c
index beec3f6b6f..ec8eab02c2 100644
--- a/tools/libs/light/libxl_create.c
+++ b/tools/libs/light/libxl_create.c
@@ -2207,6 +2207,8 @@ static int do_domain_soft_reset(libxl_ctx *ctx,
                               aop_console_how);
     cdcs->domid_out = &domid_out;
 
+    state->soft_reset = true;
+
     dom_path = libxl__xs_get_dompath(gc, domid);
     if (!dom_path) {
         LOGD(ERROR, domid, "failed to read domain path");
diff --git a/tools/libs/light/libxl_dom.c b/tools/libs/light/libxl_dom.c
index b454f988fb..f6311eea6e 100644
--- a/tools/libs/light/libxl_dom.c
+++ b/tools/libs/light/libxl_dom.c
@@ -382,7 +382,7 @@ int libxl__build_pre(libxl__gc *gc, uint32_t domid,
     /* Construct a CPUID policy, but only for brand new domains.  Domains
      * being migrated-in/restored have CPUID handled during the
      * static_data_done() callback. */
-    if (!state->restore)
+    if (!state->restore && !state->soft_reset)
         rc = libxl__cpuid_legacy(ctx, domid, false, info);
 
 out:
diff --git a/tools/libs/light/libxl_internal.h b/tools/libs/light/libxl_internal.h
index 0dc8b8f210..ad982d691a 100644
--- a/tools/libs/light/libxl_internal.h
+++ b/tools/libs/light/libxl_internal.h
@@ -1411,6 +1411,7 @@ typedef struct {
     /* Whether this domain is being migrated/restored, or booting fresh.  Only
      * applicable to the primary domain, not support domains (e.g. stub QEMU). */
     bool restore;
+    bool soft_reset;
 } libxl__domain_build_state;
 
 _hidden void libxl__domain_build_state_init(libxl__domain_build_state *s);
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sun Feb 05 04:21:20 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 05 Feb 2023 04:21:20 +0000
Received: from list by lists.xenproject.org with outflank-mailman.489749.758273 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pOWWm-0003js-Gx; Sun, 05 Feb 2023 04:21:20 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 489749.758273; Sun, 05 Feb 2023 04:21: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 1pOWWm-0003jk-Dm; Sun, 05 Feb 2023 04:21:20 +0000
Received: by outflank-mailman (input) for mailman id 489749;
 Sun, 05 Feb 2023 04:21: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 1pOWWk-0003jX-G9
 for xen-changelog@lists.xenproject.org; Sun, 05 Feb 2023 04:21:18 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pOWWk-0001KS-FX
 for xen-changelog@lists.xenproject.org; Sun, 05 Feb 2023 04:21:18 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pOWWk-0000Mn-Eq
 for xen-changelog@lists.xenproject.org; Sun, 05 Feb 2023 04:21: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=ljVveW9PwmS7vdYbth+TPt/egpzLhadFrx/aer7Qz1Y=; b=0kTLZAZoRlIYYoPFh+Cgl2l8VR
	hvGwbW0bh+xeVZUON3zmSSVU139YPVSv2Na8F9cNGE3IZ3ux7cvgiYuAj2ngL9xOTVXXggIqetz60
	oRA/w/mHadFaMGcCUbqykDaDmW1+YqB/jdJypau6uLKp4Ka7IQKfX0E7l/B8miS/+MJw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/shadow: Fix PV32 shadowing when CONFIG_HVM is enabled
Message-Id: <E1pOWWk-0000Mn-Eq@xenbits.xenproject.org>
Date: Sun, 05 Feb 2023 04:21:18 +0000

commit 10b80ee5588e8928b266dea02a5e99d098bd227a
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Wed Jan 25 16:18:16 2023 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Jan 26 12:15:59 2023 +0000

    x86/shadow: Fix PV32 shadowing when CONFIG_HVM is enabled
    
    The OSSTest bisector identified an issue with c/s 1894049fa283 ("x86/shadow:
    L2H shadow type is PV32-only") in !HVM builds.
    
    The bug is ultimately caused by sh_type_to_size[] not actually being specific
    to HVM guests, and it's position in shadow/hvm.c mislead the reasoning.
    
    To fix the issue that OSSTest identified, SH_type_l2h_64_shadow must still
    have the value 1 in any CONFIG_PV32 build.  But simply adjusting this leaves
    us with misleading logic, and a reasonable chance of making a related error
    again in the future.
    
    In hindsight, moving sh_type_to_size[] out of common.c in the first place a
    mistake.  Therefore, move sh_type_to_size[] back to living in common.c,
    leaving a comment explaining why it happens to be inside an HVM conditional.
    
    This effectively reverts the second half of 4fec945409fc ("x86/shadow: adjust
    and move sh_type_to_size[]") while retaining the other improvements from the
    same changeset.
    
    While making this change, also adjust the sh_type_to_size[] declaration to
    match its definition.
    
    Fixes: 4fec945409fc ("x86/shadow: adjust and move sh_type_to_size[]")
    Fixes: 1894049fa283 ("x86/shadow: L2H shadow type is PV32-only")
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: George Dunlap <george.dunlap@cloud.com>
---
 xen/arch/x86/mm/shadow/common.c  | 38 ++++++++++++++++++++++++++++++++++++++
 xen/arch/x86/mm/shadow/hvm.c     | 31 -------------------------------
 xen/arch/x86/mm/shadow/private.h |  2 +-
 3 files changed, 39 insertions(+), 32 deletions(-)

diff --git a/xen/arch/x86/mm/shadow/common.c b/xen/arch/x86/mm/shadow/common.c
index 26901b8b3b..a74b15e3e7 100644
--- a/xen/arch/x86/mm/shadow/common.c
+++ b/xen/arch/x86/mm/shadow/common.c
@@ -39,6 +39,44 @@
 #include <public/sched.h>
 #include "private.h"
 
+/*
+ * This table shows the allocation behaviour of the different modes:
+ *
+ * Xen paging      64b  64b  64b
+ * Guest paging    32b  pae  64b
+ * PV or HVM       HVM  HVM   *
+ * Shadow paging   pae  pae  64b
+ *
+ * sl1 size         8k   4k   4k
+ * sl2 size        16k   4k   4k
+ * sl3 size         -    -    4k
+ * sl4 size         -    -    4k
+ *
+ * Note: our accessor, shadow_size(), can optimise out this table in PV-only
+ * builds.
+ */
+#ifdef CONFIG_HVM
+const uint8_t sh_type_to_size[] = {
+    [SH_type_l1_32_shadow]   = 2,
+    [SH_type_fl1_32_shadow]  = 2,
+    [SH_type_l2_32_shadow]   = 4,
+    [SH_type_l1_pae_shadow]  = 1,
+    [SH_type_fl1_pae_shadow] = 1,
+    [SH_type_l2_pae_shadow]  = 1,
+    [SH_type_l1_64_shadow]   = 1,
+    [SH_type_fl1_64_shadow]  = 1,
+    [SH_type_l2_64_shadow]   = 1,
+#ifdef CONFIG_PV32
+    [SH_type_l2h_64_shadow]  = 1,
+#endif
+    [SH_type_l3_64_shadow]   = 1,
+    [SH_type_l4_64_shadow]   = 1,
+    [SH_type_p2m_table]      = 1,
+    [SH_type_monitor_table]  = 1,
+    [SH_type_oos_snapshot]   = 1,
+};
+#endif /* CONFIG_HVM */
+
 DEFINE_PER_CPU(uint32_t,trace_shadow_path_flags);
 
 static int cf_check sh_enable_log_dirty(struct domain *, bool log_global);
diff --git a/xen/arch/x86/mm/shadow/hvm.c b/xen/arch/x86/mm/shadow/hvm.c
index 918865cf1b..88c3c16322 100644
--- a/xen/arch/x86/mm/shadow/hvm.c
+++ b/xen/arch/x86/mm/shadow/hvm.c
@@ -33,37 +33,6 @@
 
 #include "private.h"
 
-/*
- * This table shows the allocation behaviour of the different modes:
- *
- * Xen paging      64b  64b  64b
- * Guest paging    32b  pae  64b
- * PV or HVM       HVM  HVM   *
- * Shadow paging   pae  pae  64b
- *
- * sl1 size         8k   4k   4k
- * sl2 size        16k   4k   4k
- * sl3 size         -    -    4k
- * sl4 size         -    -    4k
- */
-const uint8_t sh_type_to_size[] = {
-    [SH_type_l1_32_shadow]   = 2,
-    [SH_type_fl1_32_shadow]  = 2,
-    [SH_type_l2_32_shadow]   = 4,
-    [SH_type_l1_pae_shadow]  = 1,
-    [SH_type_fl1_pae_shadow] = 1,
-    [SH_type_l2_pae_shadow]  = 1,
-    [SH_type_l1_64_shadow]   = 1,
-    [SH_type_fl1_64_shadow]  = 1,
-    [SH_type_l2_64_shadow]   = 1,
-/*  [SH_type_l2h_64_shadow]  = 1,  PV32-only */
-    [SH_type_l3_64_shadow]   = 1,
-    [SH_type_l4_64_shadow]   = 1,
-    [SH_type_p2m_table]      = 1,
-    [SH_type_monitor_table]  = 1,
-    [SH_type_oos_snapshot]   = 1,
-};
-
 /**************************************************************************/
 /* x86 emulator support for the shadow code
  */
diff --git a/xen/arch/x86/mm/shadow/private.h b/xen/arch/x86/mm/shadow/private.h
index 7d6c846c80..79d82364fc 100644
--- a/xen/arch/x86/mm/shadow/private.h
+++ b/xen/arch/x86/mm/shadow/private.h
@@ -362,7 +362,7 @@ static inline int mfn_oos_may_write(mfn_t gmfn)
 #endif /* (SHADOW_OPTIMIZATIONS & SHOPT_OUT_OF_SYNC) */
 
 /* Figure out the size (in pages) of a given shadow type */
-extern const u8 sh_type_to_size[SH_type_unused];
+extern const uint8_t sh_type_to_size[SH_type_unused];
 static inline unsigned int
 shadow_size(unsigned int shadow_type)
 {
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sun Feb 05 04:21:30 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 05 Feb 2023 04:21:30 +0000
Received: from list by lists.xenproject.org with outflank-mailman.489750.758276 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pOWWw-0003mm-IV; Sun, 05 Feb 2023 04:21:30 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 489750.758276; Sun, 05 Feb 2023 04:21: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 1pOWWw-0003me-FJ; Sun, 05 Feb 2023 04:21:30 +0000
Received: by outflank-mailman (input) for mailman id 489750;
 Sun, 05 Feb 2023 04:21: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 1pOWWu-0003mK-JC
 for xen-changelog@lists.xenproject.org; Sun, 05 Feb 2023 04:21:28 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pOWWu-0001Kg-IW
 for xen-changelog@lists.xenproject.org; Sun, 05 Feb 2023 04:21:28 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pOWWu-0000NF-Ho
 for xen-changelog@lists.xenproject.org; Sun, 05 Feb 2023 04:21: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=ro0GUn7dwT32u1p725LJWgvnNJ8ezGNApujgegHMcrw=; b=yL5PYGboEOoNxoe7pM5rD23ZFZ
	s9z1lxe/Mx844DOIHaenogtW7pmk/iK00Mh3n+epz9vlwyDJi2fDOjzZRCwIB1u9Zaq0FHM+xoyuW
	zK3QxtV4bJXojgGA3DbGAgiw3W3k976+FoPytSRbkvTSn3dQppheMdQKBXnXScwrjehM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/arm: Probe the load/entry point address of an uImage correctly
Message-Id: <E1pOWWu-0000NF-Ho@xenbits.xenproject.org>
Date: Sun, 05 Feb 2023 04:21:28 +0000

commit 78e93e6e57c218eead498a664785f414bcb12460
Author:     Ayan Kumar Halder <ayan.kumar.halder@amd.com>
AuthorDate: Wed Jan 25 11:21:31 2023 +0000
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Mon Jan 30 12:54:47 2023 -0800

    xen/arm: Probe the load/entry point address of an uImage correctly
    
    Currently, kernel_uimage_probe() does not read the load/entry point address
    set in the uImge header. Thus, info->zimage.start is 0 (default value). This
    causes, kernel_zimage_place() to treat the binary (contained within uImage)
    as position independent executable. Thus, it loads it at an incorrect
    address.
    
    The correct approach would be to read "uimage.load" and set
    info->zimage.start. This will ensure that the binary is loaded at the
    correct address. Also, read "uimage.ep" and set info->entry (ie kernel entry
    address).
    
    If user provides load address (ie "uimage.load") as 0x0, then the image is
    treated as position independent executable. Xen can load such an image at
    any address it considers appropriate. A position independent executable
    cannot have a fixed entry point address.
    
    This behavior is applicable for both arm32 and arm64 platforms.
    
    Earlier for arm32 and arm64 platforms, Xen was ignoring the load and entry
    point address set in the uImage header. With this commit, Xen will use them.
    This makes the behavior of Xen consistent with uboot for uimage headers.
    
    Users who want to use Xen with statically partitioned domains, can provide
    non zero load address and entry address for the dom0/domU kernel. It is
    required that the load and entry address provided must be within the memory
    region allocated by Xen.
    
    A deviation from uboot behaviour is that we consider load address == 0x0,
    to denote that the image supports position independent execution. This
    is to make the behavior consistent across uImage and zImage.
    
    Signed-off-by: Ayan Kumar Halder <ayan.kumar.halder@amd.com>
    [stefano: minor doc improvement]
    Signed-off-by: Stefano Stabellini <stefano.stabellini@amd.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
---
 docs/misc/arm/booting.txt         | 34 +++++++++++++++++++++++
 xen/arch/arm/include/asm/kernel.h |  2 +-
 xen/arch/arm/kernel.c             | 58 +++++++++++++++++++++++++++++++++++++--
 3 files changed, 90 insertions(+), 4 deletions(-)

diff --git a/docs/misc/arm/booting.txt b/docs/misc/arm/booting.txt
index 3e0c03e065..bd7bfe7f28 100644
--- a/docs/misc/arm/booting.txt
+++ b/docs/misc/arm/booting.txt
@@ -23,6 +23,36 @@ The exceptions to this on 32-bit ARM are as follows:
 
 There are no exception on 64-bit ARM.
 
+Booting Guests
+--------------
+
+Xen supports the legacy image header[3], zImage protocol for 32-bit
+ARM Linux[1] and Image protocol defined for ARM64[2].
+
+Until Xen 4.17, in case of legacy image protocol, Xen ignored the load
+address and entry point specified in the header. This has now changed.
+
+Now, it loads the image at the load address provided in the header.
+And the entry point is used as the kernel start address.
+
+A deviation from uboot is that, Xen treats "load address == 0x0" as
+position independent execution (PIE). Thus, Xen will load such an image
+at an address it considers appropriate. Also, user cannot specify the
+entry point of a PIE image since the start address cennot be
+predetermined.
+
+Users who want to use Xen with statically partitioned domains, can provide
+the fixed non zero load address and start address for the dom0/domU kernel.
+The load address and start address specified by the user in the header must
+be within the memory region allocated by Xen.
+
+Also, it is to be noted that if user provides the legacy image header on
+top of zImage or Image header, then Xen uses the attributes of legacy
+image header to determine the load address, entry point, etc.
+
+Known limitation: compressed kernels with a uboot headers are not
+working.
+
 
 Firmware/bootloader requirements
 --------------------------------
@@ -39,3 +69,7 @@ Latest version: http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/t
 
 [2] linux/Documentation/arm64/booting.rst
 Latest version: http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/Documentation/arm64/booting.rst
+
+[3] legacy format header
+Latest version: https://source.denx.de/u-boot/u-boot/-/blob/master/include/image.h#L315
+https://linux.die.net/man/1/mkimage
diff --git a/xen/arch/arm/include/asm/kernel.h b/xen/arch/arm/include/asm/kernel.h
index 5bb30c3f2f..4617cdc83b 100644
--- a/xen/arch/arm/include/asm/kernel.h
+++ b/xen/arch/arm/include/asm/kernel.h
@@ -72,7 +72,7 @@ struct kernel_info {
 #ifdef CONFIG_ARM_64
             paddr_t text_offset; /* 64-bit Image only */
 #endif
-            paddr_t start; /* 32-bit zImage only */
+            paddr_t start; /* Must be 0 for 64-bit Image */
         } zimage;
     };
 };
diff --git a/xen/arch/arm/kernel.c b/xen/arch/arm/kernel.c
index 23b840ea9e..36081e73f1 100644
--- a/xen/arch/arm/kernel.c
+++ b/xen/arch/arm/kernel.c
@@ -127,7 +127,7 @@ static paddr_t __init kernel_zimage_place(struct kernel_info *info)
     paddr_t load_addr;
 
 #ifdef CONFIG_ARM_64
-    if ( info->type == DOMAIN_64BIT )
+    if ( (info->type == DOMAIN_64BIT) && (info->zimage.start == 0) )
         return info->mem.bank[0].start + info->zimage.text_offset;
 #endif
 
@@ -162,7 +162,12 @@ static void __init kernel_zimage_load(struct kernel_info *info)
     void *kernel;
     int rc;
 
-    info->entry = load_addr;
+    /*
+     * If the image does not have a fixed entry point, then use the load
+     * address as the entry point.
+     */
+    if ( info->entry == 0 )
+        info->entry = load_addr;
 
     place_modules(info, load_addr, load_addr + len);
 
@@ -223,10 +228,38 @@ static int __init kernel_uimage_probe(struct kernel_info *info,
     if ( len > size - sizeof(uimage) )
         return -EINVAL;
 
+    info->zimage.start = be32_to_cpu(uimage.load);
+    info->entry = be32_to_cpu(uimage.ep);
+
+    /*
+     * While uboot considers 0x0 to be a valid load/start address, for Xen
+     * to maintain parity with zImage, we consider 0x0 to denote position
+     * independent image. That means Xen is free to load such an image at
+     * any valid address.
+     */
+    if ( info->zimage.start == 0 )
+        printk(XENLOG_INFO
+               "No load address provided. Xen will decide where to load it.\n");
+    else
+        printk(XENLOG_INFO
+               "Provided load address: %"PRIpaddr" and entry address: %"PRIpaddr"\n",
+               info->zimage.start, info->entry);
+
+    /*
+     * If the image supports position independent execution, then user cannot
+     * provide an entry point as Xen will load such an image at any appropriate
+     * memory address. Thus, we need to return error.
+     */
+    if ( (info->zimage.start == 0) && (info->entry != 0) )
+    {
+        printk(XENLOG_ERR
+               "Entry point cannot be non zero for PIE image.\n");
+        return -EINVAL;
+    }
+
     info->zimage.kernel_addr = addr + sizeof(uimage);
     info->zimage.len = len;
 
-    info->entry = info->zimage.start;
     info->load = kernel_zimage_load;
 
 #ifdef CONFIG_ARM_64
@@ -242,6 +275,15 @@ static int __init kernel_uimage_probe(struct kernel_info *info,
         printk(XENLOG_ERR "Unsupported uImage arch type %d\n", uimage.arch);
         return -EINVAL;
     }
+
+    /*
+     * If there is a uImage header, then we do not parse zImage or zImage64
+     * header. In other words if the user provides a uImage header on top of
+     * zImage or zImage64 header, Xen uses the attributes of uImage header only.
+     * Thus, Xen uses uimage.load attribute to determine the load address and
+     * zimage.text_offset is ignored.
+     */
+    info->zimage.text_offset = 0;
 #endif
 
     return 0;
@@ -366,6 +408,7 @@ static int __init kernel_zimage64_probe(struct kernel_info *info,
     info->zimage.kernel_addr = addr;
     info->zimage.len = end - start;
     info->zimage.text_offset = zimage.text_offset;
+    info->zimage.start = 0;
 
     info->load = kernel_zimage_load;
 
@@ -436,6 +479,15 @@ int __init kernel_probe(struct kernel_info *info,
     u64 kernel_addr, initrd_addr, dtb_addr, size;
     int rc;
 
+    /*
+     * We need to initialize start to 0. This field may be populated during
+     * kernel_xxx_probe() if the image has a fixed entry point (for e.g.
+     * uimage.ep).
+     * We will use this to determine if the image has a fixed entry point or
+     * the load address should be used as the start address.
+     */
+    info->entry = 0;
+
     /* domain is NULL only for the hardware domain */
     if ( domain == NULL )
     {
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sun Feb 05 04:21:39 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 05 Feb 2023 04:21:39 +0000
Received: from list by lists.xenproject.org with outflank-mailman.489751.758281 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pOWX5-0003pk-Np; Sun, 05 Feb 2023 04:21:39 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 489751.758281; Sun, 05 Feb 2023 04:21: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 1pOWX5-0003pc-Jt; Sun, 05 Feb 2023 04:21:39 +0000
Received: by outflank-mailman (input) for mailman id 489751;
 Sun, 05 Feb 2023 04:21: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 1pOWX4-0003pS-ME
 for xen-changelog@lists.xenproject.org; Sun, 05 Feb 2023 04:21:38 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pOWX4-0001Kv-LZ
 for xen-changelog@lists.xenproject.org; Sun, 05 Feb 2023 04:21:38 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pOWX4-0000Ng-Kl
 for xen-changelog@lists.xenproject.org; Sun, 05 Feb 2023 04:21: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=HOCNAsLBW5sZKKSyVAWh6zlFn+oVbNuta+JBLCJjz2Q=; b=qFa/kzeoGbesHZT96lCFopUaV0
	gT32M0YMUs69fXLeE40s82rkeGANVkE/V20EgTMi+gbfpcVlKm6qSEgkB8HLZcbZ45N/Yhm5lveh0
	l0ii5twrc/aRlyliHEYtKzxbMQmXnpNbu0cYY69r5Gn1+kSeXX0vkyV/Jy8Z+iEKcs2Q=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] Add more rules to docs/misra/rules.rst
Message-Id: <E1pOWX4-0000Ng-Kl@xenbits.xenproject.org>
Date: Sun, 05 Feb 2023 04:21:38 +0000

commit 4a1bceded2a986f91c76a9bd57ecd912cb61735d
Author:     Stefano Stabellini <stefano.stabellini@amd.com>
AuthorDate: Fri Jan 27 10:35:41 2023 -0800
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Thu Feb 2 12:01:10 2023 -0800

    Add more rules to docs/misra/rules.rst
    
    As agreed during the last MISRA C discussion, I am adding the following
    MISRA C rules: 7.1, 7.3, 18.3.
    
    I am also adding 13.1 that was "agreed pending an analysis on the amount
    of violations". There are zero violations reported by cppcheck.
    
    Signed-off-by: Stefano Stabellini <stefano.stabellini@amd.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 docs/misra/rules.rst | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/docs/misra/rules.rst b/docs/misra/rules.rst
index dcceab9388..83f01462f7 100644
--- a/docs/misra/rules.rst
+++ b/docs/misra/rules.rst
@@ -138,6 +138,16 @@ existing codebase are work-in-progress.
      - Single-bit named bit fields shall not be of a signed type
      -
 
+   * - `Rule 7.1 <https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/blob/master/R_07_01.c>`_
+     - Required
+     - Octal constants shall not be used
+     -
+
+   * - `Rule 7.3 <https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/blob/master/R_07_03.c>`_
+     - Required
+     - The lowercase character l shall not be used in a literal suffix
+     -
+
    * - `Rule 8.1 <https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/blob/master/R_08_01.c>`_
      - Required
      - Types shall be explicitly specified
@@ -200,6 +210,11 @@ existing codebase are work-in-progress.
        expression which has potential side effects
      -
 
+   * - `Rule 13.1 <https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/blob/master/R_13_01_1.c>`_
+     - Required
+     - Initializer lists shall not contain persistent side effects
+     -
+
    * - `Rule 14.1 <https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/blob/master/R_14_01.c>`_
      - Required
      - A loop counter shall not have essentially floating type
@@ -227,6 +242,11 @@ existing codebase are work-in-progress.
        static keyword between the [ ]
      -
 
+   * - `Rule 18.3 <https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/blob/master/R_18_03.c>`_
+     - Required
+     - The relational operators > >= < and <= shall not be applied to objects of pointer type except where they point into the same object
+     -
+
    * - `Rule 19.1 <https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/blob/master/R_19_01.c>`_
      - Mandatory
      - An object shall not be assigned or copied to an overlapping
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sun Feb 05 04:21:49 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 05 Feb 2023 04:21:49 +0000
Received: from list by lists.xenproject.org with outflank-mailman.489752.758284 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pOWXF-0003sg-OM; Sun, 05 Feb 2023 04:21:49 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 489752.758284; Sun, 05 Feb 2023 04:21: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 1pOWXF-0003sW-LW; Sun, 05 Feb 2023 04:21:49 +0000
Received: by outflank-mailman (input) for mailman id 489752;
 Sun, 05 Feb 2023 04:21: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 1pOWXE-0003sO-PB
 for xen-changelog@lists.xenproject.org; Sun, 05 Feb 2023 04:21:48 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pOWXE-0001L8-OW
 for xen-changelog@lists.xenproject.org; Sun, 05 Feb 2023 04:21:48 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pOWXE-0000O8-Nn
 for xen-changelog@lists.xenproject.org; Sun, 05 Feb 2023 04:21: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=+n0YGIkLqho+rElZVDAXNt4ybpvGJL3ARccZiqBOUXE=; b=mmEgiWfexuZJBoK1Q14qbPG4IK
	g5JjkwnNf01sP+OH7ayh7T2rYl+2L6APVH9kuIUYDww2RwplS5r/Jwg6u0hQO3gjXocpkw4ILJnhv
	KZTZVDVHUTWgIhnyRwo5qUFeDBuGa9iyf83HLHKAPfJKRlOTTRRvA0ovmm3Hp/5qKN5U=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/cppcheck: sort alphabetically cppcheck report entries
Message-Id: <E1pOWXE-0000O8-Nn@xenbits.xenproject.org>
Date: Sun, 05 Feb 2023 04:21:48 +0000

commit 94f154f1681a54a1e1d1226bd6a6ecd216f9eddc
Author:     Luca Fancellu <luca.fancellu@arm.com>
AuthorDate: Mon Jan 30 11:01:31 2023 +0000
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Thu Feb 2 12:02:43 2023 -0800

    xen/cppcheck: sort alphabetically cppcheck report entries
    
    Sort alphabetically cppcheck report entries when producing the text
    report, this will help comparing different reports and will group
    together findings from the same file.
    
    The sort operation is performed with two criteria, the first one is
    sorting by misra rule, the second one is sorting by file.
    
    Signed-off-by: Luca Fancellu <luca.fancellu@arm.com>
    [stefano: add black line for code style]
    Signed-off-by: Stefano Stabellini <stefano.stabellini@amd.com>
    Reviewed-by: Michal Orzel <michal.orzel@amd.com>
    Acked-by: Stefano Stabellini <sstabellini@kernel.org>
---
 xen/scripts/xen_analysis/cppcheck_report_utils.py | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/xen/scripts/xen_analysis/cppcheck_report_utils.py b/xen/scripts/xen_analysis/cppcheck_report_utils.py
index 02440aefdf..c5f466aff1 100644
--- a/xen/scripts/xen_analysis/cppcheck_report_utils.py
+++ b/xen/scripts/xen_analysis/cppcheck_report_utils.py
@@ -104,6 +104,14 @@ def cppcheck_merge_txt_fragments(fragments_list, out_txt_file, strip_paths):
                 for path in strip_paths:
                     text_report_content[i] = text_report_content[i].replace(
                                                                 path + "/", "")
+                    # Split by : separator
+                    text_report_content[i] = text_report_content[i].split(":")
+
+            # sort alphabetically for second field (misra rule) and as second
+            # criteria for the first field (file name)
+            text_report_content.sort(key = lambda x: (x[1], x[0]))
+            # merge back with : separator
+            text_report_content = [":".join(x) for x in text_report_content]
             # Write the final text report
             outfile.writelines(text_report_content)
     except OSError as e:
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sun Feb 05 04:21:59 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 05 Feb 2023 04:21:59 +0000
Received: from list by lists.xenproject.org with outflank-mailman.489753.758288 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pOWXP-0003vR-Pq; Sun, 05 Feb 2023 04:21:59 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 489753.758288; Sun, 05 Feb 2023 04:21: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 1pOWXP-0003vJ-Mz; Sun, 05 Feb 2023 04:21:59 +0000
Received: by outflank-mailman (input) for mailman id 489753;
 Sun, 05 Feb 2023 04:21: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 1pOWXO-0003v5-SA
 for xen-changelog@lists.xenproject.org; Sun, 05 Feb 2023 04:21:58 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pOWXO-0001LZ-RU
 for xen-changelog@lists.xenproject.org; Sun, 05 Feb 2023 04:21:58 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pOWXO-0000OX-Ql
 for xen-changelog@lists.xenproject.org; Sun, 05 Feb 2023 04:21: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=j+3i4iXFtApOla8hAVQ2P2llLdobXoPN8qEEGj5HN+Q=; b=WvzsVNGHu3ukivgIYiaquF6r4y
	xm3601qyIyfQoASHFp0ItshZuE+mnToh66X/il5yOUEwBLJQDovhK1aY6taiIDldf6rYPzzzD/L+e
	czImkPRs5xb1kZ2tNrC5ankAP2DFtXYDg55uLMvOOFcHl4rUpCBJ57qkJaUDH22LqZg4=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/cppcheck: add parameter to skip given MISRA rules
Message-Id: <E1pOWXO-0000OX-Ql@xenbits.xenproject.org>
Date: Sun, 05 Feb 2023 04:21:58 +0000

commit a21c9e6ddfee6d21dff1f18c299cb94a47b32c9e
Author:     Luca Fancellu <luca.fancellu@arm.com>
AuthorDate: Mon Jan 30 11:01:32 2023 +0000
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Thu Feb 2 12:03:10 2023 -0800

    xen/cppcheck: add parameter to skip given MISRA rules
    
    Add parameter to skip the passed MISRA rules during the cppcheck
    analysis, the rules are specified as a list of comma separated
    rules with the MISRA number notation (e.g. 1.1,1.3,...).
    
    Modify convert_misra_doc.py script to take an extra parameter
    giving a list of MISRA rule to be skipped, comma separated.
    While there, fix some typos in the help and print functions.
    
    Modify settings.py and cppcheck_analysis.py to have a new
    parameter (--cppcheck-skip-rules) used to specify a list of
    MISRA rule to be skipped during the cppcheck analysis.
    
    Signed-off-by: Luca Fancellu <luca.fancellu@arm.com>
    Acked-by: Stefano Stabellini <sstabellini@kernel.org>
---
 xen/scripts/xen_analysis/cppcheck_analysis.py |  8 ++++--
 xen/scripts/xen_analysis/settings.py          | 35 ++++++++++++++++-----------
 xen/tools/convert_misra_doc.py                | 28 ++++++++++++++-------
 3 files changed, 46 insertions(+), 25 deletions(-)

diff --git a/xen/scripts/xen_analysis/cppcheck_analysis.py b/xen/scripts/xen_analysis/cppcheck_analysis.py
index 0e952a1696..cc1f403d31 100644
--- a/xen/scripts/xen_analysis/cppcheck_analysis.py
+++ b/xen/scripts/xen_analysis/cppcheck_analysis.py
@@ -153,11 +153,15 @@ def generate_cppcheck_deps():
     if settings.cppcheck_misra:
         cppcheck_flags = cppcheck_flags + " --addon=cppcheck-misra.json"
 
+        skip_rules_arg = ""
+        if settings.cppcheck_skip_rules != "":
+            skip_rules_arg = "-s {}".format(settings.cppcheck_skip_rules)
+
         utils.invoke_command(
             "{}/convert_misra_doc.py -i {}/docs/misra/rules.rst"
-            " -o {}/cppcheck-misra.txt -j {}/cppcheck-misra.json"
+            " -o {}/cppcheck-misra.txt -j {}/cppcheck-misra.json {}"
                 .format(settings.tools_dir, settings.repo_dir,
-                        settings.outdir, settings.outdir),
+                        settings.outdir, settings.outdir, skip_rules_arg),
             False, CppcheckDepsPhaseError,
             "An error occured when running:\n{}"
         )
diff --git a/xen/scripts/xen_analysis/settings.py b/xen/scripts/xen_analysis/settings.py
index a8502e554e..8c0d357fe0 100644
--- a/xen/scripts/xen_analysis/settings.py
+++ b/xen/scripts/xen_analysis/settings.py
@@ -24,6 +24,7 @@ cppcheck_binpath = "cppcheck"
 cppcheck_html = False
 cppcheck_htmlreport_binpath = "cppcheck-htmlreport"
 cppcheck_misra = False
+cppcheck_skip_rules = ""
 make_forward_args = ""
 outdir = xen_dir
 
@@ -53,20 +54,22 @@ Cppcheck report creation phase runs only when --run-cppcheck is passed to the
 script.
 
 Options:
-  --build-only          Run only the commands to build Xen with the optional
-                        make arguments passed to the script
-  --clean-only          Run only the commands to clean the analysis artifacts
-  --cppcheck-bin=       Path to the cppcheck binary (Default: {})
-  --cppcheck-html       Produce an additional HTML output report for Cppcheck
-  --cppcheck-html-bin=  Path to the cppcheck-html binary (Default: {})
-  --cppcheck-misra      Activate the Cppcheck MISRA analysis
-  --distclean           Clean analysis artifacts and reports
-  -h, --help            Print this help
-  --no-build            Skip the build Xen phase
-  --no-clean            Don\'t clean the analysis artifacts on exit
-  --run-coverity        Run the analysis for the Coverity tool
-  --run-cppcheck        Run the Cppcheck analysis tool on Xen
-  --run-eclair          Run the analysis for the Eclair tool
+  --build-only            Run only the commands to build Xen with the optional
+                          make arguments passed to the script
+  --clean-only            Run only the commands to clean the analysis artifacts
+  --cppcheck-bin=         Path to the cppcheck binary (Default: {})
+  --cppcheck-html         Produce an additional HTML output report for Cppcheck
+  --cppcheck-html-bin=    Path to the cppcheck-html binary (Default: {})
+  --cppcheck-misra        Activate the Cppcheck MISRA analysis
+  --cppcheck-skip-rules=  List of MISRA rules to be skipped, comma separated.
+                          (e.g. --cppcheck-skip-rules=1.1,20.7,8.4)
+  --distclean             Clean analysis artifacts and reports
+  -h, --help              Print this help
+  --no-build              Skip the build Xen phase
+  --no-clean              Don\'t clean the analysis artifacts on exit
+  --run-coverity          Run the analysis for the Coverity tool
+  --run-cppcheck          Run the Cppcheck analysis tool on Xen
+  --run-eclair            Run the analysis for the Eclair tool
 """
     print(msg.format(sys.argv[0], cppcheck_binpath,
                      cppcheck_htmlreport_binpath))
@@ -78,6 +81,7 @@ def parse_commandline(argv):
     global cppcheck_html
     global cppcheck_htmlreport_binpath
     global cppcheck_misra
+    global cppcheck_skip_rules
     global make_forward_args
     global outdir
     global step_get_make_vars
@@ -115,6 +119,9 @@ def parse_commandline(argv):
             cppcheck_htmlreport_binpath = args_with_content_regex.group(2)
         elif option == "--cppcheck-misra":
             cppcheck_misra = True
+        elif args_with_content_regex and \
+             args_with_content_regex.group(1) == "--cppcheck-skip-rules":
+            cppcheck_skip_rules = args_with_content_regex.group(2)
         elif option == "--distclean":
             target_distclean = True
         elif (option == "--help") or (option == "-h"):
diff --git a/xen/tools/convert_misra_doc.py b/xen/tools/convert_misra_doc.py
index 13074d8a2e..8984ec625f 100755
--- a/xen/tools/convert_misra_doc.py
+++ b/xen/tools/convert_misra_doc.py
@@ -4,12 +4,14 @@
 This script is converting the misra documentation RST file into a text file
 that can be used as text-rules for cppcheck.
 Usage:
-    convert_misr_doc.py -i INPUT [-o OUTPUT] [-j JSON]
+    convert_misra_doc.py -i INPUT [-o OUTPUT] [-j JSON] [-s RULES,[...,RULES]]
 
     INPUT  - RST file containing the list of misra rules.
     OUTPUT - file to store the text output to be used by cppcheck.
              If not specified, the result will be printed to stdout.
     JSON   - cppcheck json file to be created (optional).
+    RULES  - list of rules to skip during the analysis, comma separated
+             (e.g. 1.1,1.2,1.3,...)
 """
 
 import sys, getopt, re
@@ -47,21 +49,25 @@ def main(argv):
     outfile = ''
     outstr = sys.stdout
     jsonfile = ''
+    force_skip = ''
 
     try:
-        opts, args = getopt.getopt(argv,"hi:o:j:",["input=","output=","json="])
+        opts, args = getopt.getopt(argv,"hi:o:j:s:",
+                                   ["input=","output=","json=","skip="])
     except getopt.GetoptError:
-        print('convert-misra.py -i <input> [-o <output>] [-j <json>')
+        print('convert-misra.py -i <input> [-o <output>] [-j <json>] [-s <rules>]')
         sys.exit(2)
     for opt, arg in opts:
         if opt == '-h':
-            print('convert-misra.py -i <input> [-o <output>] [-j <json>')
+            print('convert-misra.py -i <input> [-o <output>] [-j <json>] [-s <rules>]')
             print('  If output is not specified, print to stdout')
             sys.exit(1)
         elif opt in ("-i", "--input"):
             infile = arg
         elif opt in ("-o", "--output"):
             outfile = arg
+        elif opt in ("-s", "--skip"):
+            force_skip = arg
         elif opt in ("-j", "--json"):
             jsonfile = arg
 
@@ -169,14 +175,18 @@ def main(argv):
 
     skip_list = []
 
+    # Add rules to be skipped anyway
+    for r in force_skip.split(','):
+        skip_list.append(r)
+
     # Search for missing rules and add a dummy text with the rule number
     for i in misra_c2012_rules:
         for j in list(range(1,misra_c2012_rules[i]+1)):
-            if str(i) + '.' + str(j) not in rule_list:
-                outstr.write('Rule ' + str(i) + '.' + str(j) + '\n')
-                outstr.write('No description for rule ' + str(i) + '.' + str(j)
-                             + '\n')
-                skip_list.append(str(i) + '.' + str(j))
+            rule_str = str(i) + '.' + str(j)
+            if (rule_str not in rule_list) and (rule_str not in skip_list):
+                outstr.write('Rule ' + rule_str + '\n')
+                outstr.write('No description for rule ' + rule_str + '\n')
+                skip_list.append(rule_str)
 
     # Make cppcheck happy by starting the appendix
     outstr.write('Appendix B\n')
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Feb 08 02:44:11 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 08 Feb 2023 02:44:11 +0000
Received: from list by lists.xenproject.org with outflank-mailman.491484.760577 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pPaRH-0006qw-76; Wed, 08 Feb 2023 02:44:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 491484.760577; Wed, 08 Feb 2023 02: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 1pPaRH-0006qn-4G; Wed, 08 Feb 2023 02:44:03 +0000
Received: by outflank-mailman (input) for mailman id 491484;
 Wed, 08 Feb 2023 02: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 1pPaRG-0006qh-4z
 for xen-changelog@lists.xenproject.org; Wed, 08 Feb 2023 02:44:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pPaRG-0003JM-2s
 for xen-changelog@lists.xenproject.org; Wed, 08 Feb 2023 02:44:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pPaRG-0000Mg-1s
 for xen-changelog@lists.xenproject.org; Wed, 08 Feb 2023 02:44:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=YXcy5jrlZ5drSWTscEaPVqGgb2Tyo5OQkcTUjN+SEVU=; b=c/+znq2atXsorxNxSJRg4FbE9Q
	I3GqRozDBgA5FKoPcPrVuxJTURwBv3oGWfS5gF3pwXKeta6tvvElemRAEU9of0baVxf/pH5Z/BKxx
	Fmas3H/y8hD/OSmU8lrH5a0ZKJTWZXRT6Z8Xme+FkApBQsQ7P0r4FdWs5My581rIbOPs=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools/python: change 's#' size type for Python >= 3.10
Message-Id: <E1pPaRG-0000Mg-1s@xenbits.xenproject.org>
Date: Wed, 08 Feb 2023 02:44:02 +0000

commit 897257ba49d0a6ddcf084960fd792ccce9c40f94
Author:     Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
AuthorDate: Mon Feb 6 08:50:13 2023 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Feb 6 08:50:13 2023 +0100

    tools/python: change 's#' size type for Python >= 3.10
    
    Python < 3.10 by default uses 'int' type for data+size string types
    (s#), unless PY_SSIZE_T_CLEAN is defined - in which case it uses
    Py_ssize_t. The former behavior was removed in Python 3.10 and now it's
    required to define PY_SSIZE_T_CLEAN before including Python.h, and using
    Py_ssize_t for the length argument. The PY_SSIZE_T_CLEAN behavior is
    supported since Python 2.5.
    
    Adjust bindings accordingly.
    
    Signed-off-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
    Reviewed-by: Anthony PERARD <anthony.perard@citrix.com>
---
 tools/python/xen/lowlevel/xc/xc.c | 3 ++-
 tools/python/xen/lowlevel/xs/xs.c | 3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/tools/python/xen/lowlevel/xc/xc.c b/tools/python/xen/lowlevel/xc/xc.c
index fd00861032..cfb2734a99 100644
--- a/tools/python/xen/lowlevel/xc/xc.c
+++ b/tools/python/xen/lowlevel/xc/xc.c
@@ -4,6 +4,7 @@
  * Copyright (c) 2003-2004, K A Fraser (University of Cambridge)
  */
 
+#define PY_SSIZE_T_CLEAN
 #include <Python.h>
 #define XC_WANT_COMPAT_MAP_FOREIGN_API
 #include <xenctrl.h>
@@ -1774,7 +1775,7 @@ static PyObject *pyflask_load(PyObject *self, PyObject *args, PyObject *kwds)
 {
     xc_interface *xc_handle;
     char *policy;
-    uint32_t len;
+    Py_ssize_t len;
     int ret;
 
     static char *kwd_list[] = { "policy", NULL };
diff --git a/tools/python/xen/lowlevel/xs/xs.c b/tools/python/xen/lowlevel/xs/xs.c
index 0dad7fa5f2..3ba5a8b893 100644
--- a/tools/python/xen/lowlevel/xs/xs.c
+++ b/tools/python/xen/lowlevel/xs/xs.c
@@ -18,6 +18,7 @@
  * Copyright (C) 2005 XenSource Ltd.
  */
 
+#define PY_SSIZE_T_CLEAN
 #include <Python.h>
 
 #include <stdbool.h>
@@ -141,7 +142,7 @@ static PyObject *xspy_write(XsHandle *self, PyObject *args)
     char *thstr;
     char *path;
     char *data;
-    int data_n;
+    Py_ssize_t data_n;
     bool result;
 
     if (!xh)
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Feb 08 02:44:13 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 08 Feb 2023 02:44:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.491485.760580 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pPaRR-0006sd-8N; Wed, 08 Feb 2023 02:44:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 491485.760580; Wed, 08 Feb 2023 02: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 1pPaRR-0006sV-5l; Wed, 08 Feb 2023 02:44:13 +0000
Received: by outflank-mailman (input) for mailman id 491485;
 Wed, 08 Feb 2023 02: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 1pPaRQ-0006sL-7J
 for xen-changelog@lists.xenproject.org; Wed, 08 Feb 2023 02:44:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pPaRQ-0003JQ-6d
 for xen-changelog@lists.xenproject.org; Wed, 08 Feb 2023 02:44:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pPaRQ-0000ND-5H
 for xen-changelog@lists.xenproject.org; Wed, 08 Feb 2023 02:44:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=dOvHCmzr2iKRS7/9Ihs60i2dBgnLwC7/ERqo/4Vf9E8=; b=FbQ+4Rr/LMq0u05jx54N6SBQJI
	O0UyXfYhGY6do1c9ozy2wpAFLINqXzUgAA3g3gKR9KVKKWlP4a7Ga4eRVI4x6999r+J09H/7PWJxI
	gLY43QC4zuO6S0D/SeWUIAWIDJ+fxlXvo8EZ5v56uDuQRPenUMF0CEkE49v4/dYZ/cWU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/emulate: remove unused svm specific header
Message-Id: <E1pPaRQ-0000ND-5H@xenbits.xenproject.org>
Date: Wed, 08 Feb 2023 02:44:12 +0000

commit efce4192837f29fb597c77e6887aac83851e88fc
Author:     Xenia Ragiadakou <burzalodowa@gmail.com>
AuthorDate: Mon Feb 6 08:50:32 2023 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Feb 6 08:50:32 2023 +0100

    x86/emulate: remove unused svm specific header
    
    Fixes: 2191599bacb7 ("x86/emul: Simplfy emulation state setup")
    Signed-off-by: Xenia Ragiadakou <burzalodowa@gmail.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/hvm/emulate.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/xen/arch/x86/hvm/emulate.c b/xen/arch/x86/hvm/emulate.c
index cb221f70e8..95364deb19 100644
--- a/xen/arch/x86/hvm/emulate.c
+++ b/xen/arch/x86/hvm/emulate.c
@@ -24,7 +24,6 @@
 #include <asm/hvm/monitor.h>
 #include <asm/hvm/trace.h>
 #include <asm/hvm/support.h>
-#include <asm/hvm/svm/svm.h>
 #include <asm/iocap.h>
 #include <asm/vm_event.h>
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Feb 08 02:44:23 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 08 Feb 2023 02:44:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.491488.760585 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pPaRb-0006vN-BO; Wed, 08 Feb 2023 02:44:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 491488.760585; Wed, 08 Feb 2023 02: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 1pPaRb-0006vF-8j; Wed, 08 Feb 2023 02:44:23 +0000
Received: by outflank-mailman (input) for mailman id 491488;
 Wed, 08 Feb 2023 02:44:22 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pPaRa-0006v2-AP
 for xen-changelog@lists.xenproject.org; Wed, 08 Feb 2023 02:44:22 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pPaRa-0003K3-9a
 for xen-changelog@lists.xenproject.org; Wed, 08 Feb 2023 02:44:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pPaRa-0000Ng-8m
 for xen-changelog@lists.xenproject.org; Wed, 08 Feb 2023 02:44:22 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=psiF1XdG9x3nKttkoAsT3f5jEshk2NCedhuYImvv81k=; b=RvtCHmKNUHja5On7kDN7nIAHjJ
	mt2L8/dukSpq9Xw4/+Zb0+2dm00TUhDD7iUCCQ0Av+oSZnbyY+NOegAoGyvaNt7dz2m2KNLdzHhOj
	LvBzD5QydyCOejwUO2AHNX+JFoKeLLsRH41tf9a25VZUY+SrFq7fVTTTALd91Oc7CK2o=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/vpmu: remove unused svm and vmx specific headers
Message-Id: <E1pPaRa-0000Ng-8m@xenbits.xenproject.org>
Date: Wed, 08 Feb 2023 02:44:22 +0000

commit 207e584bd6d46ce437d970935b9db98b73344690
Author:     Xenia Ragiadakou <burzalodowa@gmail.com>
AuthorDate: Mon Feb 6 08:51:39 2023 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Feb 6 08:51:39 2023 +0100

    x86/vpmu: remove unused svm and vmx specific headers
    
    Fixes: 8c20aca6751b ("x86/vPMU: invoke <vendor>_vpmu_initialise() through a hook as well")
    Signed-off-by: Xenia Ragiadakou <burzalodowa@gmail.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/cpu/vpmu.c | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/xen/arch/x86/cpu/vpmu.c b/xen/arch/x86/cpu/vpmu.c
index 64cdbfc48c..33e2fca8cd 100644
--- a/xen/arch/x86/cpu/vpmu.c
+++ b/xen/arch/x86/cpu/vpmu.c
@@ -31,10 +31,6 @@
 #include <asm/p2m.h>
 #include <asm/vpmu.h>
 #include <asm/hvm/support.h>
-#include <asm/hvm/vmx/vmx.h>
-#include <asm/hvm/vmx/vmcs.h>
-#include <asm/hvm/svm/svm.h>
-#include <asm/hvm/svm/vmcb.h>
 #include <asm/apic.h>
 #include <irq_vectors.h>
 #include <public/pmu.h>
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Feb 08 02:44:33 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 08 Feb 2023 02:44:33 +0000
Received: from list by lists.xenproject.org with outflank-mailman.491489.760589 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pPaRl-0006yS-Cv; Wed, 08 Feb 2023 02:44:33 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 491489.760589; Wed, 08 Feb 2023 02: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 1pPaRl-0006yK-AF; Wed, 08 Feb 2023 02:44:33 +0000
Received: by outflank-mailman (input) for mailman id 491489;
 Wed, 08 Feb 2023 02:44:32 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pPaRk-0006yB-DJ
 for xen-changelog@lists.xenproject.org; Wed, 08 Feb 2023 02:44:32 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pPaRk-0003KL-Ce
 for xen-changelog@lists.xenproject.org; Wed, 08 Feb 2023 02:44:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pPaRk-0000O6-Bo
 for xen-changelog@lists.xenproject.org; Wed, 08 Feb 2023 02:44:32 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=1iGhxXIFHEmSWcrRilL/Hjd+5DDdPk7YT/hn33Rv1vg=; b=ZJsgo6J9N1+DT14nSsmJoUuBj0
	UNMz6kC6bOpZElmZgBFcA0AX8BEa4/zFouNybB9zjYgmuZN8aLiiSyj++7uKxW5xaVqd3TBLmCxC5
	d3K+motnWXqt0ACkA4epCZArQxythtjpDLzMPCKpS0d9s4tgC3tQP1K1sDvScJgnqI38=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/public: move xenstore related doc into 9pfs.h
Message-Id: <E1pPaRk-0000O6-Bo@xenbits.xenproject.org>
Date: Wed, 08 Feb 2023 02:44:32 +0000

commit ad58142e73a9dca3f90917f65819337ea1e921fb
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Mon Feb 6 08:52:15 2023 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Feb 6 08:52:15 2023 +0100

    xen/public: move xenstore related doc into 9pfs.h
    
    The Xenstore related documentation is currently to be found in
    docs/misc/9pfs.pandoc, instead of the related header file
    xen/include/public/io/9pfs.h like for most other paravirtualized
    device protocols.
    
    There is a comment in the header pointing at the document, but the
    given file name is wrong. Additionally such headers are meant to be
    copied into consuming projects (Linux kernel, qemu, etc.), so pointing
    at a doc file in the Xen git repository isn't really helpful for the
    consumers of the header.
    
    This situation is far from ideal, which is already being proved by the
    fact that neither qemu nor the Linux kernel are implementing the
    device attach/detach protocol correctly.
    
    Change that by moving the Xenstore related 9pfs documentation from
    docs/misc/9pfs.pandoc into xen/include/public/io/9pfs.h.
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Julien Grall <jgrall@amazon.com>
---
 docs/misc/9pfs.pandoc        | 153 ++-------------------------------------
 xen/include/public/io/9pfs.h | 166 ++++++++++++++++++++++++++++++++++++++++++-
 2 files changed, 169 insertions(+), 150 deletions(-)

diff --git a/docs/misc/9pfs.pandoc b/docs/misc/9pfs.pandoc
index b034fb5fa6..5c82625040 100644
--- a/docs/misc/9pfs.pandoc
+++ b/docs/misc/9pfs.pandoc
@@ -59,155 +59,10 @@ This document does not cover the 9pfs client/server design or
 implementation, only the transport for it.
 
 
-## Xenstore
+## Configuration
 
-The frontend and the backend connect via xenstore to exchange
-information. The toolstack creates front and back nodes with state
-[XenbusStateInitialising]. The protocol node name is **9pfs**.
-
-Multiple rings are supported for each frontend and backend connection.
-
-### Backend XenBus Nodes
-
-Backend specific properties, written by the backend, read by the
-frontend:
-
-    versions
-         Values:         <string>
-
-         List of comma separated protocol versions supported by the backend.
-         For example "1,2,3". Currently the value is just "1", as there is
-         only one version. N.B.: this is the version of the Xen trasport
-         protocol, not the version of 9pfs supported by the server.
-
-    max-rings
-         Values:         <uint32_t>
-
-         The maximum supported number of rings per frontend.
-
-    max-ring-page-order
-         Values:         <uint32_t>
-
-         The maximum supported size of a memory allocation in units of
-         log2n(machine pages), e.g. 1 = 2 pages, 2 == 4 pages, etc. It
-         must be at least 1.
-
-Backend configuration nodes, written by the toolstack, read by the
-backend:
-
-    path
-         Values:         <string>
-
-         Host filesystem path to share.
-
-    tag
-         Values:         <string>
-
-         Alphanumeric tag that identifies the 9pfs share. The client needs
-         to know the tag to be able to mount it.
-
-    security-model
-         Values:         "none"
-
-         *none*: files are stored using the same credentials as they are
-                 created on the guest (no user ownership squash or remap)
-         Only "none" is supported in this version of the protocol.
-
-### Frontend XenBus Nodes
-
-    version
-         Values:         <string>
-
-         Protocol version, chosen among the ones supported by the backend
-         (see **versions** under [Backend XenBus Nodes]). Currently the
-         value must be "1".
-
-    num-rings
-         Values:         <uint32_t>
-
-         Number of rings. It needs to be lower or equal to max-rings.
-
-    event-channel-<num> (event-channel-0, event-channel-1, etc)
-         Values:         <uint32_t>
-
-         The identifier of the Xen event channel used to signal activity
-         in the ring buffer. One for each ring.
-
-    ring-ref<num> (ring-ref0, ring-ref1, etc)
-         Values:         <uint32_t>
-
-         The Xen grant reference granting permission for the backend to
-         map a page with information to setup a share ring. One for each
-         ring.
-
-### State Machine
-
-Initialization:
-
-    *Front*                               *Back*
-    XenbusStateInitialising               XenbusStateInitialising
-    - Query virtual device                - Query backend device
-      properties.                           identification data.
-    - Setup OS device instance.           - Publish backend features
-    - Allocate and initialize the           and transport parameters
-      request ring.                                      |
-    - Publish transport parameters                       |
-      that will be in effect during                      V
-      this connection.                            XenbusStateInitWait
-                 |
-                 |
-                 V
-       XenbusStateInitialised
-
-                                          - Query frontend transport parameters.
-                                          - Connect to the request ring and
-                                            event channel.
-                                                         |
-                                                         |
-                                                         V
-                                                 XenbusStateConnected
-
-     - Query backend device properties.
-     - Finalize OS virtual device
-       instance.
-                 |
-                 |
-                 V
-        XenbusStateConnected
-
-Once frontend and backend are connected, they have a shared page per
-ring, which are used to setup the rings, and an event channel per ring,
-which are used to send notifications.
-
-Shutdown:
-
-    *Front*                            *Back*
-    XenbusStateConnected               XenbusStateConnected
-                |
-                |
-                V
-       XenbusStateClosing
-
-                                       - Unmap grants
-                                       - Unbind evtchns
-                                                 |
-                                                 |
-                                                 V
-                                         XenbusStateClosing
-
-    - Unbind evtchns
-    - Free rings
-    - Free data structures
-               |
-               |
-               V
-       XenbusStateClosed
-
-                                       - Free remaining data structures
-                                                 |
-                                                 |
-                                                 V
-                                         XenbusStateClosed
+The frontend and backend are configured via Xenstore. See [header] for
+the detailed Xenstore entries and the connection protocol.
 
 
 ## Ring Setup
@@ -415,5 +270,5 @@ the *size* field of the 9pfs header.
 
 [paper]: https://www.usenix.org/legacy/event/usenix05/tech/freenix/full_papers/hensbergen/hensbergen.pdf
 [website]: https://github.com/chaos/diod/blob/master/protocol.md
-[XenbusStateInitialising]: https://xenbits.xen.org/docs/unstable/hypercall/x86_64/include,public,io,xenbus.h.html
+[header]: https://xenbits.xen.org/gitweb/?p=xen.git;a=blob;f=xen/include/public/io/9pfs.h;hb=HEAD
 [ring.h]: https://xenbits.xen.org/gitweb/?p=xen.git;a=blob;f=xen/include/public/io/ring.h;hb=HEAD
diff --git a/xen/include/public/io/9pfs.h b/xen/include/public/io/9pfs.h
index ad26bd69eb..5dad0db869 100644
--- a/xen/include/public/io/9pfs.h
+++ b/xen/include/public/io/9pfs.h
@@ -14,9 +14,173 @@
 #include "ring.h"
 
 /*
- * See docs/misc/9pfs.markdown in xen.git for the full specification:
+ * See docs/misc/9pfs.pandoc in xen.git for the full specification:
  * https://xenbits.xen.org/docs/unstable/misc/9pfs.html
  */
+
+/*
+ ******************************************************************************
+ *                                  Xenstore
+ ******************************************************************************
+ *
+ * The frontend and the backend connect via xenstore to exchange
+ * information. The toolstack creates front and back nodes with state
+ * XenbusStateInitialising. The protocol node name is **9pfs**.
+ *
+ * Multiple rings are supported for each frontend and backend connection.
+ *
+ ******************************************************************************
+ *                            Backend XenBus Nodes
+ ******************************************************************************
+ *
+ * Backend specific properties, written by the backend, read by the
+ * frontend:
+ *
+ *    versions
+ *         Values:         <string>
+ *
+ *         List of comma separated protocol versions supported by the backend.
+ *         For example "1,2,3". Currently the value is just "1", as there is
+ *         only one version. N.B.: this is the version of the Xen transport
+ *         protocol, not the version of 9pfs supported by the server.
+ *
+ *    max-rings
+ *         Values:         <uint32_t>
+ *
+ *         The maximum supported number of rings per frontend.
+ *
+ *    max-ring-page-order
+ *         Values:         <uint32_t>
+ *
+ *         The maximum supported size of a memory allocation in units of
+ *         log2n(machine pages), e.g. 1 = 2 pages, 2 == 4 pages, etc. It
+ *         must be at least 1.
+ *
+ * Backend configuration nodes, written by the toolstack, read by the
+ * backend:
+ *
+ *    path
+ *         Values:         <string>
+ *
+ *         Host filesystem path to share.
+ *
+ *    tag
+ *         Values:         <string>
+ *
+ *         Alphanumeric tag that identifies the 9pfs share. The client needs
+ *         to know the tag to be able to mount it.
+ *
+ *    security-model
+ *         Values:         "none"
+ *
+ *         *none*: files are stored using the same credentials as they are
+ *                 created on the guest (no user ownership squash or remap)
+ *         Only "none" is supported in this version of the protocol.
+ *
+ ******************************************************************************
+ *                            Frontend XenBus Nodes
+ ******************************************************************************
+ *
+ *    version
+ *         Values:         <string>
+ *
+ *         Protocol version, chosen among the ones supported by the backend
+ *         (see **versions** under [Backend XenBus Nodes]). Currently the
+ *         value must be "1".
+ *
+ *    num-rings
+ *         Values:         <uint32_t>
+ *
+ *         Number of rings. It needs to be lower or equal to max-rings.
+ *
+ *    event-channel-<num> (event-channel-0, event-channel-1, etc)
+ *         Values:         <uint32_t>
+ *
+ *         The identifier of the Xen event channel used to signal activity
+ *         in the ring buffer. One for each ring.
+ *
+ *    ring-ref<num> (ring-ref0, ring-ref1, etc)
+ *         Values:         <uint32_t>
+ *
+ *         The Xen grant reference granting permission for the backend to
+ *         map a page with information to setup a share ring. One for each
+ *         ring.
+ *
+ ******************************************************************************
+ *                              State Machine
+ ******************************************************************************
+ *
+ * Initialization:
+ *
+ *    *Front*                               *Back*
+ *    XenbusStateInitialising               XenbusStateInitialising
+ *    - Query virtual device                - Query backend device
+ *      properties.                           identification data.
+ *    - Setup OS device instance.           - Publish backend features
+ *    - Allocate and initialize the           and transport parameters
+ *      request ring.                                      |
+ *    - Publish transport parameters                       |
+ *      that will be in effect during                      V
+ *      this connection.                            XenbusStateInitWait
+ *                 |
+ *                 |
+ *                 V
+ *       XenbusStateInitialised
+ *
+ *                                          - Query frontend transport
+ *                                            parameters.
+ *                                          - Connect to the request ring and
+ *                                            event channel.
+ *                                                         |
+ *                                                         |
+ *                                                         V
+ *                                                 XenbusStateConnected
+ *
+ *    - Query backend device properties.
+ *    - Finalize OS virtual device
+ *      instance.
+ *                |
+ *                |
+ *                V
+ *       XenbusStateConnected
+ *
+ * Once frontend and backend are connected, they have a shared page per
+ * ring, which are used to setup the rings, and an event channel per ring,
+ * which are used to send notifications.
+ *
+ * Shutdown:
+ *
+ *    *Front*                            *Back*
+ *    XenbusStateConnected               XenbusStateConnected
+ *                |
+ *                |
+ *                V
+ *       XenbusStateClosing
+ *
+ *                                       - Unmap grants
+ *                                       - Unbind evtchns
+ *                                                 |
+ *                                                 |
+ *                                                 V
+ *                                         XenbusStateClosing
+ *
+ *    - Unbind evtchns
+ *    - Free rings
+ *    - Free data structures
+ *               |
+ *               |
+ *               V
+ *       XenbusStateClosed
+ *
+ *                                       - Free remaining data structures
+ *                                                 |
+ *                                                 |
+ *                                                 V
+ *                                         XenbusStateClosed
+ *
+ ******************************************************************************
+ */
+
 DEFINE_XEN_FLEX_RING_AND_INTF(xen_9pfs);
 
 #endif
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Feb 08 02:44:43 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 08 Feb 2023 02:44:43 +0000
Received: from list by lists.xenproject.org with outflank-mailman.491490.760593 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pPaRv-00070r-Ec; Wed, 08 Feb 2023 02:44:43 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 491490.760593; Wed, 08 Feb 2023 02: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 1pPaRv-00070i-Bw; Wed, 08 Feb 2023 02:44:43 +0000
Received: by outflank-mailman (input) for mailman id 491490;
 Wed, 08 Feb 2023 02:44:42 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pPaRu-00070c-Gq
 for xen-changelog@lists.xenproject.org; Wed, 08 Feb 2023 02:44:42 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pPaRu-0003Km-Fn
 for xen-changelog@lists.xenproject.org; Wed, 08 Feb 2023 02:44:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pPaRu-0000Oa-Ep
 for xen-changelog@lists.xenproject.org; Wed, 08 Feb 2023 02:44:42 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=zAFUChj5QN0H3kV6L6wTYZQrbNHo8TOj4CboSOEXEUA=; b=EkyegMLeNBmEP7muuEBx76I49l
	biOAWBbLT73cgjT5O8SmQFc7BKBTNPMhCUNCTR4Ux8awJEwocyC8RmFXi9FWJRxTgxESoJQ5bPK51
	XqvR1SBfxh4P3omRxCw2CGjcjruebwhgAQabV7Wmi/eLdLQQI5ihbuigXG4GuzXhP7Ig=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] public/x86: add TSC defines for cpuid leaf 4
Message-Id: <E1pPaRu-0000Oa-Ep@xenbits.xenproject.org>
Date: Wed, 08 Feb 2023 02:44:42 +0000

commit b7b4a0a623695a4ce006a144cf21a157132f3c89
Author:     Krister Johansen <kjlx@templeofstupid.com>
AuthorDate: Mon Feb 6 08:52:31 2023 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Feb 6 08:52:31 2023 +0100

    public/x86: add TSC defines for cpuid leaf 4
    
    Cpuid leaf 4 contains information about how the state of the tsc, its
    mode, and some additional information.  A commit that is queued for
    linux would like to use this to determine whether the tsc mode has been
    set to 'no emulation' in order to make some decisions about which
    clocksource is more reliable.
    
    Expose this information in the public API headers so that they can
    subsequently be imported into linux and used there.
    
    Link: https://lore.kernel.org/xen-devel/eda8d9f2-3013-1b68-0df8-64d7f13ee35e@suse.com/
    Link: https://lore.kernel.org/xen-devel/0835453d-9617-48d5-b2dc-77a2ac298bad@oracle.com/
    Signed-off-by: Krister Johansen <kjlx@templeofstupid.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/include/public/arch-x86/cpuid.h | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/xen/include/public/arch-x86/cpuid.h b/xen/include/public/arch-x86/cpuid.h
index 7ecd16ae05..3bb0dd249f 100644
--- a/xen/include/public/arch-x86/cpuid.h
+++ b/xen/include/public/arch-x86/cpuid.h
@@ -72,6 +72,15 @@
  * Sub-leaf 2: EAX: host tsc frequency in kHz
  */
 
+#define XEN_CPUID_TSC_EMULATED               (1u << 0)
+#define XEN_CPUID_HOST_TSC_RELIABLE          (1u << 1)
+#define XEN_CPUID_RDTSCP_INSTR_AVAIL         (1u << 2)
+
+#define XEN_CPUID_TSC_MODE_DEFAULT           (0)
+#define XEN_CPUID_TSC_MODE_ALWAYS_EMULATE    (1u)
+#define XEN_CPUID_TSC_MODE_NEVER_EMULATE     (2u)
+#define XEN_CPUID_TSC_MODE_PVRDTSCP          (3u)
+
 /*
  * Leaf 5 (0x40000x04)
  * HVM-specific features
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Feb 08 02:44:53 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 08 Feb 2023 02:44:53 +0000
Received: from list by lists.xenproject.org with outflank-mailman.491491.760597 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pPaS5-00074c-Hf; Wed, 08 Feb 2023 02:44:53 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 491491.760597; Wed, 08 Feb 2023 02: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 1pPaS5-00074U-Ev; Wed, 08 Feb 2023 02:44:53 +0000
Received: by outflank-mailman (input) for mailman id 491491;
 Wed, 08 Feb 2023 02:44:52 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pPaS4-00074K-JR
 for xen-changelog@lists.xenproject.org; Wed, 08 Feb 2023 02:44:52 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pPaS4-0003L0-Ih
 for xen-changelog@lists.xenproject.org; Wed, 08 Feb 2023 02:44:52 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pPaS4-0000P1-Ht
 for xen-changelog@lists.xenproject.org; Wed, 08 Feb 2023 02:44:52 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=98SA9j+Q8j+vrTjiTQ/MSMKgHdyBcqFnoGVYi7Vdww4=; b=k/r0uFg7BWzGJoYGZectMsh/Vv
	ezu6IeCkDpAWXv59xuKPM/Dxfu/+slZ/0hJjztJuckc+xEA/jzCMsIm9Fvj0mZIgDQZ0+9jp1oUkP
	zOZz4jRCInQTD0EVn99ujqj0hqucE02ZjFKEjYCrv+ntrfyIX7NlkvhYUEDq0fppOLwI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] .gitignore: only ignore hidden dependency files
Message-Id: <E1pPaS4-0000P1-Ht@xenbits.xenproject.org>
Date: Wed, 08 Feb 2023 02:44:52 +0000

commit 39ee93d21290293712ffb7f7c265df7dcb45b12f
Author:     Anthony PERARD <anthony.perard@citrix.com>
AuthorDate: Mon Feb 6 08:53:22 2023 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Feb 6 08:53:22 2023 +0100

    .gitignore: only ignore hidden dependency files
    
    The current pattern also ignores directories suffixed with ".d", like:
        tools/hotplug/*/rc.d
        tools/hotplug/*/init.d
    
    Avoid this by only ignoring "hidden" files, for which name starts with
    a dot.
    
    Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 .gitignore | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/.gitignore b/.gitignore
index 880ba88c55..5b30d8fc36 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,12 +1,12 @@
 .hg
 .*.cmd
+.*.d
+.*.d2
 .*.tmp
 *.orig
 *~
 *.swp
 *.o
-*.d
-*.d2
 *.cppcheck.txt
 *.cppcheck.xml
 *.opic
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Feb 08 02:45:03 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 08 Feb 2023 02:45:03 +0000
Received: from list by lists.xenproject.org with outflank-mailman.491492.760601 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pPaSF-00077A-JC; Wed, 08 Feb 2023 02:45:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 491492.760601; Wed, 08 Feb 2023 02: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 1pPaSF-000773-GY; Wed, 08 Feb 2023 02:45:03 +0000
Received: by outflank-mailman (input) for mailman id 491492;
 Wed, 08 Feb 2023 02:45:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pPaSE-00076w-Mu
 for xen-changelog@lists.xenproject.org; Wed, 08 Feb 2023 02:45:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pPaSE-0003Lb-Lj
 for xen-changelog@lists.xenproject.org; Wed, 08 Feb 2023 02:45:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pPaSE-0000Ph-Ko
 for xen-changelog@lists.xenproject.org; Wed, 08 Feb 2023 02:45:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=IvTPaTx50W/J33GP7UIU7k6Hilok0RiH2Tpsvv2Qafg=; b=PStOHPeoF/TGG+rUf6VNOzUYjp
	kli1+S3Bm8oLZ8/I4/3wbADv28oiAuVtqY8aETz9aZ3z7xu5O1g482Qn/bdq4znh2pRza3DulIkMN
	hIFoQ5ISgW24DEkFMYrqZkTuzpUuJ2gtm3D6mI48zyKrFQ3EoeU793+v6PLDd0Xa0isw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] Changelog: Add details about new features for SPR
Message-Id: <E1pPaSE-0000Ph-Ko@xenbits.xenproject.org>
Date: Wed, 08 Feb 2023 02:45:02 +0000

commit f28fe0849b68411b8d5fdd92875bae0ebd8b1516
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Fri Jan 20 21:58:36 2023 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Mon Feb 6 10:22:12 2023 +0000

    Changelog: Add details about new features for SPR
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Henry Wang <Henry.Wang@arm.com>
---
 CHANGELOG.md | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 6754139713..b116163b62 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -6,6 +6,14 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
 
 ## [unstable UNRELEASED](https://xenbits.xen.org/gitweb/?p=xen.git;a=shortlog;h=staging) - TBD
 
+### Added
+ - On x86, support for features new in Intel Sapphire Rapids CPUs:
+   - PKS (Protection Key Supervisor) available to HVM/PVH guests.
+   - VM-Notify used by Xen to mitigate certain micro-architectural pipeline
+     livelocks, instead of crashing the entire server.
+   - Bus-lock detection, used by Xen to mitigate (by rate-limiting) the system
+     wide impact of a guest misusing atomic instructions.
+
 ## [4.17.0](https://xenbits.xen.org/gitweb/?p=xen.git;a=shortlog;h=RELEASE-4.17.0) - 2022-12-12
 
 ### Changed
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Feb 08 02:45:13 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 08 Feb 2023 02:45:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.491493.760605 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pPaSP-0007Ak-Kk; Wed, 08 Feb 2023 02:45:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 491493.760605; Wed, 08 Feb 2023 02: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 1pPaSP-0007Ac-I7; Wed, 08 Feb 2023 02:45:13 +0000
Received: by outflank-mailman (input) for mailman id 491493;
 Wed, 08 Feb 2023 02:45:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pPaSO-0007AN-PQ
 for xen-changelog@lists.xenproject.org; Wed, 08 Feb 2023 02:45:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pPaSO-0003Lo-Ok
 for xen-changelog@lists.xenproject.org; Wed, 08 Feb 2023 02:45:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pPaSO-0000QB-O3
 for xen-changelog@lists.xenproject.org; Wed, 08 Feb 2023 02:45:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=12wyl6XkIDD4wtrqq4QfWBoleDLorNGUxo4Bzf1Hmkk=; b=3gKQG+9zXna9icsNb/qP/xY/UN
	l3j0NdPCDIEr9jJ4OH1SJqNOGTP/nlr95DbHb+TERvXjr2S1RMPpfRefAN+UteoN1aaOUTgFKwqz4
	y2bTdBOLqcSC1RTJaN8X5n/Va4WiXuM22pdjH20C+8z9GrO2oH9RUK/Un+QPUBRPAyxA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] build: include/compat, remove typedefs handling
Message-Id: <E1pPaSO-0000QB-O3@xenbits.xenproject.org>
Date: Wed, 08 Feb 2023 02:45:12 +0000

commit d1d3fb1cd5f79cb74122e1639891a5f0fd9df3e5
Author:     Anthony PERARD <anthony.perard@citrix.com>
AuthorDate: Thu Jan 19 15:22:54 2023 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Mon Feb 6 10:22:12 2023 +0000

    build: include/compat, remove typedefs handling
    
    Partial revert of c93bd0e6ea2a ("tmem: fix 32-on-64 support")
    Since c492e19fdd05 ("xen: remove tmem from hypervisor"), this code
    isn't used anymore.
    
    Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/tools/get-fields.sh | 57 +------------------------------------------------
 1 file changed, 1 insertion(+), 56 deletions(-)

diff --git a/xen/tools/get-fields.sh b/xen/tools/get-fields.sh
index 002db2093f..ad4a7aacc6 100644
--- a/xen/tools/get-fields.sh
+++ b/xen/tools/get-fields.sh
@@ -41,34 +41,6 @@ get_fields ()
 	done
 }
 
-get_typedefs ()
-{
-	local level=1 state=
-	for token in $1
-	do
-		case "$token" in
-		typedef)
-			test $level != 1 || state=1
-			;;
-		COMPAT_HANDLE\(*\))
-			test $level != 1 -o "$state" != 1 || state=2
-			;;
-		[\{\[])
-			level=$(expr $level + 1)
-			;;
-		[\}\]])
-			level=$(expr $level - 1)
-			;;
-		";")
-			test $level != 1 || state=
-			;;
-		[a-zA-Z_]*)
-			test $level != 1 -o "$state" != 2 || echo "$token"
-			;;
-		esac
-	done
-}
-
 build_enums ()
 {
 	local level=1 kind= fields= members= named= id= token
@@ -201,21 +173,7 @@ for line in sys.stdin.readlines():
 				fi
 				;;
 			[a-zA-Z]*)
-				if [ -z "$id" -a -z "$type" -a -z "$array_type" ]
-				then
-					for id in $typedefs
-					do
-						test $id != "$token" || type=$id
-					done
-					if [ -z "$type" ]
-					then
-						id=$token
-					else
-						id=
-					fi
-				else
-					id=$token
-				fi
+				id=$token
 				;;
 			[\,\;])
 				if [ $level = 2 -a -n "$(echo $id | $SED 's,^_pad[[:digit:]]*,,')" ]
@@ -330,18 +288,6 @@ build_body ()
 			if [ -n "$array" ]
 			then
 				array="$array $token"
-			elif [ -z "$id" -a -z "$type" -a -z "$array_type" ]
-			then
-				for id in $typedefs
-				do
-					test $id != "$token" || type=$id
-				done
-				if [ -z "$type" ]
-				then
-					id=$token
-				else
-					id=
-				fi
 			else
 				id=$token
 			fi
@@ -514,7 +460,6 @@ name=${2#compat_}
 name=${name#xen}
 case "$1" in
 "!")
-	typedefs="$(get_typedefs "$list")"
 	build_enums $name "$fields"
 	build_body $name "$fields"
 	;;
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Feb 08 02:45:23 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 08 Feb 2023 02:45:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.491494.760609 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pPaSZ-0007JZ-MV; Wed, 08 Feb 2023 02:45:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 491494.760609; Wed, 08 Feb 2023 02: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 1pPaSZ-0007JR-Ja; Wed, 08 Feb 2023 02:45:23 +0000
Received: by outflank-mailman (input) for mailman id 491494;
 Wed, 08 Feb 2023 02:45: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 1pPaSY-0007JJ-Sd
 for xen-changelog@lists.xenproject.org; Wed, 08 Feb 2023 02:45:22 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pPaSY-0003NW-Rn
 for xen-changelog@lists.xenproject.org; Wed, 08 Feb 2023 02:45:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pPaSY-0000Qp-Qy
 for xen-changelog@lists.xenproject.org; Wed, 08 Feb 2023 02: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=z+/t4ng+ojpom3YChGlWTrlaBAOo5DgQX5QmFeQqnbI=; b=uSr96HV/+KjIsGw4E9My3XC4UY
	EgCn1VfunSPbnlV78HEvpZ1j6f7H1RGROhGB4ddIhYsyl14dIP68S0uB/yWVS1MLacDqKFzjVJ2VT
	+uMqZfRmFiE1b5DPvp4w3+nL6AJxKk4jQ5jPWS1sSxdS3MiYdfYwcFi9g0xGOd0iTnK4=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] build: replace get-fields.sh by a python script
Message-Id: <E1pPaSY-0000Qp-Qy@xenbits.xenproject.org>
Date: Wed, 08 Feb 2023 02:45:22 +0000

commit e0cfbcfa57e1b64247f1f450a7cc961bf92448ee
Author:     Anthony PERARD <anthony.perard@citrix.com>
AuthorDate: Thu Jan 19 15:22:55 2023 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Mon Feb 6 10:22:12 2023 +0000

    build: replace get-fields.sh by a python script
    
    The get-fields.sh which generate all the include/compat/.xlat/*.h
    headers is quite slow. It takes for example nearly 3 seconds to
    generate platform.h on a recent machine, or 2.3 seconds for memory.h.
    
    Rewriting the mix of shell/sed/python into a single python script make
    the generation of those file a lot faster.
    
    No functional change, the headers generated are identical.
    
    Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/include/Makefile            |   6 +-
 xen/tools/compat-xlat-header.py | 432 ++++++++++++++++++++++++++++++++++++
 xen/tools/get-fields.sh         | 473 ----------------------------------------
 3 files changed, 434 insertions(+), 477 deletions(-)

diff --git a/xen/include/Makefile b/xen/include/Makefile
index cfd7851614..2da842b3ee 100644
--- a/xen/include/Makefile
+++ b/xen/include/Makefile
@@ -65,9 +65,7 @@ cmd_compat_c = \
 
 quiet_cmd_xlat_headers = GEN     $@
 cmd_xlat_headers = \
-    while read what name; do \
-        $(SHELL) $(srctree)/tools/get-fields.sh "$$what" compat_$$name $< || exit $$?; \
-    done <$(patsubst $(obj)/compat/%,$(obj)/compat/.xlat/%,$(basename $<)).lst >$@.new; \
+    $(PYTHON) $(srctree)/tools/compat-xlat-header.py $< $(patsubst $(obj)/compat/%,$(obj)/compat/.xlat/%,$(basename $<)).lst > $@.new; \
     mv -f $@.new $@
 
 targets += $(headers-y)
@@ -92,7 +90,7 @@ $(obj)/compat/%.c: $(src)/public/%.h $(srcdir)/xlat.lst $(srctree)/tools/compat-
 	$(call if_changed,compat_c)
 
 targets += $(patsubst compat/%, compat/.xlat/%, $(headers-y))
-$(obj)/compat/.xlat/%.h: $(obj)/compat/%.h $(obj)/compat/.xlat/%.lst $(srctree)/tools/get-fields.sh FORCE
+$(obj)/compat/.xlat/%.h: $(obj)/compat/%.h $(obj)/compat/.xlat/%.lst $(srctree)/tools/compat-xlat-header.py FORCE
 	$(call if_changed,xlat_headers)
 
 quiet_cmd_xlat_lst = GEN     $@
diff --git a/xen/tools/compat-xlat-header.py b/xen/tools/compat-xlat-header.py
new file mode 100644
index 0000000000..ae5c9f11c9
--- /dev/null
+++ b/xen/tools/compat-xlat-header.py
@@ -0,0 +1,432 @@
+#!/usr/bin/env python
+
+from __future__ import print_function
+import re
+import sys
+
+re_identifier = re.compile(r'^[a-zA-Z_]')
+re_compat_handle = re.compile(r'^COMPAT_HANDLE\((.*)\)$')
+re_pad = re.compile(r'^_pad\d*$')
+re_compat = re.compile(r'^compat_.*_t$')
+re_brackets = re.compile(r'[{}]')
+
+def removeprefix(s, prefix):
+    if s.startswith(prefix):
+        return s[len(prefix):]
+    return s
+
+def removesuffix(s, suffix):
+    if s.endswith(suffix):
+        return s[:-len(suffix)]
+    return s
+
+def get_fields(looking_for, header_tokens):
+    level = 1
+    aggr = 0
+    fields = []
+    name = ''
+
+    for token in header_tokens:
+        if token in ('struct', 'union'):
+            if level == 1:
+                aggr = 1
+                fields = []
+                name = ''
+        elif token == '{':
+            level += 1
+        elif token == '}':
+            level -= 1
+            if level == 1 and name == looking_for:
+                fields.append(token)
+                return fields
+        elif re_identifier.match(token):
+            if not (aggr == 0 or name != ''):
+                name = token
+
+        if aggr != 0:
+            fields.append(token)
+
+    return []
+
+def build_enums(name, tokens):
+    level = 1
+    kind = ''
+    named = ''
+    fields = []
+    members = []
+    id = ''
+
+    for token in tokens:
+        if token in ('struct', 'union'):
+            if not level != 2:
+                fields = ['']
+            kind = "%s;%s" % (token, kind)
+        elif token == '{':
+            level += 1
+        elif token == '}':
+            level -= 1
+            if level == 1:
+                subkind = kind
+                (subkind, _, _) = subkind.partition(';')
+                if subkind == 'union':
+                    print("\nenum XLAT_%s {" % (name,))
+                    for m in members:
+                        print("    XLAT_%s_%s," % (name, m))
+                    print("};")
+                return
+            elif level == 2:
+                named = '?'
+        elif re_identifier.match(token):
+            id = token
+            k = kind
+            (_, _, k) = k.partition(';')
+            if named != '' and k != '':
+                if len(fields) > 0 and fields[0] == '':
+                    fields.pop(0)
+                build_enums("%s_%s" % (name, token), fields)
+                named = '!'
+        elif token == ',':
+            if level == 2:
+                members.append(id)
+        elif token == ';':
+            if level == 2:
+                members.append(id)
+            if named != '':
+                (_, _, kind) = kind.partition(';')
+            named = ''
+        if len(fields) != 0:
+            fields.append(token)
+
+def handle_field(prefix, name, id, type, fields):
+    if len(fields) == 0:
+        print(" \\")
+        if type == '':
+            print("%s(_d_)->%s = (_s_)->%s;" % (prefix, id, id), end='')
+        else:
+            k = id.replace('.', '_')
+            print("%sXLAT_%s_HNDL_%s(_d_, _s_);" % (prefix, name, k), end='')
+    elif not re_brackets.search(' '.join(fields)):
+        tag = ' '.join(fields)
+        tag = re.sub(r'\s*(struct|union)\s+(compat_)?(\w+)\s.*', '\\3', tag)
+        print(" \\")
+        print("%sXLAT_%s(&(_d_)->%s, &(_s_)->%s);" % (prefix, tag, id, id), end='')
+    else:
+        func_id = id
+        func_tokens = fields
+        kind = ''
+        array = ""
+        level = 1
+        arrlvl = 1
+        array_type = ''
+        id = ''
+        type = ''
+        fields = []
+        for token in func_tokens:
+            if token in ('struct', 'union'):
+                if level == 2:
+                    fields = ['']
+                if level == 1:
+                    kind = token
+                    if kind == 'union':
+                        tmp = func_id.replace('.', '_')
+                        print(" \\")
+                        print("%sswitch (%s) {" % (prefix, tmp), end='')
+            elif token == '{':
+                level += 1
+                id = ''
+            elif token == '}':
+                level -= 1
+                id = ''
+                if level == 1 and kind == 'union':
+                    print(" \\")
+                    print("%s}" % (prefix,), end='')
+            elif token == '[':
+                if level != 2 or arrlvl != 1:
+                    pass
+                elif array == '':
+                    array = ' '
+                else:
+                    array = "%s;" % (array,)
+                arrlvl += 1
+            elif token == ']':
+                arrlvl -= 1
+            elif re_compat_handle.match(token):
+                if level == 2 and id == '':
+                    m = re_compat_handle.match(token)
+                    type = m.groups()[0]
+                    type = removeprefix(type, 'compat_')
+            elif token == "compat_domain_handle_t":
+                if level == 2 and id == '':
+                    array_type = token
+            elif re_identifier.match(token):
+                id = token
+            elif token in (',', ';'):
+                if level == 2 and not re_pad.match(id):
+                    if kind == 'union':
+                        tmp = "%s.%s" % (func_id, id)
+                        tmp = tmp.replace('.', '_')
+                        print(" \\")
+                        print("%scase XLAT_%s_%s:" % (prefix, name, tmp), end='')
+                        if len(fields) > 0 and fields[0] == '':
+                            fields.pop(0)
+                        handle_field("%s    " % (prefix,), name, "%s.%s" % (func_id, id), type, fields)
+                    elif array == '' and array_type == '':
+                        if len(fields) > 0 and fields[0] == '':
+                            fields.pop(0)
+                        handle_field(prefix, name, "%s.%s" % (func_id, id), type, fields)
+                    elif array == '':
+                        copy_array("    ", "%s.%s" % (func_id, id))
+                    else:
+                        (_, _, array) = array.partition(';')
+                        if len(fields) > 0 and fields[0] == '':
+                            fields.pop(0)
+                        handle_array(prefix, name, "{func_id}.{id}", array, type, fields)
+                    if token == ';':
+                        fields = []
+                        id = ''
+                        type = ''
+                    array = ''
+                    if kind == 'union':
+                        print(" \\")
+                        print("%s    break;" % (prefix,), end='')
+            else:
+                if array != '':
+                    array = "%s %s" % (array, token)
+            if len(fields) > 0:
+                fields.append(token)
+
+def copy_array(prefix, id):
+    print(" \\")
+    print("%sif ((_d_)->%s != (_s_)->%s) \\" % (prefix, id, id))
+    print("%s    memcpy((_d_)->%s, (_s_)->%s, sizeof((_d_)->%s));" % (prefix, id, id, id), end='')
+
+def handle_array(prefix, name, id, array, type, fields):
+    i = re.sub(r'[^;]', '', array)
+    i = "i%s" % (len(i),)
+
+    print(" \\")
+    print("%s{ \\" % (prefix,))
+    print("%s    unsigned int %s; \\" % (prefix, i))
+    (head, _, tail) = array.partition(';')
+    head = head.strip()
+    print("%s    for (%s = 0; %s < %s; ++%s) {" % (prefix, i, i, head, i), end='')
+    if not ';' in array:
+        handle_field("%s        " % (prefix,), name, "%s[%s]" % (id, i), type, fields)
+    else:
+        handle_array("%s        " % (prefix,) , name, "%s[%s]" % (id, i), tail, type, fields)
+    print(" \\")
+    print("%s    } \\" % (prefix,))
+    print("%s}" % (prefix,), end='')
+
+def build_body(name, tokens):
+    level = 1
+    id = ''
+    array = ''
+    arrlvl = 1
+    array_type = ''
+    type = ''
+    fields = []
+
+    print("\n#define XLAT_%s(_d_, _s_) do {" % (name,), end='')
+
+    for token in tokens:
+        if token in ('struct', 'union'):
+            if level == 2:
+                fields = ['']
+        elif token == '{':
+            level += 1
+            id = ''
+        elif token == '}':
+            level -= 1
+            id = ''
+        elif token == '[':
+            if level != 2 or arrlvl != 1:
+                pass
+            elif array == '':
+                array = ' '
+            else:
+                array = "%s;" % (array,)
+            arrlvl += 1
+        elif token == ']':
+            arrlvl -= 1
+        elif re_compat_handle.match(token):
+            if level == 2 and id == '':
+                m = re_compat_handle.match(token)
+                type = m.groups()[0]
+                type = removeprefix(type, 'compat_')
+        elif token == "compat_domain_handle_t":
+            if level == 2 and id == '':
+                array_type = token
+        elif re_identifier.match(token):
+            if array != '':
+                array = "%s %s" % (array, token)
+            else:
+                id = token
+        elif token in (',', ';'):
+            if level == 2 and not re_pad.match(id):
+                if array == '' and array_type == '':
+                    if len(fields) > 0 and fields[0] == '':
+                        fields.pop(0)
+                    handle_field("    ", name, id, type, fields)
+                elif array == '':
+                    copy_array("    ", id)
+                else:
+                    (head, sep, tmp) = array.partition(';')
+                    if sep == '':
+                        tmp = head
+                    if len(fields) > 0 and fields[0] == '':
+                        fields.pop(0)
+                    handle_array("    ", name, id, tmp, type, fields)
+                if token == ';':
+                    fields = []
+                    id = ''
+                    type = ''
+                array = ''
+        else:
+            if array != '':
+                array = "%s %s" % (array, token)
+        if len(fields) > 0:
+            fields.append(token)
+    print(" \\\n} while (0)")
+
+def check_field(kind, name, field, extrafields):
+    if not re_brackets.search(' '.join(extrafields)):
+        print("; \\")
+        if len(extrafields) != 0:
+            for token in extrafields:
+                if token in ('struct', 'union'):
+                    pass
+                elif re_identifier.match(token):
+                    print("    CHECK_%s" % (removeprefix(token, 'xen_'),), end='')
+                    break
+                else:
+                    raise Exception("Malformed compound declaration: '%s'" % (token,))
+        elif not '.' in field:
+            print("    CHECK_FIELD_(%s, %s, %s)" % (kind, name, field), end='')
+        else:
+            n = field.count('.')
+            field = field.replace('.', ', ')
+            print("    CHECK_SUBFIELD_%s_(%s, %s, %s)" % (n, kind, name, field), end='')
+    else:
+        level = 1
+        fields = []
+        id = ''
+
+        for token in extrafields:
+            if token in ('struct', 'union'):
+                if level == 2:
+                    fields = ['']
+            elif token == '{':
+                level += 1
+                id = ''
+            elif token == '}':
+                level -= 1
+                id = ''
+            elif re_compat.match(token):
+                if level == 2:
+                    fields = ['']
+                    token = removesuffix(token, '_t')
+                    token = removeprefix(token, 'compat_')
+            elif re.match(r'^evtchn_.*_compat_t$', token):
+                if level == 2 and token != "evtchn_port_compat_t":
+                    fields = ['']
+                    token = removesuffix(token, '_compat_t')
+            elif re_identifier.match(token):
+                id = token
+            elif token in (',', ';'):
+                if level == 2 and not re_pad.match(id):
+                    if len(fields) > 0 and fields[0] == '':
+                        fields.pop(0)
+                    check_field(kind, name, "%s.%s" % (field, id), fields)
+                    if token == ";":
+                        fields = []
+                        id = ''
+            if len(fields) > 0:
+                fields.append(token)
+
+def build_check(name, tokens):
+    level = 1
+    fields = []
+    kind = ''
+    id = ''
+    arrlvl = 1
+
+    print("")
+    print("#define CHECK_%s \\" % (name,))
+
+    for token in tokens:
+        if token in ('struct', 'union'):
+            if level == 1:
+                kind = token
+                print("    CHECK_SIZE_(%s, %s)" % (kind, name), end='')
+            elif level == 2:
+                fields = ['']
+        elif token == '{':
+            level += 1
+            id = ''
+        elif token == '}':
+            level -= 1
+            id = ''
+        elif token == '[':
+            arrlvl += 1
+        elif token == ']':
+            arrlvl -= 1
+        elif re_compat.match(token):
+            if level == 2 and token != "compat_argo_port_t":
+                fields = ['']
+                token = removesuffix(token, '_t')
+                token = removeprefix(token, 'compat_')
+        elif re_identifier.match(token):
+            if not (level != 2 or arrlvl != 1):
+                id = token
+        elif token in (',', ';'):
+            if level == 2 and not re_pad.match(id):
+                if len(fields) > 0 and fields[0] == '':
+                    fields.pop(0)
+                check_field(kind, name, id, fields)
+                if token == ";":
+                    fields = []
+                    id = ''
+
+        if len(fields) > 0:
+            fields.append(token)
+    print("")
+
+
+def main():
+    header_tokens = []
+    re_tokenazier = re.compile(r'\s+')
+    re_skip_line = re.compile(r'^\s*(#|$)')
+    re_spacer = re.compile(r'([\]\[,;:{}])')
+
+    with open(sys.argv[1]) as header:
+        for line in header:
+            if re_skip_line.match(line):
+                continue
+            line = re_spacer.sub(' \\1 ', line)
+            line = line.strip()
+            header_tokens += re_tokenazier.split(line)
+
+    with open(sys.argv[2]) as compat_list:
+        for line in compat_list:
+            words = re_tokenazier.split(line, maxsplit=1)
+            what = words[0]
+            name = words[1]
+
+            name = removeprefix(name, 'xen')
+            name = name.strip()
+
+            fields = get_fields("compat_%s" % (name,), header_tokens)
+            if len(fields) == 0:
+                raise Exception("Fields of 'compat_%s' not found in '%s'" % (name, sys.argv[1]))
+
+            if what == "!":
+                build_enums(name, fields)
+                build_body(name, fields)
+            elif what == "?":
+                build_check(name, fields)
+            else:
+                raise Exception("Invalid translation indicator: '%s'" % (what,))
+
+if __name__ == '__main__':
+    main()
diff --git a/xen/tools/get-fields.sh b/xen/tools/get-fields.sh
deleted file mode 100644
index ad4a7aacc6..0000000000
--- a/xen/tools/get-fields.sh
+++ /dev/null
@@ -1,473 +0,0 @@
-test -n "$1" -a -n "$2" -a -n "$3"
-set -ef
-
-SED=sed
-if test -x /usr/xpg4/bin/sed; then
-	SED=/usr/xpg4/bin/sed
-fi
-if test -z ${PYTHON}; then
-	PYTHON=`/usr/bin/env python`
-fi
-if test -z ${PYTHON}; then
-	echo "Python not found"
-	exit 1
-fi
-
-get_fields ()
-{
-	local level=1 aggr=0 name= fields=
-	for token in $2
-	do
-		case "$token" in
-		struct|union)
-			test $level != 1 || aggr=1 fields= name=
-			;;
-		"{")
-			level=$(expr $level + 1)
-			;;
-		"}")
-			level=$(expr $level - 1)
-			if [ $level = 1 -a $name = $1 ]
-			then
-				echo "$fields }"
-				return 0
-			fi
-			;;
-		[a-zA-Z_]*)
-			test $aggr = 0 -o -n "$name" || name="$token"
-			;;
-		esac
-		test $aggr = 0 || fields="$fields $token"
-	done
-}
-
-build_enums ()
-{
-	local level=1 kind= fields= members= named= id= token
-	for token in $2
-	do
-		case "$token" in
-		struct|union)
-			test $level != 2 || fields=" "
-			kind="$token;$kind"
-			;;
-		"{")
-			level=$(expr $level + 1)
-			;;
-		"}")
-			level=$(expr $level - 1)
-			if [ $level = 1 ]
-			then
-				if [ "${kind%%;*}" = union ]
-				then
-					echo
-					echo "enum XLAT_$1 {"
-					for m in $members
-					do
-						echo "    XLAT_${1}_$m,"
-					done
-					echo "};"
-				fi
-				return 0
-			elif [ $level = 2 ]
-			then
-				named='?'
-			fi
-			;;
-		[a-zA-Z]*)
-			id=$token
-			if [ -n "$named" -a -n "${kind#*;}" ]
-			then
-				build_enums ${1}_$token "$fields"
-				named='!'
-			fi
-			;;
-		",")
-			test $level != 2 || members="$members $id"
-			;;
-		";")
-			test $level != 2 || members="$members $id"
-			test -z "$named" || kind=${kind#*;}
-			named=
-			;;
-		esac
-		test -z "$fields" || fields="$fields $token"
-	done
-}
-
-handle_field ()
-{
-	if [ -z "$5" ]
-	then
-		echo " \\"
-		if [ -z "$4" ]
-		then
-			printf %s "$1(_d_)->$3 = (_s_)->$3;"
-		else
-			printf %s "$1XLAT_${2}_HNDL_$(echo $3 | $SED 's,\.,_,g')(_d_, _s_);"
-		fi
-	elif [ -z "$(echo "$5" | $SED 's,[^{}],,g')" ]
-	then
-		local tag=$(echo "$5" | ${PYTHON} -c '
-import re,sys
-for line in sys.stdin.readlines():
-    sys.stdout.write(re.subn(r"\s*(struct|union)\s+(compat_)?(\w+)\s.*", r"\3", line)[0].rstrip() + "\n")
-')
-		echo " \\"
-		printf %s "${1}XLAT_$tag(&(_d_)->$3, &(_s_)->$3);"
-	else
-		local level=1 kind= fields= id= array= arrlvl=1 array_type= type= token
-		for token in $5
-		do
-			case "$token" in
-			struct|union)
-				test $level != 2 || fields=" "
-				if [ $level = 1 ]
-				then
-					kind=$token
-					if [ $kind = union ]
-					then
-						echo " \\"
-						printf %s "${1}switch ($(echo $3 | $SED 's,\.,_,g')) {"
-					fi
-				fi
-				;;
-			"{")
-				level=$(expr $level + 1) id=
-				;;
-			"}")
-				level=$(expr $level - 1) id=
-				if [ $level = 1 -a $kind = union ]
-				then
-					echo " \\"
-					printf %s "$1}"
-				fi
-				;;
-			"[")
-				if [ $level != 2 -o $arrlvl != 1 ]
-				then
-					:
-				elif [ -z "$array" ]
-				then
-					array=" "
-				else
-					array="$array;"
-				fi
-				arrlvl=$(expr $arrlvl + 1)
-				;;
-			"]")
-				arrlvl=$(expr $arrlvl - 1)
-				;;
-			COMPAT_HANDLE\(*\))
-				if [ $level = 2 -a -z "$id" ]
-				then
-					type=${token#COMPAT_HANDLE?}
-					type=${type%?}
-					type=${type#compat_}
-				fi
-				;;
-			compat_domain_handle_t)
-				if [ $level = 2 -a -z "$id" ]
-				then
-					array_type=$token
-				fi
-				;;
-			[a-zA-Z]*)
-				id=$token
-				;;
-			[\,\;])
-				if [ $level = 2 -a -n "$(echo $id | $SED 's,^_pad[[:digit:]]*,,')" ]
-				then
-					if [ $kind = union ]
-					then
-						echo " \\"
-						printf %s "${1}case XLAT_${2}_$(echo $3.$id | $SED 's,\.,_,g'):"
-						handle_field "$1    " $2 $3.$id "$type" "$fields"
-					elif [ -z "$array" -a -z "$array_type" ]
-					then
-						handle_field "$1" $2 $3.$id "$type" "$fields"
-					elif [ -z "$array" ]
-					then
-						copy_array "    " $3.$id
-					else
-						handle_array "$1" $2 $3.$id "${array#*;}" "$type" "$fields"
-					fi
-					test "$token" != ";" || fields= id= type=
-					array=
-					if [ $kind = union ]
-					then
-						echo " \\"
-						printf %s "$1    break;"
-					fi
-				fi
-				;;
-			*)
-				if [ -n "$array" ]
-				then
-					array="$array $token"
-				fi
-				;;
-			esac
-			test -z "$fields" || fields="$fields $token"
-		done
-	fi
-}
-
-copy_array ()
-{
-	echo " \\"
-	echo "${1}if ((_d_)->$2 != (_s_)->$2) \\"
-	printf %s "$1    memcpy((_d_)->$2, (_s_)->$2, sizeof((_d_)->$2));"
-}
-
-handle_array ()
-{
-	local i="i$(echo $4 | $SED 's,[^;], ,g' | wc -w | $SED 's,[[:space:]]*,,g')"
-	echo " \\"
-	echo "$1{ \\"
-	echo "$1    unsigned int $i; \\"
-	printf %s "$1    for ($i = 0; $i < "${4%%;*}"; ++$i) {"
-	if [ "$4" = "${4#*;}" ]
-	then
-		handle_field "$1        " $2 $3[$i] "$5" "$6"
-	else
-		handle_array "$1        " $2 $3[$i] "${4#*;}" "$5" "$6"
-	fi
-	echo " \\"
-	echo "$1    } \\"
-	printf %s "$1}"
-}
-
-build_body ()
-{
-	echo
-	printf %s "#define XLAT_$1(_d_, _s_) do {"
-	local level=1 fields= id= array= arrlvl=1 array_type= type= token
-	for token in $2
-	do
-		case "$token" in
-		struct|union)
-			test $level != 2 || fields=" "
-			;;
-		"{")
-			level=$(expr $level + 1) id=
-			;;
-		"}")
-			level=$(expr $level - 1) id=
-			;;
-		"[")
-			if [ $level != 2 -o $arrlvl != 1 ]
-			then
-				:
-			elif [ -z "$array" ]
-			then
-				array=" "
-			else
-				array="$array;"
-			fi
-			arrlvl=$(expr $arrlvl + 1)
-			;;
-		"]")
-			arrlvl=$(expr $arrlvl - 1)
-			;;
-		COMPAT_HANDLE\(*\))
-			if [ $level = 2 -a -z "$id" ]
-			then
-				type=${token#COMPAT_HANDLE?}
-				type=${type%?}
-				type=${type#compat_}
-			fi
-			;;
-		compat_domain_handle_t)
-			if [ $level = 2 -a -z "$id" ]
-			then
-				array_type=$token
-			fi
-			;;
-		[a-zA-Z_]*)
-			if [ -n "$array" ]
-			then
-				array="$array $token"
-			else
-				id=$token
-			fi
-			;;
-		[\,\;])
-			if [ $level = 2 -a -n "$(echo $id | $SED 's,^_pad[[:digit:]]*,,')" ]
-			then
-				if [ -z "$array" -a -z "$array_type" ]
-				then
-					handle_field "    " $1 $id "$type" "$fields"
-				elif [ -z "$array" ]
-				then
-					copy_array "    " $id
-				else
-					handle_array "    " $1 $id "${array#*;}" "$type" "$fields"
-				fi
-				test "$token" != ";" || fields= id= type=
-				array=
-			fi
-			;;
-		*)
-			if [ -n "$array" ]
-			then
-				array="$array $token"
-			fi
-			;;
-		esac
-		test -z "$fields" || fields="$fields $token"
-	done
-	echo " \\"
-	echo "} while (0)"
-}
-
-check_field ()
-{
-	if [ -z "$(echo "$4" | $SED 's,[^{}],,g')" ]
-	then
-		echo "; \\"
-		local n=$(echo $3 | $SED 's,[^.], ,g' | wc -w | $SED 's,[[:space:]]*,,g')
-		if [ -n "$4" ]
-		then
-			for n in $4
-			do
-				case $n in
-				struct|union)
-					;;
-				[a-zA-Z_]*)
-					printf %s "    CHECK_${n#xen_}"
-					break
-					;;
-				*)
-					echo "Malformed compound declaration: '$n'" >&2
-					exit 1
-					;;
-				esac
-			done
-		elif [ $n = 0 ]
-		then
-			printf %s "    CHECK_FIELD_($1, $2, $3)"
-		else
-			printf %s "    CHECK_SUBFIELD_${n}_($1, $2, $(echo $3 | $SED 's!\.!, !g'))"
-		fi
-	else
-		local level=1 fields= id= token
-		for token in $4
-		do
-			case "$token" in
-			struct|union)
-				test $level != 2 || fields=" "
-				;;
-			"{")
-				level=$(expr $level + 1) id=
-				;;
-			"}")
-				level=$(expr $level - 1) id=
-				;;
-			compat_*_t)
-				if [ $level = 2 ]
-				then
-					fields=" "
-					token="${token%_t}"
-					token="${token#compat_}"
-				fi
-				;;
-			evtchn_*_compat_t)
-				if [ $level = 2 -a $token != evtchn_port_compat_t ]
-				then
-					fields=" "
-					token="${token%_compat_t}"
-				fi
-				;;
-			[a-zA-Z]*)
-				id=$token
-				;;
-			[\,\;])
-				if [ $level = 2 -a -n "$(echo $id | $SED 's,^_pad[[:digit:]]*,,')" ]
-				then
-					check_field $1 $2 $3.$id "$fields"
-					test "$token" != ";" || fields= id=
-				fi
-				;;
-			esac
-			test -z "$fields" || fields="$fields $token"
-		done
-	fi
-}
-
-build_check ()
-{
-	echo
-	echo "#define CHECK_$1 \\"
-	local level=1 fields= kind= id= arrlvl=1 token
-	for token in $2
-	do
-		case "$token" in
-		struct|union)
-			if [ $level = 1 ]
-			then
-				kind=$token
-				printf %s "    CHECK_SIZE_($kind, $1)"
-			elif [ $level = 2 ]
-			then
-				fields=" "
-			fi
-			;;
-		"{")
-			level=$(expr $level + 1) id=
-			;;
-		"}")
-			level=$(expr $level - 1) id=
-			;;
-		"[")
-			arrlvl=$(expr $arrlvl + 1)
-			;;
-		"]")
-			arrlvl=$(expr $arrlvl - 1)
-			;;
-		compat_*_t)
-			if [ $level = 2 -a $token != compat_argo_port_t ]
-			then
-				fields=" "
-				token="${token%_t}"
-				token="${token#compat_}"
-			fi
-			;;
-		[a-zA-Z_]*)
-			test $level != 2 -o $arrlvl != 1 || id=$token
-			;;
-		[\,\;])
-			if [ $level = 2 -a -n "$(echo $id | $SED 's,^_pad[[:digit:]]*,,')" ]
-			then
-				check_field $kind $1 $id "$fields"
-				test "$token" != ";" || fields= id=
-			fi
-			;;
-		esac
-		test -z "$fields" || fields="$fields $token"
-	done
-	echo ""
-}
-
-list="$($SED -e 's,^[[:space:]]#.*,,' -e 's!\([]\[,;:{}]\)! \1 !g' $3)"
-fields="$(get_fields $(echo $2 | $SED 's,^compat_xen,compat_,') "$list")"
-if [ -z "$fields" ]
-then
-	echo "Fields of '$2' not found in '$3'" >&2
-	exit 1
-fi
-name=${2#compat_}
-name=${name#xen}
-case "$1" in
-"!")
-	build_enums $name "$fields"
-	build_body $name "$fields"
-	;;
-"?")
-	build_check $name "$fields"
-	;;
-*)
-	echo "Invalid translation indicator: '$1'" >&2
-	exit 1
-	;;
-esac
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Feb 08 02:45:33 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 08 Feb 2023 02:45:33 +0000
Received: from list by lists.xenproject.org with outflank-mailman.491495.760614 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pPaSj-0007My-Pq; Wed, 08 Feb 2023 02:45:33 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 491495.760614; Wed, 08 Feb 2023 02:45:33 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pPaSj-0007Mq-Mk; Wed, 08 Feb 2023 02:45:33 +0000
Received: by outflank-mailman (input) for mailman id 491495;
 Wed, 08 Feb 2023 02:45:33 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pPaSi-0007Mf-Vr
 for xen-changelog@lists.xenproject.org; Wed, 08 Feb 2023 02:45:32 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pPaSi-0003Nk-V6
 for xen-changelog@lists.xenproject.org; Wed, 08 Feb 2023 02:45:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pPaSi-0000RK-UA
 for xen-changelog@lists.xenproject.org; Wed, 08 Feb 2023 02:45:32 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=WDEheBwVwJp+iGVTWNkV9tGggmyVK8DiwkvF/Gx0cyg=; b=yuQModBsTSfrOHcUWZ2IRf2/D3
	up+BkUOnqM1MFgc5egslpSPjznths3giJ75aTK5pq3Vr7Na0rW/oSxdA9nLGje5LOLtlekDBertOK
	mVFjzid8KZ8ui2JtRua6DD55w6IuREe4sLrDsWWfz9km3b6Sfhj9WeAzoOGS/3upsYWo=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] build: compat-xlat-header.py: optimisation to search for just '{' instead of [{}]
Message-Id: <E1pPaSi-0000RK-UA@xenbits.xenproject.org>
Date: Wed, 08 Feb 2023 02:45:32 +0000

commit df4daa15ee029b76d447c3cae903ab830f21963e
Author:     Anthony PERARD <anthony.perard@citrix.com>
AuthorDate: Thu Jan 19 15:22:56 2023 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Mon Feb 6 10:22:12 2023 +0000

    build: compat-xlat-header.py: optimisation to search for just '{' instead of [{}]
    
    `fields` and `extrafields` always all the parts of a sub-struct, so
    when there is '}', there is always a '{' before it. Also, both are
    lists.
    
    Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/tools/compat-xlat-header.py | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/xen/tools/compat-xlat-header.py b/xen/tools/compat-xlat-header.py
index ae5c9f11c9..2b805b23a8 100644
--- a/xen/tools/compat-xlat-header.py
+++ b/xen/tools/compat-xlat-header.py
@@ -8,7 +8,6 @@ re_identifier = re.compile(r'^[a-zA-Z_]')
 re_compat_handle = re.compile(r'^COMPAT_HANDLE\((.*)\)$')
 re_pad = re.compile(r'^_pad\d*$')
 re_compat = re.compile(r'^compat_.*_t$')
-re_brackets = re.compile(r'[{}]')
 
 def removeprefix(s, prefix):
     if s.startswith(prefix):
@@ -105,7 +104,7 @@ def handle_field(prefix, name, id, type, fields):
         else:
             k = id.replace('.', '_')
             print("%sXLAT_%s_HNDL_%s(_d_, _s_);" % (prefix, name, k), end='')
-    elif not re_brackets.search(' '.join(fields)):
+    elif not '{' in fields:
         tag = ' '.join(fields)
         tag = re.sub(r'\s*(struct|union)\s+(compat_)?(\w+)\s.*', '\\3', tag)
         print(" \\")
@@ -290,7 +289,7 @@ def build_body(name, tokens):
     print(" \\\n} while (0)")
 
 def check_field(kind, name, field, extrafields):
-    if not re_brackets.search(' '.join(extrafields)):
+    if not '{' in extrafields:
         print("; \\")
         if len(extrafields) != 0:
             for token in extrafields:
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Feb 08 02:45:44 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 08 Feb 2023 02:45:44 +0000
Received: from list by lists.xenproject.org with outflank-mailman.491496.760617 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pPaSu-0007Pk-Qy; Wed, 08 Feb 2023 02:45:44 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 491496.760617; Wed, 08 Feb 2023 02: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 1pPaSu-0007Pc-OO; Wed, 08 Feb 2023 02:45:44 +0000
Received: by outflank-mailman (input) for mailman id 491496;
 Wed, 08 Feb 2023 02:45:43 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pPaSt-0007PT-2R
 for xen-changelog@lists.xenproject.org; Wed, 08 Feb 2023 02:45:43 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pPaSt-0003O9-1j
 for xen-changelog@lists.xenproject.org; Wed, 08 Feb 2023 02:45:43 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pPaSt-0000Rx-15
 for xen-changelog@lists.xenproject.org; Wed, 08 Feb 2023 02:45:43 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=3AAhSWo8ZPUCsSO6Kh+GAXeVi5oPK9UuIGpK9zye5IM=; b=sqqrMAc4VqslA0/V7CoJo/O9rM
	SRoRU11vCkJK8xmHaTFNW3izFRpoObl5Mh7nuhsucxBkh/cIyHAijb32ZWFQ61nz2cyp7A+x2ofsx
	jUrDJqQ/dZOub00lV4RCaGu/GXPGoAhUQLPwBR9zzqA+KSEvBxO04iOFC3rEK0y7kADY=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools/ocaml: add 'make format' for OCaml files
Message-Id: <E1pPaSt-0000Rx-15@xenbits.xenproject.org>
Date: Wed, 08 Feb 2023 02:45:43 +0000

commit aad8c1276cbe21b1306b32899e19875ca015267e
Author:     Edwin Török <edvin.torok@citrix.com>
AuthorDate: Fri Dec 2 17:17:32 2022 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Mon Feb 6 10:22:12 2023 +0000

    tools/ocaml: add 'make format' for OCaml files
    
    Using `ocp-indent` for now to just make minimal modifications in
    tabs vs spaces and get the right indentation.
    
    This avoids perpetuating a formatting style that is inconsistent with
    the rest of Xen, and that makes preparing and submitting patches more
    difficult (OCaml indentation tools usually only support spaces, not tabs).
    
    No functional change.
    
    Signed-off-by: Edwin Török <edvin.torok@citrix.com>
    Acked-by: Christian Lindig <christian.lindig@citrix.com>
---
 tools/ocaml/Makefile | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/tools/ocaml/Makefile b/tools/ocaml/Makefile
index a7c04b6546..85bfd087c9 100644
--- a/tools/ocaml/Makefile
+++ b/tools/ocaml/Makefile
@@ -34,3 +34,7 @@ build-tools-oxenstored:
 	$(MAKE) -s -C libs/xb
 	$(MAKE) -s -C libs/xc
 	$(MAKE) -C xenstored
+
+.PHONY: format
+format:
+	git ls-files '*.ml' '*.mli' | xargs -n1 ocp-indent -i
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Feb 08 02:45:55 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 08 Feb 2023 02:45:55 +0000
Received: from list by lists.xenproject.org with outflank-mailman.491497.760621 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pPaT4-0007Su-TQ; Wed, 08 Feb 2023 02:45:54 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 491497.760621; Wed, 08 Feb 2023 02:45:54 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pPaT4-0007Sn-Q1; Wed, 08 Feb 2023 02:45:54 +0000
Received: by outflank-mailman (input) for mailman id 491497;
 Wed, 08 Feb 2023 02:45:53 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pPaT3-0007SP-6Y
 for xen-changelog@lists.xenproject.org; Wed, 08 Feb 2023 02:45:53 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pPaT3-0003OD-5g
 for xen-changelog@lists.xenproject.org; Wed, 08 Feb 2023 02:45:53 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pPaT3-0000Sg-4f
 for xen-changelog@lists.xenproject.org; Wed, 08 Feb 2023 02:45:53 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=1yFhg7/SlCoMu7RVgFQpi5kD1lBGzq7/kPLYqzjfa44=; b=Vs8lPi5CQH2bXzip/iDqmgVHmx
	QExGBQvXomg19eVvTcpERi7QDDaqXTrvKggLkYjxa64v/omPwX7NRpy/5rdGrg9QKq4XtjmQDIgnP
	mpY3T5S6fPXJICXKAGy0aHTST9JrKKGdWTiaCSfMCPQi23Hs7xEdGpF/pAdixY9Zo/qY=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools/ocaml: run 'make format' on OCaml files
Message-Id: <E1pPaT3-0000Sg-4f@xenbits.xenproject.org>
Date: Wed, 08 Feb 2023 02:45:53 +0000

commit ea250e81cfc709feccd47a682dbaf805bde08e87
Author:     Edwin Török <edwin.torok@cloud.com>
AuthorDate: Thu Jan 12 17:26:39 2023 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Mon Feb 6 10:22:12 2023 +0000

    tools/ocaml: run 'make format' on OCaml files
    
    `git log -p -1 -w` proves the change here is only whitespace.
    
    No functional change.
    
    Signed-off-by: Edwin Török <edwin.torok@cloud.com>
    Acked-by: Christian Lindig <christian.lindig@citrix.com>
---
 tools/ocaml/libs/mmap/xenmmap.ml     |    2 +-
 tools/ocaml/libs/mmap/xenmmap.mli    |    4 +-
 tools/ocaml/libs/xb/op.ml            |   76 +--
 tools/ocaml/libs/xb/packet.ml        |   30 +-
 tools/ocaml/libs/xb/partial.ml       |   48 +-
 tools/ocaml/libs/xb/xb.ml            |  440 ++++++------
 tools/ocaml/libs/xb/xb.mli           |  106 +--
 tools/ocaml/libs/xb/xs_ring.ml       |   26 +-
 tools/ocaml/libs/xc/xenctrl.ml       |  326 ++++-----
 tools/ocaml/libs/xc/xenctrl.mli      |   12 +-
 tools/ocaml/libs/xs/queueop.ml       |   48 +-
 tools/ocaml/libs/xs/xs.ml            |  234 +++----
 tools/ocaml/libs/xs/xs.mli           |   46 +-
 tools/ocaml/libs/xs/xsraw.ml         |  300 ++++----
 tools/ocaml/libs/xs/xst.ml           |   76 +--
 tools/ocaml/libs/xs/xst.mli          |   20 +-
 tools/ocaml/test/dmesg.ml            |   26 +-
 tools/ocaml/test/list_domains.ml     |    4 +-
 tools/ocaml/test/raise_exception.ml  |    4 +-
 tools/ocaml/test/xtl.ml              |   28 +-
 tools/ocaml/xenstored/config.ml      |  156 ++---
 tools/ocaml/xenstored/connection.ml  |  604 ++++++++---------
 tools/ocaml/xenstored/connections.ml |  294 ++++----
 tools/ocaml/xenstored/disk.ml        |  226 +++---
 tools/ocaml/xenstored/domain.ml      |  116 ++--
 tools/ocaml/xenstored/domains.ml     |  310 ++++-----
 tools/ocaml/xenstored/event.ml       |   28 +-
 tools/ocaml/xenstored/history.ml     |   62 +-
 tools/ocaml/xenstored/logging.ml     |  494 +++++++-------
 tools/ocaml/xenstored/packet.ml      |   20 +-
 tools/ocaml/xenstored/parse_arg.ml   |  106 +--
 tools/ocaml/xenstored/perms.ml       |  234 +++----
 tools/ocaml/xenstored/poll.ml        |   68 +-
 tools/ocaml/xenstored/poll.mli       |    4 +-
 tools/ocaml/xenstored/process.ml     | 1244 +++++++++++++++++-----------------
 tools/ocaml/xenstored/quota.ml       |   74 +-
 tools/ocaml/xenstored/stdext.ml      |  206 +++---
 tools/ocaml/xenstored/store.ml       |  822 +++++++++++-----------
 tools/ocaml/xenstored/symbol.ml      |    2 +-
 tools/ocaml/xenstored/syslog.ml      |   48 +-
 tools/ocaml/xenstored/transaction.ml |  352 +++++-----
 tools/ocaml/xenstored/trie.ml        |  234 +++----
 tools/ocaml/xenstored/trie.mli       |   22 +-
 tools/ocaml/xenstored/utils.ml       |  146 ++--
 tools/ocaml/xenstored/xenstored.ml   | 1070 ++++++++++++++---------------
 45 files changed, 4399 insertions(+), 4399 deletions(-)

diff --git a/tools/ocaml/libs/mmap/xenmmap.ml b/tools/ocaml/libs/mmap/xenmmap.ml
index 44b67c89d2..fd6735649f 100644
--- a/tools/ocaml/libs/mmap/xenmmap.ml
+++ b/tools/ocaml/libs/mmap/xenmmap.ml
@@ -21,7 +21,7 @@ type mmap_map_flag = SHARED | PRIVATE
 
 (* mmap: fd -> prot_flag -> map_flag -> length -> offset -> interface *)
 external mmap: Unix.file_descr -> mmap_prot_flag -> mmap_map_flag
-		-> int -> int -> mmap_interface = "stub_mmap_init"
+  -> int -> int -> mmap_interface = "stub_mmap_init"
 external unmap: mmap_interface -> unit = "stub_mmap_final"
 (* read: interface -> start -> length -> data *)
 external read: mmap_interface -> int -> int -> string = "stub_mmap_read"
diff --git a/tools/ocaml/libs/mmap/xenmmap.mli b/tools/ocaml/libs/mmap/xenmmap.mli
index 8f92ed6310..d097b68a8f 100644
--- a/tools/ocaml/libs/mmap/xenmmap.mli
+++ b/tools/ocaml/libs/mmap/xenmmap.mli
@@ -19,10 +19,10 @@ type mmap_prot_flag = RDONLY | WRONLY | RDWR
 type mmap_map_flag = SHARED | PRIVATE
 
 external mmap : Unix.file_descr -> mmap_prot_flag -> mmap_map_flag -> int -> int
-             -> mmap_interface = "stub_mmap_init"
+  -> mmap_interface = "stub_mmap_init"
 external unmap : mmap_interface -> unit = "stub_mmap_final"
 external read : mmap_interface -> int -> int -> string = "stub_mmap_read"
 external write : mmap_interface -> string -> int -> int -> unit
-               = "stub_mmap_write"
+  = "stub_mmap_write"
 
 external getpagesize : unit -> int = "stub_mmap_getpagesize"
diff --git a/tools/ocaml/libs/xb/op.ml b/tools/ocaml/libs/xb/op.ml
index 9bcab0f38c..77cf04a752 100644
--- a/tools/ocaml/libs/xb/op.ml
+++ b/tools/ocaml/libs/xb/op.ml
@@ -23,50 +23,50 @@ type operation = Debug | Directory | Read | Getperms |
                  Invalid
 
 let operation_c_mapping =
-	[| Debug; Directory; Read; Getperms;
-           Watch; Unwatch; Transaction_start;
-           Transaction_end; Introduce; Release;
-           Getdomainpath; Write; Mkdir; Rm;
-           Setperms; Watchevent; Error; Isintroduced;
-           Resume; Set_target; Invalid; Reset_watches |]
+  [| Debug; Directory; Read; Getperms;
+     Watch; Unwatch; Transaction_start;
+     Transaction_end; Introduce; Release;
+     Getdomainpath; Write; Mkdir; Rm;
+     Setperms; Watchevent; Error; Isintroduced;
+     Resume; Set_target; Invalid; Reset_watches |]
 let size = Array.length operation_c_mapping
 
 let array_search el a =
-	let len = Array.length a in
-	let rec search i =
-		if i > len then raise Not_found;
-		if a.(i) = el then i else search (i + 1) in
-	search 0
+  let len = Array.length a in
+  let rec search i =
+    if i > len then raise Not_found;
+    if a.(i) = el then i else search (i + 1) in
+  search 0
 
 let of_cval i =
-	if i >= 0 && i < size
-	then operation_c_mapping.(i)
-	else Invalid
+  if i >= 0 && i < size
+  then operation_c_mapping.(i)
+  else Invalid
 
 let to_cval op =
-	array_search op operation_c_mapping
+  array_search op operation_c_mapping
 
 let to_string ty =
-	match ty with
-	| Debug			-> "DEBUG"
-	| Directory		-> "DIRECTORY"
-	| Read			-> "READ"
-	| Getperms		-> "GET_PERMS"
-	| Watch			-> "WATCH"
-	| Unwatch		-> "UNWATCH"
-	| Transaction_start	-> "TRANSACTION_START"
-	| Transaction_end	-> "TRANSACTION_END"
-	| Introduce		-> "INTRODUCE"
-	| Release		-> "RELEASE"
-	| Getdomainpath		-> "GET_DOMAIN_PATH"
-	| Write			-> "WRITE"
-	| Mkdir			-> "MKDIR"
-	| Rm			-> "RM"
-	| Setperms		-> "SET_PERMS"
-	| Watchevent		-> "WATCH_EVENT"
-	| Error			-> "ERROR"
-	| Isintroduced		-> "IS_INTRODUCED"
-	| Resume		-> "RESUME"
-	| Set_target		-> "SET_TARGET"
-	| Reset_watches         -> "RESET_WATCHES"
-	| Invalid		-> "INVALID"
+  match ty with
+  | Debug			-> "DEBUG"
+  | Directory		-> "DIRECTORY"
+  | Read			-> "READ"
+  | Getperms		-> "GET_PERMS"
+  | Watch			-> "WATCH"
+  | Unwatch		-> "UNWATCH"
+  | Transaction_start	-> "TRANSACTION_START"
+  | Transaction_end	-> "TRANSACTION_END"
+  | Introduce		-> "INTRODUCE"
+  | Release		-> "RELEASE"
+  | Getdomainpath		-> "GET_DOMAIN_PATH"
+  | Write			-> "WRITE"
+  | Mkdir			-> "MKDIR"
+  | Rm			-> "RM"
+  | Setperms		-> "SET_PERMS"
+  | Watchevent		-> "WATCH_EVENT"
+  | Error			-> "ERROR"
+  | Isintroduced		-> "IS_INTRODUCED"
+  | Resume		-> "RESUME"
+  | Set_target		-> "SET_TARGET"
+  | Reset_watches         -> "RESET_WATCHES"
+  | Invalid		-> "INVALID"
diff --git a/tools/ocaml/libs/xb/packet.ml b/tools/ocaml/libs/xb/packet.ml
index 74c04bb7ae..cd169c066b 100644
--- a/tools/ocaml/libs/xb/packet.ml
+++ b/tools/ocaml/libs/xb/packet.ml
@@ -15,12 +15,12 @@
  *)
 
 type t =
-{
-	tid: int;
-	rid: int;
-	ty: Op.operation;
-	data: string;
-}
+  {
+    tid: int;
+    rid: int;
+    ty: Op.operation;
+    data: string;
+  }
 
 exception Error of string
 exception DataError of string
@@ -30,21 +30,21 @@ external string_of_header: int -> int -> int -> int -> string = "stub_string_of_
 let create tid rid ty data = { tid = tid; rid = rid; ty = ty; data = data; }
 
 let of_partialpkt ppkt =
-	create ppkt.Partial.tid ppkt.Partial.rid ppkt.Partial.ty (Buffer.contents ppkt.Partial.buf)
+  create ppkt.Partial.tid ppkt.Partial.rid ppkt.Partial.ty (Buffer.contents ppkt.Partial.buf)
 
 let to_string pkt =
-	let header = string_of_header pkt.tid pkt.rid (Op.to_cval pkt.ty) (String.length pkt.data) in
-	header ^ pkt.data
+  let header = string_of_header pkt.tid pkt.rid (Op.to_cval pkt.ty) (String.length pkt.data) in
+  header ^ pkt.data
 
 let unpack pkt =
-	pkt.tid, pkt.rid, pkt.ty, pkt.data
+  pkt.tid, pkt.rid, pkt.ty, pkt.data
 
 let get_tid pkt = pkt.tid
 let get_ty pkt = pkt.ty
 let get_data pkt =
-	let l = String.length pkt.data in
-	if l > 0 && pkt.data.[l - 1] = '\000' then
-		String.sub pkt.data 0 (l - 1)
-	else
-		pkt.data
+  let l = String.length pkt.data in
+  if l > 0 && pkt.data.[l - 1] = '\000' then
+    String.sub pkt.data 0 (l - 1)
+  else
+    pkt.data
 let get_rid pkt = pkt.rid
\ No newline at end of file
diff --git a/tools/ocaml/libs/xb/partial.ml b/tools/ocaml/libs/xb/partial.ml
index 3aa8927eb7..0e6532807d 100644
--- a/tools/ocaml/libs/xb/partial.ml
+++ b/tools/ocaml/libs/xb/partial.ml
@@ -15,39 +15,39 @@
  *)
 
 type pkt =
-{
-	tid: int;
-	rid: int;
-	ty: Op.operation;
-	len: int;
-	buf: Buffer.t;
-}
+  {
+    tid: int;
+    rid: int;
+    ty: Op.operation;
+    len: int;
+    buf: Buffer.t;
+  }
 
 external header_size: unit -> int = "stub_header_size"
 external header_of_string_internal: string -> int * int * int * int
-         = "stub_header_of_string"
+  = "stub_header_of_string"
 
 let xenstore_payload_max = 4096 (* xen/include/public/io/xs_wire.h *)
 let xenstore_rel_path_max = 2048 (* xen/include/public/io/xs_wire.h *)
 
 let of_string s =
-	let tid, rid, opint, dlen = header_of_string_internal s in
-	(* A packet which is bigger than xenstore_payload_max is illegal.
-	   This will leave the guest connection is a bad state and will
-	   be hard to recover from without restarting the connection
-	   (ie rebooting the guest) *)
-	let dlen = max 0 (min xenstore_payload_max dlen) in
-	{
-		tid = tid;
-		rid = rid;
-		ty = (Op.of_cval opint);
-		len = dlen;
-		buf = Buffer.create dlen;
-	}
+  let tid, rid, opint, dlen = header_of_string_internal s in
+  (* A packet which is bigger than xenstore_payload_max is illegal.
+     	   This will leave the guest connection is a bad state and will
+     	   be hard to recover from without restarting the connection
+     	   (ie rebooting the guest) *)
+  let dlen = max 0 (min xenstore_payload_max dlen) in
+  {
+    tid = tid;
+    rid = rid;
+    ty = (Op.of_cval opint);
+    len = dlen;
+    buf = Buffer.create dlen;
+  }
 
 let append pkt s sz =
-	if Buffer.length pkt.buf + sz > xenstore_payload_max then failwith "Buffer.add: cannot grow buffer";
-	Buffer.add_substring pkt.buf s 0 sz
+  if Buffer.length pkt.buf + sz > xenstore_payload_max then failwith "Buffer.add: cannot grow buffer";
+  Buffer.add_substring pkt.buf s 0 sz
 
 let to_complete pkt =
-	pkt.len - (Buffer.length pkt.buf)
+  pkt.len - (Buffer.length pkt.buf)
diff --git a/tools/ocaml/libs/xb/xb.ml b/tools/ocaml/libs/xb/xb.ml
index b292ed7a87..3e3ef2b29d 100644
--- a/tools/ocaml/libs/xb/xb.ml
+++ b/tools/ocaml/libs/xb/xb.ml
@@ -18,94 +18,94 @@ module Op = struct include Op end
 module Packet = struct include Packet end
 
 module BoundedQueue : sig
-	type ('a, 'b) t
+  type ('a, 'b) t
 
-	(** [create ~capacity ~classify ~limit] creates a queue with maximum [capacity] elements.
-	    This is burst capacity, each element is further classified according to [classify],
-	    and each class can have its own [limit].
-	    [capacity] is enforced as an overall limit.
-	    The [limit] can be dynamic, and can be smaller than the number of elements already queued of that class,
-	    in which case those elements are considered to use "burst capacity".
-	  *)
-	val create: capacity:int -> classify:('a -> 'b) -> limit:('b -> int) -> ('a, 'b) t
+  (** [create ~capacity ~classify ~limit] creates a queue with maximum [capacity] elements.
+      	    This is burst capacity, each element is further classified according to [classify],
+      	    and each class can have its own [limit].
+      	    [capacity] is enforced as an overall limit.
+      	    The [limit] can be dynamic, and can be smaller than the number of elements already queued of that class,
+      	    in which case those elements are considered to use "burst capacity".
+      	  *)
+  val create: capacity:int -> classify:('a -> 'b) -> limit:('b -> int) -> ('a, 'b) t
 
-	(** [clear q] discards all elements from [q] *)
-	val clear: ('a, 'b) t -> unit
+  (** [clear q] discards all elements from [q] *)
+  val clear: ('a, 'b) t -> unit
 
-	(** [can_push q] when [length q < capacity].	*)
-	val can_push: ('a, 'b) t -> 'b -> bool
+  (** [can_push q] when [length q < capacity].	*)
+  val can_push: ('a, 'b) t -> 'b -> bool
 
-	(** [push e q] adds [e] at the end of queue [q] if [can_push q], or returns [None]. *)
-	val push: 'a -> ('a, 'b) t -> unit option
+  (** [push e q] adds [e] at the end of queue [q] if [can_push q], or returns [None]. *)
+  val push: 'a -> ('a, 'b) t -> unit option
 
-	(** [pop q] removes and returns first element in [q], or raises [Queue.Empty]. *)
-	val pop: ('a, 'b) t -> 'a
+  (** [pop q] removes and returns first element in [q], or raises [Queue.Empty]. *)
+  val pop: ('a, 'b) t -> 'a
 
-	(** [peek q] returns the first element in [q], or raises [Queue.Empty].  *)
-	val peek : ('a, 'b) t -> 'a
+  (** [peek q] returns the first element in [q], or raises [Queue.Empty].  *)
+  val peek : ('a, 'b) t -> 'a
 
-	(** [length q] returns the current number of elements in [q] *)
-	val length: ('a, 'b) t -> int
+  (** [length q] returns the current number of elements in [q] *)
+  val length: ('a, 'b) t -> int
 
-	(** [debug string_of_class q] prints queue usage statistics in an unspecified internal format. *)
-	val debug: ('b -> string) -> (_, 'b) t -> string
+  (** [debug string_of_class q] prints queue usage statistics in an unspecified internal format. *)
+  val debug: ('b -> string) -> (_, 'b) t -> string
 end = struct
-	type ('a, 'b) t =
-		{ q: 'a Queue.t
-		; capacity: int
-		; classify: 'a -> 'b
-		; limit: 'b -> int
-		; class_count: ('b, int) Hashtbl.t
-		}
-
-	let create ~capacity ~classify ~limit =
-		{ capacity; q = Queue.create (); classify; limit; class_count = Hashtbl.create 3 }
-
-	let get_count t classification = try Hashtbl.find t.class_count classification with Not_found -> 0
-
-	let can_push_internal t classification class_count =
-		Queue.length t.q < t.capacity && class_count < t.limit classification
-
-	let ok = Some ()
-
-	let push e t =
-		let classification = t.classify e in
-		let class_count = get_count t classification in
-		if can_push_internal t classification class_count then begin
-			Queue.push e t.q;
-			Hashtbl.replace t.class_count classification (class_count + 1);
-			ok
-		end
-		else
-			None
-
-	let can_push t classification =
-		can_push_internal t classification @@ get_count t classification
-
-	let clear t =
-		Queue.clear t.q;
-		Hashtbl.reset t.class_count
-
-	let pop t =
-		let e = Queue.pop t.q in
-		let classification = t.classify e in
-		let () = match get_count t classification - 1 with
-		| 0 -> Hashtbl.remove t.class_count classification (* reduces memusage *)
-		| n -> Hashtbl.replace t.class_count classification n
-		in
-		e
-
-	let peek t = Queue.peek t.q
-	let length t = Queue.length t.q
-
-	let debug string_of_class t =
-		let b = Buffer.create 128 in
-		Printf.bprintf b "BoundedQueue capacity: %d, used: {" t.capacity;
-		Hashtbl.iter (fun packet_class count ->
-			Printf.bprintf b "	%s: %d" (string_of_class packet_class) count
-		) t.class_count;
-		Printf.bprintf b "}";
-		Buffer.contents b
+  type ('a, 'b) t =
+    { q: 'a Queue.t
+    ; capacity: int
+    ; classify: 'a -> 'b
+    ; limit: 'b -> int
+    ; class_count: ('b, int) Hashtbl.t
+    }
+
+  let create ~capacity ~classify ~limit =
+    { capacity; q = Queue.create (); classify; limit; class_count = Hashtbl.create 3 }
+
+  let get_count t classification = try Hashtbl.find t.class_count classification with Not_found -> 0
+
+  let can_push_internal t classification class_count =
+    Queue.length t.q < t.capacity && class_count < t.limit classification
+
+  let ok = Some ()
+
+  let push e t =
+    let classification = t.classify e in
+    let class_count = get_count t classification in
+    if can_push_internal t classification class_count then begin
+      Queue.push e t.q;
+      Hashtbl.replace t.class_count classification (class_count + 1);
+      ok
+    end
+    else
+      None
+
+  let can_push t classification =
+    can_push_internal t classification @@ get_count t classification
+
+  let clear t =
+    Queue.clear t.q;
+    Hashtbl.reset t.class_count
+
+  let pop t =
+    let e = Queue.pop t.q in
+    let classification = t.classify e in
+    let () = match get_count t classification - 1 with
+      | 0 -> Hashtbl.remove t.class_count classification (* reduces memusage *)
+      | n -> Hashtbl.replace t.class_count classification n
+    in
+    e
+
+  let peek t = Queue.peek t.q
+  let length t = Queue.length t.q
+
+  let debug string_of_class t =
+    let b = Buffer.create 128 in
+    Printf.bprintf b "BoundedQueue capacity: %d, used: {" t.capacity;
+    Hashtbl.iter (fun packet_class count ->
+        Printf.bprintf b "	%s: %d" (string_of_class packet_class) count
+      ) t.class_count;
+    Printf.bprintf b "}";
+    Buffer.contents b
 end
 
 
@@ -119,16 +119,16 @@ let _ =
   Callback.register_exception "Xb.Reconnect" Reconnect
 
 type backend_mmap =
-{
-	mmap: Xenmmap.mmap_interface;     (* mmaped interface = xs_ring *)
-	eventchn_notify: unit -> unit; (* function to notify through eventchn *)
-	mutable work_again: bool;
-}
+  {
+    mmap: Xenmmap.mmap_interface;     (* mmaped interface = xs_ring *)
+    eventchn_notify: unit -> unit; (* function to notify through eventchn *)
+    mutable work_again: bool;
+  }
 
 type backend_fd =
-{
-	fd: Unix.file_descr;
-}
+  {
+    fd: Unix.file_descr;
+  }
 
 type backend = Fd of backend_fd | Xenmmap of backend_mmap
 
@@ -144,104 +144,104 @@ type capacity = { maxoutstanding: int; maxwatchevents: int }
 module Queue = BoundedQueue
 
 type packet_class =
-	| CommandReply
-	| Watchevent
+  | CommandReply
+  | Watchevent
 
 let string_of_packet_class = function
-	| CommandReply -> "command_reply"
-	| Watchevent -> "watch_event"
+  | CommandReply -> "command_reply"
+  | Watchevent -> "watch_event"
 
 type t =
-{
-	backend: backend;
-	pkt_out: (Packet.t, packet_class) Queue.t;
-	mutable partial_in: partial_buf;
-	mutable partial_out: string;
-	capacity: capacity
-}
+  {
+    backend: backend;
+    pkt_out: (Packet.t, packet_class) Queue.t;
+    mutable partial_in: partial_buf;
+    mutable partial_out: string;
+    capacity: capacity
+  }
 
 let to_read con =
-	match con.partial_in with
-		| HaveHdr partial_pkt -> Partial.to_complete partial_pkt
-		| NoHdr   (i, _)    -> i
+  match con.partial_in with
+  | HaveHdr partial_pkt -> Partial.to_complete partial_pkt
+  | NoHdr   (i, _)    -> i
 
 let debug t =
-	Printf.sprintf "XenBus state: partial_in: %d needed, partial_out: %d bytes, pkt_out: %d packets, %s"
-		(to_read t)
-		(String.length t.partial_out)
-		(Queue.length t.pkt_out)
-		(BoundedQueue.debug string_of_packet_class t.pkt_out)
+  Printf.sprintf "XenBus state: partial_in: %d needed, partial_out: %d bytes, pkt_out: %d packets, %s"
+    (to_read t)
+    (String.length t.partial_out)
+    (Queue.length t.pkt_out)
+    (BoundedQueue.debug string_of_packet_class t.pkt_out)
 
 let init_partial_in () = NoHdr
-	(Partial.header_size (), Bytes.make (Partial.header_size()) '\000')
+    (Partial.header_size (), Bytes.make (Partial.header_size()) '\000')
 
 let reconnect t = match t.backend with
-	| Fd _ ->
-		(* should never happen, so close the connection *)
-		raise End_of_file
-	| Xenmmap backend ->
-		Xs_ring.close backend.mmap;
-		backend.eventchn_notify ();
-		(* Clear our old connection state *)
-		Queue.clear t.pkt_out;
-		t.partial_in <- init_partial_in ();
-		t.partial_out <- ""
+  | Fd _ ->
+    (* should never happen, so close the connection *)
+    raise End_of_file
+  | Xenmmap backend ->
+    Xs_ring.close backend.mmap;
+    backend.eventchn_notify ();
+    (* Clear our old connection state *)
+    Queue.clear t.pkt_out;
+    t.partial_in <- init_partial_in ();
+    t.partial_out <- ""
 
 let queue con pkt = Queue.push pkt con.pkt_out
 
 let read_fd back _con b len =
-	let rd = Unix.read back.fd b 0 len in
-	if rd = 0 then
-		raise End_of_file;
-	rd
+  let rd = Unix.read back.fd b 0 len in
+  if rd = 0 then
+    raise End_of_file;
+  rd
 
 let read_mmap back _con b len =
-	let s = Bytes.make len '\000' in
-	let rd = Xs_ring.read back.mmap s len in
-	Bytes.blit s 0 b 0 rd;
-	back.work_again <- (rd > 0);
-	if rd > 0 then
-		back.eventchn_notify ();
-	rd
+  let s = Bytes.make len '\000' in
+  let rd = Xs_ring.read back.mmap s len in
+  Bytes.blit s 0 b 0 rd;
+  back.work_again <- (rd > 0);
+  if rd > 0 then
+    back.eventchn_notify ();
+  rd
 
 let read con b len =
-	match con.backend with
-	| Fd backfd     -> read_fd backfd con b len
-	| Xenmmap backmmap -> read_mmap backmmap con b len
+  match con.backend with
+  | Fd backfd     -> read_fd backfd con b len
+  | Xenmmap backmmap -> read_mmap backmmap con b len
 
 let write_fd back _con b len =
-	Unix.write_substring back.fd b 0 len
+  Unix.write_substring back.fd b 0 len
 
 let write_mmap back _con s len =
-	let ws = Xs_ring.write_substring back.mmap s len in
-	if ws > 0 then
-		back.eventchn_notify ();
-	ws
+  let ws = Xs_ring.write_substring back.mmap s len in
+  if ws > 0 then
+    back.eventchn_notify ();
+  ws
 
 let write con s len =
-	match con.backend with
-	| Fd backfd     -> write_fd backfd con s len
-	| Xenmmap backmmap -> write_mmap backmmap con s len
+  match con.backend with
+  | Fd backfd     -> write_fd backfd con s len
+  | Xenmmap backmmap -> write_mmap backmmap con s len
 
 (* NB: can throw Reconnect *)
 let output con =
-	(* get the output string from a string_of(packet) or partial_out *)
-	let s = if String.length con.partial_out > 0 then
-			con.partial_out
-		else if Queue.length con.pkt_out > 0 then
-			let pkt = Queue.pop con.pkt_out in
-			Packet.to_string pkt
-		else
-			"" in
-	(* send data from s, and save the unsent data to partial_out *)
-	if s <> "" then (
-		let len = String.length s in
-		let sz = write con s len in
-		let left = String.sub s sz (len - sz) in
-		con.partial_out <- left
-	);
-	(* after sending one packet, partial is empty *)
-	con.partial_out = ""
+  (* get the output string from a string_of(packet) or partial_out *)
+  let s = if String.length con.partial_out > 0 then
+      con.partial_out
+    else if Queue.length con.pkt_out > 0 then
+      let pkt = Queue.pop con.pkt_out in
+      Packet.to_string pkt
+    else
+      "" in
+  (* send data from s, and save the unsent data to partial_out *)
+  if s <> "" then (
+    let len = String.length s in
+    let sz = write con s len in
+    let left = String.sub s sz (len - sz) in
+    con.partial_out <- left
+  );
+  (* after sending one packet, partial is empty *)
+  con.partial_out = ""
 
 (* we can only process an input packet if we're guaranteed to have room
    to store the response packet *)
@@ -249,71 +249,71 @@ let can_input con = Queue.can_push con.pkt_out CommandReply
 
 (* NB: can throw Reconnect *)
 let input con =
-	if not (can_input con) then None
-	else
-	let to_read = to_read con in
-
-	(* try to get more data from input stream *)
-	let b = Bytes.make to_read '\000' in
-	let sz = if to_read > 0 then read con b to_read else 0 in
-
-	(
-	match con.partial_in with
-	| HaveHdr partial_pkt ->
-		(* we complete the data *)
-		if sz > 0 then
-			Partial.append partial_pkt (Bytes.to_string b) sz;
-		if Partial.to_complete partial_pkt = 0 then (
-			let pkt = Packet.of_partialpkt partial_pkt in
-			con.partial_in <- init_partial_in ();
-			Some pkt
-		) else None
-	| NoHdr (i, buf)      ->
-		(* we complete the partial header *)
-		if sz > 0 then
-			Bytes.blit b 0 buf (Partial.header_size () - i) sz;
-		con.partial_in <- if sz = i then
-			HaveHdr (Partial.of_string (Bytes.to_string buf)) else NoHdr (i - sz, buf);
-		None
-	)
+  if not (can_input con) then None
+  else
+    let to_read = to_read con in
+
+    (* try to get more data from input stream *)
+    let b = Bytes.make to_read '\000' in
+    let sz = if to_read > 0 then read con b to_read else 0 in
+
+    (
+      match con.partial_in with
+      | HaveHdr partial_pkt ->
+        (* we complete the data *)
+        if sz > 0 then
+          Partial.append partial_pkt (Bytes.to_string b) sz;
+        if Partial.to_complete partial_pkt = 0 then (
+          let pkt = Packet.of_partialpkt partial_pkt in
+          con.partial_in <- init_partial_in ();
+          Some pkt
+        ) else None
+      | NoHdr (i, buf)      ->
+        (* we complete the partial header *)
+        if sz > 0 then
+          Bytes.blit b 0 buf (Partial.header_size () - i) sz;
+        con.partial_in <- if sz = i then
+            HaveHdr (Partial.of_string (Bytes.to_string buf)) else NoHdr (i - sz, buf);
+        None
+    )
 
 let classify t =
-	match t.Packet.ty with
-	| Op.Watchevent -> Watchevent
-	| _ -> CommandReply
+  match t.Packet.ty with
+  | Op.Watchevent -> Watchevent
+  | _ -> CommandReply
 
 let newcon ~capacity backend =
-	let limit = function
-		| CommandReply -> capacity.maxoutstanding
-		| Watchevent -> capacity.maxwatchevents
-	in
-	{
-	backend = backend;
-	pkt_out = Queue.create ~capacity:(capacity.maxoutstanding + capacity.maxwatchevents) ~classify ~limit;
-	partial_in = init_partial_in ();
-	partial_out = "";
-	capacity = capacity;
-	}
+  let limit = function
+    | CommandReply -> capacity.maxoutstanding
+    | Watchevent -> capacity.maxwatchevents
+  in
+  {
+    backend = backend;
+    pkt_out = Queue.create ~capacity:(capacity.maxoutstanding + capacity.maxwatchevents) ~classify ~limit;
+    partial_in = init_partial_in ();
+    partial_out = "";
+    capacity = capacity;
+  }
 
 let open_fd fd = newcon (Fd { fd = fd; })
 
 let open_mmap mmap notifyfct =
-	(* Advertise XENSTORE_SERVER_FEATURE_RECONNECTION *)
-	Xs_ring.set_server_features mmap (Xs_ring.Server_features.singleton Xs_ring.Server_feature.Reconnection);
-	newcon (Xenmmap {
-		mmap = mmap;
-		eventchn_notify = notifyfct;
-		work_again = false; })
+  (* Advertise XENSTORE_SERVER_FEATURE_RECONNECTION *)
+  Xs_ring.set_server_features mmap (Xs_ring.Server_features.singleton Xs_ring.Server_feature.Reconnection);
+  newcon (Xenmmap {
+      mmap = mmap;
+      eventchn_notify = notifyfct;
+      work_again = false; })
 
 let close con =
-	match con.backend with
-	| Fd backend   -> Unix.close backend.fd
-	| Xenmmap backend -> Xenmmap.unmap backend.mmap
+  match con.backend with
+  | Fd backend   -> Unix.close backend.fd
+  | Xenmmap backend -> Xenmmap.unmap backend.mmap
 
 let is_fd con =
-	match con.backend with
-	| Fd _   -> true
-	| Xenmmap _ -> false
+  match con.backend with
+  | Fd _   -> true
+  | Xenmmap _ -> false
 
 let is_mmap con = not (is_fd con)
 
@@ -326,19 +326,19 @@ let has_output con = has_new_output con || has_old_output con
 let peek_output con = Queue.peek con.pkt_out
 
 let has_partial_input con = match con.partial_in with
-	| HaveHdr _ -> true
-	| NoHdr (n, _) -> n < Partial.header_size ()
+  | HaveHdr _ -> true
+  | NoHdr (n, _) -> n < Partial.header_size ()
 let has_more_input con =
-	match con.backend with
-	| Fd _         -> false
-	| Xenmmap backend -> backend.work_again
+  match con.backend with
+  | Fd _         -> false
+  | Xenmmap backend -> backend.work_again
 
 let is_selectable con =
-	match con.backend with
-	| Fd _   -> true
-	| Xenmmap _ -> false
+  match con.backend with
+  | Fd _   -> true
+  | Xenmmap _ -> false
 
 let get_fd con =
-	match con.backend with
-	| Fd backend -> backend.fd
-	| Xenmmap _     -> raise (Failure "get_fd")
+  match con.backend with
+  | Fd backend -> backend.fd
+  | Xenmmap _     -> raise (Failure "get_fd")
diff --git a/tools/ocaml/libs/xb/xb.mli b/tools/ocaml/libs/xb/xb.mli
index 71b2754ca7..e6bb3809dc 100644
--- a/tools/ocaml/libs/xb/xb.mli
+++ b/tools/ocaml/libs/xb/xb.mli
@@ -1,58 +1,58 @@
 module Op :
-  sig
-    type operation =
-      Op.operation =
-        Debug
-      | Directory
-      | Read
-      | Getperms
-      | Watch
-      | Unwatch
-      | Transaction_start
-      | Transaction_end
-      | Introduce
-      | Release
-      | Getdomainpath
-      | Write
-      | Mkdir
-      | Rm
-      | Setperms
-      | Watchevent
-      | Error
-      | Isintroduced
-      | Resume
-      | Set_target
-      | Reset_watches
-      | Invalid
-    val operation_c_mapping : operation array
-    val size : int
-    val array_search : 'a -> 'a array -> int
-    val of_cval : int -> operation
-    val to_cval : operation -> int
-    val to_string : operation -> string
-  end
+sig
+  type operation =
+    Op.operation =
+      Debug
+    | Directory
+    | Read
+    | Getperms
+    | Watch
+    | Unwatch
+    | Transaction_start
+    | Transaction_end
+    | Introduce
+    | Release
+    | Getdomainpath
+    | Write
+    | Mkdir
+    | Rm
+    | Setperms
+    | Watchevent
+    | Error
+    | Isintroduced
+    | Resume
+    | Set_target
+    | Reset_watches
+    | Invalid
+  val operation_c_mapping : operation array
+  val size : int
+  val array_search : 'a -> 'a array -> int
+  val of_cval : int -> operation
+  val to_cval : operation -> int
+  val to_string : operation -> string
+end
 module Packet :
-  sig
-    type t =
-      Packet.t = {
-      tid : int;
-      rid : int;
-      ty : Op.operation;
-      data : string;
-    }
-    exception Error of string
-    exception DataError of string
-    external string_of_header : int -> int -> int -> int -> string
-      = "stub_string_of_header"
-    val create : int -> int -> Op.operation -> string -> t
-    val of_partialpkt : Partial.pkt -> t
-    val to_string : t -> string
-    val unpack : t -> int * int * Op.operation * string
-    val get_tid : t -> int
-    val get_ty : t -> Op.operation
-    val get_data : t -> string
-    val get_rid : t -> int
-  end
+sig
+  type t =
+    Packet.t = {
+    tid : int;
+    rid : int;
+    ty : Op.operation;
+    data : string;
+  }
+  exception Error of string
+  exception DataError of string
+  external string_of_header : int -> int -> int -> int -> string
+    = "stub_string_of_header"
+  val create : int -> int -> Op.operation -> string -> t
+  val of_partialpkt : Partial.pkt -> t
+  val to_string : t -> string
+  val unpack : t -> int * int * Op.operation * string
+  val get_tid : t -> int
+  val get_ty : t -> Op.operation
+  val get_data : t -> string
+  val get_rid : t -> int
+end
 exception End_of_file
 exception Eagain
 exception Noent
diff --git a/tools/ocaml/libs/xb/xs_ring.ml b/tools/ocaml/libs/xb/xs_ring.ml
index dd5e014a33..87c6b243e4 100644
--- a/tools/ocaml/libs/xb/xs_ring.ml
+++ b/tools/ocaml/libs/xb/xs_ring.ml
@@ -15,14 +15,14 @@
  *)
 
 module Server_feature = struct
-	type t =
-	| Reconnection
+  type t =
+    | Reconnection
 end
 
 module Server_features = Set.Make(struct
-	type t = Server_feature.t
-	let compare = compare
-end)
+    type t = Server_feature.t
+    let compare = compare
+  end)
 
 external read: Xenmmap.mmap_interface -> bytes -> int -> int = "ml_interface_read"
 external write_substring: Xenmmap.mmap_interface -> string -> int -> int = "ml_interface_write"
@@ -31,15 +31,15 @@ external _internal_set_server_features: Xenmmap.mmap_interface -> int -> unit =
 external _internal_get_server_features: Xenmmap.mmap_interface -> int = "ml_interface_get_server_features" [@@noalloc]
 
 let get_server_features mmap =
-	(* NB only one feature currently defined above *)
-	let x = _internal_get_server_features mmap in
-	if x = 0
-	then Server_features.empty
-	else Server_features.singleton Server_feature.Reconnection
+  (* NB only one feature currently defined above *)
+  let x = _internal_get_server_features mmap in
+  if x = 0
+  then Server_features.empty
+  else Server_features.singleton Server_feature.Reconnection
 
 let set_server_features mmap set =
-	(* NB only one feature currently defined above *)
-	let x = if set = Server_features.empty then 0 else 1 in
-	_internal_set_server_features mmap x
+  (* NB only one feature currently defined above *)
+  let x = if set = Server_features.empty then 0 else 1 in
+  _internal_set_server_features mmap x
 
 external close: Xenmmap.mmap_interface -> unit = "ml_interface_close" [@@noalloc]
diff --git a/tools/ocaml/libs/xc/xenctrl.ml b/tools/ocaml/libs/xc/xenctrl.ml
index 7442bbbfc5..a59dee0938 100644
--- a/tools/ocaml/libs/xc/xenctrl.ml
+++ b/tools/ocaml/libs/xc/xenctrl.ml
@@ -20,153 +20,153 @@ type domid = int
 (* ** xenctrl.h ** *)
 
 type vcpuinfo =
-{
-	online: bool;
-	blocked: bool;
-	running: bool;
-	cputime: int64;
-	cpumap: int32;
-}
+  {
+    online: bool;
+    blocked: bool;
+    running: bool;
+    cputime: int64;
+    cpumap: int32;
+  }
 
 type xen_arm_arch_domainconfig =
-{
-	gic_version: int;
-	nr_spis: int;
-	clock_frequency: int32;
-}
+  {
+    gic_version: int;
+    nr_spis: int;
+    clock_frequency: int32;
+  }
 
 type x86_arch_emulation_flags =
-	| X86_EMU_LAPIC
-	| X86_EMU_HPET
-	| X86_EMU_PM
-	| X86_EMU_RTC
-	| X86_EMU_IOAPIC
-	| X86_EMU_PIC
-	| X86_EMU_VGA
-	| X86_EMU_IOMMU
-	| X86_EMU_PIT
-	| X86_EMU_USE_PIRQ
-	| X86_EMU_VPCI
+  | X86_EMU_LAPIC
+  | X86_EMU_HPET
+  | X86_EMU_PM
+  | X86_EMU_RTC
+  | X86_EMU_IOAPIC
+  | X86_EMU_PIC
+  | X86_EMU_VGA
+  | X86_EMU_IOMMU
+  | X86_EMU_PIT
+  | X86_EMU_USE_PIRQ
+  | X86_EMU_VPCI
 
 type x86_arch_misc_flags =
-	| X86_MSR_RELAXED
+  | X86_MSR_RELAXED
 
 type xen_x86_arch_domainconfig =
-{
-	emulation_flags: x86_arch_emulation_flags list;
-	misc_flags: x86_arch_misc_flags list;
-}
+  {
+    emulation_flags: x86_arch_emulation_flags list;
+    misc_flags: x86_arch_misc_flags list;
+  }
 
 type arch_domainconfig =
-	| ARM of xen_arm_arch_domainconfig
-	| X86 of xen_x86_arch_domainconfig
+  | ARM of xen_arm_arch_domainconfig
+  | X86 of xen_x86_arch_domainconfig
 
 type domain_create_flag =
-	| CDF_HVM
-	| CDF_HAP
-	| CDF_S3_INTEGRITY
-	| CDF_OOS_OFF
-	| CDF_XS_DOMAIN
-	| CDF_IOMMU
-	| CDF_NESTED_VIRT
-	| CDF_VPMU
+  | CDF_HVM
+  | CDF_HAP
+  | CDF_S3_INTEGRITY
+  | CDF_OOS_OFF
+  | CDF_XS_DOMAIN
+  | CDF_IOMMU
+  | CDF_NESTED_VIRT
+  | CDF_VPMU
 
 type domain_create_iommu_opts =
-	| IOMMU_NO_SHAREPT
+  | IOMMU_NO_SHAREPT
 
 type domctl_create_config =
-{
-	ssidref: int32;
-	handle: string;
-	flags: domain_create_flag list;
-	iommu_opts: domain_create_iommu_opts list;
-	max_vcpus: int;
-	max_evtchn_port: int;
-	max_grant_frames: int;
-	max_maptrack_frames: int;
-	max_grant_version: int;
-	cpupool_id: int32;
-	arch: arch_domainconfig;
-}
+  {
+    ssidref: int32;
+    handle: string;
+    flags: domain_create_flag list;
+    iommu_opts: domain_create_iommu_opts list;
+    max_vcpus: int;
+    max_evtchn_port: int;
+    max_grant_frames: int;
+    max_maptrack_frames: int;
+    max_grant_version: int;
+    cpupool_id: int32;
+    arch: arch_domainconfig;
+  }
 
 type domaininfo =
-{
-	domid             : domid;
-	dying             : bool;
-	shutdown          : bool;
-	paused            : bool;
-	blocked           : bool;
-	running           : bool;
-	hvm_guest         : bool;
-	shutdown_code     : int;
-	total_memory_pages: nativeint;
-	max_memory_pages  : nativeint;
-	shared_info_frame : int64;
-	cpu_time          : int64;
-	nr_online_vcpus   : int;
-	max_vcpu_id       : int;
-	ssidref           : int32;
-	handle            : int array;
-	arch_config       : arch_domainconfig;
-}
+  {
+    domid             : domid;
+    dying             : bool;
+    shutdown          : bool;
+    paused            : bool;
+    blocked           : bool;
+    running           : bool;
+    hvm_guest         : bool;
+    shutdown_code     : int;
+    total_memory_pages: nativeint;
+    max_memory_pages  : nativeint;
+    shared_info_frame : int64;
+    cpu_time          : int64;
+    nr_online_vcpus   : int;
+    max_vcpu_id       : int;
+    ssidref           : int32;
+    handle            : int array;
+    arch_config       : arch_domainconfig;
+  }
 
 type sched_control =
-{
-	weight : int;
-	cap    : int;
-}
+  {
+    weight : int;
+    cap    : int;
+  }
 
 type physinfo_cap_flag =
-	| CAP_HVM
-	| CAP_PV
-	| CAP_DirectIO
-	| CAP_HAP
-	| CAP_Shadow
-	| CAP_IOMMU_HAP_PT_SHARE
-	| CAP_Vmtrace
-	| CAP_Vpmu
-	| CAP_Gnttab_v1
-	| CAP_Gnttab_v2
+  | CAP_HVM
+  | CAP_PV
+  | CAP_DirectIO
+  | CAP_HAP
+  | CAP_Shadow
+  | CAP_IOMMU_HAP_PT_SHARE
+  | CAP_Vmtrace
+  | CAP_Vpmu
+  | CAP_Gnttab_v1
+  | CAP_Gnttab_v2
 
 type arm_physinfo_cap_flag
 
 type x86_physinfo_cap_flag
 
 type arch_physinfo_cap_flags =
-	| ARM of arm_physinfo_cap_flag list
-	| X86 of x86_physinfo_cap_flag list
+  | ARM of arm_physinfo_cap_flag list
+  | X86 of x86_physinfo_cap_flag list
 
 type physinfo =
-{
-	threads_per_core : int;
-	cores_per_socket : int;
-	nr_cpus          : int;
-	max_node_id      : int;
-	cpu_khz          : int;
-	total_pages      : nativeint;
-	free_pages       : nativeint;
-	scrub_pages      : nativeint;
-	(* XXX hw_cap *)
-	capabilities     : physinfo_cap_flag list;
-	max_nr_cpus      : int;
-	arch_capabilities : arch_physinfo_cap_flags;
-}
+  {
+    threads_per_core : int;
+    cores_per_socket : int;
+    nr_cpus          : int;
+    max_node_id      : int;
+    cpu_khz          : int;
+    total_pages      : nativeint;
+    free_pages       : nativeint;
+    scrub_pages      : nativeint;
+    (* XXX hw_cap *)
+    capabilities     : physinfo_cap_flag list;
+    max_nr_cpus      : int;
+    arch_capabilities : arch_physinfo_cap_flags;
+  }
 
 type version =
-{
-	major : int;
-	minor : int;
-	extra : string;
-}
+  {
+    major : int;
+    minor : int;
+    extra : string;
+  }
 
 
 type compile_info =
-{
-	compiler : string;
-	compile_by : string;
-	compile_domain : string;
-	compile_date : string;
-}
+  {
+    compiler : string;
+    compile_by : string;
+    compile_domain : string;
+    compile_date : string;
+  }
 
 type shutdown_reason = Poweroff | Reboot | Suspend | Crash | Watchdog | Soft_reset
 
@@ -181,34 +181,34 @@ let handle = ref None
 let get_handle () = !handle
 
 let close_handle () =
-	match !handle with
-	| Some _ -> handle := None
-	| None -> ()
+  match !handle with
+  | Some _ -> handle := None
+  | None -> ()
 
 let with_intf f =
-	match !handle with
-	| Some h -> f h
-	| None ->
-		let h =
-			try interface_open () with
-			| e ->
-				let msg = Printexc.to_string e in
-				failwith ("failed to open xenctrl: "^msg)
-		in
-		handle := Some h;
-		f h
+  match !handle with
+  | Some h -> f h
+  | None ->
+    let h =
+      try interface_open () with
+      | e ->
+        let msg = Printexc.to_string e in
+        failwith ("failed to open xenctrl: "^msg)
+    in
+    handle := Some h;
+    f h
 
 external domain_create_stub: handle -> domid -> domctl_create_config -> domid
-       = "stub_xc_domain_create"
+  = "stub_xc_domain_create"
 
 let domain_create handle ?(domid=0) config =
-	domain_create_stub handle domid config
+  domain_create_stub handle domid config
 
 external domain_sethandle: handle -> domid -> string -> unit
-       = "stub_xc_domain_sethandle"
+  = "stub_xc_domain_sethandle"
 
 external domain_max_vcpus: handle -> domid -> int -> unit
-       = "stub_xc_domain_max_vcpus"
+  = "stub_xc_domain_max_vcpus"
 
 external domain_pause: handle -> domid -> unit = "stub_xc_domain_pause"
 external domain_unpause: handle -> domid -> unit = "stub_xc_domain_unpause"
@@ -216,10 +216,10 @@ external domain_resume_fast: handle -> domid -> unit = "stub_xc_domain_resume_fa
 external domain_destroy: handle -> domid -> unit = "stub_xc_domain_destroy"
 
 external domain_shutdown: handle -> domid -> shutdown_reason -> unit
-       = "stub_xc_domain_shutdown"
+  = "stub_xc_domain_shutdown"
 
 external _domain_getinfolist: handle -> domid -> int -> domaininfo list
-       = "stub_xc_domain_getinfolist"
+  = "stub_xc_domain_getinfolist"
 
 let rev_append_fold acc e = List.rev_append e acc
 
@@ -228,53 +228,53 @@ let rev_append_fold acc e = List.rev_append e acc
  * except it is tail recursive, whereas [List.concat] isn't.
  * Example:
  * rev_concat [[10;9;8];[7;6];[5]]] = [5; 6; 7; 8; 9; 10]
- *)
+*)
 let rev_concat lst = List.fold_left rev_append_fold [] lst
 
 let domain_getinfolist handle first_domain =
-	let nb = 1024 in
-	let rec __getlist lst from =
-		(* _domain_getinfolist returns domains in reverse order, largest first *)
-		match _domain_getinfolist handle from nb with
-		| [] -> rev_concat lst
-		| (hd :: _) as l -> __getlist (l :: lst) (hd.domid + 1)
-	in
-	__getlist [] first_domain
+  let nb = 1024 in
+  let rec __getlist lst from =
+    (* _domain_getinfolist returns domains in reverse order, largest first *)
+    match _domain_getinfolist handle from nb with
+    | [] -> rev_concat lst
+    | (hd :: _) as l -> __getlist (l :: lst) (hd.domid + 1)
+  in
+  __getlist [] first_domain
 
 external domain_getinfo: handle -> domid -> domaininfo= "stub_xc_domain_getinfo"
 
 external domain_get_vcpuinfo: handle -> int -> int -> vcpuinfo
-       = "stub_xc_vcpu_getinfo"
+  = "stub_xc_vcpu_getinfo"
 
 external domain_ioport_permission: handle -> domid -> int -> int -> bool -> unit
-       = "stub_xc_domain_ioport_permission"
+  = "stub_xc_domain_ioport_permission"
 external domain_iomem_permission: handle -> domid -> nativeint -> nativeint -> bool -> unit
-       = "stub_xc_domain_iomem_permission"
+  = "stub_xc_domain_iomem_permission"
 external domain_irq_permission: handle -> domid -> int -> bool -> unit
-       = "stub_xc_domain_irq_permission"
+  = "stub_xc_domain_irq_permission"
 
 external vcpu_affinity_set: handle -> domid -> int -> bool array -> unit
-       = "stub_xc_vcpu_setaffinity"
+  = "stub_xc_vcpu_setaffinity"
 external vcpu_affinity_get: handle -> domid -> int -> bool array
-       = "stub_xc_vcpu_getaffinity"
+  = "stub_xc_vcpu_getaffinity"
 
 external vcpu_context_get: handle -> domid -> int -> string
-       = "stub_xc_vcpu_context_get"
+  = "stub_xc_vcpu_context_get"
 
 external sched_id: handle -> int = "stub_xc_sched_id"
 
 external sched_credit_domain_set: handle -> domid -> sched_control -> unit
-       = "stub_sched_credit_domain_set"
+  = "stub_sched_credit_domain_set"
 external sched_credit_domain_get: handle -> domid -> sched_control
-       = "stub_sched_credit_domain_get"
+  = "stub_sched_credit_domain_get"
 
 external shadow_allocation_set: handle -> domid -> int -> unit
-       = "stub_shadow_allocation_set"
+  = "stub_shadow_allocation_set"
 external shadow_allocation_get: handle -> domid -> int
-       = "stub_shadow_allocation_get"
+  = "stub_shadow_allocation_get"
 
 external evtchn_alloc_unbound: handle -> domid -> domid -> int
-       = "stub_xc_evtchn_alloc_unbound"
+  = "stub_xc_evtchn_alloc_unbound"
 external evtchn_reset: handle -> domid -> unit = "stub_xc_evtchn_reset"
 
 (* FIFO has theoretical maximum of 2^28 ports, fits in an int *)
@@ -299,15 +299,15 @@ external physinfo: handle -> physinfo = "stub_xc_physinfo"
 external pcpu_info: handle -> int -> int64 array = "stub_xc_pcpu_info"
 
 external domain_setmaxmem: handle -> domid -> int64 -> unit
-       = "stub_xc_domain_setmaxmem"
+  = "stub_xc_domain_setmaxmem"
 external domain_set_memmap_limit: handle -> domid -> int64 -> unit
-       = "stub_xc_domain_set_memmap_limit"
+  = "stub_xc_domain_set_memmap_limit"
 external domain_memory_increase_reservation: handle -> domid -> int64 -> unit
-       = "stub_xc_domain_memory_increase_reservation"
+  = "stub_xc_domain_memory_increase_reservation"
 
 external map_foreign_range: handle -> domid -> int
-                         -> nativeint -> Xenmmap.mmap_interface
-       = "stub_map_foreign_range"
+  -> nativeint -> Xenmmap.mmap_interface
+  = "stub_map_foreign_range"
 
 type hvm_param =
   | HVM_PARAM_CALLBACK_IRQ
@@ -357,15 +357,15 @@ external hvm_param_set: handle -> domid -> hvm_param -> int64 -> unit
   = "stub_xc_hvm_param_set"
 
 external domain_assign_device: handle -> domid -> (int * int * int * int) -> unit
-       = "stub_xc_domain_assign_device"
+  = "stub_xc_domain_assign_device"
 external domain_deassign_device: handle -> domid -> (int * int * int * int) -> unit
-       = "stub_xc_domain_deassign_device"
+  = "stub_xc_domain_deassign_device"
 external domain_test_assign_device: handle -> domid -> (int * int * int * int) -> bool
-       = "stub_xc_domain_test_assign_device"
+  = "stub_xc_domain_test_assign_device"
 
 external version: handle -> version = "stub_xc_version_version"
 external version_compile_info: handle -> compile_info
-       = "stub_xc_version_compile_info"
+  = "stub_xc_version_compile_info"
 external version_changeset: handle -> string = "stub_xc_version_changeset"
 external version_capabilities: handle -> string =
   "stub_xc_version_capabilities"
@@ -380,7 +380,7 @@ external watchdog : handle -> int -> int32 -> int
 
 (**
    Convert the given number of pages to an amount in KiB, rounded up.
- *)
+*)
 external pages_to_kib : int64 -> int64 = "stub_pages_to_kib"
 let pages_to_mib pages = Int64.div (pages_to_kib pages) 1024L
 
diff --git a/tools/ocaml/libs/xc/xenctrl.mli b/tools/ocaml/libs/xc/xenctrl.mli
index 82def5a17c..3154e90f4f 100644
--- a/tools/ocaml/libs/xc/xenctrl.mli
+++ b/tools/ocaml/libs/xc/xenctrl.mli
@@ -182,11 +182,11 @@ external domain_getinfo : handle -> domid -> domaininfo
 external domain_get_vcpuinfo : handle -> int -> int -> vcpuinfo
   = "stub_xc_vcpu_getinfo"
 external domain_ioport_permission: handle -> domid -> int -> int -> bool -> unit
-       = "stub_xc_domain_ioport_permission"
+  = "stub_xc_domain_ioport_permission"
 external domain_iomem_permission: handle -> domid -> nativeint -> nativeint -> bool -> unit
-       = "stub_xc_domain_iomem_permission"
+  = "stub_xc_domain_iomem_permission"
 external domain_irq_permission: handle -> domid -> int -> bool -> unit
-       = "stub_xc_domain_irq_permission"
+  = "stub_xc_domain_irq_permission"
 external vcpu_affinity_set : handle -> domid -> int -> bool array -> unit
   = "stub_xc_vcpu_setaffinity"
 external vcpu_affinity_get : handle -> domid -> int -> bool array
@@ -284,11 +284,11 @@ external hvm_param_set: handle -> domid -> hvm_param -> int64 -> unit
   = "stub_xc_hvm_param_set"
 
 external domain_assign_device: handle -> domid -> (int * int * int * int) -> unit
-       = "stub_xc_domain_assign_device"
+  = "stub_xc_domain_assign_device"
 external domain_deassign_device: handle -> domid -> (int * int * int * int) -> unit
-       = "stub_xc_domain_deassign_device"
+  = "stub_xc_domain_deassign_device"
 external domain_test_assign_device: handle -> domid -> (int * int * int * int) -> bool
-       = "stub_xc_domain_test_assign_device"
+  = "stub_xc_domain_test_assign_device"
 
 external version : handle -> version = "stub_xc_version_version"
 external version_compile_info : handle -> compile_info
diff --git a/tools/ocaml/libs/xs/queueop.ml b/tools/ocaml/libs/xs/queueop.ml
index 4e532cdaea..e069ab7a9c 100644
--- a/tools/ocaml/libs/xs/queueop.ml
+++ b/tools/ocaml/libs/xs/queueop.ml
@@ -18,8 +18,8 @@ open Xenbus
 let data_concat ls = (String.concat "\000" ls) ^ "\000"
 let queue con pkt = let r = Xb.queue con pkt in assert (r <> None)
 let queue_path ty (tid: int) (path: string) con =
-	let data = data_concat [ path; ] in
-	queue con (Xb.Packet.create tid 0 ty data)
+  let data = data_concat [ path; ] in
+  queue con (Xb.Packet.create tid 0 ty data)
 
 (* operations *)
 let directory tid path con = queue_path Xb.Op.Directory tid path con
@@ -28,48 +28,48 @@ let read tid path con = queue_path Xb.Op.Read tid path con
 let getperms tid path con = queue_path Xb.Op.Getperms tid path con
 
 let debug commands con =
-	queue con (Xb.Packet.create 0 0 Xb.Op.Debug (data_concat commands))
+  queue con (Xb.Packet.create 0 0 Xb.Op.Debug (data_concat commands))
 
 let watch path data con =
-	let data = data_concat [ path; data; ] in
-	queue con (Xb.Packet.create 0 0 Xb.Op.Watch data)
+  let data = data_concat [ path; data; ] in
+  queue con (Xb.Packet.create 0 0 Xb.Op.Watch data)
 
 let unwatch path data con =
-	let data = data_concat [ path; data; ] in
-	queue con (Xb.Packet.create 0 0 Xb.Op.Unwatch data)
+  let data = data_concat [ path; data; ] in
+  queue con (Xb.Packet.create 0 0 Xb.Op.Unwatch data)
 
 let transaction_start con =
-	queue con (Xb.Packet.create 0 0 Xb.Op.Transaction_start (data_concat []))
+  queue con (Xb.Packet.create 0 0 Xb.Op.Transaction_start (data_concat []))
 
 let transaction_end tid commit con =
-	let data = data_concat [ (if commit then "T" else "F"); ] in
-	queue con (Xb.Packet.create tid 0 Xb.Op.Transaction_end data)
+  let data = data_concat [ (if commit then "T" else "F"); ] in
+  queue con (Xb.Packet.create tid 0 Xb.Op.Transaction_end data)
 
 let introduce domid mfn port con =
-	let data = data_concat [ Printf.sprintf "%u" domid;
-	                         Printf.sprintf "%nu" mfn;
-	                         string_of_int port; ] in
-	queue con (Xb.Packet.create 0 0 Xb.Op.Introduce data)
+  let data = data_concat [ Printf.sprintf "%u" domid;
+                           Printf.sprintf "%nu" mfn;
+                           string_of_int port; ] in
+  queue con (Xb.Packet.create 0 0 Xb.Op.Introduce data)
 
 let release domid con =
-	let data = data_concat [ Printf.sprintf "%u" domid; ] in
-	queue con (Xb.Packet.create 0 0 Xb.Op.Release data)
+  let data = data_concat [ Printf.sprintf "%u" domid; ] in
+  queue con (Xb.Packet.create 0 0 Xb.Op.Release data)
 
 let resume domid con =
-	let data = data_concat [ Printf.sprintf "%u" domid; ] in
-	queue con (Xb.Packet.create 0 0 Xb.Op.Resume data)
+  let data = data_concat [ Printf.sprintf "%u" domid; ] in
+  queue con (Xb.Packet.create 0 0 Xb.Op.Resume data)
 
 let getdomainpath domid con =
-	let data = data_concat [ Printf.sprintf "%u" domid; ] in
-	queue con (Xb.Packet.create 0 0 Xb.Op.Getdomainpath data)
+  let data = data_concat [ Printf.sprintf "%u" domid; ] in
+  queue con (Xb.Packet.create 0 0 Xb.Op.Getdomainpath data)
 
 let write tid path value con =
-	let data = path ^ "\000" ^ value (* no NULL at the end *) in
-	queue con (Xb.Packet.create tid 0 Xb.Op.Write data)
+  let data = path ^ "\000" ^ value (* no NULL at the end *) in
+  queue con (Xb.Packet.create tid 0 Xb.Op.Write data)
 
 let mkdir tid path con = queue_path Xb.Op.Mkdir tid path con
 let rm tid path con = queue_path Xb.Op.Rm tid path con
 
 let setperms tid path perms con =
-	let data = data_concat [ path; perms ] in
-	queue con (Xb.Packet.create tid 0 Xb.Op.Setperms data)
+  let data = data_concat [ path; perms ] in
+  queue con (Xb.Packet.create tid 0 Xb.Op.Setperms data)
diff --git a/tools/ocaml/libs/xs/xs.ml b/tools/ocaml/libs/xs/xs.ml
index 90bd68d73d..addccc8009 100644
--- a/tools/ocaml/libs/xs/xs.ml
+++ b/tools/ocaml/libs/xs/xs.ml
@@ -19,46 +19,46 @@ type con = Xsraw.con
 type domid = int
 
 type xsh =
-{
-	con: con;
-	debug: string list -> string;
-	directory: string -> string list;
-	read: string -> string;
-	readv: string -> string list -> string list;
-	write: string -> string -> unit;
-	writev: string -> (string * string) list -> unit;
-	mkdir: string -> unit;
-	rm: string -> unit;
-	getperms: string -> perms;
-	setperms: string -> perms -> unit;
-	setpermsv: string -> string list -> perms -> unit;
-	introduce: domid -> nativeint -> int -> unit;
-	release: domid -> unit;
-	resume: domid -> unit;
-	getdomainpath: domid -> string;
-	watch: string -> string -> unit;
-	unwatch: string -> string -> unit;
-}
+  {
+    con: con;
+    debug: string list -> string;
+    directory: string -> string list;
+    read: string -> string;
+    readv: string -> string list -> string list;
+    write: string -> string -> unit;
+    writev: string -> (string * string) list -> unit;
+    mkdir: string -> unit;
+    rm: string -> unit;
+    getperms: string -> perms;
+    setperms: string -> perms -> unit;
+    setpermsv: string -> string list -> perms -> unit;
+    introduce: domid -> nativeint -> int -> unit;
+    release: domid -> unit;
+    resume: domid -> unit;
+    getdomainpath: domid -> string;
+    watch: string -> string -> unit;
+    unwatch: string -> string -> unit;
+  }
 
 let get_operations con = {
-	con = con;
-	debug = (fun commands -> Xsraw.debug commands con);
-	directory = (fun path -> Xsraw.directory 0 path con);
-	read = (fun path -> Xsraw.read 0 path con);
-	readv = (fun dir vec -> Xsraw.readv 0 dir vec con);
-	write = (fun path value -> Xsraw.write 0 path value con);
-	writev = (fun dir vec -> Xsraw.writev 0 dir vec con);
-	mkdir = (fun path -> Xsraw.mkdir 0 path con);
-	rm = (fun path -> Xsraw.rm 0 path con);
-	getperms = (fun path -> Xsraw.getperms 0 path con);
-	setperms = (fun path perms -> Xsraw.setperms 0 path perms con);
-	setpermsv = (fun dir vec perms -> Xsraw.setpermsv 0 dir vec perms con);
-	introduce = (fun id mfn port -> Xsraw.introduce id mfn port con);
-	release = (fun id -> Xsraw.release id con);
-	resume = (fun id -> Xsraw.resume id con);
-	getdomainpath = (fun id -> Xsraw.getdomainpath id con);
-	watch = (fun path data -> Xsraw.watch path data con);
-	unwatch = (fun path data -> Xsraw.unwatch path data con);
+  con = con;
+  debug = (fun commands -> Xsraw.debug commands con);
+  directory = (fun path -> Xsraw.directory 0 path con);
+  read = (fun path -> Xsraw.read 0 path con);
+  readv = (fun dir vec -> Xsraw.readv 0 dir vec con);
+  write = (fun path value -> Xsraw.write 0 path value con);
+  writev = (fun dir vec -> Xsraw.writev 0 dir vec con);
+  mkdir = (fun path -> Xsraw.mkdir 0 path con);
+  rm = (fun path -> Xsraw.rm 0 path con);
+  getperms = (fun path -> Xsraw.getperms 0 path con);
+  setperms = (fun path perms -> Xsraw.setperms 0 path perms con);
+  setpermsv = (fun dir vec perms -> Xsraw.setpermsv 0 dir vec perms con);
+  introduce = (fun id mfn port -> Xsraw.introduce id mfn port con);
+  release = (fun id -> Xsraw.release id con);
+  resume = (fun id -> Xsraw.resume id con);
+  getdomainpath = (fun id -> Xsraw.getdomainpath id con);
+  watch = (fun path data -> Xsraw.watch path data con);
+  unwatch = (fun path data -> Xsraw.unwatch path data con);
 }
 
 let transaction xsh = Xst.transaction xsh.con
@@ -81,71 +81,71 @@ exception Timeout_with_nonempty_queue
 let max_blocking_time = 5. (* seconds *)
 
 let read_watchevent_timeout xsh timeout callback =
-	let start_time = Unix.gettimeofday () in
-	let end_time = start_time +. timeout in
-
-	let left = ref timeout in
-
-	(* Returns true if a watch event in the queue satisfied us *)
-	let process_queued_events () =
-		let success = ref false in
-		while Xsraw.has_watchevents xsh.con && not(!success)
-		do
-			success := callback (Xsraw.get_watchevent xsh.con)
-		done;
-		!success in
-	(* Returns true if a watch event read from the socket satisfied us *)
-	let process_incoming_event () =
-		let fd = get_fd xsh in
-		let r, _, _ = Unix.select [ fd ] [] [] (min max_blocking_time !left) in
-
-		(* If data is available for reading then read it *)
-		if r = []
-		then false (* timeout, either a max_blocking_time or global *)
-		else callback (Xsraw.read_watchevent xsh.con) in
-
-	let success = ref false in
-	while !left > 0. && not(!success)
-	do
-		(* NB the 'callback' might call back into Xs functions
-		   and as a side-effect, watches might be queued. Hence
-		   we must process the queue on every loop iteration *)
-
-		(* First process all queued watch events *)
-		if not(!success)
-		then success := process_queued_events ();
-		(* Then block for one more watch event *)
-		if not(!success)
-		then success := process_incoming_event ();
-		(* Just in case our callback caused events to be queued
-		   and this is our last time round the loop: this prevents
-		   us throwing the Timeout_with_nonempty_queue spuriously *)
-		if not(!success)
-		then success := process_queued_events ();
-
-		(* Update the time left *)
-		let current_time = Unix.gettimeofday () in
-		left := end_time -. current_time
-	done;
-	if not(!success) then begin
-		(* Sanity check: it should be impossible for any
-		   events to be queued here *)
-		if Xsraw.has_watchevents xsh.con
-		then raise Timeout_with_nonempty_queue
-		else raise Timeout
-	end
+  let start_time = Unix.gettimeofday () in
+  let end_time = start_time +. timeout in
+
+  let left = ref timeout in
+
+  (* Returns true if a watch event in the queue satisfied us *)
+  let process_queued_events () =
+    let success = ref false in
+    while Xsraw.has_watchevents xsh.con && not(!success)
+    do
+      success := callback (Xsraw.get_watchevent xsh.con)
+    done;
+    !success in
+  (* Returns true if a watch event read from the socket satisfied us *)
+  let process_incoming_event () =
+    let fd = get_fd xsh in
+    let r, _, _ = Unix.select [ fd ] [] [] (min max_blocking_time !left) in
+
+    (* If data is available for reading then read it *)
+    if r = []
+    then false (* timeout, either a max_blocking_time or global *)
+    else callback (Xsraw.read_watchevent xsh.con) in
+
+  let success = ref false in
+  while !left > 0. && not(!success)
+  do
+    (* NB the 'callback' might call back into Xs functions
+       		   and as a side-effect, watches might be queued. Hence
+       		   we must process the queue on every loop iteration *)
+
+    (* First process all queued watch events *)
+    if not(!success)
+    then success := process_queued_events ();
+    (* Then block for one more watch event *)
+    if not(!success)
+    then success := process_incoming_event ();
+    (* Just in case our callback caused events to be queued
+       		   and this is our last time round the loop: this prevents
+       		   us throwing the Timeout_with_nonempty_queue spuriously *)
+    if not(!success)
+    then success := process_queued_events ();
+
+    (* Update the time left *)
+    let current_time = Unix.gettimeofday () in
+    left := end_time -. current_time
+  done;
+  if not(!success) then begin
+    (* Sanity check: it should be impossible for any
+       		   events to be queued here *)
+    if Xsraw.has_watchevents xsh.con
+    then raise Timeout_with_nonempty_queue
+    else raise Timeout
+  end
 
 
 let monitor_paths xsh l time callback =
-	let unwatch () =
-		List.iter (fun (w,v) -> try xsh.unwatch w v with _ -> ()) l in
-	List.iter (fun (w,v) -> xsh.watch w v) l;
-	begin try
-		read_watchevent_timeout xsh time callback;
-	with
-		exn -> unwatch (); raise exn;
-	end;
-	unwatch ()
+  let unwatch () =
+    List.iter (fun (w,v) -> try xsh.unwatch w v with _ -> ()) l in
+  List.iter (fun (w,v) -> xsh.watch w v) l;
+  begin try
+      read_watchevent_timeout xsh time callback;
+    with
+      exn -> unwatch (); raise exn;
+  end;
+  unwatch ()
 
 let daemon_socket = Paths.xen_run_stored ^ "/socket"
 
@@ -153,24 +153,24 @@ let daemon_socket = Paths.xen_run_stored ^ "/socket"
 exception Failed_to_connect
 
 let daemon_open () =
-	try
-		let sockaddr = Unix.ADDR_UNIX(daemon_socket) in
-		let sock = Unix.socket Unix.PF_UNIX Unix.SOCK_STREAM 0 in
-		Unix.connect sock sockaddr;
-		Unix.set_close_on_exec sock;
-		make sock
-	with _ -> raise Failed_to_connect
+  try
+    let sockaddr = Unix.ADDR_UNIX(daemon_socket) in
+    let sock = Unix.socket Unix.PF_UNIX Unix.SOCK_STREAM 0 in
+    Unix.connect sock sockaddr;
+    Unix.set_close_on_exec sock;
+    make sock
+  with _ -> raise Failed_to_connect
 
 let domain_open () =
-	let path = try
-		let devpath = "/dev/xen/xenbus" in
-		Unix.access devpath [ Unix.F_OK ];
-		devpath
-	with Unix.Unix_error(_, _, _) ->
-		"/proc/xen/xenbus" in
-
-	let fd = Unix.openfile path [ Unix.O_RDWR ] 0o550 in
-	Unix.set_close_on_exec fd;
-	make fd
+  let path = try
+      let devpath = "/dev/xen/xenbus" in
+      Unix.access devpath [ Unix.F_OK ];
+      devpath
+    with Unix.Unix_error(_, _, _) ->
+      "/proc/xen/xenbus" in
+
+  let fd = Unix.openfile path [ Unix.O_RDWR ] 0o550 in
+  Unix.set_close_on_exec fd;
+  make fd
 
 let close xsh = Xsraw.close xsh.con
diff --git a/tools/ocaml/libs/xs/xs.mli b/tools/ocaml/libs/xs/xs.mli
index ce505b659b..cf8855c7d8 100644
--- a/tools/ocaml/libs/xs/xs.mli
+++ b/tools/ocaml/libs/xs/xs.mli
@@ -23,31 +23,31 @@ exception Failed_to_connect
     - owner domid.
     - other perm: applied to domain that is not owner or in ACL.
     - ACL: list of per-domain permission
-  *)
+*)
 type perms = Xsraw.perms
 
 type domid = int
 type con
 
 type xsh = {
-	con : con;
-	debug: string list -> string;
-	directory : string -> string list;
-	read : string -> string;
-	readv : string -> string list -> string list;
-	write : string -> string -> unit;
-	writev : string -> (string * string) list -> unit;
-	mkdir : string -> unit;
-	rm : string -> unit;
-	getperms : string -> perms;
-	setperms : string -> perms -> unit;
-	setpermsv : string -> string list -> perms -> unit;
-	introduce : domid -> nativeint -> int -> unit;
-	release : domid -> unit;
-	resume : domid -> unit;
-	getdomainpath : domid -> string;
-	watch : string -> string -> unit;
-	unwatch : string -> string -> unit;
+  con : con;
+  debug: string list -> string;
+  directory : string -> string list;
+  read : string -> string;
+  readv : string -> string list -> string list;
+  write : string -> string -> unit;
+  writev : string -> (string * string) list -> unit;
+  mkdir : string -> unit;
+  rm : string -> unit;
+  getperms : string -> perms;
+  setperms : string -> perms -> unit;
+  setpermsv : string -> string list -> perms -> unit;
+  introduce : domid -> nativeint -> int -> unit;
+  release : domid -> unit;
+  resume : domid -> unit;
+  getdomainpath : domid -> string;
+  watch : string -> string -> unit;
+  unwatch : string -> string -> unit;
 }
 
 (** get operations provide a vector of xenstore function that apply to one
@@ -75,10 +75,10 @@ val read_watchevent_timeout : xsh -> float -> (string * string -> bool) -> unit
 (** register a set of watches, then wait for watchevent.
     remove all watches previously set before giving back the hand. *)
 val monitor_paths : xsh
-                 -> (string * string) list
-                 -> float
-                 -> (string * string -> bool)
-                 -> unit
+  -> (string * string) list
+  -> float
+  -> (string * string -> bool)
+  -> unit
 
 (** open a socket-based xenstored connection *)
 val daemon_open : unit -> xsh
diff --git a/tools/ocaml/libs/xs/xsraw.ml b/tools/ocaml/libs/xs/xsraw.ml
index cbd1728060..d51e40eed3 100644
--- a/tools/ocaml/libs/xs/xsraw.ml
+++ b/tools/ocaml/libs/xs/xsraw.ml
@@ -23,239 +23,239 @@ exception Unexpected_packet of string
 exception Invalid_path of string
 
 let unexpected_packet expected received =
-	let s = Printf.sprintf "expecting %s received %s"
-	                       (Xb.Op.to_string expected)
-	                       (Xb.Op.to_string received) in
-	raise (Unexpected_packet s)
+  let s = Printf.sprintf "expecting %s received %s"
+      (Xb.Op.to_string expected)
+      (Xb.Op.to_string received) in
+  raise (Unexpected_packet s)
 
 type con = {
-	xb: Xenbus.Xb.t;
-	watchevents: (string * string) Queue.t;
+  xb: Xenbus.Xb.t;
+  watchevents: (string * string) Queue.t;
 }
 
 let close con =
-	Xb.close con.xb
+  Xb.close con.xb
 
 let capacity = { Xb.maxoutstanding = 1; maxwatchevents = 0; }
 
 let open_fd fd = {
-	xb = Xb.open_fd ~capacity fd;
-	watchevents = Queue.create ();
+  xb = Xb.open_fd ~capacity fd;
+  watchevents = Queue.create ();
 }
 
 let rec split_string ?limit:(limit=(-1)) c s =
-	let i = try String.index s c with Not_found -> -1 in
-	let nlimit = if limit = -1 || limit = 0 then limit else limit - 1 in
-	if i = -1 || nlimit = 0 then
-		[ s ]
-	else
-		let a = String.sub s 0 i
-		and b = String.sub s (i + 1) (String.length s - i - 1) in
-		a :: (split_string ~limit: nlimit c b)
+  let i = try String.index s c with Not_found -> -1 in
+  let nlimit = if limit = -1 || limit = 0 then limit else limit - 1 in
+  if i = -1 || nlimit = 0 then
+    [ s ]
+  else
+    let a = String.sub s 0 i
+    and b = String.sub s (i + 1) (String.length s - i - 1) in
+    a :: (split_string ~limit: nlimit c b)
 
 type perm = PERM_NONE | PERM_READ | PERM_WRITE | PERM_RDWR
 
 type perms = int * perm * (int * perm) list
 
 let string_of_perms perms =
-	let owner, other, acl = perms in
-	let char_of_perm perm =
-		match perm with PERM_NONE -> 'n' | PERM_READ -> 'r'
-			      | PERM_WRITE -> 'w' | PERM_RDWR -> 'b' in
-	let string_of_perm (id, perm) = Printf.sprintf "%c%u" (char_of_perm perm) id in
-	String.concat "\000" (List.map string_of_perm ((owner,other) :: acl))
+  let owner, other, acl = perms in
+  let char_of_perm perm =
+    match perm with PERM_NONE -> 'n' | PERM_READ -> 'r'
+                  | PERM_WRITE -> 'w' | PERM_RDWR -> 'b' in
+  let string_of_perm (id, perm) = Printf.sprintf "%c%u" (char_of_perm perm) id in
+  String.concat "\000" (List.map string_of_perm ((owner,other) :: acl))
 
 let perms_of_string s =
-	let perm_of_char c =
-		match c with 'n' -> PERM_NONE | 'r' -> PERM_READ
-		           | 'w' -> PERM_WRITE | 'b' -> PERM_RDWR
-		           | c -> invalid_arg (Printf.sprintf "unknown permission type: %c" c) in
-	let perm_of_string s =
-		if String.length s < 2
-		then invalid_arg (Printf.sprintf "perm of string: length = %d; contents=\"%s\"" (String.length s) s)
-		else
-		begin
-			int_of_string (String.sub s 1 (String.length s - 1)),
-			perm_of_char s.[0]
-		end in
-	let rec split s =
-		try let i = String.index s '\000' in
-		String.sub s 0 i :: split (String.sub s (i + 1) (String.length s - 1 - i))
-		with Not_found -> if s = "" then [] else [ s ] in
-	let l = List.map perm_of_string (split s) in
-	match l with h :: l -> (fst h, snd h, l) | [] -> (0, PERM_NONE, [])
+  let perm_of_char c =
+    match c with 'n' -> PERM_NONE | 'r' -> PERM_READ
+                                  | 'w' -> PERM_WRITE | 'b' -> PERM_RDWR
+                                  | c -> invalid_arg (Printf.sprintf "unknown permission type: %c" c) in
+  let perm_of_string s =
+    if String.length s < 2
+    then invalid_arg (Printf.sprintf "perm of string: length = %d; contents=\"%s\"" (String.length s) s)
+    else
+      begin
+        int_of_string (String.sub s 1 (String.length s - 1)),
+        perm_of_char s.[0]
+      end in
+  let rec split s =
+    try let i = String.index s '\000' in
+      String.sub s 0 i :: split (String.sub s (i + 1) (String.length s - 1 - i))
+    with Not_found -> if s = "" then [] else [ s ] in
+  let l = List.map perm_of_string (split s) in
+  match l with h :: l -> (fst h, snd h, l) | [] -> (0, PERM_NONE, [])
 
 (* send one packet - can sleep *)
 let pkt_send con =
-	if Xb.has_old_output con.xb then
-		raise Partial_not_empty;
-	let workdone = ref false in
-	while not !workdone
-	do
-		workdone := Xb.output con.xb
-	done
+  if Xb.has_old_output con.xb then
+    raise Partial_not_empty;
+  let workdone = ref false in
+  while not !workdone
+  do
+    workdone := Xb.output con.xb
+  done
 
 (* receive one packet - can sleep *)
 let rec pkt_recv con =
-	match Xb.input con.xb with
-	| Some packet -> packet
-	| None -> pkt_recv con
+  match Xb.input con.xb with
+  | Some packet -> packet
+  | None -> pkt_recv con
 
 let pkt_recv_timeout con timeout =
-	let fd = Xb.get_fd con.xb in
-	let r, _, _ = Unix.select [ fd ] [] [] timeout in
-	if r = [] then
-		true, None
-	else
-		false, Xb.input con.xb
+  let fd = Xb.get_fd con.xb in
+  let r, _, _ = Unix.select [ fd ] [] [] timeout in
+  if r = [] then
+    true, None
+  else
+    false, Xb.input con.xb
 
 let queue_watchevent con data =
-	let ls = split_string ~limit:2 '\000' data in
-	if List.length ls != 2 then
-		raise (Xb.Packet.DataError "arguments number mismatch");
-	let event = List.nth ls 0
-	and event_data = List.nth ls 1 in
-	Queue.push (event, event_data) con.watchevents
+  let ls = split_string ~limit:2 '\000' data in
+  if List.length ls != 2 then
+    raise (Xb.Packet.DataError "arguments number mismatch");
+  let event = List.nth ls 0
+  and event_data = List.nth ls 1 in
+  Queue.push (event, event_data) con.watchevents
 
 let has_watchevents con = Queue.length con.watchevents > 0
 let get_watchevent con = Queue.pop con.watchevents
 
 let read_watchevent con =
-	let pkt = pkt_recv con in
-	match Xb.Packet.get_ty pkt with
-	| Xb.Op.Watchevent ->
-		queue_watchevent con (Xb.Packet.get_data pkt);
-		Queue.pop con.watchevents
-	| ty               -> unexpected_packet Xb.Op.Watchevent ty
+  let pkt = pkt_recv con in
+  match Xb.Packet.get_ty pkt with
+  | Xb.Op.Watchevent ->
+    queue_watchevent con (Xb.Packet.get_data pkt);
+    Queue.pop con.watchevents
+  | ty               -> unexpected_packet Xb.Op.Watchevent ty
 
 (* send one packet in the queue, and wait for reply *)
 let rec sync_recv ty con =
-	let pkt = pkt_recv con in
-	match Xb.Packet.get_ty pkt with
-	| Xb.Op.Error       -> (
-		match Xb.Packet.get_data pkt with
-		| "ENOENT" -> raise Xb.Noent
-		| "EAGAIN" -> raise Xb.Eagain
-		| "EINVAL" -> raise Xb.Invalid
-		| s        -> raise (Xb.Packet.Error s))
-	| Xb.Op.Watchevent  ->
-		queue_watchevent con (Xb.Packet.get_data pkt);
-		sync_recv ty con
-	| rty when rty = ty -> Xb.Packet.get_data pkt
-	| rty               -> unexpected_packet ty rty
+  let pkt = pkt_recv con in
+  match Xb.Packet.get_ty pkt with
+  | Xb.Op.Error       -> (
+      match Xb.Packet.get_data pkt with
+      | "ENOENT" -> raise Xb.Noent
+      | "EAGAIN" -> raise Xb.Eagain
+      | "EINVAL" -> raise Xb.Invalid
+      | s        -> raise (Xb.Packet.Error s))
+  | Xb.Op.Watchevent  ->
+    queue_watchevent con (Xb.Packet.get_data pkt);
+    sync_recv ty con
+  | rty when rty = ty -> Xb.Packet.get_data pkt
+  | rty               -> unexpected_packet ty rty
 
 let sync f con =
-	(* queue a query using function f *)
-	f con.xb;
-	if Xb.output_len con.xb = 0 then
-		Printf.printf "output len = 0\n%!";
-	let ty = Xb.Packet.get_ty (Xb.peek_output con.xb) in
-	pkt_send con;
-	sync_recv ty con
+  (* queue a query using function f *)
+  f con.xb;
+  if Xb.output_len con.xb = 0 then
+    Printf.printf "output len = 0\n%!";
+  let ty = Xb.Packet.get_ty (Xb.peek_output con.xb) in
+  pkt_send con;
+  sync_recv ty con
 
 let ack s =
-	if s = "OK" then () else raise (Xb.Packet.DataError s)
+  if s = "OK" then () else raise (Xb.Packet.DataError s)
 
 (** Check paths are suitable for read/write/mkdir/rm/directory etc (NOT watches) *)
 let validate_path path =
-	(* Paths shouldn't have a "//" in the middle *)
-	let bad = "//" in
-	for offset = 0 to String.length path - (String.length bad) do
-		if String.sub path offset (String.length bad) = bad then
-			raise (Invalid_path path)
-	done;
-	(* Paths shouldn't have a "/" at the end, except for the root *)
-	if path <> "/" && path <> "" && path.[String.length path - 1] = '/' then
-		raise (Invalid_path path)
+  (* Paths shouldn't have a "//" in the middle *)
+  let bad = "//" in
+  for offset = 0 to String.length path - (String.length bad) do
+    if String.sub path offset (String.length bad) = bad then
+      raise (Invalid_path path)
+  done;
+  (* Paths shouldn't have a "/" at the end, except for the root *)
+  if path <> "/" && path <> "" && path.[String.length path - 1] = '/' then
+    raise (Invalid_path path)
 
 (** Check to see if a path is suitable for watches *)
 let validate_watch_path path =
-	(* Check for stuff like @releaseDomain etc first *)
-	if path <> "" && path.[0] = '@' then ()
-	else validate_path path
+  (* Check for stuff like @releaseDomain etc first *)
+  if path <> "" && path.[0] = '@' then ()
+  else validate_path path
 
 let debug command con =
-	sync (Queueop.debug command) con
+  sync (Queueop.debug command) con
 
 let directory tid path con =
-	validate_path path;
-	let data = sync (Queueop.directory tid path) con in
-	split_string '\000' data
+  validate_path path;
+  let data = sync (Queueop.directory tid path) con in
+  split_string '\000' data
 
 let read tid path con =
-	validate_path path;
-	sync (Queueop.read tid path) con
+  validate_path path;
+  sync (Queueop.read tid path) con
 
 let readv tid dir vec con =
-	List.map (fun path -> validate_path path; read tid path con)
-		(if dir <> "" then
-			(List.map (fun v -> dir ^ "/" ^ v) vec) else vec)
+  List.map (fun path -> validate_path path; read tid path con)
+    (if dir <> "" then
+       (List.map (fun v -> dir ^ "/" ^ v) vec) else vec)
 
 let getperms tid path con =
-	validate_path path;
-	perms_of_string (sync (Queueop.getperms tid path) con)
+  validate_path path;
+  perms_of_string (sync (Queueop.getperms tid path) con)
 
 let watch path data con =
-	validate_watch_path path;
-	ack (sync (Queueop.watch path data) con)
+  validate_watch_path path;
+  ack (sync (Queueop.watch path data) con)
 
 let unwatch path data con =
-	validate_watch_path path;
-	ack (sync (Queueop.unwatch path data) con)
+  validate_watch_path path;
+  ack (sync (Queueop.unwatch path data) con)
 
 let transaction_start con =
-	let data = sync (Queueop.transaction_start) con in
-	try
-		int_of_string data
-	with
-		_ -> raise (Packet.DataError (Printf.sprintf "int expected; got '%s'" data))
+  let data = sync (Queueop.transaction_start) con in
+  try
+    int_of_string data
+  with
+    _ -> raise (Packet.DataError (Printf.sprintf "int expected; got '%s'" data))
 
 let transaction_end tid commit con =
-	try
-		ack (sync (Queueop.transaction_end tid commit) con);
-		true
-	with
-		Xb.Eagain -> false
+  try
+    ack (sync (Queueop.transaction_end tid commit) con);
+    true
+  with
+    Xb.Eagain -> false
 
 let introduce domid mfn port con =
-	ack (sync (Queueop.introduce domid mfn port) con)
+  ack (sync (Queueop.introduce domid mfn port) con)
 
 let release domid con =
-	ack (sync (Queueop.release domid) con)
+  ack (sync (Queueop.release domid) con)
 
 let resume domid con =
-	ack (sync (Queueop.resume domid) con)
+  ack (sync (Queueop.resume domid) con)
 
 let getdomainpath domid con =
-	sync (Queueop.getdomainpath domid) con
+  sync (Queueop.getdomainpath domid) con
 
 let write tid path value con =
-	validate_path path;
-	ack (sync (Queueop.write tid path value) con)
+  validate_path path;
+  ack (sync (Queueop.write tid path value) con)
 
 let writev tid dir vec con =
-	List.iter (fun (entry, value) ->
-		let path = (if dir <> "" then dir ^ "/" ^ entry else entry) in
-                validate_path path;
-		write tid path value con) vec
+  List.iter (fun (entry, value) ->
+      let path = (if dir <> "" then dir ^ "/" ^ entry else entry) in
+      validate_path path;
+      write tid path value con) vec
 
 let mkdir tid path con =
-	validate_path path;
-	ack (sync (Queueop.mkdir tid path) con)
+  validate_path path;
+  ack (sync (Queueop.mkdir tid path) con)
 
 let rm tid path con =
-        validate_path path;
-	try
-		ack (sync (Queueop.rm tid path) con)
-	with
-		Xb.Noent -> ()
+  validate_path path;
+  try
+    ack (sync (Queueop.rm tid path) con)
+  with
+    Xb.Noent -> ()
 
 let setperms tid path perms con =
-	validate_path path;
-	ack (sync (Queueop.setperms tid path (string_of_perms perms)) con)
+  validate_path path;
+  ack (sync (Queueop.setperms tid path (string_of_perms perms)) con)
 
 let setpermsv tid dir vec perms con =
-	List.iter (fun entry ->
-		let path = (if dir <> "" then dir ^ "/" ^ entry else entry) in
-		validate_path path;
-		setperms tid path perms con) vec
+  List.iter (fun entry ->
+      let path = (if dir <> "" then dir ^ "/" ^ entry else entry) in
+      validate_path path;
+      setperms tid path perms con) vec
diff --git a/tools/ocaml/libs/xs/xst.ml b/tools/ocaml/libs/xs/xst.ml
index 16affd2e07..50a980b915 100644
--- a/tools/ocaml/libs/xs/xst.ml
+++ b/tools/ocaml/libs/xs/xst.ml
@@ -15,47 +15,47 @@
  *)
 
 type ops =
-{
-	directory: string -> string list;
-	read: string -> string;
-	readv: string -> string list -> string list;
-	write: string -> string -> unit;
-	writev: string -> (string * string) list -> unit;
-	mkdir: string -> unit;
-	rm: string -> unit;
-	getperms: string -> Xsraw.perms;
-	setperms: string -> Xsraw.perms -> unit;
-	setpermsv: string -> string list -> Xsraw.perms -> unit;
-}
+  {
+    directory: string -> string list;
+    read: string -> string;
+    readv: string -> string list -> string list;
+    write: string -> string -> unit;
+    writev: string -> (string * string) list -> unit;
+    mkdir: string -> unit;
+    rm: string -> unit;
+    getperms: string -> Xsraw.perms;
+    setperms: string -> Xsraw.perms -> unit;
+    setpermsv: string -> string list -> Xsraw.perms -> unit;
+  }
 
 let get_operations tid xsh = {
-	directory = (fun path -> Xsraw.directory tid path xsh);
-	read = (fun path -> Xsraw.read tid path xsh);
-	readv = (fun dir vec -> Xsraw.readv tid dir vec xsh);
-	write = (fun path value -> Xsraw.write tid path value xsh);
-	writev = (fun dir vec -> Xsraw.writev tid dir vec xsh);
-	mkdir = (fun path -> Xsraw.mkdir tid path xsh);
-	rm = (fun path -> Xsraw.rm tid path xsh);
-	getperms = (fun path -> Xsraw.getperms tid path xsh);
-	setperms = (fun path perms -> Xsraw.setperms tid path perms xsh);
-	setpermsv = (fun dir vec perms -> Xsraw.setpermsv tid dir vec perms xsh);
+  directory = (fun path -> Xsraw.directory tid path xsh);
+  read = (fun path -> Xsraw.read tid path xsh);
+  readv = (fun dir vec -> Xsraw.readv tid dir vec xsh);
+  write = (fun path value -> Xsraw.write tid path value xsh);
+  writev = (fun dir vec -> Xsraw.writev tid dir vec xsh);
+  mkdir = (fun path -> Xsraw.mkdir tid path xsh);
+  rm = (fun path -> Xsraw.rm tid path xsh);
+  getperms = (fun path -> Xsraw.getperms tid path xsh);
+  setperms = (fun path perms -> Xsraw.setperms tid path perms xsh);
+  setpermsv = (fun dir vec perms -> Xsraw.setpermsv tid dir vec perms xsh);
 }
 
 let transaction xsh (f: ops -> 'a) : 'a =
-	let commited = ref false and result = ref None in
-	while not !commited
-	do
-		let tid = Xsraw.transaction_start xsh in
-		let t = get_operations tid xsh in
+  let commited = ref false and result = ref None in
+  while not !commited
+  do
+    let tid = Xsraw.transaction_start xsh in
+    let t = get_operations tid xsh in
 
-		begin try
-			result := Some (f t)
-		with exn ->
-			ignore (Xsraw.transaction_end tid false xsh);
-			raise exn
-		end;
-		commited := Xsraw.transaction_end tid true xsh
-	done;
-	match !result with
-	| None        -> failwith "internal error in transaction"
-	| Some result -> result
+    begin try
+        result := Some (f t)
+      with exn ->
+        ignore (Xsraw.transaction_end tid false xsh);
+        raise exn
+    end;
+    commited := Xsraw.transaction_end tid true xsh
+  done;
+  match !result with
+  | None        -> failwith "internal error in transaction"
+  | Some result -> result
diff --git a/tools/ocaml/libs/xs/xst.mli b/tools/ocaml/libs/xs/xst.mli
index 5ae560424c..08d737bc36 100644
--- a/tools/ocaml/libs/xs/xst.mli
+++ b/tools/ocaml/libs/xs/xst.mli
@@ -14,16 +14,16 @@
  * GNU Lesser General Public License for more details.
  *)
 type ops = {
-	directory : string -> string list;
-	read : string -> string;
-	readv : string -> string list -> string list;
-	write : string -> string -> unit;
-	writev : string -> (string * string) list -> unit;
-	mkdir : string -> unit;
-	rm : string -> unit;
-	getperms : string -> Xsraw.perms;
-	setperms : string -> Xsraw.perms -> unit;
-	setpermsv : string -> string list -> Xsraw.perms -> unit;
+  directory : string -> string list;
+  read : string -> string;
+  readv : string -> string list -> string list;
+  write : string -> string -> unit;
+  writev : string -> (string * string) list -> unit;
+  mkdir : string -> unit;
+  rm : string -> unit;
+  getperms : string -> Xsraw.perms;
+  setperms : string -> Xsraw.perms -> unit;
+  setpermsv : string -> string list -> Xsraw.perms -> unit;
 }
 
 val get_operations : int -> Xsraw.con -> ops
diff --git a/tools/ocaml/test/dmesg.ml b/tools/ocaml/test/dmesg.ml
index c868024c52..f9efe5dc30 100644
--- a/tools/ocaml/test/dmesg.ml
+++ b/tools/ocaml/test/dmesg.ml
@@ -1,17 +1,17 @@
 
 let _ =
-	Xenlight.register_exceptions ();
-	let logger = Xtl.create_stdio_logger ~level:Xentoollog.Debug () in
-	let ctx = Xenlight.ctx_alloc logger in
+  Xenlight.register_exceptions ();
+  let logger = Xtl.create_stdio_logger ~level:Xentoollog.Debug () in
+  let ctx = Xenlight.ctx_alloc logger in
 
-	let open Xenlight.Host in
-	let reader = xen_console_read_start ctx 0 in
-	(try
-		while true do
-			let line = xen_console_read_line ctx reader in
-			print_string line
-		done
-	with End_of_file -> ());
-	let _ = xen_console_read_finish ctx reader in
-	()
+  let open Xenlight.Host in
+  let reader = xen_console_read_start ctx 0 in
+  (try
+     while true do
+       let line = xen_console_read_line ctx reader in
+       print_string line
+     done
+   with End_of_file -> ());
+  let _ = xen_console_read_finish ctx reader in
+  ()
 
diff --git a/tools/ocaml/test/list_domains.ml b/tools/ocaml/test/list_domains.ml
index c8974957fd..94f1cec050 100644
--- a/tools/ocaml/test/list_domains.ml
+++ b/tools/ocaml/test/list_domains.ml
@@ -20,7 +20,7 @@ let _ =
     let domains = Xenlight.Dominfo.list ctx in
     List.iter (fun d -> print_dominfo d) domains
   with Xenlight.Error(err, fn) -> begin
-    printf "Caught Exception: %s: %s\n" (Xenlight.string_of_error err) fn;
-  end
+      printf "Caught Exception: %s: %s\n" (Xenlight.string_of_error err) fn;
+    end
 
 
diff --git a/tools/ocaml/test/raise_exception.ml b/tools/ocaml/test/raise_exception.ml
index 5ef7fc0f13..8c24c3555b 100644
--- a/tools/ocaml/test/raise_exception.ml
+++ b/tools/ocaml/test/raise_exception.ml
@@ -4,6 +4,6 @@ let _ =
   try
     Xenlight.test_raise_exception ()
   with Xenlight.Error(err, fn) -> begin
-    printf "Caught Exception: %s: %s\n" (Xenlight.string_of_error err) fn;
-  end
+      printf "Caught Exception: %s: %s\n" (Xenlight.string_of_error err) fn;
+    end
 
diff --git a/tools/ocaml/test/xtl.ml b/tools/ocaml/test/xtl.ml
index 5f94a76a82..458b11bbaa 100644
--- a/tools/ocaml/test/xtl.ml
+++ b/tools/ocaml/test/xtl.ml
@@ -2,24 +2,24 @@ open Printf
 open Xentoollog
 
 let stdio_vmessage min_level level errno ctx msg =
-	let level_str = level_to_string level
-	and errno_str = match errno with None -> "" | Some s -> sprintf ": errno=%d" s
-	and ctx_str = match ctx with None -> "" | Some s -> sprintf ": %s" s in
-	if compare min_level level <= 0 then begin
-		printf "%s%s%s: %s\n" level_str ctx_str errno_str msg;
-		flush stdout;
-	end
+  let level_str = level_to_string level
+  and errno_str = match errno with None -> "" | Some s -> sprintf ": errno=%d" s
+  and ctx_str = match ctx with None -> "" | Some s -> sprintf ": %s" s in
+  if compare min_level level <= 0 then begin
+    printf "%s%s%s: %s\n" level_str ctx_str errno_str msg;
+    flush stdout;
+  end
 
 let stdio_progress _ctx what percent dne total =
-	let nl = if dne = total then "\n" else "" in
-	printf "\rProgress %s %d%% (%Ld/%Ld)%s" what percent dne total nl;
-	flush stdout
+  let nl = if dne = total then "\n" else "" in
+  printf "\rProgress %s %d%% (%Ld/%Ld)%s" what percent dne total nl;
+  flush stdout
 
 let create_stdio_logger ?(level=Info) () =
-	let cbs = {
-		vmessage = stdio_vmessage level;
-		progress = stdio_progress; } in
-	create "Xentoollog.stdio_logger" cbs
+  let cbs = {
+    vmessage = stdio_vmessage level;
+    progress = stdio_progress; } in
+  create "Xentoollog.stdio_logger" cbs
 
 let do_test level =
   let lgr = create_stdio_logger ~level:level () in
diff --git a/tools/ocaml/xenstored/config.ml b/tools/ocaml/xenstored/config.ml
index 0ee7bc32ff..95ef745a54 100644
--- a/tools/ocaml/xenstored/config.ml
+++ b/tools/ocaml/xenstored/config.ml
@@ -15,98 +15,98 @@
  *)
 
 type ty =
-	| Set_bool of bool ref
-	| Set_int of int ref
-	| Set_string of string ref
-	| Set_float of float ref
-	| Unit of (unit -> unit)
-	| Bool of (bool -> unit)
-	| Int of (int -> unit)
-	| String of (string -> unit)
-	| Float of (float -> unit)
+  | Set_bool of bool ref
+  | Set_int of int ref
+  | Set_string of string ref
+  | Set_float of float ref
+  | Unit of (unit -> unit)
+  | Bool of (bool -> unit)
+  | Int of (int -> unit)
+  | String of (string -> unit)
+  | Float of (float -> unit)
 
 exception Error of (string * string) list
 
 let trim_start lc s =
-	let len = String.length s and i = ref 0 in
-	while !i < len && (List.mem s.[!i] lc)
-	do
-		incr i
-	done;
-	if !i < len then String.sub s !i (len - !i) else ""
+  let len = String.length s and i = ref 0 in
+  while !i < len && (List.mem s.[!i] lc)
+  do
+    incr i
+  done;
+  if !i < len then String.sub s !i (len - !i) else ""
 
 let trim_end lc s =
-	let i = ref (String.length s - 1) in
-	while !i > 0 && (List.mem s.[!i] lc)
-	do
-		decr i
-	done;
-	if !i >= 0 then String.sub s 0 (!i + 1) else ""
+  let i = ref (String.length s - 1) in
+  while !i > 0 && (List.mem s.[!i] lc)
+  do
+    decr i
+  done;
+  if !i >= 0 then String.sub s 0 (!i + 1) else ""
 
 let rec split ?limit:(limit=(-1)) c s =
-	let i = try String.index s c with Not_found -> -1 in
-	let nlimit = if limit = -1 || limit = 0 then limit else limit - 1 in
-	if i = -1 || nlimit = 0 then
-		[ s ]
-	else
-		let a = String.sub s 0 i
-		and b = String.sub s (i + 1) (String.length s - i - 1) in
-		a :: (split ~limit: nlimit c b)
+  let i = try String.index s c with Not_found -> -1 in
+  let nlimit = if limit = -1 || limit = 0 then limit else limit - 1 in
+  if i = -1 || nlimit = 0 then
+    [ s ]
+  else
+    let a = String.sub s 0 i
+    and b = String.sub s (i + 1) (String.length s - i - 1) in
+    a :: (split ~limit: nlimit c b)
 
 let parse_line stream =
-	let lc = [ ' '; '\t' ] in
-	let trim_spaces s = trim_end lc (trim_start lc s) in
-	let to_config s =
-		match split ~limit:2 '=' s with
-		| k :: v :: [] -> Some (trim_end lc k, trim_start lc v)
-		| _            -> None in
-	let rec read_filter_line () =
-		try
-			let line = trim_spaces (input_line stream) in
-			if String.length line > 0 && line.[0] <> '#' then
-				match to_config line with
-				| None   -> read_filter_line ()
-				| Some x -> x :: read_filter_line ()
-			else
-				read_filter_line ()
-		with
-			End_of_file -> [] in
-	read_filter_line ()
+  let lc = [ ' '; '\t' ] in
+  let trim_spaces s = trim_end lc (trim_start lc s) in
+  let to_config s =
+    match split ~limit:2 '=' s with
+    | k :: v :: [] -> Some (trim_end lc k, trim_start lc v)
+    | _            -> None in
+  let rec read_filter_line () =
+    try
+      let line = trim_spaces (input_line stream) in
+      if String.length line > 0 && line.[0] <> '#' then
+        match to_config line with
+        | None   -> read_filter_line ()
+        | Some x -> x :: read_filter_line ()
+      else
+        read_filter_line ()
+    with
+      End_of_file -> [] in
+  read_filter_line ()
 
 let parse filename =
-	let stream = open_in filename in
-	let cf = parse_line stream in
-	close_in stream;
-	cf
+  let stream = open_in filename in
+  let cf = parse_line stream in
+  close_in stream;
+  cf
 
 let validate cf expected other =
-	let err = ref [] in
-	let append x = err := x :: !err in
-	List.iter (fun (k, v) ->
-		try
-			if not (List.mem_assoc k expected) then
-				other k v
-			else let ty = List.assoc k expected in
-			match ty with
-			| Unit f       -> f ()
-			| Bool f       -> f (bool_of_string v)
-			| String f     -> f v
-			| Int f        -> f (int_of_string v)
-			| Float f      -> f (float_of_string v)
-			| Set_bool r   -> r := (bool_of_string v)
-			| Set_string r -> r := v
-			| Set_int r    -> r := int_of_string v
-			| Set_float r  -> r := (float_of_string v)
-		with
-		| Not_found                 -> append (k, "unknown key")
-		| Failure "int_of_string"   -> append (k, "expect int arg")
-		| Failure "bool_of_string"  -> append (k, "expect bool arg")
-		| Failure "float_of_string" -> append (k, "expect float arg")
-		| exn                       -> append (k, Printexc.to_string exn)
-		) cf;
-	if !err != [] then raise (Error !err)
+  let err = ref [] in
+  let append x = err := x :: !err in
+  List.iter (fun (k, v) ->
+      try
+        if not (List.mem_assoc k expected) then
+          other k v
+        else let ty = List.assoc k expected in
+          match ty with
+          | Unit f       -> f ()
+          | Bool f       -> f (bool_of_string v)
+          | String f     -> f v
+          | Int f        -> f (int_of_string v)
+          | Float f      -> f (float_of_string v)
+          | Set_bool r   -> r := (bool_of_string v)
+          | Set_string r -> r := v
+          | Set_int r    -> r := int_of_string v
+          | Set_float r  -> r := (float_of_string v)
+      with
+      | Not_found                 -> append (k, "unknown key")
+      | Failure "int_of_string"   -> append (k, "expect int arg")
+      | Failure "bool_of_string"  -> append (k, "expect bool arg")
+      | Failure "float_of_string" -> append (k, "expect float arg")
+      | exn                       -> append (k, Printexc.to_string exn)
+    ) cf;
+  if !err != [] then raise (Error !err)
 
 (** read a filename, parse and validate, and return the errors if any *)
 let read filename expected other =
-	let cf = parse filename in
-	validate cf expected other
+  let cf = parse filename in
+  validate cf expected other
diff --git a/tools/ocaml/xenstored/connection.ml b/tools/ocaml/xenstored/connection.ml
index 54f7f76516..d11011e164 100644
--- a/tools/ocaml/xenstored/connection.ml
+++ b/tools/ocaml/xenstored/connection.ml
@@ -24,281 +24,281 @@ type 'a bounded_sender = 'a -> unit option
 (** a bounded sender accepts an ['a] item and returns:
     None - if there is no room to accept the item
     Some () -  if it has successfully accepted/sent the item
- *)
+*)
 
 module BoundedPipe : sig
-	type 'a t
-
-	(** [create ~capacity ~destination] creates a bounded pipe with a
-	    local buffer holding at most [capacity] items.  Once the buffer is
-	    full it will not accept further items.  items from the pipe are
-	    flushed into [destination] as long as it accepts items.  The
-	    destination could be another pipe.
-	 *)
-	val create: capacity:int -> destination:'a bounded_sender -> 'a t
-
-	(** [is_empty t] returns whether the local buffer of [t] is empty. *)
-	val is_empty : _ t -> bool
-
-	(** [length t] the number of items in the internal buffer *)
-	val length: _ t -> int
-
-	(** [flush_pipe t] sends as many items from the local buffer as possible,
-			which could be none. *)
-	val flush_pipe: _ t -> unit
-
-	(** [push t item] tries to [flush_pipe] and then push [item]
-	    into the pipe if its [capacity] allows.
-	    Returns [None] if there is no more room
-	 *)
-	val push : 'a t -> 'a bounded_sender
+  type 'a t
+
+  (** [create ~capacity ~destination] creates a bounded pipe with a
+      	    local buffer holding at most [capacity] items.  Once the buffer is
+      	    full it will not accept further items.  items from the pipe are
+      	    flushed into [destination] as long as it accepts items.  The
+      	    destination could be another pipe.
+      	 *)
+  val create: capacity:int -> destination:'a bounded_sender -> 'a t
+
+  (** [is_empty t] returns whether the local buffer of [t] is empty. *)
+  val is_empty : _ t -> bool
+
+  (** [length t] the number of items in the internal buffer *)
+  val length: _ t -> int
+
+  (** [flush_pipe t] sends as many items from the local buffer as possible,
+      			which could be none. *)
+  val flush_pipe: _ t -> unit
+
+  (** [push t item] tries to [flush_pipe] and then push [item]
+      	    into the pipe if its [capacity] allows.
+      	    Returns [None] if there is no more room
+      	 *)
+  val push : 'a t -> 'a bounded_sender
 end = struct
-	(* items are enqueued in [q], and then flushed to [connect_to] *)
-	type 'a t =
-		{ q: 'a Queue.t
-		; destination: 'a bounded_sender
-		; capacity: int
-		}
-
-	let create ~capacity ~destination =
-		{ q = Queue.create (); capacity; destination }
-
-	let rec flush_pipe t =
-		if not Queue.(is_empty t.q) then
-			let item = Queue.peek t.q in
-			match t.destination item with
-			| None -> () (* no room *)
-			| Some () ->
-				(* successfully sent item to next stage *)
-				let _ = Queue.pop t.q in
-				(* continue trying to send more items *)
-				flush_pipe t
-
-	let push t item =
-		(* first try to flush as many items from this pipe as possible to make room,
-		   it is important to do this first to preserve the order of the items
-		 *)
-		flush_pipe t;
-		if Queue.length t.q < t.capacity then begin
-			(* enqueue, instead of sending directly.
-			   this ensures that [out] sees the items in the same order as we receive them
-			 *)
-			Queue.push item t.q;
-			Some (flush_pipe t)
-		end else None
-
-	let is_empty t = Queue.is_empty t.q
-	let length t = Queue.length t.q
+  (* items are enqueued in [q], and then flushed to [connect_to] *)
+  type 'a t =
+    { q: 'a Queue.t
+    ; destination: 'a bounded_sender
+    ; capacity: int
+    }
+
+  let create ~capacity ~destination =
+    { q = Queue.create (); capacity; destination }
+
+  let rec flush_pipe t =
+    if not Queue.(is_empty t.q) then
+      let item = Queue.peek t.q in
+      match t.destination item with
+      | None -> () (* no room *)
+      | Some () ->
+        (* successfully sent item to next stage *)
+        let _ = Queue.pop t.q in
+        (* continue trying to send more items *)
+        flush_pipe t
+
+  let push t item =
+    (* first try to flush as many items from this pipe as possible to make room,
+       		   it is important to do this first to preserve the order of the items
+       		 *)
+    flush_pipe t;
+    if Queue.length t.q < t.capacity then begin
+      (* enqueue, instead of sending directly.
+         			   this ensures that [out] sees the items in the same order as we receive them
+         			 *)
+      Queue.push item t.q;
+      Some (flush_pipe t)
+    end else None
+
+  let is_empty t = Queue.is_empty t.q
+  let length t = Queue.length t.q
 end
 
 type watch = {
-	con: t;
-	token: string;
-	path: string;
-	base: string;
-	is_relative: bool;
-	pending_watchevents: Xenbus.Xb.Packet.t BoundedPipe.t;
+  con: t;
+  token: string;
+  path: string;
+  base: string;
+  is_relative: bool;
+  pending_watchevents: Xenbus.Xb.Packet.t BoundedPipe.t;
 }
 
 and t = {
-	xb: Xenbus.Xb.t;
-	dom: Domain.t option;
-	transactions: (int, Transaction.t) Hashtbl.t;
-	mutable next_tid: int;
-	watches: (string, watch list) Hashtbl.t;
-	mutable nb_watches: int;
-	anonid: int;
-	mutable stat_nb_ops: int;
-	mutable perm: Perms.Connection.t;
-	pending_source_watchevents: (watch * Xenbus.Xb.Packet.t) BoundedPipe.t
+  xb: Xenbus.Xb.t;
+  dom: Domain.t option;
+  transactions: (int, Transaction.t) Hashtbl.t;
+  mutable next_tid: int;
+  watches: (string, watch list) Hashtbl.t;
+  mutable nb_watches: int;
+  anonid: int;
+  mutable stat_nb_ops: int;
+  mutable perm: Perms.Connection.t;
+  pending_source_watchevents: (watch * Xenbus.Xb.Packet.t) BoundedPipe.t
 }
 
 module Watch = struct
-	module T = struct
-		type t = watch
-
-		let compare w1 w2 =
-			(* cannot compare watches from different connections *)
-			assert (w1.con == w2.con);
-			match String.compare w1.token w2.token with
-			| 0 -> String.compare w1.path w2.path
-			| n -> n
-	end
-	module Set = Set.Make(T)
-
-	let flush_events t =
-		BoundedPipe.flush_pipe t.pending_watchevents;
-		not (BoundedPipe.is_empty t.pending_watchevents)
-
-	let pending_watchevents t =
-		BoundedPipe.length t.pending_watchevents
+  module T = struct
+    type t = watch
+
+    let compare w1 w2 =
+      (* cannot compare watches from different connections *)
+      assert (w1.con == w2.con);
+      match String.compare w1.token w2.token with
+      | 0 -> String.compare w1.path w2.path
+      | n -> n
+  end
+  module Set = Set.Make(T)
+
+  let flush_events t =
+    BoundedPipe.flush_pipe t.pending_watchevents;
+    not (BoundedPipe.is_empty t.pending_watchevents)
+
+  let pending_watchevents t =
+    BoundedPipe.length t.pending_watchevents
 end
 
 let source_flush_watchevents t =
-	BoundedPipe.flush_pipe t.pending_source_watchevents
+  BoundedPipe.flush_pipe t.pending_source_watchevents
 
 let source_pending_watchevents t =
-	BoundedPipe.length t.pending_source_watchevents
+  BoundedPipe.length t.pending_source_watchevents
 
 let mark_as_bad con =
-	match con.dom with
-	|None -> ()
-	| Some domain -> Domain.mark_as_bad domain
+  match con.dom with
+  |None -> ()
+  | Some domain -> Domain.mark_as_bad domain
 
 let initial_next_tid = 1
 
 let do_reconnect con =
-	Xenbus.Xb.reconnect con.xb;
-	(* dom is the same *)
-	Hashtbl.clear con.transactions;
-	con.next_tid <- initial_next_tid;
-	Hashtbl.clear con.watches;
-	(* anonid is the same *)
-	con.nb_watches <- 0;
-	con.stat_nb_ops <- 0;
-	(* perm is the same *)
-	()
+  Xenbus.Xb.reconnect con.xb;
+  (* dom is the same *)
+  Hashtbl.clear con.transactions;
+  con.next_tid <- initial_next_tid;
+  Hashtbl.clear con.watches;
+  (* anonid is the same *)
+  con.nb_watches <- 0;
+  con.stat_nb_ops <- 0;
+  (* perm is the same *)
+  ()
 
 let get_path con =
-Printf.sprintf "/local/domain/%i/" (match con.dom with None -> 0 | Some d -> Domain.get_id d)
+  Printf.sprintf "/local/domain/%i/" (match con.dom with None -> 0 | Some d -> Domain.get_id d)
 
 let watch_create ~con ~path ~token = {
-	con = con;
-	token = token;
-	path = path;
-	base = get_path con;
-	is_relative = path.[0] <> '/' && path.[0] <> '@';
-	pending_watchevents = BoundedPipe.create ~capacity:!Define.maxwatchevents ~destination:(Xenbus.Xb.queue con.xb)
+  con = con;
+  token = token;
+  path = path;
+  base = get_path con;
+  is_relative = path.[0] <> '/' && path.[0] <> '@';
+  pending_watchevents = BoundedPipe.create ~capacity:!Define.maxwatchevents ~destination:(Xenbus.Xb.queue con.xb)
 }
 


From xen-changelog-bounces@lists.xenproject.org Wed Feb 08 02:46:05 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 08 Feb 2023 02:46:05 +0000
Received: from list by lists.xenproject.org with outflank-mailman.491498.760625 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pPaTF-0007Vw-1g; Wed, 08 Feb 2023 02:46:05 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 491498.760625; Wed, 08 Feb 2023 02:46:05 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pPaTE-0007Vo-Ux; Wed, 08 Feb 2023 02:46:04 +0000
Received: by outflank-mailman (input) for mailman id 491498;
 Wed, 08 Feb 2023 02:46:03 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pPaTD-0007VY-9S
 for xen-changelog@lists.xenproject.org; Wed, 08 Feb 2023 02:46:03 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pPaTD-0003OV-8j
 for xen-changelog@lists.xenproject.org; Wed, 08 Feb 2023 02:46:03 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pPaTD-0000TZ-7z
 for xen-changelog@lists.xenproject.org; Wed, 08 Feb 2023 02:46:03 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=q/WiNZKEf+QY/4ePwRe+aAng05HX+qN9TyIqFYnPDy0=; b=XTL6lKJa6vgChdt957SXj2V6bg
	X+VfKWYcSPBWD+dRlyE2K8bDfAxVZ+GgZVSYdDy8ZmYlX6f4XlZIwcxZrO2nUzss6bgc8KRpBPXIQ
	3Zwc13gAtf86O5klFrWL+O7YCBsRXa9JbVv+FPvbDe/Syd9OTrMmhRa9sLRnVn0nvD9M=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools/oxenstored: validate config file before live update
Message-Id: <E1pPaTD-0000TZ-7z@xenbits.xenproject.org>
Date: Wed, 08 Feb 2023 02:46:03 +0000

commit e6f07052ce4a0f0b7d4dc522d87465efb2d9ee86
Author:     Edwin Török <edvin.torok@citrix.com>
AuthorDate: Tue May 11 15:56:50 2021 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Mon Feb 6 10:22:12 2023 +0000

    tools/oxenstored: validate config file before live update
    
    The configuration file can contain typos or various errors that could prevent
    live update from succeeding (e.g. a flag only valid on a different version).
    Unknown entries in the config file would be ignored on startup normally,
    add a strict --config-test that live-update can use to check that the config file
    is valid *for the new binary*.
    
    For compatibility with running old code during live update recognize
    --live --help as an equivalent to --config-test.
    
    Signed-off-by: Edwin Török <edvin.torok@citrix.com>
    Acked-by: Christian Lindig <christian.lindig@citrix.com>
---
 tools/ocaml/xenstored/parse_arg.ml | 26 ++++++++++++++++++++++++++
 tools/ocaml/xenstored/xenstored.ml | 11 +++++++++--
 2 files changed, 35 insertions(+), 2 deletions(-)

diff --git a/tools/ocaml/xenstored/parse_arg.ml b/tools/ocaml/xenstored/parse_arg.ml
index 1a85b14ef5..b159b91f00 100644
--- a/tools/ocaml/xenstored/parse_arg.ml
+++ b/tools/ocaml/xenstored/parse_arg.ml
@@ -26,8 +26,14 @@ type config =
     restart: bool;
     live_reload: bool;
     disable_socket: bool;
+    config_test: bool;
   }
 
+let get_config_filename config_file =
+  match config_file with
+  | Some name -> name
+  | None      -> Define.default_config_dir ^ "/oxenstored.conf"
+
 let do_argv =
   let pidfile = ref "" and tracefile = ref "" (* old xenstored compatibility *)
   and domain_init = ref true
@@ -38,6 +44,8 @@ let do_argv =
   and restart = ref false
   and live_reload = ref false
   and disable_socket = ref false
+  and config_test = ref false
+  and help = ref false
   in
 
   let speclist =
@@ -55,10 +63,27 @@ let do_argv =
       ("-T", Arg.Set_string tracefile, ""); (* for compatibility *)
       ("--restart", Arg.Set restart, "Read database on starting");
       ("--live", Arg.Set live_reload, "Read live dump on startup");
+      ("--config-test", Arg.Set config_test, "Test validity of config file");
       ("--disable-socket", Arg.Unit (fun () -> disable_socket := true), "Disable socket");
+      ("--help", Arg.Set help, "Display this list of options")
     ] in
   let usage_msg = "usage : xenstored [--config-file <filename>] [--no-domain-init] [--help] [--no-fork] [--reraise-top-level] [--restart] [--disable-socket]" in
   Arg.parse speclist (fun _ -> ()) usage_msg;
+  let () =
+    if !help then begin
+      if !live_reload then
+        (*
+          Transform --live --help into --config-test for backward compat with
+          running code during live update.
+          Caller will validate config and exit
+        *)
+        config_test := true
+      else begin
+        Arg.usage_string speclist usage_msg |> print_endline;
+        exit 0
+      end
+    end
+  in
   {
     domain_init = !domain_init;
     activate_access_log = !activate_access_log;
@@ -70,4 +95,5 @@ let do_argv =
     restart = !restart;
     live_reload = !live_reload;
     disable_socket = !disable_socket;
+    config_test = !config_test;
   }
diff --git a/tools/ocaml/xenstored/xenstored.ml b/tools/ocaml/xenstored/xenstored.ml
index 366437b396..1aaa3e995e 100644
--- a/tools/ocaml/xenstored/xenstored.ml
+++ b/tools/ocaml/xenstored/xenstored.ml
@@ -88,7 +88,7 @@ let default_pidfile = Paths.xen_run_dir ^ "/xenstored.pid"
 
 let ring_scan_interval = ref 20
 
-let parse_config filename =
+let parse_config ?(strict=false) filename =
   let pidfile = ref default_pidfile in
   let options = [
     ("merge-activate", Config.Set_bool Transaction.do_coalesce);
@@ -129,11 +129,12 @@ let parse_config filename =
     ("xenstored-port", Config.Set_string Domains.xenstored_port); ] in
   begin try Config.read filename options (fun _ _ -> raise Not_found)
     with
-    | Config.Error err -> List.iter (fun (k, e) ->
+    | Config.Error err as e -> List.iter (fun (k, e) ->
         match e with
         | "unknown key" -> eprintf "config: unknown key %s\n" k
         | _             -> eprintf "config: %s: %s\n" k e
       ) err;
+      if strict then raise e
     | Sys_error m -> eprintf "error: config: %s\n" m;
   end;
   !pidfile
@@ -358,6 +359,12 @@ let tweak_gc () =
 let () =
   Printexc.set_uncaught_exception_handler Logging.fallback_exception_handler;
   let cf = do_argv in
+  if cf.config_test then begin
+    let path = config_filename cf in
+    let _pidfile:string = parse_config ~strict:true path in
+    Printf.printf "Configuration valid at %s\n%!" path;
+    exit 0
+  end;
   let pidfile =
     if Sys.file_exists (config_filename cf) then
       parse_config (config_filename cf)
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Feb 08 02:46:15 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 08 Feb 2023 02:46:15 +0000
Received: from list by lists.xenproject.org with outflank-mailman.491502.760640 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pPaTP-0007oD-C4; Wed, 08 Feb 2023 02:46:15 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 491502.760640; Wed, 08 Feb 2023 02:46:15 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pPaTP-0007o5-9D; Wed, 08 Feb 2023 02:46:15 +0000
Received: by outflank-mailman (input) for mailman id 491502;
 Wed, 08 Feb 2023 02:46:13 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pPaTN-0007e1-D0
 for xen-changelog@lists.xenproject.org; Wed, 08 Feb 2023 02:46:13 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pPaTN-0003Yw-Bo
 for xen-changelog@lists.xenproject.org; Wed, 08 Feb 2023 02:46:13 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pPaTN-0000U6-Az
 for xen-changelog@lists.xenproject.org; Wed, 08 Feb 2023 02:46:13 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=wHJQ6Yano7ZfkL8EUlP48VCQro8xEe7+2P+NLGDj+jg=; b=OAFgbklGlvBAMuniegNlPRccEI
	UmX9QfEZjHEYOWxgN9E2i2Ga4K3nHe8243DShCJW3JvKe6f4Sz6w80t98NuSP8faKVlWyR402+Usm
	zohO0+eYgQxzCAv/PtG4DfPax9X88IzIIRpR8PIjNlhmVN8zC1EXWBNNULCNpdO07LTI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools/ocaml/libs: Don't declare stubs as taking void
Message-Id: <E1pPaTN-0000U6-Az@xenbits.xenproject.org>
Date: Wed, 08 Feb 2023 02:46:13 +0000

commit ff8b560be80b9211c303d74df7e4b3921d2bb8ca
Author:     Edwin Török <edwin.torok@cloud.com>
AuthorDate: Thu Jan 12 11:28:29 2023 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Mon Feb 6 10:22:12 2023 +0000

    tools/ocaml/libs: Don't declare stubs as taking void
    
    There is no such thing as an Ocaml function (C stub or otherwise) taking no
    parameters.  In the absence of any other parameters, unit is still passed.
    
    This doesn't explode with any ABI we care about, but would malfunction for an
    ABI environment such as stdcall.
    
    Fixes: c3afd398ba7f ("ocaml: Add XS bindings.")
    Fixes: 8b7ce06a2d34 ("ocaml: Add XC bindings.")
    Signed-off-by: Edwin Török <edwin.torok@cloud.com>
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Christian Lindig <christian.lindig@citrix.com>
---
 tools/ocaml/libs/xb/xenbus_stubs.c  | 5 ++---
 tools/ocaml/libs/xc/xenctrl_stubs.c | 4 ++--
 2 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/tools/ocaml/libs/xb/xenbus_stubs.c b/tools/ocaml/libs/xb/xenbus_stubs.c
index 3065181a55..97116b0782 100644
--- a/tools/ocaml/libs/xb/xenbus_stubs.c
+++ b/tools/ocaml/libs/xb/xenbus_stubs.c
@@ -30,10 +30,9 @@
 #include <xenctrl.h>
 #include <xen/io/xs_wire.h>
 
-CAMLprim value stub_header_size(void)
+CAMLprim value stub_header_size(value unit)
 {
-	CAMLparam0();
-	CAMLreturn(Val_int(sizeof(struct xsd_sockmsg)));
+	return Val_int(sizeof(struct xsd_sockmsg));
 }
 
 CAMLprim value stub_header_of_string(value s)
diff --git a/tools/ocaml/libs/xc/xenctrl_stubs.c b/tools/ocaml/libs/xc/xenctrl_stubs.c
index 2fba9c5e94..7288184459 100644
--- a/tools/ocaml/libs/xc/xenctrl_stubs.c
+++ b/tools/ocaml/libs/xc/xenctrl_stubs.c
@@ -86,9 +86,9 @@ static void Noreturn failwith_xc(xc_interface *xch)
 	caml_raise_with_string(*caml_named_value("xc.error"), error_str);
 }
 
-CAMLprim value stub_xc_interface_open(void)
+CAMLprim value stub_xc_interface_open(value unit)
 {
-	CAMLparam0();
+	CAMLparam1(unit);
 	CAMLlocal1(result);
 	xc_interface *xch;
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Feb 08 02:46:25 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 08 Feb 2023 02:46:25 +0000
Received: from list by lists.xenproject.org with outflank-mailman.491503.760643 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pPaTZ-0007tY-DC; Wed, 08 Feb 2023 02:46:25 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 491503.760643; Wed, 08 Feb 2023 02:46:25 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pPaTZ-0007tR-Aa; Wed, 08 Feb 2023 02:46:25 +0000
Received: by outflank-mailman (input) for mailman id 491503;
 Wed, 08 Feb 2023 02:46:23 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pPaTX-0007sR-FM
 for xen-changelog@lists.xenproject.org; Wed, 08 Feb 2023 02:46:23 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pPaTX-0003Z7-Ef
 for xen-changelog@lists.xenproject.org; Wed, 08 Feb 2023 02:46:23 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pPaTX-0000Uu-E1
 for xen-changelog@lists.xenproject.org; Wed, 08 Feb 2023 02:46:23 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=02pWZximd3/CJ2dxVyt/Jfm+pjl9//XSrabWtAoscsk=; b=PT6prZMs268sw/K1mF7H2OThC3
	YGuAw6eWCdcPjG2g4km+l9ncB9EXU1vm6gPM8znoz/vJ/xv3ZWXf5kpcUezqqEz3x7oQsdRjkzHJW
	OYmozVKMstWXTocu1LXvIxvrWI/xBU6vQLYbZ6Xv8BanEzSViDLgFOQFA1AVKQB8rABc=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools/ocaml/libs: Allocate the correct amount of memory for Abstract_tag
Message-Id: <E1pPaTX-0000Uu-E1@xenbits.xenproject.org>
Date: Wed, 08 Feb 2023 02:46:23 +0000

commit 36eb2de31b6ecb8787698fb1a701bd708c8971b2
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Tue Jan 31 10:59:42 2023 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Mon Feb 6 10:22:12 2023 +0000

    tools/ocaml/libs: Allocate the correct amount of memory for Abstract_tag
    
    caml_alloc() takes units of Wsize (word size), not bytes.  As a consequence,
    we're allocating 4 or 8 times too much memory.
    
    Ocaml has a helper, Wsize_bsize(), but it truncates cases which aren't an
    exact multiple.  Use a BUILD_BUG_ON() to cover the potential for truncation,
    as there's no rounding-up form of the helper.
    
    Fixes: 8b7ce06a2d34 ("ocaml: Add XC bindings.")
    Fixes: d3e649277a13 ("ocaml: add mmap bindings implementation.")
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Christian Lindig <christian.lindig@citrix.com>
---
 tools/ocaml/libs/mmap/Makefile        | 2 ++
 tools/ocaml/libs/mmap/xenmmap_stubs.c | 6 +++++-
 tools/ocaml/libs/xc/xenctrl_stubs.c   | 5 ++++-
 3 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/tools/ocaml/libs/mmap/Makefile b/tools/ocaml/libs/mmap/Makefile
index a621537135..855b8b2c98 100644
--- a/tools/ocaml/libs/mmap/Makefile
+++ b/tools/ocaml/libs/mmap/Makefile
@@ -2,6 +2,8 @@ OCAML_TOPLEVEL=$(CURDIR)/../..
 XEN_ROOT=$(OCAML_TOPLEVEL)/../..
 include $(OCAML_TOPLEVEL)/common.make
 
+CFLAGS += $(CFLAGS_xeninclude)
+
 OBJS = xenmmap
 INTF = $(foreach obj, $(OBJS),$(obj).cmi)
 LIBS = xenmmap.cma xenmmap.cmxa
diff --git a/tools/ocaml/libs/mmap/xenmmap_stubs.c b/tools/ocaml/libs/mmap/xenmmap_stubs.c
index e03951d781..d623ad390e 100644
--- a/tools/ocaml/libs/mmap/xenmmap_stubs.c
+++ b/tools/ocaml/libs/mmap/xenmmap_stubs.c
@@ -21,6 +21,8 @@
 #include <errno.h>
 #include "mmap_stubs.h"
 
+#include <xen-tools/libs.h>
+
 #include <caml/mlvalues.h>
 #include <caml/memory.h>
 #include <caml/alloc.h>
@@ -59,7 +61,9 @@ CAMLprim value stub_mmap_init(value fd, value pflag, value mflag,
 	default: caml_invalid_argument("maptype");
 	}
 
-	result = caml_alloc(sizeof(struct mmap_interface), Abstract_tag);
+	BUILD_BUG_ON((sizeof(struct mmap_interface) % sizeof(value)) != 0);
+	result = caml_alloc(Wsize_bsize(sizeof(struct mmap_interface)),
+			    Abstract_tag);
 
 	if (mmap_interface_init(Intf_val(result), Int_val(fd),
 	                        c_pflag, c_mflag,
diff --git a/tools/ocaml/libs/xc/xenctrl_stubs.c b/tools/ocaml/libs/xc/xenctrl_stubs.c
index 7288184459..fd1f306f02 100644
--- a/tools/ocaml/libs/xc/xenctrl_stubs.c
+++ b/tools/ocaml/libs/xc/xenctrl_stubs.c
@@ -1031,7 +1031,10 @@ CAMLprim value stub_map_foreign_range(value xch, value dom,
 	uint32_t c_dom;
 	unsigned long c_mfn;
 
-	result = caml_alloc(sizeof(struct mmap_interface), Abstract_tag);
+	BUILD_BUG_ON((sizeof(struct mmap_interface) % sizeof(value)) != 0);
+	result = caml_alloc(Wsize_bsize(sizeof(struct mmap_interface)),
+			    Abstract_tag);
+
 	intf = (struct mmap_interface *) result;
 
 	intf->len = Int_val(size);
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Feb 08 02:46:35 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 08 Feb 2023 02:46:35 +0000
Received: from list by lists.xenproject.org with outflank-mailman.491504.760648 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pPaTj-00082m-F4; Wed, 08 Feb 2023 02:46:35 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 491504.760648; Wed, 08 Feb 2023 02:46:35 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pPaTj-00082f-C6; Wed, 08 Feb 2023 02:46:35 +0000
Received: by outflank-mailman (input) for mailman id 491504;
 Wed, 08 Feb 2023 02:46:33 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pPaTh-0007zH-IC
 for xen-changelog@lists.xenproject.org; Wed, 08 Feb 2023 02:46:33 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pPaTh-0003ZD-HR
 for xen-changelog@lists.xenproject.org; Wed, 08 Feb 2023 02:46:33 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pPaTh-0000Vt-Gl
 for xen-changelog@lists.xenproject.org; Wed, 08 Feb 2023 02:46:33 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=iIamPD5qgWNodAXpbAoKtmanw1BBqTx8dCICF+fs000=; b=jBtF1EFEfMSX7AfOst+koeg0IP
	A5hpzgdtRn+GbXn1S0N+v0HJHSD+xBUi5jzFl9FPu+pqWEweyp2xcTyTlrxQRPYVtFOL0AVYFf8Nb
	Th8Wya1UmdckV9d0cY8G7RBiN0OFtRmfu4ep4dxhh23wcrXmxxvDqM2xX/7rRmsr66OU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools/ocaml/evtchn: Don't reference Custom objects with the GC lock released
Message-Id: <E1pPaTh-0000Vt-Gl@xenbits.xenproject.org>
Date: Wed, 08 Feb 2023 02:46:33 +0000

commit 2636d8ff7a670c4d2485757dbe966e36c259a960
Author:     Edwin Török <edwin.torok@cloud.com>
AuthorDate: Thu Jan 12 17:48:29 2023 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Mon Feb 6 10:22:12 2023 +0000

    tools/ocaml/evtchn: Don't reference Custom objects with the GC lock released
    
    The modification to the _H() macro for Ocaml 5 support introduced a subtle
    bug.  From the manual:
    
      https://ocaml.org/manual/intfc.html#ss:parallel-execution-long-running-c-code
    
    "After caml_release_runtime_system() was called and until
    caml_acquire_runtime_system() is called, the C code must not access any OCaml
    data, nor call any function of the run-time system, nor call back into OCaml
    code."
    
    Previously, the value was a naked C pointer, so dereferencing it wasn't
    "accessing any Ocaml data", but the fix to avoid naked C pointers added a
    layer of indirection through an Ocaml Custom object, meaning that the common
    pattern of using _H() in a blocking section is unsafe.
    
    In order to fix:
    
     * Drop the _H() macro and replace it with a static inline xce_of_val().
     * Opencode the assignment into Data_custom_val() in the two constructors.
     * Rename "value xce" parameters to "value xce_val" so we can consistently
       have "xenevtchn_handle *xce" on the stack, and obtain the pointer with the
       GC lock still held.
    
    Fixes: 22d5affdf0ce ("tools/ocaml/evtchn: OCaml 5 support, fix potential resource leak")
    Signed-off-by: Edwin Török <edwin.torok@cloud.com>
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Christian Lindig <christian.lindig@citrix.com>
---
 tools/ocaml/libs/eventchn/xeneventchn_stubs.c | 60 ++++++++++++++++-----------
 1 file changed, 35 insertions(+), 25 deletions(-)

diff --git a/tools/ocaml/libs/eventchn/xeneventchn_stubs.c b/tools/ocaml/libs/eventchn/xeneventchn_stubs.c
index aa8a69cc1e..d7881ca95f 100644
--- a/tools/ocaml/libs/eventchn/xeneventchn_stubs.c
+++ b/tools/ocaml/libs/eventchn/xeneventchn_stubs.c
@@ -33,11 +33,14 @@
 #include <caml/fail.h>
 #include <caml/signals.h>
 
-#define _H(__h) (*((xenevtchn_handle **)Data_custom_val(__h)))
+static inline xenevtchn_handle *xce_of_val(value v)
+{
+	return *(xenevtchn_handle **)Data_custom_val(v);
+}
 
 static void stub_evtchn_finalize(value v)
 {
-	xenevtchn_close(_H(v));
+	xenevtchn_close(xce_of_val(v));
 }
 
 static struct custom_operations xenevtchn_ops = {
@@ -68,7 +71,7 @@ CAMLprim value stub_eventchn_init(value cloexec)
 		caml_failwith("open failed");
 
 	result = caml_alloc_custom(&xenevtchn_ops, sizeof(xce), 0, 1);
-	_H(result) = xce;
+	*(xenevtchn_handle **)Data_custom_val(result) = xce;
 
 	CAMLreturn(result);
 }
@@ -87,18 +90,19 @@ CAMLprim value stub_eventchn_fdopen(value fdval)
 		caml_failwith("evtchn fdopen failed");
 
 	result = caml_alloc_custom(&xenevtchn_ops, sizeof(xce), 0, 1);
-	_H(result) = xce;
+	*(xenevtchn_handle **)Data_custom_val(result) = xce;
 
 	CAMLreturn(result);
 }
 
-CAMLprim value stub_eventchn_fd(value xce)
+CAMLprim value stub_eventchn_fd(value xce_val)
 {
-	CAMLparam1(xce);
+	CAMLparam1(xce_val);
 	CAMLlocal1(result);
+	xenevtchn_handle *xce = xce_of_val(xce_val);
 	int fd;
 
-	fd = xenevtchn_fd(_H(xce));
+	fd = xenevtchn_fd(xce);
 	if (fd == -1)
 		caml_failwith("evtchn fd failed");
 
@@ -107,13 +111,14 @@ CAMLprim value stub_eventchn_fd(value xce)
 	CAMLreturn(result);
 }
 
-CAMLprim value stub_eventchn_notify(value xce, value port)
+CAMLprim value stub_eventchn_notify(value xce_val, value port)
 {
-	CAMLparam2(xce, port);
+	CAMLparam2(xce_val, port);
+	xenevtchn_handle *xce = xce_of_val(xce_val);
 	int rc;
 
 	caml_enter_blocking_section();
-	rc = xenevtchn_notify(_H(xce), Int_val(port));
+	rc = xenevtchn_notify(xce, Int_val(port));
 	caml_leave_blocking_section();
 
 	if (rc == -1)
@@ -122,15 +127,16 @@ CAMLprim value stub_eventchn_notify(value xce, value port)
 	CAMLreturn(Val_unit);
 }
 
-CAMLprim value stub_eventchn_bind_interdomain(value xce, value domid,
+CAMLprim value stub_eventchn_bind_interdomain(value xce_val, value domid,
                                               value remote_port)
 {
-	CAMLparam3(xce, domid, remote_port);
+	CAMLparam3(xce_val, domid, remote_port);
 	CAMLlocal1(port);
+	xenevtchn_handle *xce = xce_of_val(xce_val);
 	xenevtchn_port_or_error_t rc;
 
 	caml_enter_blocking_section();
-	rc = xenevtchn_bind_interdomain(_H(xce), Int_val(domid), Int_val(remote_port));
+	rc = xenevtchn_bind_interdomain(xce, Int_val(domid), Int_val(remote_port));
 	caml_leave_blocking_section();
 
 	if (rc == -1)
@@ -140,14 +146,15 @@ CAMLprim value stub_eventchn_bind_interdomain(value xce, value domid,
 	CAMLreturn(port);
 }
 
-CAMLprim value stub_eventchn_bind_virq(value xce, value virq_type)
+CAMLprim value stub_eventchn_bind_virq(value xce_val, value virq_type)
 {
-	CAMLparam2(xce, virq_type);
+	CAMLparam2(xce_val, virq_type);
 	CAMLlocal1(port);
+	xenevtchn_handle *xce = xce_of_val(xce_val);
 	xenevtchn_port_or_error_t rc;
 
 	caml_enter_blocking_section();
-	rc = xenevtchn_bind_virq(_H(xce), Int_val(virq_type));
+	rc = xenevtchn_bind_virq(xce, Int_val(virq_type));
 	caml_leave_blocking_section();
 
 	if (rc == -1)
@@ -157,13 +164,14 @@ CAMLprim value stub_eventchn_bind_virq(value xce, value virq_type)
 	CAMLreturn(port);
 }
 
-CAMLprim value stub_eventchn_unbind(value xce, value port)
+CAMLprim value stub_eventchn_unbind(value xce_val, value port)
 {
-	CAMLparam2(xce, port);
+	CAMLparam2(xce_val, port);
+	xenevtchn_handle *xce = xce_of_val(xce_val);
 	int rc;
 
 	caml_enter_blocking_section();
-	rc = xenevtchn_unbind(_H(xce), Int_val(port));
+	rc = xenevtchn_unbind(xce, Int_val(port));
 	caml_leave_blocking_section();
 
 	if (rc == -1)
@@ -172,14 +180,15 @@ CAMLprim value stub_eventchn_unbind(value xce, value port)
 	CAMLreturn(Val_unit);
 }
 
-CAMLprim value stub_eventchn_pending(value xce)
+CAMLprim value stub_eventchn_pending(value xce_val)
 {
-	CAMLparam1(xce);
+	CAMLparam1(xce_val);
 	CAMLlocal1(result);
+	xenevtchn_handle *xce = xce_of_val(xce_val);
 	xenevtchn_port_or_error_t port;
 
 	caml_enter_blocking_section();
-	port = xenevtchn_pending(_H(xce));
+	port = xenevtchn_pending(xce);
 	caml_leave_blocking_section();
 
 	if (port == -1)
@@ -189,16 +198,17 @@ CAMLprim value stub_eventchn_pending(value xce)
 	CAMLreturn(result);
 }
 
-CAMLprim value stub_eventchn_unmask(value xce, value _port)
+CAMLprim value stub_eventchn_unmask(value xce_val, value _port)
 {
-	CAMLparam2(xce, _port);
+	CAMLparam2(xce_val, _port);
+	xenevtchn_handle *xce = xce_of_val(xce_val);
 	evtchn_port_t port;
 	int rc;
 
 	port = Int_val(_port);
 
 	caml_enter_blocking_section();
-	rc = xenevtchn_unmask(_H(xce), port);
+	rc = xenevtchn_unmask(xce, port);
 	caml_leave_blocking_section();
 
 	if (rc)
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Feb 08 02:46:45 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 08 Feb 2023 02:46:45 +0000
Received: from list by lists.xenproject.org with outflank-mailman.491507.760651 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pPaTt-000897-GN; Wed, 08 Feb 2023 02:46:45 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 491507.760651; Wed, 08 Feb 2023 02:46:45 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pPaTt-00088z-De; Wed, 08 Feb 2023 02:46:45 +0000
Received: by outflank-mailman (input) for mailman id 491507;
 Wed, 08 Feb 2023 02:46:43 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pPaTr-00088L-Kt
 for xen-changelog@lists.xenproject.org; Wed, 08 Feb 2023 02:46:43 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pPaTr-0003Zh-KG
 for xen-changelog@lists.xenproject.org; Wed, 08 Feb 2023 02:46:43 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pPaTr-0000WP-Jg
 for xen-changelog@lists.xenproject.org; Wed, 08 Feb 2023 02:46:43 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=btYfm0yrSWkkpQW30nIIjGmBDrd6jhATgcDXGAnFxug=; b=F7OXLjXZ5d9wivAAxIZCF5X5ok
	LrrnxEjDJKQ9ioC5cQd9M6KQeGDv78H/4tIpCNjB95BKAdIhoh49pJWUoj0lorrEb/tWUjwx4+n7P
	2vbxQbL1MjBI0YSrDL+B45DXDtml2F2kHErip+tUZc/kC3oGLV0XadEZYVuKJWZhmIPE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools/ocaml/evtchn: Misc cleanup
Message-Id: <E1pPaTr-0000WP-Jg@xenbits.xenproject.org>
Date: Wed, 08 Feb 2023 02:46:43 +0000

commit 40893f5ac6f2405656ffe0c75099f75b1817b641
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Mon Jan 30 16:37:49 2023 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Mon Feb 6 10:22:12 2023 +0000

    tools/ocaml/evtchn: Misc cleanup
    
     * Remove local integers when all we're returning is Val_int() of another
       variable.  The CAMLlocal*() can't be optimised automatically, as it's
       registered with the GC.
     * Rename "virq_type" to "virq" and "_port" to "port".
     * In stub_eventchn_pending(), rename 'port' to 'rc', to be consistent with
       all other stubs that return xenevtchn_port_or_error_t.
     * In stub_eventchn_unmask(), check for rc == -1 to be consistent with all
       other stubs.
    
    No practical change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Christian Lindig <christian.lindig@citrix.com>
---
 tools/ocaml/libs/eventchn/xeneventchn_stubs.c | 45 +++++++++++----------------
 1 file changed, 18 insertions(+), 27 deletions(-)

diff --git a/tools/ocaml/libs/eventchn/xeneventchn_stubs.c b/tools/ocaml/libs/eventchn/xeneventchn_stubs.c
index d7881ca95f..34dcfed302 100644
--- a/tools/ocaml/libs/eventchn/xeneventchn_stubs.c
+++ b/tools/ocaml/libs/eventchn/xeneventchn_stubs.c
@@ -98,17 +98,15 @@ CAMLprim value stub_eventchn_fdopen(value fdval)
 CAMLprim value stub_eventchn_fd(value xce_val)
 {
 	CAMLparam1(xce_val);
-	CAMLlocal1(result);
 	xenevtchn_handle *xce = xce_of_val(xce_val);
 	int fd;
 
+	/* Don't drop the GC lock.  This is a simple read out of memory */
 	fd = xenevtchn_fd(xce);
 	if (fd == -1)
 		caml_failwith("evtchn fd failed");
 
-	result = Val_int(fd);
-
-	CAMLreturn(result);
+	CAMLreturn(Val_int(fd));
 }
 
 CAMLprim value stub_eventchn_notify(value xce_val, value port)
@@ -131,37 +129,34 @@ CAMLprim value stub_eventchn_bind_interdomain(value xce_val, value domid,
                                               value remote_port)
 {
 	CAMLparam3(xce_val, domid, remote_port);
-	CAMLlocal1(port);
 	xenevtchn_handle *xce = xce_of_val(xce_val);
 	xenevtchn_port_or_error_t rc;
 
 	caml_enter_blocking_section();
-	rc = xenevtchn_bind_interdomain(xce, Int_val(domid), Int_val(remote_port));
+	rc = xenevtchn_bind_interdomain(xce, Int_val(domid),
+					Int_val(remote_port));
 	caml_leave_blocking_section();
 
 	if (rc == -1)
 		caml_failwith("evtchn bind_interdomain failed");
-	port = Val_int(rc);
 
-	CAMLreturn(port);
+	CAMLreturn(Val_int(rc));
 }
 
-CAMLprim value stub_eventchn_bind_virq(value xce_val, value virq_type)
+CAMLprim value stub_eventchn_bind_virq(value xce_val, value virq)
 {
-	CAMLparam2(xce_val, virq_type);
-	CAMLlocal1(port);
+	CAMLparam2(xce_val, virq);
 	xenevtchn_handle *xce = xce_of_val(xce_val);
 	xenevtchn_port_or_error_t rc;
 
 	caml_enter_blocking_section();
-	rc = xenevtchn_bind_virq(xce, Int_val(virq_type));
+	rc = xenevtchn_bind_virq(xce, Int_val(virq));
 	caml_leave_blocking_section();
 
 	if (rc == -1)
 		caml_failwith("evtchn bind_virq failed");
-	port = Val_int(rc);
 
-	CAMLreturn(port);
+	CAMLreturn(Val_int(rc));
 }
 
 CAMLprim value stub_eventchn_unbind(value xce_val, value port)
@@ -183,35 +178,31 @@ CAMLprim value stub_eventchn_unbind(value xce_val, value port)
 CAMLprim value stub_eventchn_pending(value xce_val)
 {
 	CAMLparam1(xce_val);
-	CAMLlocal1(result);
 	xenevtchn_handle *xce = xce_of_val(xce_val);
-	xenevtchn_port_or_error_t port;
+	xenevtchn_port_or_error_t rc;
 
 	caml_enter_blocking_section();
-	port = xenevtchn_pending(xce);
+	rc = xenevtchn_pending(xce);
 	caml_leave_blocking_section();
 
-	if (port == -1)
+	if (rc == -1)
 		caml_failwith("evtchn pending failed");
-	result = Val_int(port);
 
-	CAMLreturn(result);
+	CAMLreturn(Val_int(rc));
 }
 
-CAMLprim value stub_eventchn_unmask(value xce_val, value _port)
+CAMLprim value stub_eventchn_unmask(value xce_val, value port)
 {
-	CAMLparam2(xce_val, _port);
+	CAMLparam2(xce_val, port);
 	xenevtchn_handle *xce = xce_of_val(xce_val);
-	evtchn_port_t port;
 	int rc;
 
-	port = Int_val(_port);
-
 	caml_enter_blocking_section();
-	rc = xenevtchn_unmask(xce, port);
+	rc = xenevtchn_unmask(xce, Int_val(port));
 	caml_leave_blocking_section();
 
-	if (rc)
+	if (rc == -1)
 		caml_failwith("evtchn unmask failed");
+
 	CAMLreturn(Val_unit);
 }
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Feb 08 02:46:55 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 08 Feb 2023 02:46:55 +0000
Received: from list by lists.xenproject.org with outflank-mailman.491510.760656 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pPaU3-0008DZ-KT; Wed, 08 Feb 2023 02:46:55 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 491510.760656; Wed, 08 Feb 2023 02:46:55 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pPaU3-0008DS-Hu; Wed, 08 Feb 2023 02:46:55 +0000
Received: by outflank-mailman (input) for mailman id 491510;
 Wed, 08 Feb 2023 02:46:53 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pPaU1-0008Cv-Nf
 for xen-changelog@lists.xenproject.org; Wed, 08 Feb 2023 02:46:53 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pPaU1-0003Zl-My
 for xen-changelog@lists.xenproject.org; Wed, 08 Feb 2023 02:46:53 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pPaU1-0000Ws-MM
 for xen-changelog@lists.xenproject.org; Wed, 08 Feb 2023 02:46:53 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=0sSFG20xRr9LBU2K5S0vj40psM++ChYlJ45dlNcFwls=; b=lWRIPD216fyhAedB20GC1dhZ8B
	kjBtf07QLrK13pPfq4JfGKMfrm3ZddH48kwdtnlQa0vlejAPH1/8Gz05ur7pURA1w5oA4a627uPlC
	uDvFbYEeydWFIAn3TE0OuEaYocNp1HdJ/RPYVaWfGwL/XDm01LPminDSidWjdsGzmxwg=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools/ocaml/xc: Fix binding for xc_domain_assign_device()
Message-Id: <E1pPaU1-0000Ws-MM@xenbits.xenproject.org>
Date: Wed, 08 Feb 2023 02:46:53 +0000

commit 4250683842104f02996428f93927a035c8e19266
Author:     Edwin Török <edwin.torok@cloud.com>
AuthorDate: Thu Jan 12 11:38:38 2023 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Mon Feb 6 10:22:12 2023 +0000

    tools/ocaml/xc: Fix binding for xc_domain_assign_device()
    
    The patch adding this binding was plain broken, and unreviewed.  It modified
    the C stub to add a 4th parameter without an equivalent adjustment in the
    Ocaml side of the bindings.
    
    In 64bit builds, this causes us to dereference whatever dead value is in %rcx
    when trying to interpret the rflags parameter.
    
    This has gone unnoticed because Xapi doesn't use this binding (it has its
    own), but unbreak the binding by passing RDM_RELAXED unconditionally for
    now (matching the libxl default behaviour).
    
    Fixes: 9b34056cb4 ("tools: extend xc_assign_device() to support rdm reservation policy")
    Signed-off-by: Edwin Török <edwin.torok@cloud.com>
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Christian Lindig <christian.lindig@citrix.com>
---
 tools/ocaml/libs/xc/xenctrl_stubs.c | 17 +++++------------
 1 file changed, 5 insertions(+), 12 deletions(-)

diff --git a/tools/ocaml/libs/xc/xenctrl_stubs.c b/tools/ocaml/libs/xc/xenctrl_stubs.c
index fd1f306f02..291663bb27 100644
--- a/tools/ocaml/libs/xc/xenctrl_stubs.c
+++ b/tools/ocaml/libs/xc/xenctrl_stubs.c
@@ -1245,17 +1245,12 @@ CAMLprim value stub_xc_domain_test_assign_device(value xch, value domid, value d
 	CAMLreturn(Val_bool(ret == 0));
 }
 
-static int domain_assign_device_rdm_flag_table[] = {
-    XEN_DOMCTL_DEV_RDM_RELAXED,
-};
-
-CAMLprim value stub_xc_domain_assign_device(value xch, value domid, value desc,
-                                            value rflag)
+CAMLprim value stub_xc_domain_assign_device(value xch, value domid, value desc)
 {
-	CAMLparam4(xch, domid, desc, rflag);
+	CAMLparam3(xch, domid, desc);
 	int ret;
 	int domain, bus, dev, func;
-	uint32_t sbdf, flag;
+	uint32_t sbdf;
 
 	domain = Int_val(Field(desc, 0));
 	bus = Int_val(Field(desc, 1));
@@ -1263,10 +1258,8 @@ CAMLprim value stub_xc_domain_assign_device(value xch, value domid, value desc,
 	func = Int_val(Field(desc, 3));
 	sbdf = encode_sbdf(domain, bus, dev, func);
 
-	ret = Int_val(Field(rflag, 0));
-	flag = domain_assign_device_rdm_flag_table[ret];
-
-	ret = xc_assign_device(_H(xch), _D(domid), sbdf, flag);
+	ret = xc_assign_device(_H(xch), _D(domid), sbdf,
+			       XEN_DOMCTL_DEV_RDM_RELAXED);
 
 	if (ret < 0)
 		failwith_xc(_H(xch));
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Feb 08 02:47:05 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 08 Feb 2023 02:47:05 +0000
Received: from list by lists.xenproject.org with outflank-mailman.491512.760660 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pPaUD-0008JU-MK; Wed, 08 Feb 2023 02:47:05 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 491512.760660; Wed, 08 Feb 2023 02:47:05 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pPaUD-0008JM-JQ; Wed, 08 Feb 2023 02:47:05 +0000
Received: by outflank-mailman (input) for mailman id 491512;
 Wed, 08 Feb 2023 02:47:03 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pPaUB-0008Iq-QU
 for xen-changelog@lists.xenproject.org; Wed, 08 Feb 2023 02:47:03 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pPaUB-0003a3-Pr
 for xen-changelog@lists.xenproject.org; Wed, 08 Feb 2023 02:47:03 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pPaUB-0000XW-P2
 for xen-changelog@lists.xenproject.org; Wed, 08 Feb 2023 02:47:03 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=immos91mm6QakiEJjdfWBa4Pi/m89kKq/2HxEfvcDR4=; b=j8/LhLf+hZc1VhTRXLpyW87goh
	vI34BukPRpYdGVk+QDDfxQ3wl2ykeTebHcf7EAG9sRTw6ebC4JHZ61Y3lJhQS/KihPm1gOqsD83g3
	k7sSdvvwn5fFGtBbMwYRW0w0uGjByI6psQXIAGbbTgkLgF3jhwiRTaEbE7ShDfTjkwBE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools/ocaml/xc: Don't reference Abstract_Tag objects with the GC lock released
Message-Id: <E1pPaUB-0000XW-P2@xenbits.xenproject.org>
Date: Wed, 08 Feb 2023 02:47:03 +0000

commit 9e7c74e6f9fd2e44df1212643b80af9032b45b07
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Tue Jan 31 17:19:30 2023 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Mon Feb 6 10:22:12 2023 +0000

    tools/ocaml/xc: Don't reference Abstract_Tag objects with the GC lock released
    
    The intf->{addr,len} references in the xc_map_foreign_range() call are unsafe.
    From the manual:
    
      https://ocaml.org/manual/intfc.html#ss:parallel-execution-long-running-c-code
    
    "After caml_release_runtime_system() was called and until
    caml_acquire_runtime_system() is called, the C code must not access any OCaml
    data, nor call any function of the run-time system, nor call back into OCaml
    code."
    
    More than what the manual says, the intf pointer is (potentially) invalidated
    by caml_enter_blocking_section() if another thread happens to perform garbage
    collection at just the right (wrong) moment.
    
    Rewrite the logic.  There's no need to stash data in the Ocaml object until
    the success path at the very end.
    
    Fixes: 8b7ce06a2d34 ("ocaml: Add XC bindings.")
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Christian Lindig <christian.lindig@citrix.com>
---
 tools/ocaml/libs/xc/xenctrl_stubs.c | 23 +++++++++++------------
 1 file changed, 11 insertions(+), 12 deletions(-)

diff --git a/tools/ocaml/libs/xc/xenctrl_stubs.c b/tools/ocaml/libs/xc/xenctrl_stubs.c
index 291663bb27..e5277f6f19 100644
--- a/tools/ocaml/libs/xc/xenctrl_stubs.c
+++ b/tools/ocaml/libs/xc/xenctrl_stubs.c
@@ -1028,26 +1028,25 @@ CAMLprim value stub_map_foreign_range(value xch, value dom,
 	CAMLparam4(xch, dom, size, mfn);
 	CAMLlocal1(result);
 	struct mmap_interface *intf;
-	uint32_t c_dom;
-	unsigned long c_mfn;
+	unsigned long c_mfn = Nativeint_val(mfn);
+	int len = Int_val(size);
+	void *ptr;
 
 	BUILD_BUG_ON((sizeof(struct mmap_interface) % sizeof(value)) != 0);
 	result = caml_alloc(Wsize_bsize(sizeof(struct mmap_interface)),
 			    Abstract_tag);
 
-	intf = (struct mmap_interface *) result;
-
-	intf->len = Int_val(size);
-
-	c_dom = _D(dom);
-	c_mfn = Nativeint_val(mfn);
 	caml_enter_blocking_section();
-	intf->addr = xc_map_foreign_range(_H(xch), c_dom,
-	                                  intf->len, PROT_READ|PROT_WRITE,
-	                                  c_mfn);
+	ptr = xc_map_foreign_range(_H(xch), _D(dom), len,
+				   PROT_READ|PROT_WRITE, c_mfn);
 	caml_leave_blocking_section();
-	if (!intf->addr)
+
+	if (!ptr)
 		caml_failwith("xc_map_foreign_range error");
+
+	intf = Data_abstract_val(result);
+	*intf = (struct mmap_interface){ ptr, len };
+
 	CAMLreturn(result);
 }
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Feb 08 02:47:15 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 08 Feb 2023 02:47:15 +0000
Received: from list by lists.xenproject.org with outflank-mailman.491514.760664 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pPaUN-0008Mb-Ok; Wed, 08 Feb 2023 02:47:15 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 491514.760664; Wed, 08 Feb 2023 02:47:15 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pPaUN-0008MQ-L7; Wed, 08 Feb 2023 02:47:15 +0000
Received: by outflank-mailman (input) for mailman id 491514;
 Wed, 08 Feb 2023 02:47:14 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pPaUL-0008M8-Ua
 for xen-changelog@lists.xenproject.org; Wed, 08 Feb 2023 02:47:13 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pPaUL-0003aE-T2
 for xen-changelog@lists.xenproject.org; Wed, 08 Feb 2023 02:47:13 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pPaUL-0000Y1-SA
 for xen-changelog@lists.xenproject.org; Wed, 08 Feb 2023 02:47:13 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=/ekrG43EAqB1nLiQ+oS5QuzrkMiFTp6SXVNwLz0f3R0=; b=5+LiD9n2F8moiUWJ8lebxNqlSW
	wT3gM+cWr+WFmrFpBE2Dixp6Vg3XBtgtR6Dm0VKFUyDpheL0H/7vnCF4dPuYtvzZpfrcpcf6U1Ko/
	ku8hDzeiGUiZ/5RzxdFdJRsjYDChsthp3KB2PryatzUpbP4TjTD9k6ltl4P8mKH70I/A=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools/ocaml/xc: Don't reference Custom objects with the GC lock released
Message-Id: <E1pPaUL-0000Y1-SA@xenbits.xenproject.org>
Date: Wed, 08 Feb 2023 02:47:13 +0000

commit 5fb7851ff2f5ef1de69c4c9598da09b110428c36
Author:     Edwin Török <edwin.torok@cloud.com>
AuthorDate: Thu Jan 26 16:44:05 2023 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Mon Feb 6 10:22:12 2023 +0000

    tools/ocaml/xc: Don't reference Custom objects with the GC lock released
    
    The modification to the _H() macro for Ocaml 5 support introduced a subtle
    bug.  From the manual:
    
      https://ocaml.org/manual/intfc.html#ss:parallel-execution-long-running-c-code
    
    "After caml_release_runtime_system() was called and until
    caml_acquire_runtime_system() is called, the C code must not access any OCaml
    data, nor call any function of the run-time system, nor call back into OCaml
    code."
    
    Previously, the value was a naked C pointer, so dereferencing it wasn't
    "accessing any Ocaml data", but the fix to avoid naked C pointers added a
    layer of indirection through an Ocaml Custom object, meaning that the common
    pattern of using _H() in a blocking section is unsafe.
    
    In order to fix:
    
     * Drop the _H() macro and replace it with a static inline xch_of_val().
     * Opencode the assignment into Data_custom_val() in the constructors.
     * Rename "value xch" parameters to "value xch_val" so we can consistently
       have "xc_interface *xch" on the stack, and obtain the pointer with the GC
       lock still held.
     * Drop the _D() macro while at it, because it's just pointless indirection.
    
    Fixes: 8b3c06a3e545 ("tools/ocaml/xenctrl: OCaml 5 support, fix use-after-free")
    Signed-off-by: Edwin Török <edwin.torok@cloud.com>
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Christian Lindig <christian.lindig@citrix.com>
---
 tools/ocaml/libs/xc/xenctrl_stubs.c | 454 ++++++++++++++++++++----------------
 1 file changed, 251 insertions(+), 203 deletions(-)

diff --git a/tools/ocaml/libs/xc/xenctrl_stubs.c b/tools/ocaml/libs/xc/xenctrl_stubs.c
index e5277f6f19..f9006c6623 100644
--- a/tools/ocaml/libs/xc/xenctrl_stubs.c
+++ b/tools/ocaml/libs/xc/xenctrl_stubs.c
@@ -37,9 +37,6 @@
 
 #include "mmap_stubs.h"
 
-#define _H(__h) (*((xc_interface **)Data_custom_val(__h)))
-#define _D(__d) ((uint32_t)Int_val(__d))
-
 #ifndef Val_none
 #define Val_none (Val_int(0))
 #endif
@@ -48,9 +45,18 @@
 #define Tag_some 0
 #endif
 
+static inline xc_interface *xch_of_val(value v)
+{
+	xc_interface *xch = *(xc_interface **)Data_custom_val(v);
+
+	return xch;
+}
+
 static void stub_xenctrl_finalize(value v)
 {
-	xc_interface_close(_H(v));
+	xc_interface *xch = xch_of_val(v);
+
+	xc_interface_close(xch);
 }
 
 static struct custom_operations xenctrl_ops = {
@@ -100,7 +106,7 @@ CAMLprim value stub_xc_interface_open(value unit)
 		failwith_xc(xch);
 
 	result = caml_alloc_custom(&xenctrl_ops, sizeof(xch), 0, 1);
-	_H(result) = xch;
+	*(xc_interface **)Data_custom_val(result) = xch;
 
 	CAMLreturn(result);
 }
@@ -187,10 +193,11 @@ static unsigned int ocaml_list_to_c_bitmap(value l)
 	return val;
 }
 
-CAMLprim value stub_xc_domain_create(value xch, value wanted_domid, value config)
+CAMLprim value stub_xc_domain_create(value xch_val, value wanted_domid, value config)
 {
-	CAMLparam3(xch, wanted_domid, config);
+	CAMLparam3(xch_val, wanted_domid, config);
 	CAMLlocal2(l, arch_domconfig);
+	xc_interface *xch = xch_of_val(xch_val);
 
 	/* Mnemonics for the named fields inside domctl_create_config */
 #define VAL_SSIDREF             Field(config, 0)
@@ -282,98 +289,104 @@ CAMLprim value stub_xc_domain_create(value xch, value wanted_domid, value config
 #undef VAL_SSIDREF
 
 	caml_enter_blocking_section();
-	result = xc_domain_create(_H(xch), &domid, &cfg);
+	result = xc_domain_create(xch, &domid, &cfg);
 	caml_leave_blocking_section();
 
 	if (result < 0)
-		failwith_xc(_H(xch));
+		failwith_xc(xch);
 
 	CAMLreturn(Val_int(domid));
 }
 
-CAMLprim value stub_xc_domain_max_vcpus(value xch, value domid,
+CAMLprim value stub_xc_domain_max_vcpus(value xch_val, value domid,
                                         value max_vcpus)
 {
-	CAMLparam3(xch, domid, max_vcpus);
+	CAMLparam3(xch_val, domid, max_vcpus);
+	xc_interface *xch = xch_of_val(xch_val);
 	int r;
 
-	r = xc_domain_max_vcpus(_H(xch), _D(domid), Int_val(max_vcpus));
+	r = xc_domain_max_vcpus(xch, Int_val(domid), Int_val(max_vcpus));
 	if (r)
-		failwith_xc(_H(xch));
+		failwith_xc(xch);
 
 	CAMLreturn(Val_unit);
 }
 
 
-value stub_xc_domain_sethandle(value xch, value domid, value handle)
+value stub_xc_domain_sethandle(value xch_val, value domid, value handle)
 {
-	CAMLparam3(xch, domid, handle);
+	CAMLparam3(xch_val, domid, handle);
+	xc_interface *xch = xch_of_val(xch_val);
 	xen_domain_handle_t h;
 	int i;
 
 	domain_handle_of_uuid_string(h, String_val(handle));
 
-	i = xc_domain_sethandle(_H(xch), _D(domid), h);
+	i = xc_domain_sethandle(xch, Int_val(domid), h);
 	if (i)
-		failwith_xc(_H(xch));
+		failwith_xc(xch);
 
 	CAMLreturn(Val_unit);
 }
 
-static value dom_op(value xch, value domid, int (*fn)(xc_interface *, uint32_t))
+static value dom_op(value xch_val, value domid,
+		    int (*fn)(xc_interface *, uint32_t))
 {
-	CAMLparam2(xch, domid);
+	CAMLparam2(xch_val, domid);
+	xc_interface *xch = xch_of_val(xch_val);
 	int result;
 
-	uint32_t c_domid = _D(domid);
+	uint32_t c_domid = Int_val(domid);
 
 	caml_enter_blocking_section();
-	result = fn(_H(xch), c_domid);
+	result = fn(xch, c_domid);
 	caml_leave_blocking_section();
         if (result)
-		failwith_xc(_H(xch));
+		failwith_xc(xch);
 	CAMLreturn(Val_unit);
 }
 
-CAMLprim value stub_xc_domain_pause(value xch, value domid)
+CAMLprim value stub_xc_domain_pause(value xch_val, value domid)
 {
-	return dom_op(xch, domid, xc_domain_pause);
+	return dom_op(xch_val, domid, xc_domain_pause);
 }
 
 
-CAMLprim value stub_xc_domain_unpause(value xch, value domid)
+CAMLprim value stub_xc_domain_unpause(value xch_val, value domid)
 {
-	return dom_op(xch, domid, xc_domain_unpause);
+	return dom_op(xch_val, domid, xc_domain_unpause);
 }
 
-CAMLprim value stub_xc_domain_destroy(value xch, value domid)
+CAMLprim value stub_xc_domain_destroy(value xch_val, value domid)
 {
-	return dom_op(xch, domid, xc_domain_destroy);
+	return dom_op(xch_val, domid, xc_domain_destroy);
 }
 
-CAMLprim value stub_xc_domain_resume_fast(value xch, value domid)
+CAMLprim value stub_xc_domain_resume_fast(value xch_val, value domid)
 {
-	CAMLparam2(xch, domid);
+	CAMLparam2(xch_val, domid);
+	xc_interface *xch = xch_of_val(xch_val);
 	int result;
 
-	uint32_t c_domid = _D(domid);
+	uint32_t c_domid = Int_val(domid);
 
 	caml_enter_blocking_section();
-	result = xc_domain_resume(_H(xch), c_domid, 1);
+	result = xc_domain_resume(xch, c_domid, 1);
 	caml_leave_blocking_section();
         if (result)
-		failwith_xc(_H(xch));
+		failwith_xc(xch);
 	CAMLreturn(Val_unit);
 }
 
-CAMLprim value stub_xc_domain_shutdown(value xch, value domid, value reason)
+CAMLprim value stub_xc_domain_shutdown(value xch_val, value domid, value reason)
 {
-	CAMLparam3(xch, domid, reason);
+	CAMLparam3(xch_val, domid, reason);
+	xc_interface *xch = xch_of_val(xch_val);
 	int ret;
 
-	ret = xc_domain_shutdown(_H(xch), _D(domid), Int_val(reason));
+	ret = xc_domain_shutdown(xch, Int_val(domid), Int_val(reason));
 	if (ret < 0)
-		failwith_xc(_H(xch));
+		failwith_xc(xch);
 
 	CAMLreturn(Val_unit);
 }
@@ -433,10 +446,11 @@ static value alloc_domaininfo(xc_domaininfo_t * info)
 	CAMLreturn(result);
 }
 
-CAMLprim value stub_xc_domain_getinfolist(value xch, value first_domain, value nb)
+CAMLprim value stub_xc_domain_getinfolist(value xch_val, value first_domain, value nb)
 {
-	CAMLparam3(xch, first_domain, nb);
+	CAMLparam3(xch_val, first_domain, nb);
 	CAMLlocal2(result, temp);
+	xc_interface *xch = xch_of_val(xch_val);
 	xc_domaininfo_t * info;
 	int i, ret, toalloc, retval;
 	unsigned int c_max_domains;
@@ -450,16 +464,16 @@ CAMLprim value stub_xc_domain_getinfolist(value xch, value first_domain, value n
 
 	result = temp = Val_emptylist;
 
-	c_first_domain = _D(first_domain);
+	c_first_domain = Int_val(first_domain);
 	c_max_domains = Int_val(nb);
 	caml_enter_blocking_section();
-	retval = xc_domain_getinfolist(_H(xch), c_first_domain,
+	retval = xc_domain_getinfolist(xch, c_first_domain,
 				       c_max_domains, info);
 	caml_leave_blocking_section();
 
 	if (retval < 0) {
 		free(info);
-		failwith_xc(_H(xch));
+		failwith_xc(xch);
 	}
 	for (i = 0; i < retval; i++) {
 		result = caml_alloc_small(2, Tag_cons);
@@ -474,38 +488,39 @@ CAMLprim value stub_xc_domain_getinfolist(value xch, value first_domain, value n
 	CAMLreturn(result);
 }
 
-CAMLprim value stub_xc_domain_getinfo(value xch, value domid)
+CAMLprim value stub_xc_domain_getinfo(value xch_val, value domid)
 {
-	CAMLparam2(xch, domid);
+	CAMLparam2(xch_val, domid);
 	CAMLlocal1(result);
+	xc_interface *xch = xch_of_val(xch_val);
 	xc_domaininfo_t info;
 	int ret;
 
-	ret = xc_domain_getinfolist(_H(xch), _D(domid), 1, &info);
+	ret = xc_domain_getinfolist(xch, Int_val(domid), 1, &info);
 	if (ret != 1)
-		failwith_xc(_H(xch));
-	if (info.domain != _D(domid))
-		failwith_xc(_H(xch));
+		failwith_xc(xch);
+	if (info.domain != Int_val(domid))
+		failwith_xc(xch);
 
 	result = alloc_domaininfo(&info);
 	CAMLreturn(result);
 }
 
-CAMLprim value stub_xc_vcpu_getinfo(value xch, value domid, value vcpu)
+CAMLprim value stub_xc_vcpu_getinfo(value xch_val, value domid, value vcpu)
 {
-	CAMLparam3(xch, domid, vcpu);
+	CAMLparam3(xch_val, domid, vcpu);
 	CAMLlocal1(result);
+	xc_interface *xch = xch_of_val(xch_val);
 	xc_vcpuinfo_t info;
 	int retval;
 
-	uint32_t c_domid = _D(domid);
+	uint32_t c_domid = Int_val(domid);
 	uint32_t c_vcpu = Int_val(vcpu);
 	caml_enter_blocking_section();
-	retval = xc_vcpu_getinfo(_H(xch), c_domid,
-	                         c_vcpu, &info);
+	retval = xc_vcpu_getinfo(xch, c_domid, c_vcpu, &info);
 	caml_leave_blocking_section();
 	if (retval < 0)
-		failwith_xc(_H(xch));
+		failwith_xc(xch);
 
 	result = caml_alloc_tuple(5);
 	Store_field(result, 0, Val_bool(info.online));
@@ -517,17 +532,18 @@ CAMLprim value stub_xc_vcpu_getinfo(value xch, value domid, value vcpu)
 	CAMLreturn(result);
 }
 
-CAMLprim value stub_xc_vcpu_context_get(value xch, value domid,
+CAMLprim value stub_xc_vcpu_context_get(value xch_val, value domid,
                                         value cpu)
 {
-	CAMLparam3(xch, domid, cpu);
+	CAMLparam3(xch_val, domid, cpu);
+	xc_interface *xch = xch_of_val(xch_val);
 	CAMLlocal1(context);
 	int ret;
 	vcpu_guest_context_any_t ctxt;
 
-	ret = xc_vcpu_getcontext(_H(xch), _D(domid), Int_val(cpu), &ctxt);
+	ret = xc_vcpu_getcontext(xch, Int_val(domid), Int_val(cpu), &ctxt);
 	if ( ret < 0 )
-		failwith_xc(_H(xch));
+		failwith_xc(xch);
 
 	context = caml_alloc_string(sizeof(ctxt));
 	memcpy((char *) String_val(context), &ctxt.c, sizeof(ctxt.c));
@@ -535,10 +551,10 @@ CAMLprim value stub_xc_vcpu_context_get(value xch, value domid,
 	CAMLreturn(context);
 }
 
-static int get_cpumap_len(value xch, value cpumap)
+static int get_cpumap_len(xc_interface *xch, value cpumap)
 {
 	int ml_len = Wosize_val(cpumap);
-	int xc_len = xc_get_max_cpus(_H(xch));
+	int xc_len = xc_get_max_cpus(xch);
 
 	if (ml_len < xc_len)
 		return ml_len;
@@ -546,56 +562,58 @@ static int get_cpumap_len(value xch, value cpumap)
 		return xc_len;
 }
 
-CAMLprim value stub_xc_vcpu_setaffinity(value xch, value domid,
+CAMLprim value stub_xc_vcpu_setaffinity(value xch_val, value domid,
                                         value vcpu, value cpumap)
 {
-	CAMLparam4(xch, domid, vcpu, cpumap);
+	CAMLparam4(xch_val, domid, vcpu, cpumap);
+	xc_interface *xch = xch_of_val(xch_val);
 	int i, len = get_cpumap_len(xch, cpumap);
 	xc_cpumap_t c_cpumap;
 	int retval;
 
-	c_cpumap = xc_cpumap_alloc(_H(xch));
+	c_cpumap = xc_cpumap_alloc(xch);
 	if (c_cpumap == NULL)
-		failwith_xc(_H(xch));
+		failwith_xc(xch);
 
 	for (i=0; i<len; i++) {
 		if (Bool_val(Field(cpumap, i)))
 			c_cpumap[i/8] |= 1 << (i&7);
 	}
-	retval = xc_vcpu_setaffinity(_H(xch), _D(domid),
+	retval = xc_vcpu_setaffinity(xch, Int_val(domid),
 				     Int_val(vcpu),
 				     c_cpumap, NULL,
 				     XEN_VCPUAFFINITY_HARD);
 	free(c_cpumap);
 
 	if (retval < 0)
-		failwith_xc(_H(xch));
+		failwith_xc(xch);
 	CAMLreturn(Val_unit);
 }
 
-CAMLprim value stub_xc_vcpu_getaffinity(value xch, value domid,
+CAMLprim value stub_xc_vcpu_getaffinity(value xch_val, value domid,
                                         value vcpu)
 {
-	CAMLparam3(xch, domid, vcpu);
+	CAMLparam3(xch_val, domid, vcpu);
 	CAMLlocal1(ret);
+	xc_interface *xch = xch_of_val(xch_val);
 	xc_cpumap_t c_cpumap;
-	int i, len = xc_get_max_cpus(_H(xch));
+	int i, len = xc_get_max_cpus(xch);
 	int retval;
 
 	if (len < 1)
-		failwith_xc(_H(xch));
+		failwith_xc(xch);
 
-	c_cpumap = xc_cpumap_alloc(_H(xch));
+	c_cpumap = xc_cpumap_alloc(xch);
 	if (c_cpumap == NULL)
-		failwith_xc(_H(xch));
+		failwith_xc(xch);
 
-	retval = xc_vcpu_getaffinity(_H(xch), _D(domid),
+	retval = xc_vcpu_getaffinity(xch, Int_val(domid),
 				     Int_val(vcpu),
 				     c_cpumap, NULL,
 				     XEN_VCPUAFFINITY_HARD);
 	if (retval < 0) {
 		free(c_cpumap);
-		failwith_xc(_H(xch));
+		failwith_xc(xch);
 	}
 
 	ret = caml_alloc(len, 0);
@@ -612,63 +630,68 @@ CAMLprim value stub_xc_vcpu_getaffinity(value xch, value domid,
 	CAMLreturn(ret);
 }
 
-CAMLprim value stub_xc_sched_id(value xch)
+CAMLprim value stub_xc_sched_id(value xch_val)
 {
-	CAMLparam1(xch);
+	CAMLparam1(xch_val);
+	xc_interface *xch = xch_of_val(xch_val);
 	int sched_id;
 
-	if (xc_sched_id(_H(xch), &sched_id))
-		failwith_xc(_H(xch));
+	if (xc_sched_id(xch, &sched_id))
+		failwith_xc(xch);
+
 	CAMLreturn(Val_int(sched_id));
 }
 
-CAMLprim value stub_xc_evtchn_alloc_unbound(value xch,
+CAMLprim value stub_xc_evtchn_alloc_unbound(value xch_val,
                                             value local_domid,
                                             value remote_domid)
 {
-	CAMLparam3(xch, local_domid, remote_domid);
+	CAMLparam3(xch_val, local_domid, remote_domid);
+	xc_interface *xch = xch_of_val(xch_val);
 	int result;
 
-	uint32_t c_local_domid = _D(local_domid);
-	uint32_t c_remote_domid = _D(remote_domid);
+	uint32_t c_local_domid = Int_val(local_domid);
+	uint32_t c_remote_domid = Int_val(remote_domid);
 
 	caml_enter_blocking_section();
-	result = xc_evtchn_alloc_unbound(_H(xch), c_local_domid,
+	result = xc_evtchn_alloc_unbound(xch, c_local_domid,
 	                                     c_remote_domid);
 	caml_leave_blocking_section();
 
 	if (result < 0)
-		failwith_xc(_H(xch));
+		failwith_xc(xch);
 	CAMLreturn(Val_int(result));
 }
 
-CAMLprim value stub_xc_evtchn_reset(value xch, value domid)
+CAMLprim value stub_xc_evtchn_reset(value xch_val, value domid)
 {
-	CAMLparam2(xch, domid);
+	CAMLparam2(xch_val, domid);
+	xc_interface *xch = xch_of_val(xch_val);
 	int r;
 
-	r = xc_evtchn_reset(_H(xch), _D(domid));
+	r = xc_evtchn_reset(xch, Int_val(domid));
 	if (r < 0)
-		failwith_xc(_H(xch));
+		failwith_xc(xch);
 	CAMLreturn(Val_unit);
 }
 
-CAMLprim value stub_xc_evtchn_status(value xch, value domid, value port)
+CAMLprim value stub_xc_evtchn_status(value xch_val, value domid, value port)
 {
-	CAMLparam3(xch, domid, port);
+	CAMLparam3(xch_val, domid, port);
 	CAMLlocal4(result, result_status, stat, interdomain);
+	xc_interface *xch = xch_of_val(xch_val);
 	xc_evtchn_status_t status = {
-		.dom = _D(domid),
+		.dom = Int_val(domid),
 		.port = Int_val(port),
 	};
 	int rc;
 
 	caml_enter_blocking_section();
-	rc = xc_evtchn_status(_H(xch), &status);
+	rc = xc_evtchn_status(xch, &status);
 	caml_leave_blocking_section();
 
 	if ( rc < 0 )
-		failwith_xc(_H(xch));
+		failwith_xc(xch);
 
 	switch ( status.status )
 	{
@@ -716,7 +739,7 @@ CAMLprim value stub_xc_evtchn_status(value xch, value domid, value port)
 	CAMLreturn(result);
 }
 
-CAMLprim value stub_xc_readconsolering(value xch)
+CAMLprim value stub_xc_readconsolering(value xch_val)
 {
 	/* Safe to use outside of blocking sections because of Ocaml GC lock. */
 	static unsigned int conring_size = 16384 + 1;
@@ -725,8 +748,9 @@ CAMLprim value stub_xc_readconsolering(value xch)
 	char *str = NULL, *ptr;
 	int ret;
 
-	CAMLparam1(xch);
+	CAMLparam1(xch_val);
 	CAMLlocal1(ring);
+	xc_interface *xch = xch_of_val(xch_val);
 
 	str = malloc(size);
 	if (!str)
@@ -734,12 +758,12 @@ CAMLprim value stub_xc_readconsolering(value xch)
 
 	/* Hopefully our conring_size guess is sufficient */
 	caml_enter_blocking_section();
-	ret = xc_readconsolering(_H(xch), str, &count, 0, 0, &index);
+	ret = xc_readconsolering(xch, str, &count, 0, 0, &index);
 	caml_leave_blocking_section();
 
 	if (ret < 0) {
 		free(str);
-		failwith_xc(_H(xch));
+		failwith_xc(xch);
 	}
 
 	while (count == size && ret >= 0) {
@@ -755,7 +779,7 @@ CAMLprim value stub_xc_readconsolering(value xch)
 		count = size - count;
 
 		caml_enter_blocking_section();
-		ret = xc_readconsolering(_H(xch), str, &count, 0, 1, &index);
+		ret = xc_readconsolering(xch, str, &count, 0, 1, &index);
 		caml_leave_blocking_section();
 
 		count += str - ptr;
@@ -777,30 +801,32 @@ CAMLprim value stub_xc_readconsolering(value xch)
 	CAMLreturn(ring);
 }
 
-CAMLprim value stub_xc_send_debug_keys(value xch, value keys)
+CAMLprim value stub_xc_send_debug_keys(value xch_val, value keys)
 {
-	CAMLparam2(xch, keys);
+	CAMLparam2(xch_val, keys);
+	xc_interface *xch = xch_of_val(xch_val);
 	int r;
 
-	r = xc_send_debug_keys(_H(xch), String_val(keys));
+	r = xc_send_debug_keys(xch, String_val(keys));
 	if (r)
-		failwith_xc(_H(xch));
+		failwith_xc(xch);
 	CAMLreturn(Val_unit);
 }
 
-CAMLprim value stub_xc_physinfo(value xch)
+CAMLprim value stub_xc_physinfo(value xch_val)
 {
-	CAMLparam1(xch);
+	CAMLparam1(xch_val);
 	CAMLlocal4(physinfo, cap_list, arch_cap_flags, arch_cap_list);
+	xc_interface *xch = xch_of_val(xch_val);
 	xc_physinfo_t c_physinfo;
 	int r, arch_cap_flags_tag;
 
 	caml_enter_blocking_section();
-	r = xc_physinfo(_H(xch), &c_physinfo);
+	r = xc_physinfo(xch, &c_physinfo);
 	caml_leave_blocking_section();
 
 	if (r)
-		failwith_xc(_H(xch));
+		failwith_xc(xch);
 
 	/*
 	 * capabilities: physinfo_cap_flag list;
@@ -837,10 +863,11 @@ CAMLprim value stub_xc_physinfo(value xch)
 	CAMLreturn(physinfo);
 }
 
-CAMLprim value stub_xc_pcpu_info(value xch, value nr_cpus)
+CAMLprim value stub_xc_pcpu_info(value xch_val, value nr_cpus)
 {
-	CAMLparam2(xch, nr_cpus);
+	CAMLparam2(xch_val, nr_cpus);
 	CAMLlocal2(pcpus, v);
+	xc_interface *xch = xch_of_val(xch_val);
 	xc_cpuinfo_t *info;
 	int r, size;
 
@@ -852,12 +879,12 @@ CAMLprim value stub_xc_pcpu_info(value xch, value nr_cpus)
 		caml_raise_out_of_memory();
 
 	caml_enter_blocking_section();
-	r = xc_getcpuinfo(_H(xch), Int_val(nr_cpus), info, &size);
+	r = xc_getcpuinfo(xch, Int_val(nr_cpus), info, &size);
 	caml_leave_blocking_section();
 
 	if (r) {
 		free(info);
-		failwith_xc(_H(xch));
+		failwith_xc(xch);
 	}
 
 	if (size > 0) {
@@ -873,79 +900,82 @@ CAMLprim value stub_xc_pcpu_info(value xch, value nr_cpus)
 	CAMLreturn(pcpus);
 }
 
-CAMLprim value stub_xc_domain_setmaxmem(value xch, value domid,
+CAMLprim value stub_xc_domain_setmaxmem(value xch_val, value domid,
                                         value max_memkb)
 {
-	CAMLparam3(xch, domid, max_memkb);
+	CAMLparam3(xch_val, domid, max_memkb);
+	xc_interface *xch = xch_of_val(xch_val);
 	int retval;
 
-	uint32_t c_domid = _D(domid);
+	uint32_t c_domid = Int_val(domid);
 	unsigned int c_max_memkb = Int64_val(max_memkb);
 	caml_enter_blocking_section();
-	retval = xc_domain_setmaxmem(_H(xch), c_domid,
-	                                 c_max_memkb);
+	retval = xc_domain_setmaxmem(xch, c_domid, c_max_memkb);
 	caml_leave_blocking_section();
 	if (retval)
-		failwith_xc(_H(xch));
+		failwith_xc(xch);
 	CAMLreturn(Val_unit);
 }
 
-CAMLprim value stub_xc_domain_set_memmap_limit(value xch, value domid,
+CAMLprim value stub_xc_domain_set_memmap_limit(value xch_val, value domid,
                                                value map_limitkb)
 {
-	CAMLparam3(xch, domid, map_limitkb);
+	CAMLparam3(xch_val, domid, map_limitkb);
+	xc_interface *xch = xch_of_val(xch_val);
 	unsigned long v;
 	int retval;
 
 	v = Int64_val(map_limitkb);
-	retval = xc_domain_set_memmap_limit(_H(xch), _D(domid), v);
+	retval = xc_domain_set_memmap_limit(xch, Int_val(domid), v);
 	if (retval)
-		failwith_xc(_H(xch));
+		failwith_xc(xch);
 
 	CAMLreturn(Val_unit);
 }
 
-CAMLprim value stub_xc_domain_memory_increase_reservation(value xch,
+CAMLprim value stub_xc_domain_memory_increase_reservation(value xch_val,
                                                           value domid,
                                                           value mem_kb)
 {
-	CAMLparam3(xch, domid, mem_kb);
+	CAMLparam3(xch_val, domid, mem_kb);
+	xc_interface *xch = xch_of_val(xch_val);
 	int retval;
 
 	unsigned long nr_extents = ((unsigned long)(Int64_val(mem_kb))) >> (XC_PAGE_SHIFT - 10);
 
-	uint32_t c_domid = _D(domid);
+	uint32_t c_domid = Int_val(domid);
 	caml_enter_blocking_section();
-	retval = xc_domain_increase_reservation_exact(_H(xch), c_domid,
+	retval = xc_domain_increase_reservation_exact(xch, c_domid,
 							  nr_extents, 0, 0, NULL);
 	caml_leave_blocking_section();
 
 	if (retval)
-		failwith_xc(_H(xch));
+		failwith_xc(xch);
 	CAMLreturn(Val_unit);
 }
 
-CAMLprim value stub_xc_version_version(value xch)
+CAMLprim value stub_xc_version_version(value xch_val)
 {
-	CAMLparam1(xch);
+	CAMLparam1(xch_val);
 	CAMLlocal1(result);
+	xc_interface *xch = xch_of_val(xch_val);
 	xen_extraversion_t extra;
 	long packed;
 	int retval;
 
 	caml_enter_blocking_section();
-	packed = xc_version(_H(xch), XENVER_version, NULL);
+	packed = xc_version(xch, XENVER_version, NULL);
 	caml_leave_blocking_section();
 
 	if (packed < 0)
-		failwith_xc(_H(xch));
+		failwith_xc(xch);
 
 	caml_enter_blocking_section();
-	retval = xc_version(_H(xch), XENVER_extraversion, &extra);
+	retval = xc_version(xch, XENVER_extraversion, &extra);
 	caml_leave_blocking_section();
 
 	if (retval)
-		failwith_xc(_H(xch));
+		failwith_xc(xch);
 
 	result = caml_alloc_tuple(3);
 
@@ -957,19 +987,20 @@ CAMLprim value stub_xc_version_version(value xch)
 }
 
 
-CAMLprim value stub_xc_version_compile_info(value xch)
+CAMLprim value stub_xc_version_compile_info(value xch_val)
 {
-	CAMLparam1(xch);
+	CAMLparam1(xch_val);
 	CAMLlocal1(result);
+	xc_interface *xch = xch_of_val(xch_val);
 	xen_compile_info_t ci;
 	int retval;
 
 	caml_enter_blocking_section();
-	retval = xc_version(_H(xch), XENVER_compile_info, &ci);
+	retval = xc_version(xch, XENVER_compile_info, &ci);
 	caml_leave_blocking_section();
 
 	if (retval)
-		failwith_xc(_H(xch));
+		failwith_xc(xch);
 
 	result = caml_alloc_tuple(4);
 
@@ -982,35 +1013,36 @@ CAMLprim value stub_xc_version_compile_info(value xch)
 }
 
 
-static value xc_version_single_string(value xch, int code, void *info)
+static value xc_version_single_string(value xch_val, int code, void *info)
 {
-	CAMLparam1(xch);
+	CAMLparam1(xch_val);
+	xc_interface *xch = xch_of_val(xch_val);
 	int retval;
 
 	caml_enter_blocking_section();
-	retval = xc_version(_H(xch), code, info);
+	retval = xc_version(xch, code, info);
 	caml_leave_blocking_section();
 
 	if (retval)
-		failwith_xc(_H(xch));
+		failwith_xc(xch);
 
 	CAMLreturn(caml_copy_string((char *)info));
 }
 
 
-CAMLprim value stub_xc_version_changeset(value xch)
+CAMLprim value stub_xc_version_changeset(value xch_val)
 {
 	xen_changeset_info_t ci;
 
-	return xc_version_single_string(xch, XENVER_changeset, &ci);
+	return xc_version_single_string(xch_val, XENVER_changeset, &ci);
 }
 
 
-CAMLprim value stub_xc_version_capabilities(value xch)
+CAMLprim value stub_xc_version_capabilities(value xch_val)
 {
 	xen_capabilities_info_t ci;
 
-	return xc_version_single_string(xch, XENVER_capabilities, &ci);
+	return xc_version_single_string(xch_val, XENVER_capabilities, &ci);
 }
 
 
@@ -1022,11 +1054,12 @@ CAMLprim value stub_pages_to_kib(value pages)
 }
 
 
-CAMLprim value stub_map_foreign_range(value xch, value dom,
+CAMLprim value stub_map_foreign_range(value xch_val, value dom,
                                       value size, value mfn)
 {
-	CAMLparam4(xch, dom, size, mfn);
+	CAMLparam4(xch_val, dom, size, mfn);
 	CAMLlocal1(result);
+	xc_interface *xch = xch_of_val(xch_val);
 	struct mmap_interface *intf;
 	unsigned long c_mfn = Nativeint_val(mfn);
 	int len = Int_val(size);
@@ -1037,7 +1070,7 @@ CAMLprim value stub_map_foreign_range(value xch, value dom,
 			    Abstract_tag);
 
 	caml_enter_blocking_section();
-	ptr = xc_map_foreign_range(_H(xch), _D(dom), len,
+	ptr = xc_map_foreign_range(xch, Int_val(dom), len,
 				   PROT_READ|PROT_WRITE, c_mfn);
 	caml_leave_blocking_section();
 
@@ -1050,18 +1083,19 @@ CAMLprim value stub_map_foreign_range(value xch, value dom,
 	CAMLreturn(result);
 }
 
-CAMLprim value stub_sched_credit_domain_get(value xch, value domid)
+CAMLprim value stub_sched_credit_domain_get(value xch_val, value domid)
 {
-	CAMLparam2(xch, domid);
+	CAMLparam2(xch_val, domid);
 	CAMLlocal1(sdom);
+	xc_interface *xch = xch_of_val(xch_val);
 	struct xen_domctl_sched_credit c_sdom;
 	int ret;
 
 	caml_enter_blocking_section();
-	ret = xc_sched_credit_domain_get(_H(xch), _D(domid), &c_sdom);
+	ret = xc_sched_credit_domain_get(xch, Int_val(domid), &c_sdom);
 	caml_leave_blocking_section();
 	if (ret != 0)
-		failwith_xc(_H(xch));
+		failwith_xc(xch);
 
 	sdom = caml_alloc_tuple(2);
 	Store_field(sdom, 0, Val_int(c_sdom.weight));
@@ -1070,67 +1104,71 @@ CAMLprim value stub_sched_credit_domain_get(value xch, value domid)
 	CAMLreturn(sdom);
 }
 
-CAMLprim value stub_sched_credit_domain_set(value xch, value domid,
+CAMLprim value stub_sched_credit_domain_set(value xch_val, value domid,
                                             value sdom)
 {
-	CAMLparam3(xch, domid, sdom);
+	CAMLparam3(xch_val, domid, sdom);
+	xc_interface *xch = xch_of_val(xch_val);
 	struct xen_domctl_sched_credit c_sdom;
 	int ret;
 
 	c_sdom.weight = Int_val(Field(sdom, 0));
 	c_sdom.cap = Int_val(Field(sdom, 1));
 	caml_enter_blocking_section();
-	ret = xc_sched_credit_domain_set(_H(xch), _D(domid), &c_sdom);
+	ret = xc_sched_credit_domain_set(xch, Int_val(domid), &c_sdom);
 	caml_leave_blocking_section();
 	if (ret != 0)
-		failwith_xc(_H(xch));
+		failwith_xc(xch);
 
 	CAMLreturn(Val_unit);
 }
 
-CAMLprim value stub_shadow_allocation_get(value xch, value domid)
+CAMLprim value stub_shadow_allocation_get(value xch_val, value domid)
 {
-	CAMLparam2(xch, domid);
+	CAMLparam2(xch_val, domid);
 	CAMLlocal1(mb);
+	xc_interface *xch = xch_of_val(xch_val);
 	unsigned int c_mb;
 	int ret;
 
 	caml_enter_blocking_section();
-	ret = xc_shadow_control(_H(xch), _D(domid),
+	ret = xc_shadow_control(xch, Int_val(domid),
 				XEN_DOMCTL_SHADOW_OP_GET_ALLOCATION,
 				&c_mb, 0);
 	caml_leave_blocking_section();
 	if (ret != 0)
-		failwith_xc(_H(xch));
+		failwith_xc(xch);
 
 	mb = Val_int(c_mb);
 	CAMLreturn(mb);
 }
 
-CAMLprim value stub_shadow_allocation_set(value xch, value domid,
+CAMLprim value stub_shadow_allocation_set(value xch_val, value domid,
 					  value mb)
 {
-	CAMLparam3(xch, domid, mb);
+	CAMLparam3(xch_val, domid, mb);
+	xc_interface *xch = xch_of_val(xch_val);
 	unsigned int c_mb;
 	int ret;
 
 	c_mb = Int_val(mb);
 	caml_enter_blocking_section();
-	ret = xc_shadow_control(_H(xch), _D(domid),
+	ret = xc_shadow_control(xch, Int_val(domid),
 				XEN_DOMCTL_SHADOW_OP_SET_ALLOCATION,
 				&c_mb, 0);
 	caml_leave_blocking_section();
 	if (ret != 0)
-		failwith_xc(_H(xch));
+		failwith_xc(xch);
 
 	CAMLreturn(Val_unit);
 }
 
-CAMLprim value stub_xc_domain_ioport_permission(value xch, value domid,
+CAMLprim value stub_xc_domain_ioport_permission(value xch_val, value domid,
 					       value start_port, value nr_ports,
 					       value allow)
 {
-	CAMLparam5(xch, domid, start_port, nr_ports, allow);
+	CAMLparam5(xch_val, domid, start_port, nr_ports, allow);
+	xc_interface *xch = xch_of_val(xch_val);
 	uint32_t c_start_port, c_nr_ports;
 	uint8_t c_allow;
 	int ret;
@@ -1139,19 +1177,20 @@ CAMLprim value stub_xc_domain_ioport_permission(value xch, value domid,
 	c_nr_ports = Int_val(nr_ports);
 	c_allow = Bool_val(allow);
 
-	ret = xc_domain_ioport_permission(_H(xch), _D(domid),
+	ret = xc_domain_ioport_permission(xch, Int_val(domid),
 					 c_start_port, c_nr_ports, c_allow);
 	if (ret < 0)
-		failwith_xc(_H(xch));
+		failwith_xc(xch);
 
 	CAMLreturn(Val_unit);
 }
 
-CAMLprim value stub_xc_domain_iomem_permission(value xch, value domid,
+CAMLprim value stub_xc_domain_iomem_permission(value xch_val, value domid,
 					       value start_pfn, value nr_pfns,
 					       value allow)
 {
-	CAMLparam5(xch, domid, start_pfn, nr_pfns, allow);
+	CAMLparam5(xch_val, domid, start_pfn, nr_pfns, allow);
+	xc_interface *xch = xch_of_val(xch_val);
 	unsigned long c_start_pfn, c_nr_pfns;
 	uint8_t c_allow;
 	int ret;
@@ -1160,18 +1199,19 @@ CAMLprim value stub_xc_domain_iomem_permission(value xch, value domid,
 	c_nr_pfns = Nativeint_val(nr_pfns);
 	c_allow = Bool_val(allow);
 
-	ret = xc_domain_iomem_permission(_H(xch), _D(domid),
+	ret = xc_domain_iomem_permission(xch, Int_val(domid),
 					 c_start_pfn, c_nr_pfns, c_allow);
 	if (ret < 0)
-		failwith_xc(_H(xch));
+		failwith_xc(xch);
 
 	CAMLreturn(Val_unit);
 }
 
-CAMLprim value stub_xc_domain_irq_permission(value xch, value domid,
+CAMLprim value stub_xc_domain_irq_permission(value xch_val, value domid,
 					     value pirq, value allow)
 {
-	CAMLparam4(xch, domid, pirq, allow);
+	CAMLparam4(xch_val, domid, pirq, allow);
+	xc_interface *xch = xch_of_val(xch_val);
 	uint32_t c_pirq;
 	bool c_allow;
 	int ret;
@@ -1179,41 +1219,44 @@ CAMLprim value stub_xc_domain_irq_permission(value xch, value domid,
 	c_pirq = Int_val(pirq);
 	c_allow = Bool_val(allow);
 
-	ret = xc_domain_irq_permission(_H(xch), _D(domid),
+	ret = xc_domain_irq_permission(xch, Int_val(domid),
 				       c_pirq, c_allow);
 	if (ret < 0)
-		failwith_xc(_H(xch));
+		failwith_xc(xch);
 
 	CAMLreturn(Val_unit);
 }
 
-CAMLprim value stub_xc_hvm_param_get(value xch, value domid, value param)
+CAMLprim value stub_xc_hvm_param_get(value xch_val, value domid, value param)
 {
-	CAMLparam3(xch, domid, param);
+	CAMLparam3(xch_val, domid, param);
+	xc_interface *xch = xch_of_val(xch_val);
 	uint64_t val;
 	int ret;
 
 	caml_enter_blocking_section();
-	ret = xc_hvm_param_get(_H(xch), _D(domid), Int_val(param), &val);
+	ret = xc_hvm_param_get(xch, Int_val(domid), Int_val(param), &val);
 	caml_leave_blocking_section();
 
 	if ( ret )
-		failwith_xc(_H(xch));
+		failwith_xc(xch);
 
 	CAMLreturn(caml_copy_int64(val));
 }
 
-CAMLprim value stub_xc_hvm_param_set(value xch, value domid, value param, value val)
+CAMLprim value stub_xc_hvm_param_set(value xch_val, value domid, value param, value val)
 {
-	CAMLparam4(xch, domid, param, val);
+	CAMLparam4(xch_val, domid, param, val);
+	xc_interface *xch = xch_of_val(xch_val);
+	uint64_t val64 = Int64_val(val);
 	int ret;
 
 	caml_enter_blocking_section();
-	ret = xc_hvm_param_set(_H(xch), _D(domid), Int_val(param), Int64_val(val));
+	ret = xc_hvm_param_set(xch, Int_val(domid), Int_val(param), val64);
 	caml_leave_blocking_section();
 
 	if ( ret )
-		failwith_xc(_H(xch));
+		failwith_xc(xch);
 
 	CAMLreturn(Val_unit);
 }
@@ -1226,9 +1269,10 @@ static uint32_t encode_sbdf(int domain, int bus, int dev, int func)
 		((uint32_t)func   &    0x7);
 }
 
-CAMLprim value stub_xc_domain_test_assign_device(value xch, value domid, value desc)
+CAMLprim value stub_xc_domain_test_assign_device(value xch_val, value domid, value desc)
 {
-	CAMLparam3(xch, domid, desc);
+	CAMLparam3(xch_val, domid, desc);
+	xc_interface *xch = xch_of_val(xch_val);
 	int ret;
 	int domain, bus, dev, func;
 	uint32_t sbdf;
@@ -1239,14 +1283,15 @@ CAMLprim value stub_xc_domain_test_assign_device(value xch, value domid, value d
 	func = Int_val(Field(desc, 3));
 	sbdf = encode_sbdf(domain, bus, dev, func);
 
-	ret = xc_test_assign_device(_H(xch), _D(domid), sbdf);
+	ret = xc_test_assign_device(xch, Int_val(domid), sbdf);
 
 	CAMLreturn(Val_bool(ret == 0));
 }
 
-CAMLprim value stub_xc_domain_assign_device(value xch, value domid, value desc)
+CAMLprim value stub_xc_domain_assign_device(value xch_val, value domid, value desc)
 {
-	CAMLparam3(xch, domid, desc);
+	CAMLparam3(xch_val, domid, desc);
+	xc_interface *xch = xch_of_val(xch_val);
 	int ret;
 	int domain, bus, dev, func;
 	uint32_t sbdf;
@@ -1257,17 +1302,18 @@ CAMLprim value stub_xc_domain_assign_device(value xch, value domid, value desc)
 	func = Int_val(Field(desc, 3));
 	sbdf = encode_sbdf(domain, bus, dev, func);
 
-	ret = xc_assign_device(_H(xch), _D(domid), sbdf,
+	ret = xc_assign_device(xch, Int_val(domid), sbdf,
 			       XEN_DOMCTL_DEV_RDM_RELAXED);
 
 	if (ret < 0)
-		failwith_xc(_H(xch));
+		failwith_xc(xch);
 	CAMLreturn(Val_unit);
 }
 
-CAMLprim value stub_xc_domain_deassign_device(value xch, value domid, value desc)
+CAMLprim value stub_xc_domain_deassign_device(value xch_val, value domid, value desc)
 {
-	CAMLparam3(xch, domid, desc);
+	CAMLparam3(xch_val, domid, desc);
+	xc_interface *xch = xch_of_val(xch_val);
 	int ret;
 	int domain, bus, dev, func;
 	uint32_t sbdf;
@@ -1278,28 +1324,29 @@ CAMLprim value stub_xc_domain_deassign_device(value xch, value domid, value desc
 	func = Int_val(Field(desc, 3));
 	sbdf = encode_sbdf(domain, bus, dev, func);
 
-	ret = xc_deassign_device(_H(xch), _D(domid), sbdf);
+	ret = xc_deassign_device(xch, Int_val(domid), sbdf);
 
 	if (ret < 0)
-		failwith_xc(_H(xch));
+		failwith_xc(xch);
 	CAMLreturn(Val_unit);
 }
 
-CAMLprim value stub_xc_get_cpu_featureset(value xch, value idx)
+CAMLprim value stub_xc_get_cpu_featureset(value xch_val, value idx)
 {
-	CAMLparam2(xch, idx);
+	CAMLparam2(xch_val, idx);
 	CAMLlocal1(bitmap_val);
 #if defined(__i386__) || defined(__x86_64__)
+	xc_interface *xch = xch_of_val(xch_val);
 
 	/* Safe, because of the global ocaml lock. */
 	static uint32_t fs_len;
 
 	if (fs_len == 0)
 	{
-		int ret = xc_get_cpu_featureset(_H(xch), 0, &fs_len, NULL);
+		int ret = xc_get_cpu_featureset(xch, 0, &fs_len, NULL);
 
 		if (ret || (fs_len == 0))
-			failwith_xc(_H(xch));
+			failwith_xc(xch);
 	}
 
 	{
@@ -1307,10 +1354,10 @@ CAMLprim value stub_xc_get_cpu_featureset(value xch, value idx)
 		uint32_t fs[fs_len], len = fs_len;
 		unsigned int i;
 
-		int ret = xc_get_cpu_featureset(_H(xch), Int_val(idx), &len, fs);
+		int ret = xc_get_cpu_featureset(xch, Int_val(idx), &len, fs);
 
 		if (ret)
-			failwith_xc(_H(xch));
+			failwith_xc(xch);
 
 		bitmap_val = caml_alloc(len, 0);
 
@@ -1323,15 +1370,16 @@ CAMLprim value stub_xc_get_cpu_featureset(value xch, value idx)
 	CAMLreturn(bitmap_val);
 }
 
-CAMLprim value stub_xc_watchdog(value xch, value domid, value timeout)
+CAMLprim value stub_xc_watchdog(value xch_val, value domid, value timeout)
 {
-	CAMLparam3(xch, domid, timeout);
+	CAMLparam3(xch_val, domid, timeout);
+	xc_interface *xch = xch_of_val(xch_val);
 	int ret;
 	unsigned int c_timeout = Int32_val(timeout);
 
-	ret = xc_watchdog(_H(xch), _D(domid), c_timeout);
+	ret = xc_watchdog(xch, Int_val(domid), c_timeout);
 	if (ret < 0)
-		failwith_xc(_H(xch));
+		failwith_xc(xch);
 
 	CAMLreturn(Val_int(ret));
 }
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Feb 08 02:47:24 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 08 Feb 2023 02:47:24 +0000
Received: from list by lists.xenproject.org with outflank-mailman.491515.760668 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pPaUW-0008QX-SU; Wed, 08 Feb 2023 02:47:24 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 491515.760668; Wed, 08 Feb 2023 02:47: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 1pPaUW-0008QP-PK; Wed, 08 Feb 2023 02:47:24 +0000
Received: by outflank-mailman (input) for mailman id 491515;
 Wed, 08 Feb 2023 02:47:24 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pPaUW-0008QD-0b
 for xen-changelog@lists.xenproject.org; Wed, 08 Feb 2023 02:47:24 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pPaUV-0003aJ-Vu
 for xen-changelog@lists.xenproject.org; Wed, 08 Feb 2023 02:47:23 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pPaUV-0000YU-VG
 for xen-changelog@lists.xenproject.org; Wed, 08 Feb 2023 02:47:23 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=O6aNVjeLzC/e2QYkUYRTHrThTeqMiv1xjwCp4u+Rigc=; b=ohBK60aSbxkoBuN/PYfzT7mNxy
	2m3LMf2BJHUFMFXltpRrU5ymc9Bx4vGt5nq/qMwiHp4ix5jpofdHNecZ7pB47gGLDBeywqeRW8VOQ
	raesR5jputD1sY797CoYY/5csH3Xc76VwZ/5v4M8PryZEUBLQeUM+tyZf4Mx+TGiAkJ0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools/ocaml/libs: Fix memory/resource leaks with caml_alloc_custom()
Message-Id: <E1pPaUV-0000YU-VG@xenbits.xenproject.org>
Date: Wed, 08 Feb 2023 02:47:23 +0000

commit d69ccf52ad467ccc22029172a8e61dc621187889
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Wed Feb 1 11:27:42 2023 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Mon Feb 6 10:22:12 2023 +0000

    tools/ocaml/libs: Fix memory/resource leaks with caml_alloc_custom()
    
    All caml_alloc_*() functions can throw exceptions, and longjump out of
    context.  If this happens, we leak the xch/xce handle.
    
    Reorder the logic to allocate the the Ocaml object first.
    
    Fixes: 8b3c06a3e545 ("tools/ocaml/xenctrl: OCaml 5 support, fix use-after-free")
    Fixes: 22d5affdf0ce ("tools/ocaml/evtchn: OCaml 5 support, fix potential resource leak")
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Christian Lindig <christian.lindig@citrix.com>
---
 tools/ocaml/libs/eventchn/xeneventchn_stubs.c | 6 ++++--
 tools/ocaml/libs/xc/xenctrl_stubs.c           | 3 ++-
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/tools/ocaml/libs/eventchn/xeneventchn_stubs.c b/tools/ocaml/libs/eventchn/xeneventchn_stubs.c
index 34dcfed302..1980acf405 100644
--- a/tools/ocaml/libs/eventchn/xeneventchn_stubs.c
+++ b/tools/ocaml/libs/eventchn/xeneventchn_stubs.c
@@ -63,6 +63,8 @@ CAMLprim value stub_eventchn_init(value cloexec)
 	if ( !Bool_val(cloexec) )
 		flags |= XENEVTCHN_NO_CLOEXEC;
 
+	result = caml_alloc_custom(&xenevtchn_ops, sizeof(xce), 0, 1);
+
 	caml_enter_blocking_section();
 	xce = xenevtchn_open(NULL, flags);
 	caml_leave_blocking_section();
@@ -70,7 +72,6 @@ CAMLprim value stub_eventchn_init(value cloexec)
 	if (xce == NULL)
 		caml_failwith("open failed");
 
-	result = caml_alloc_custom(&xenevtchn_ops, sizeof(xce), 0, 1);
 	*(xenevtchn_handle **)Data_custom_val(result) = xce;
 
 	CAMLreturn(result);
@@ -82,6 +83,8 @@ CAMLprim value stub_eventchn_fdopen(value fdval)
 	CAMLlocal1(result);
 	xenevtchn_handle *xce;
 
+	result = caml_alloc_custom(&xenevtchn_ops, sizeof(xce), 0, 1);
+
 	caml_enter_blocking_section();
 	xce = xenevtchn_fdopen(NULL, Int_val(fdval), 0);
 	caml_leave_blocking_section();
@@ -89,7 +92,6 @@ CAMLprim value stub_eventchn_fdopen(value fdval)
 	if (xce == NULL)
 		caml_failwith("evtchn fdopen failed");
 
-	result = caml_alloc_custom(&xenevtchn_ops, sizeof(xce), 0, 1);
 	*(xenevtchn_handle **)Data_custom_val(result) = xce;
 
 	CAMLreturn(result);
diff --git a/tools/ocaml/libs/xc/xenctrl_stubs.c b/tools/ocaml/libs/xc/xenctrl_stubs.c
index f9006c6623..ed1cbafdb4 100644
--- a/tools/ocaml/libs/xc/xenctrl_stubs.c
+++ b/tools/ocaml/libs/xc/xenctrl_stubs.c
@@ -98,6 +98,8 @@ CAMLprim value stub_xc_interface_open(value unit)
 	CAMLlocal1(result);
 	xc_interface *xch;
 
+	result = caml_alloc_custom(&xenctrl_ops, sizeof(xch), 0, 1);
+
 	caml_enter_blocking_section();
 	xch = xc_interface_open(NULL, NULL, 0);
 	caml_leave_blocking_section();
@@ -105,7 +107,6 @@ CAMLprim value stub_xc_interface_open(value unit)
 	if ( !xch )
 		failwith_xc(xch);
 
-	result = caml_alloc_custom(&xenctrl_ops, sizeof(xch), 0, 1);
 	*(xc_interface **)Data_custom_val(result) = xch;
 
 	CAMLreturn(result);
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Feb 08 02:47:34 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 08 Feb 2023 02:47:34 +0000
Received: from list by lists.xenproject.org with outflank-mailman.491516.760671 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pPaUg-0008Tu-Tb; Wed, 08 Feb 2023 02:47:34 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 491516.760671; Wed, 08 Feb 2023 02:47: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 1pPaUg-0008Tm-Qy; Wed, 08 Feb 2023 02:47:34 +0000
Received: by outflank-mailman (input) for mailman id 491516;
 Wed, 08 Feb 2023 02:47:34 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pPaUg-0008Ta-31
 for xen-changelog@lists.xenproject.org; Wed, 08 Feb 2023 02:47:34 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pPaUg-0003aw-2L
 for xen-changelog@lists.xenproject.org; Wed, 08 Feb 2023 02:47:34 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pPaUg-0000Yv-1j
 for xen-changelog@lists.xenproject.org; Wed, 08 Feb 2023 02:47:34 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=X22D0mQBmqT9HpI7W/YifIOR2bARahjonp2uDqUG89c=; b=EAPfXvGoEnwpVopcpR5PhgZtvW
	T0fym+cv9N1B9AkgpXHuCgxKsAoHAnKX7DRnYxlVRIv80arptp1EMht7Ho+PZ0P+3rDnkyKXGkzdB
	Vk/4h7/ErjRpmYVbkkp1VV4NWJqvrSAVifUhzo0FgTIQsozEBzeULTCf2LssqFXQhxq8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools/xenmon: Fix xenmon.py for with python3.x
Message-Id: <E1pPaUg-0000Yv-1j@xenbits.xenproject.org>
Date: Wed, 08 Feb 2023 02:47:34 +0000

commit 3a59443c1d5ae0677a792c660ccd3796ce036732
Author:     Bernhard Kaindl <bernhard.kaindl@citrix.com>
AuthorDate: Thu Feb 2 18:13:19 2023 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Mon Feb 6 10:22:12 2023 +0000

    tools/xenmon: Fix xenmon.py for with python3.x
    
    Fixes for Py3:
    * class Delayed(): file not defined; also an error for pylint -E.  Inherit
      object instead for Py2 compatibility.  Fix DomainInfo() too.
    * Inconsistent use of tabs and spaces for indentation (in one block)
    
    Signed-off-by: Bernhard Kaindl <bernhard.kaindl@citrix.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 tools/xenmon/xenmon.py | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/tools/xenmon/xenmon.py b/tools/xenmon/xenmon.py
index 175eacd2cb..977ada6887 100644
--- a/tools/xenmon/xenmon.py
+++ b/tools/xenmon/xenmon.py
@@ -117,7 +117,7 @@ def setup_cmdline_parser():
     return parser
 
 # encapsulate information about a domain
-class DomainInfo:
+class DomainInfo(object):
     def __init__(self):
         self.allocated_sum = 0
         self.gotten_sum = 0
@@ -533,7 +533,7 @@ def show_livestats(cpu):
 # simple functions to allow initialization of log files without actually
 # physically creating files that are never used; only on the first real
 # write does the file get created
-class Delayed(file):
+class Delayed(object):
     def __init__(self, filename, mode):
         self.filename = filename
         self.saved_mode = mode
@@ -677,8 +677,8 @@ def main():
 
     if os.uname()[0] == "SunOS":
         xenbaked_cmd = "/usr/lib/xenbaked"
-	stop_cmd = "/usr/bin/pkill -INT -z global xenbaked"
-	kill_cmd = "/usr/bin/pkill -KILL -z global xenbaked"
+        stop_cmd = "/usr/bin/pkill -INT -z global xenbaked"
+        kill_cmd = "/usr/bin/pkill -KILL -z global xenbaked"
     else:
         # assumes that xenbaked is in your path
         xenbaked_cmd = "xenbaked"
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Feb 08 02:47:45 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 08 Feb 2023 02:47:45 +0000
Received: from list by lists.xenproject.org with outflank-mailman.491517.760677 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pPaUq-00005C-Vr; Wed, 08 Feb 2023 02:47:44 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 491517.760677; Wed, 08 Feb 2023 02:47: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 1pPaUq-00004z-Sk; Wed, 08 Feb 2023 02:47:44 +0000
Received: by outflank-mailman (input) for mailman id 491517;
 Wed, 08 Feb 2023 02:47:44 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pPaUq-0008WV-5t
 for xen-changelog@lists.xenproject.org; Wed, 08 Feb 2023 02:47:44 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pPaUq-0003b7-5B
 for xen-changelog@lists.xenproject.org; Wed, 08 Feb 2023 02:47:44 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pPaUq-0000ZQ-4X
 for xen-changelog@lists.xenproject.org; Wed, 08 Feb 2023 02:47:44 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=tt/Mv0JwsFlVO6JS9BvK7f2ZnqlbFRV+Zf33RnTjrvQ=; b=t8S9LPpuNwesAmd9mDWBoxLTlF
	Zai3zuUf+AWwZY7Aecxw6ajhdVL6QmNCHrWtpupttHm1QQGADU0c8AHrUw/MmL/NhAqqWzIt4lGLf
	Mo8ReUVp+V+haNbGcamXLZjaMFwWGiD5vzBXd89Fq3f19fYsiBWwXezkXg9gQHbqSxxU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools/symbols: drop asm/types.h inclusion
Message-Id: <E1pPaUq-0000ZQ-4X@xenbits.xenproject.org>
Date: Wed, 08 Feb 2023 02:47:44 +0000

commit d476bba90c3e35fd28ec787b32826cf1d5134ba1
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Mon Feb 6 16:03:00 2023 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Feb 6 16:03:00 2023 +0100

    tools/symbols: drop asm/types.h inclusion
    
    While this has been there forever, it's not clear to me what it was
    (thought to be) needed for. In fact, all three instances of the header
    already exclude their entire bodies when __ASSEMBLY__ was defined.
    Hence, with no other assembly files including this header, we can at the
    same time get rid of those conditionals.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
    Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
---
 xen/arch/arm/include/asm/types.h   | 5 -----
 xen/arch/riscv/include/asm/types.h | 4 ----
 xen/arch/x86/include/asm/types.h   | 4 ----
 xen/tools/symbols.c                | 1 -
 4 files changed, 14 deletions(-)

diff --git a/xen/arch/arm/include/asm/types.h b/xen/arch/arm/include/asm/types.h
index 576e971fe1..e218ed77bd 100644
--- a/xen/arch/arm/include/asm/types.h
+++ b/xen/arch/arm/include/asm/types.h
@@ -1,9 +1,6 @@
 #ifndef __ARM_TYPES_H__
 #define __ARM_TYPES_H__
 
-#ifndef __ASSEMBLY__
-
-
 typedef __signed__ char __s8;
 typedef unsigned char __u8;
 
@@ -54,8 +51,6 @@ typedef u64 register_t;
 #define PRIregister "016lx"
 #endif
 
-#endif /* __ASSEMBLY__ */
-
 #endif /* __ARM_TYPES_H__ */
 /*
  * Local variables:
diff --git a/xen/arch/riscv/include/asm/types.h b/xen/arch/riscv/include/asm/types.h
index 64976f118d..0c0ce78c8f 100644
--- a/xen/arch/riscv/include/asm/types.h
+++ b/xen/arch/riscv/include/asm/types.h
@@ -1,8 +1,6 @@
 #ifndef __RISCV_TYPES_H__
 #define __RISCV_TYPES_H__
 
-#ifndef __ASSEMBLY__
-
 typedef __signed__ char __s8;
 typedef unsigned char __u8;
 
@@ -57,8 +55,6 @@ typedef u64 register_t;
 
 #endif
 
-#endif /* __ASSEMBLY__ */
-
 #endif /* __RISCV_TYPES_H__ */
 /*
  * Local variables:
diff --git a/xen/arch/x86/include/asm/types.h b/xen/arch/x86/include/asm/types.h
index 0e9cfdece8..2d56aed667 100644
--- a/xen/arch/x86/include/asm/types.h
+++ b/xen/arch/x86/include/asm/types.h
@@ -1,8 +1,6 @@
 #ifndef __X86_TYPES_H__
 #define __X86_TYPES_H__
 
-#ifndef __ASSEMBLY__
-
 typedef __signed__ char __s8;
 typedef unsigned char __u8;
 
@@ -32,6 +30,4 @@ typedef unsigned long paddr_t;
 #define INVALID_PADDR (~0UL)
 #define PRIpaddr "016lx"
 
-#endif /* __ASSEMBLY__ */
-
 #endif /* __X86_TYPES_H__ */
diff --git a/xen/tools/symbols.c b/xen/tools/symbols.c
index 710e9785d3..67560605f2 100644
--- a/xen/tools/symbols.c
+++ b/xen/tools/symbols.c
@@ -302,7 +302,6 @@ static void write_src(void)
 		return;
 	}
 	printf("#include <xen/config.h>\n");
-	printf("#include <asm/types.h>\n");
 	printf("#if BITS_PER_LONG == 64 && !defined(SYMBOLS_ORIGIN)\n");
 	printf("#define PTR .quad\n");
 	printf("#define ALGN .align 8\n");
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Feb 08 02:47:55 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 08 Feb 2023 02:47:55 +0000
Received: from list by lists.xenproject.org with outflank-mailman.491518.760681 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pPaV1-00009G-1M; Wed, 08 Feb 2023 02:47:55 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 491518.760681; Wed, 08 Feb 2023 02:47:55 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pPaV0-000098-UT; Wed, 08 Feb 2023 02:47:54 +0000
Received: by outflank-mailman (input) for mailman id 491518;
 Wed, 08 Feb 2023 02:47:54 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pPaV0-00008s-8b
 for xen-changelog@lists.xenproject.org; Wed, 08 Feb 2023 02:47:54 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pPaV0-0003bD-7y
 for xen-changelog@lists.xenproject.org; Wed, 08 Feb 2023 02:47:54 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pPaV0-0000cG-7K
 for xen-changelog@lists.xenproject.org; Wed, 08 Feb 2023 02:47:54 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=3jjw1PfhF5Mn8jmLriJ06YBwpmElKhbT9S+VywNddL8=; b=kYoW7/PlFm7PjeqJqcC7SHqtlV
	g4BT/WDVetveOb6caBK6WBDB2ySV1yMTUUP7KTrI1EiqbAa8YNVzp/xzKFxVAmswBf/1bDHpitd5k
	bHR8YI8Lb/RNfknTOrSZsQzZjpipybHWYEinKZZPVV9Y3HyzISiho0tWky/ZrNlZajKE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/hygon: do not include asm/hvm/support.h when not used
Message-Id: <E1pPaV0-0000cG-7K@xenbits.xenproject.org>
Date: Wed, 08 Feb 2023 02:47:54 +0000

commit 7cf218fc07b562c55f410638549439ef1f0aa58b
Author:     Xenia Ragiadakou <burzalodowa@gmail.com>
AuthorDate: Mon Feb 6 16:04:09 2023 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Feb 6 16:04:09 2023 +0100

    x86/hygon: do not include asm/hvm/support.h when not used
    
    Since none of the declarations and macro definitions in asm/hvm/support.h is
    referred in x86/cpu/hygon.c, remove the unnecessary include.
    
    To resolve the subsequent build error for implicit declaration of wrmsrl()
    and rdmsrl() triggered in asm/spec_ctrl.h, replace asm/msr-index.h with
    asm/msr.h in asm/spec_ctrl.h's included headers.
    
    No functional change intended.
    
    Signed-off-by: Xenia Ragiadakou <burzalodowa@gmail.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/cpu/hygon.c             | 1 -
 xen/arch/x86/include/asm/spec_ctrl.h | 2 +-
 2 files changed, 1 insertion(+), 2 deletions(-)

diff --git a/xen/arch/x86/cpu/hygon.c b/xen/arch/x86/cpu/hygon.c
index 361eb6fd41..42029f2145 100644
--- a/xen/arch/x86/cpu/hygon.c
+++ b/xen/arch/x86/cpu/hygon.c
@@ -1,6 +1,5 @@
 #include <xen/init.h>
 #include <asm/processor.h>
-#include <asm/hvm/support.h>
 #include <asm/spec_ctrl.h>
 
 #include "cpu.h"
diff --git a/xen/arch/x86/include/asm/spec_ctrl.h b/xen/arch/x86/include/asm/spec_ctrl.h
index 6a77c39378..e928596450 100644
--- a/xen/arch/x86/include/asm/spec_ctrl.h
+++ b/xen/arch/x86/include/asm/spec_ctrl.h
@@ -60,7 +60,7 @@
 
 #include <asm/alternative.h>
 #include <asm/current.h>
-#include <asm/msr-index.h>
+#include <asm/msr.h>
 
 void init_speculation_mitigations(void);
 void spec_ctrl_init_domain(struct domain *d);
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Feb 08 02:48:05 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 08 Feb 2023 02:48:05 +0000
Received: from list by lists.xenproject.org with outflank-mailman.491519.760684 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pPaVB-0000Cg-2u; Wed, 08 Feb 2023 02:48:05 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 491519.760684; Wed, 08 Feb 2023 02:48:05 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pPaVA-0000CU-W6; Wed, 08 Feb 2023 02:48:04 +0000
Received: by outflank-mailman (input) for mailman id 491519;
 Wed, 08 Feb 2023 02:48:04 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pPaVA-0000CK-Bq
 for xen-changelog@lists.xenproject.org; Wed, 08 Feb 2023 02:48:04 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pPaVA-0003bo-BD
 for xen-changelog@lists.xenproject.org; Wed, 08 Feb 2023 02:48:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pPaVA-0000ct-AO
 for xen-changelog@lists.xenproject.org; Wed, 08 Feb 2023 02:48:04 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Gb46H0LvNYMTAmhJdih82DLxUZ+NA74LB8W2JCk5EMY=; b=uxf4ryao8BgIon5kRDZuGaa6Gm
	E+sDNHeQzDZsHcdCV6HdFfus2VK8R6jF2szrB0mlRMOh+Y/Z3nBH1cqAxBzg2hAvBFhMVktn6kh6p
	G9yl39R5Xj1mLrFQ16ZuM1a7x5Hs0gp3CXdcOgSDqC/mXMmD9JsdPluGhWeNhuUm+FZ4=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/time: use public interface TSC mode definitions
Message-Id: <E1pPaVA-0000ct-AO@xenbits.xenproject.org>
Date: Wed, 08 Feb 2023 02:48:04 +0000

commit 6c707d4573f5df2b60503dfeedc10b33cebd60d1
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Mon Feb 6 16:04:43 2023 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Feb 6 16:04:43 2023 +0100

    x86/time: use public interface TSC mode definitions
    
    Now that they're properly represented in the public interface, let's do
    away with our private #define-s.
    
    No functional change intended.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/domain.c           |  3 ++-
 xen/arch/x86/include/asm/time.h | 14 --------------
 xen/arch/x86/time.c             | 17 +++++++++--------
 3 files changed, 11 insertions(+), 23 deletions(-)

diff --git a/xen/arch/x86/domain.c b/xen/arch/x86/domain.c
index d7a8237f01..a3c88cd729 100644
--- a/xen/arch/x86/domain.c
+++ b/xen/arch/x86/domain.c
@@ -36,6 +36,7 @@
 #include <xen/wait.h>
 #include <xen/guest_access.h>
 #include <xen/livepatch.h>
+#include <public/arch-x86/cpuid.h>
 #include <public/sysctl.h>
 #include <public/hvm/hvm_vcpu.h>
 #include <asm/regs.h>
@@ -844,7 +845,7 @@ int arch_domain_create(struct domain *d,
     else
         ASSERT_UNREACHABLE(); /* Not HVM and not PV? */
 
-    if ( (rc = tsc_set_info(d, TSC_MODE_DEFAULT, 0, 0, 0)) != 0 )
+    if ( (rc = tsc_set_info(d, XEN_CPUID_TSC_MODE_DEFAULT, 0, 0, 0)) != 0 )
     {
         ASSERT_UNREACHABLE();
         goto fail;
diff --git a/xen/arch/x86/include/asm/time.h b/xen/arch/x86/include/asm/time.h
index dc2e636916..0d7989a1fe 100644
--- a/xen/arch/x86/include/asm/time.h
+++ b/xen/arch/x86/include/asm/time.h
@@ -4,20 +4,6 @@
 
 #include <asm/msr.h>
 
-/*
- *  PV TSC emulation modes:
- *    0 = guest rdtsc/p executed natively when monotonicity can be guaranteed
- *         and emulated otherwise (with frequency scaled if necessary)
- *    1 = guest rdtsc/p always emulated at 1GHz (kernel and user)
- *    2 = guest rdtsc always executed natively (no monotonicity/frequency
- *         guarantees); guest rdtscp emulated at native frequency if
- *         unsupported by h/w, else executed natively
- *    3 = Removed, was PVRDTSCP.
- */
-#define TSC_MODE_DEFAULT          0
-#define TSC_MODE_ALWAYS_EMULATE   1
-#define TSC_MODE_NEVER_EMULATE    2
-
 typedef u64 cycles_t;
 
 extern bool disable_tsc_sync;
diff --git a/xen/arch/x86/time.c b/xen/arch/x86/time.c
index 7bee4f784f..782b11c8a9 100644
--- a/xen/arch/x86/time.c
+++ b/xen/arch/x86/time.c
@@ -2545,13 +2545,13 @@ void tsc_get_info(struct domain *d, uint32_t *tsc_mode,
     {
         uint64_t tsc;
 
-    case TSC_MODE_NEVER_EMULATE:
+    case XEN_CPUID_TSC_MODE_NEVER_EMULATE:
         *elapsed_nsec = *gtsc_khz = 0;
         break;
-    case TSC_MODE_DEFAULT:
+    case XEN_CPUID_TSC_MODE_DEFAULT:
         if ( d->arch.vtsc )
         {
-    case TSC_MODE_ALWAYS_EMULATE:
+    case XEN_CPUID_TSC_MODE_ALWAYS_EMULATE:
             *elapsed_nsec = get_s_time() - d->arch.vtsc_offset;
             *gtsc_khz = d->arch.tsc_khz;
             break;
@@ -2588,8 +2588,8 @@ int tsc_set_info(struct domain *d,
 
     switch ( tsc_mode )
     {
-    case TSC_MODE_DEFAULT:
-    case TSC_MODE_ALWAYS_EMULATE:
+    case XEN_CPUID_TSC_MODE_DEFAULT:
+    case XEN_CPUID_TSC_MODE_ALWAYS_EMULATE:
         d->arch.vtsc_offset = get_s_time() - elapsed_nsec;
         d->arch.tsc_khz = gtsc_khz ?: cpu_khz;
         set_time_scale(&d->arch.vtsc_to_ns, d->arch.tsc_khz * 1000UL);
@@ -2601,12 +2601,12 @@ int tsc_set_info(struct domain *d,
          * When a guest is created, gtsc_khz is passed in as zero, making
          * d->arch.tsc_khz == cpu_khz. Thus no need to check incarnation.
          */
-        if ( tsc_mode == TSC_MODE_DEFAULT && host_tsc_is_safe() &&
+        if ( tsc_mode == XEN_CPUID_TSC_MODE_DEFAULT && host_tsc_is_safe() &&
              (d->arch.tsc_khz == cpu_khz ||
               (is_hvm_domain(d) &&
                hvm_get_tsc_scaling_ratio(d->arch.tsc_khz))) )
         {
-    case TSC_MODE_NEVER_EMULATE:
+    case XEN_CPUID_TSC_MODE_NEVER_EMULATE:
             d->arch.vtsc = 0;
             break;
         }
@@ -2674,7 +2674,8 @@ static void cf_check dump_softtsc(unsigned char key)
 
     for_each_domain ( d )
     {
-        if ( is_hardware_domain(d) && d->arch.tsc_mode == TSC_MODE_DEFAULT )
+        if ( is_hardware_domain(d) &&
+             d->arch.tsc_mode == XEN_CPUID_TSC_MODE_DEFAULT )
             continue;
         printk("dom%u%s: mode=%d",d->domain_id,
                 is_hvm_domain(d) ? "(hvm)" : "", d->arch.tsc_mode);
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Feb 08 10:44:11 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 08 Feb 2023 10:44:11 +0000
Received: from list by lists.xenproject.org with outflank-mailman.491673.760874 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pPhvn-0002pS-0q; Wed, 08 Feb 2023 10:44:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 491673.760874; Wed, 08 Feb 2023 10: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 1pPhvm-0002pK-UF; Wed, 08 Feb 2023 10:44:02 +0000
Received: by outflank-mailman (input) for mailman id 491673;
 Wed, 08 Feb 2023 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 1pPhvm-0002pE-0U
 for xen-changelog@lists.xenproject.org; Wed, 08 Feb 2023 10:44:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pPhvl-00076M-Ts
 for xen-changelog@lists.xenproject.org; Wed, 08 Feb 2023 10:44:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pPhvl-0005Q9-Sx
 for xen-changelog@lists.xenproject.org; Wed, 08 Feb 2023 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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=QMmK7j20EEapZi+ofawH98LUcAPwXw0EIA8Xn3H4TKg=; b=wdTIzhNOCyJ2rOS4rIZJ0Ju3+j
	ycWP0G8yWa85641ZsYCtLHWBLwwAyryDz2Hc6J0ZvMVjJyM7EZzeyOk7PGm4oPTCnaf45YrmToB4L
	0qX94MdDb+z6bgT4FZ5tn6uNEKkAMTZDFvoz5gEtnHEoC4i8yq/hRZ0pbLZEP6CMm6EE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.17] x86/S3: Restore Xen's MSR_PAT value on S3 resume
Message-Id: <E1pPhvl-0005Q9-Sx@xenbits.xenproject.org>
Date: Wed, 08 Feb 2023 10:44:01 +0000

commit a470a83c36c07b56d90957ae1e6e9ebc458d3686
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Tue Feb 7 16:56:14 2023 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Feb 7 16:56:14 2023 +0100

    x86/S3: Restore Xen's MSR_PAT value on S3 resume
    
    There are two paths in the trampoline, and Xen's PAT needs setting up in both,
    not just the boot path.
    
    Fixes: 4304ff420e51 ("x86/S3: Drop {save,restore}_rest_processor_state() completely")
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 4d975798e11579fdf405b348543061129e01b0fb
    master date: 2023-01-10 21:21:30 +0000
---
 xen/arch/x86/boot/wakeup.S | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/xen/arch/x86/boot/wakeup.S b/xen/arch/x86/boot/wakeup.S
index c17d613b61..08447e1934 100644
--- a/xen/arch/x86/boot/wakeup.S
+++ b/xen/arch/x86/boot/wakeup.S
@@ -130,6 +130,11 @@ wakeup_32:
         and     %edi, %edx
         wrmsr
 1:
+        /* Set up PAT before enabling paging. */
+        mov     $XEN_MSR_PAT & 0xffffffff, %eax
+        mov     $XEN_MSR_PAT >> 32, %edx
+        mov     $MSR_IA32_CR_PAT, %ecx
+        wrmsr
 
         /* Set up EFER (Extended Feature Enable Register). */
         movl    $MSR_EFER,%ecx
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.17


From xen-changelog-bounces@lists.xenproject.org Wed Feb 08 10:44:13 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 08 Feb 2023 10:44:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.491674.760880 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pPhvx-0002rH-3T; Wed, 08 Feb 2023 10:44:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 491674.760880; Wed, 08 Feb 2023 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 1pPhvw-0002r9-W2; Wed, 08 Feb 2023 10:44:12 +0000
Received: by outflank-mailman (input) for mailman id 491674;
 Wed, 08 Feb 2023 10: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 1pPhvw-0002r3-1a
 for xen-changelog@lists.xenproject.org; Wed, 08 Feb 2023 10:44:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pPhvw-00076Q-0r
 for xen-changelog@lists.xenproject.org; Wed, 08 Feb 2023 10:44:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pPhvv-0005Qa-Vy
 for xen-changelog@lists.xenproject.org; Wed, 08 Feb 2023 10:44:11 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=ReDeqIIc7L0zLv3I+M1kt6hoHhMZXFBSVKstO2gISbc=; b=J99QeuUC9YZtJbWIHyUSNvPBpU
	VVSeo/RLa+nJj4ILvDdu5GtAnj7uGDszZrohSXW5XsiVm3bR51OuBmTWFbhK9ToOlB/3ZGyqH/0N9
	SCBlsbigyL8mUapkYA+YzUjH4PQjid91WmFmQ23Bf5YeQTUeS+0Zo9R6v9ipDatf+a8U=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.17] tools: Fix build with recent QEMU, use "--enable-trace-backends"
Message-Id: <E1pPhvv-0005Qa-Vy@xenbits.xenproject.org>
Date: Wed, 08 Feb 2023 10:44:11 +0000

commit 1d7a388e7b9711cbd7e14b2020b168b6789772af
Author:     Anthony PERARD <anthony.perard@citrix.com>
AuthorDate: Tue Feb 7 16:57:22 2023 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Feb 7 16:57:22 2023 +0100

    tools: Fix build with recent QEMU, use "--enable-trace-backends"
    
    The configure option "--enable-trace-backend" isn't accepted anymore
    and we should use "--enable-trace-backends" instead which was
    introduce in 2014 and allow multiple backends.
    
    "--enable-trace-backends" was introduced by:
        5b808275f3bb ("trace: Multi-backend tracing")
    The backward compatible option "--enable-trace-backend" is removed by
        10229ec3b0ff ("configure: remove backwards-compatibility and obsolete options")
    
    As we already use ./configure options that wouldn't be accepted by
    older version of QEMU's configure, we will simply use the new spelling
    for the option and avoid trying to detect which spelling to use.
    
    We already make use if "--firmwarepath=" which was introduced by
        3d5eecab4a5a ("Add --firmwarepath to configure")
    which already include the new spelling for "--enable-trace-backends".
    
    Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
    Reviewed-by: Jason Andryuk <jandryuk@gmail.com>
    master commit: e66d450b6e0ffec635639df993ab43ce28b3383f
    master date: 2023-01-11 10:45:29 +0100
---
 tools/Makefile | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/Makefile b/tools/Makefile
index 9e28027835..4906fdbc23 100644
--- a/tools/Makefile
+++ b/tools/Makefile
@@ -218,9 +218,9 @@ subdir-all-qemu-xen-dir: qemu-xen-dir-find
 	mkdir -p qemu-xen-build; \
 	cd qemu-xen-build; \
 	if $$source/scripts/tracetool.py --check-backend --backend log ; then \
-		enable_trace_backend='--enable-trace-backend=log'; \
+		enable_trace_backend="--enable-trace-backends=log"; \
 	elif $$source/scripts/tracetool.py --check-backend --backend stderr ; then \
-		enable_trace_backend='--enable-trace-backend=stderr'; \
+		enable_trace_backend='--enable-trace-backends=stderr'; \
 	else \
 		enable_trace_backend='' ; \
 	fi ; \
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.17


From xen-changelog-bounces@lists.xenproject.org Wed Feb 08 10:44:23 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 08 Feb 2023 10:44:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.491675.760883 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pPhw7-0002ud-5n; Wed, 08 Feb 2023 10:44:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 491675.760883; Wed, 08 Feb 2023 10:44:23 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pPhw7-0002uV-31; Wed, 08 Feb 2023 10:44:23 +0000
Received: by outflank-mailman (input) for mailman id 491675;
 Wed, 08 Feb 2023 10:44:22 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pPhw6-0002uI-4l
 for xen-changelog@lists.xenproject.org; Wed, 08 Feb 2023 10:44:22 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pPhw6-00076q-42
 for xen-changelog@lists.xenproject.org; Wed, 08 Feb 2023 10:44:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pPhw6-0005RH-2u
 for xen-changelog@lists.xenproject.org; Wed, 08 Feb 2023 10:44:22 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=qsLzMIunesJEN5Z/b95LoP14hs44kkJ64X/fVHHc83I=; b=lpSuBLi4URoiBh3H/lPfsTKDYY
	KBYc6O/zKZDHGWQT1LQHtp3OBp3T9OGqKOEkf2xwxEKQdRxbWbwgtmYxMyi7WClyMounLL89N+SUs
	bWzg1oxtLGtCgLZKk9wshMFU+6E1mFTTzoKzgPwaMe09y3z0YhLAbBib1UJmYqh8oiuI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.17] include/compat: produce stubs for headers not otherwise generated
Message-Id: <E1pPhw6-0005RH-2u@xenbits.xenproject.org>
Date: Wed, 08 Feb 2023 10:44:22 +0000

commit c871e05e138aae2ac75e9b4ccebe6cf3fd1a775b
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Feb 7 16:57:52 2023 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Feb 7 16:57:52 2023 +0100

    include/compat: produce stubs for headers not otherwise generated
    
    Public headers can include other public headers. Such interdependencies
    are retained in their compat counterparts. Since some compat headers are
    generated only in certain configurations, the referenced headers still
    need to exist. The lack thereof was observed with hvm/hvm_op.h needing
    trace.h, where generation of the latter depends on TRACEBUFFER=y. Make
    empty stubs in such cases (as generating the extra headers is relatively
    slow and hence better to avoid). Changes to .config and incrementally
    (re-)building is covered by the respective .*.cmd then no longer
    matching the command to be used, resulting in the necessary re-creation
    of the (possibly stub) header.
    
    Reported-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Anthony PERARD <anthony.perard@citrix.com>
    master commit: 6bec713f871f21c6254a5783c1e39867ea828256
    master date: 2023-01-12 16:17:54 +0100
---
 xen/include/Makefile | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/xen/include/Makefile b/xen/include/Makefile
index 65be310eca..cfd7851614 100644
--- a/xen/include/Makefile
+++ b/xen/include/Makefile
@@ -34,6 +34,8 @@ headers-$(CONFIG_TRACEBUFFER) += compat/trace.h
 headers-$(CONFIG_XENOPROF) += compat/xenoprof.h
 headers-$(CONFIG_XSM_FLASK) += compat/xsm/flask_op.h
 
+headers-n := $(filter-out $(headers-y),$(headers-n) $(headers-))
+
 cppflags-y                := -include public/xen-compat.h -DXEN_GENERATING_COMPAT_HEADERS
 cppflags-$(CONFIG_X86)    += -m32
 
@@ -43,13 +45,16 @@ public-$(CONFIG_X86) := $(wildcard $(srcdir)/public/arch-x86/*.h $(srcdir)/publi
 public-$(CONFIG_ARM) := $(wildcard $(srcdir)/public/arch-arm/*.h $(srcdir)/public/arch-arm/*/*.h)
 
 .PHONY: all
-all: $(addprefix $(obj)/,$(headers-y))
+all: $(addprefix $(obj)/,$(headers-y) $(headers-n))
 
 quiet_cmd_compat_h = GEN     $@
 cmd_compat_h = \
     $(PYTHON) $(srctree)/tools/compat-build-header.py <$< $(patsubst $(obj)/%,%,$@) >>$@.new; \
     mv -f $@.new $@
 
+quiet_cmd_stub_h = GEN     $@
+cmd_stub_h = echo '/* empty */' >$@
+
 quiet_cmd_compat_i = CPP     $@
 cmd_compat_i = $(CPP) $(filter-out -Wa$(comma)% -include %/include/xen/config.h,$(XEN_CFLAGS)) $(cppflags-y) -o $@ $<
 
@@ -69,6 +74,13 @@ targets += $(headers-y)
 $(obj)/compat/%.h: $(obj)/compat/%.i $(srctree)/tools/compat-build-header.py FORCE
 	$(call if_changed,compat_h)
 
+# Placeholders may be needed in case files in $(headers-y) include files we
+# don't otherwise generate.  Real dependencies would need spelling out explicitly,
+# for them to appear in $(headers-y) instead.
+targets += $(headers-n)
+$(addprefix $(obj)/,$(headers-n)): FORCE
+	$(call if_changed,stub_h)
+
 .PRECIOUS: $(obj)/compat/%.i
 targets += $(patsubst %.h, %.i, $(headers-y))
 $(obj)/compat/%.i: $(obj)/compat/%.c FORCE
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.17


From xen-changelog-bounces@lists.xenproject.org Wed Feb 08 10:44:33 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 08 Feb 2023 10:44:33 +0000
Received: from list by lists.xenproject.org with outflank-mailman.491676.760887 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pPhwH-0002xT-7E; Wed, 08 Feb 2023 10:44:33 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 491676.760887; Wed, 08 Feb 2023 10:44:33 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pPhwH-0002xL-4U; Wed, 08 Feb 2023 10:44:33 +0000
Received: by outflank-mailman (input) for mailman id 491676;
 Wed, 08 Feb 2023 10:44:32 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pPhwG-0002x5-80
 for xen-changelog@lists.xenproject.org; Wed, 08 Feb 2023 10:44:32 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pPhwG-000775-7I
 for xen-changelog@lists.xenproject.org; Wed, 08 Feb 2023 10:44:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pPhwG-0005Rg-6P
 for xen-changelog@lists.xenproject.org; Wed, 08 Feb 2023 10:44:32 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=4d4xdh+v7LWoBWZYKWuhyR1W7uZ4GhSH7tnIWiQyW04=; b=pO66UpXh8l2o1hM2WK1k7PnDIf
	lSOEAGP8Sz/MYHEZ9KOqiglErqYY1/d3wcy/455ekIXBRwKS01RWkfytBYz90QYG3HWyL9R8xkRtP
	onzfVFPyhnoTK4UNXijx9iQWJ++kjvUPg+36/D+KpTAeRVi/ecOSHK6D8O3MEvI0TIDs=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.17] x86/vmx: Calculate model-specific LBRs once at start of day
Message-Id: <E1pPhwG-0005Rg-6P@xenbits.xenproject.org>
Date: Wed, 08 Feb 2023 10:44:32 +0000

commit 5e3250258afbace3e5dc3f31ac99c1eebf60f238
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Tue Feb 7 16:58:25 2023 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Feb 7 16:58:25 2023 +0100

    x86/vmx: Calculate model-specific LBRs once at start of day
    
    There is no point repeating this calculation at runtime, especially as it is
    in the fallback path of the WRSMR/RDMSR handlers.
    
    Move the infrastructure higher in vmx.c to avoid forward declarations,
    renaming last_branch_msr_get() to get_model_specific_lbr() to highlight that
    these are model-specific only.
    
    No practical change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Kevin Tian <kevin.tian@intel.com>
    master commit: e94af0d58f86c3a914b9cbbf4d9ed3d43b974771
    master date: 2023-01-12 18:42:00 +0000
---
 xen/arch/x86/hvm/vmx/vmx.c | 276 +++++++++++++++++++++++----------------------
 1 file changed, 139 insertions(+), 137 deletions(-)

diff --git a/xen/arch/x86/hvm/vmx/vmx.c b/xen/arch/x86/hvm/vmx/vmx.c
index 7c81b80710..ad91464103 100644
--- a/xen/arch/x86/hvm/vmx/vmx.c
+++ b/xen/arch/x86/hvm/vmx/vmx.c
@@ -396,6 +396,142 @@ void vmx_pi_hooks_deassign(struct domain *d)
     domain_unpause(d);
 }
 
+static const struct lbr_info {
+    u32 base, count;
+} p4_lbr[] = {
+    { MSR_P4_LER_FROM_LIP,          1 },
+    { MSR_P4_LER_TO_LIP,            1 },
+    { MSR_P4_LASTBRANCH_TOS,        1 },
+    { MSR_P4_LASTBRANCH_0_FROM_LIP, NUM_MSR_P4_LASTBRANCH_FROM_TO },
+    { MSR_P4_LASTBRANCH_0_TO_LIP,   NUM_MSR_P4_LASTBRANCH_FROM_TO },
+    { 0, 0 }
+}, c2_lbr[] = {
+    { MSR_IA32_LASTINTFROMIP,       1 },
+    { MSR_IA32_LASTINTTOIP,         1 },
+    { MSR_C2_LASTBRANCH_TOS,        1 },
+    { MSR_C2_LASTBRANCH_0_FROM_IP,  NUM_MSR_C2_LASTBRANCH_FROM_TO },
+    { MSR_C2_LASTBRANCH_0_TO_IP,    NUM_MSR_C2_LASTBRANCH_FROM_TO },
+    { 0, 0 }
+}, nh_lbr[] = {
+    { MSR_IA32_LASTINTFROMIP,       1 },
+    { MSR_IA32_LASTINTTOIP,         1 },
+    { MSR_NHL_LBR_SELECT,           1 },
+    { MSR_NHL_LASTBRANCH_TOS,       1 },
+    { MSR_P4_LASTBRANCH_0_FROM_LIP, NUM_MSR_P4_LASTBRANCH_FROM_TO },
+    { MSR_P4_LASTBRANCH_0_TO_LIP,   NUM_MSR_P4_LASTBRANCH_FROM_TO },
+    { 0, 0 }
+}, sk_lbr[] = {
+    { MSR_IA32_LASTINTFROMIP,       1 },
+    { MSR_IA32_LASTINTTOIP,         1 },
+    { MSR_NHL_LBR_SELECT,           1 },
+    { MSR_NHL_LASTBRANCH_TOS,       1 },
+    { MSR_SKL_LASTBRANCH_0_FROM_IP, NUM_MSR_SKL_LASTBRANCH },
+    { MSR_SKL_LASTBRANCH_0_TO_IP,   NUM_MSR_SKL_LASTBRANCH },
+    { MSR_SKL_LASTBRANCH_0_INFO,    NUM_MSR_SKL_LASTBRANCH },
+    { 0, 0 }
+}, at_lbr[] = {
+    { MSR_IA32_LASTINTFROMIP,       1 },
+    { MSR_IA32_LASTINTTOIP,         1 },
+    { MSR_C2_LASTBRANCH_TOS,        1 },
+    { MSR_C2_LASTBRANCH_0_FROM_IP,  NUM_MSR_ATOM_LASTBRANCH_FROM_TO },
+    { MSR_C2_LASTBRANCH_0_TO_IP,    NUM_MSR_ATOM_LASTBRANCH_FROM_TO },
+    { 0, 0 }
+}, sm_lbr[] = {
+    { MSR_IA32_LASTINTFROMIP,       1 },
+    { MSR_IA32_LASTINTTOIP,         1 },
+    { MSR_SM_LBR_SELECT,            1 },
+    { MSR_SM_LASTBRANCH_TOS,        1 },
+    { MSR_C2_LASTBRANCH_0_FROM_IP,  NUM_MSR_ATOM_LASTBRANCH_FROM_TO },
+    { MSR_C2_LASTBRANCH_0_TO_IP,    NUM_MSR_ATOM_LASTBRANCH_FROM_TO },
+    { 0, 0 }
+}, gm_lbr[] = {
+    { MSR_IA32_LASTINTFROMIP,       1 },
+    { MSR_IA32_LASTINTTOIP,         1 },
+    { MSR_SM_LBR_SELECT,            1 },
+    { MSR_SM_LASTBRANCH_TOS,        1 },
+    { MSR_GM_LASTBRANCH_0_FROM_IP,  NUM_MSR_GM_LASTBRANCH_FROM_TO },
+    { MSR_GM_LASTBRANCH_0_TO_IP,    NUM_MSR_GM_LASTBRANCH_FROM_TO },
+    { 0, 0 }
+};
+static const struct lbr_info *__ro_after_init model_specific_lbr;
+
+static const struct lbr_info *__init get_model_specific_lbr(void)
+{
+    switch ( boot_cpu_data.x86 )
+    {
+    case 6:
+        switch ( boot_cpu_data.x86_model )
+        {
+        /* Core2 Duo */
+        case 0x0f:
+        /* Enhanced Core */
+        case 0x17:
+        /* Xeon 7400 */
+        case 0x1d:
+            return c2_lbr;
+        /* Nehalem */
+        case 0x1a: case 0x1e: case 0x1f: case 0x2e:
+        /* Westmere */
+        case 0x25: case 0x2c: case 0x2f:
+        /* Sandy Bridge */
+        case 0x2a: case 0x2d:
+        /* Ivy Bridge */
+        case 0x3a: case 0x3e:
+        /* Haswell */
+        case 0x3c: case 0x3f: case 0x45: case 0x46:
+        /* Broadwell */
+        case 0x3d: case 0x47: case 0x4f: case 0x56:
+            return nh_lbr;
+        /* Skylake */
+        case 0x4e: case 0x5e:
+        /* Xeon Scalable */
+        case 0x55:
+        /* Cannon Lake */
+        case 0x66:
+        /* Goldmont Plus */
+        case 0x7a:
+        /* Ice Lake */
+        case 0x6a: case 0x6c: case 0x7d: case 0x7e:
+        /* Tiger Lake */
+        case 0x8c: case 0x8d:
+        /* Tremont */
+        case 0x86:
+        /* Kaby Lake */
+        case 0x8e: case 0x9e:
+        /* Comet Lake */
+        case 0xa5: case 0xa6:
+            return sk_lbr;
+        /* Atom */
+        case 0x1c: case 0x26: case 0x27: case 0x35: case 0x36:
+            return at_lbr;
+        /* Silvermont */
+        case 0x37: case 0x4a: case 0x4d: case 0x5a: case 0x5d:
+        /* Xeon Phi Knights Landing */
+        case 0x57:
+        /* Xeon Phi Knights Mill */
+        case 0x85:
+        /* Airmont */
+        case 0x4c:
+            return sm_lbr;
+        /* Goldmont */
+        case 0x5c: case 0x5f:
+            return gm_lbr;
+        }
+        break;
+
+    case 15:
+        switch ( boot_cpu_data.x86_model )
+        {
+        /* Pentium4/Xeon with em64t */
+        case 3: case 4: case 6:
+            return p4_lbr;
+        }
+        break;
+    }
+
+    return NULL;
+}
+
 static int cf_check vmx_domain_initialise(struct domain *d)
 {
     static const struct arch_csw csw = {
@@ -2837,6 +2973,7 @@ const struct hvm_function_table * __init start_vmx(void)
         vmx_function_table.tsc_scaling.setup = vmx_setup_tsc_scaling;
     }
 
+    model_specific_lbr = get_model_specific_lbr();
     lbr_tsx_fixup_check();
     ler_to_fixup_check();
 
@@ -2983,141 +3120,6 @@ static int vmx_cr_access(cr_access_qual_t qual)
     return X86EMUL_OKAY;
 }
 
-static const struct lbr_info {
-    u32 base, count;
-} p4_lbr[] = {
-    { MSR_P4_LER_FROM_LIP,          1 },
-    { MSR_P4_LER_TO_LIP,            1 },
-    { MSR_P4_LASTBRANCH_TOS,        1 },
-    { MSR_P4_LASTBRANCH_0_FROM_LIP, NUM_MSR_P4_LASTBRANCH_FROM_TO },
-    { MSR_P4_LASTBRANCH_0_TO_LIP,   NUM_MSR_P4_LASTBRANCH_FROM_TO },
-    { 0, 0 }
-}, c2_lbr[] = {
-    { MSR_IA32_LASTINTFROMIP,       1 },
-    { MSR_IA32_LASTINTTOIP,         1 },
-    { MSR_C2_LASTBRANCH_TOS,        1 },
-    { MSR_C2_LASTBRANCH_0_FROM_IP,  NUM_MSR_C2_LASTBRANCH_FROM_TO },
-    { MSR_C2_LASTBRANCH_0_TO_IP,    NUM_MSR_C2_LASTBRANCH_FROM_TO },
-    { 0, 0 }
-}, nh_lbr[] = {
-    { MSR_IA32_LASTINTFROMIP,       1 },
-    { MSR_IA32_LASTINTTOIP,         1 },
-    { MSR_NHL_LBR_SELECT,           1 },
-    { MSR_NHL_LASTBRANCH_TOS,       1 },
-    { MSR_P4_LASTBRANCH_0_FROM_LIP, NUM_MSR_P4_LASTBRANCH_FROM_TO },
-    { MSR_P4_LASTBRANCH_0_TO_LIP,   NUM_MSR_P4_LASTBRANCH_FROM_TO },
-    { 0, 0 }
-}, sk_lbr[] = {
-    { MSR_IA32_LASTINTFROMIP,       1 },
-    { MSR_IA32_LASTINTTOIP,         1 },
-    { MSR_NHL_LBR_SELECT,           1 },
-    { MSR_NHL_LASTBRANCH_TOS,       1 },
-    { MSR_SKL_LASTBRANCH_0_FROM_IP, NUM_MSR_SKL_LASTBRANCH },
-    { MSR_SKL_LASTBRANCH_0_TO_IP,   NUM_MSR_SKL_LASTBRANCH },
-    { MSR_SKL_LASTBRANCH_0_INFO,    NUM_MSR_SKL_LASTBRANCH },
-    { 0, 0 }
-}, at_lbr[] = {
-    { MSR_IA32_LASTINTFROMIP,       1 },
-    { MSR_IA32_LASTINTTOIP,         1 },
-    { MSR_C2_LASTBRANCH_TOS,        1 },
-    { MSR_C2_LASTBRANCH_0_FROM_IP,  NUM_MSR_ATOM_LASTBRANCH_FROM_TO },
-    { MSR_C2_LASTBRANCH_0_TO_IP,    NUM_MSR_ATOM_LASTBRANCH_FROM_TO },
-    { 0, 0 }
-}, sm_lbr[] = {
-    { MSR_IA32_LASTINTFROMIP,       1 },
-    { MSR_IA32_LASTINTTOIP,         1 },
-    { MSR_SM_LBR_SELECT,            1 },
-    { MSR_SM_LASTBRANCH_TOS,        1 },
-    { MSR_C2_LASTBRANCH_0_FROM_IP,  NUM_MSR_ATOM_LASTBRANCH_FROM_TO },
-    { MSR_C2_LASTBRANCH_0_TO_IP,    NUM_MSR_ATOM_LASTBRANCH_FROM_TO },
-    { 0, 0 }
-}, gm_lbr[] = {
-    { MSR_IA32_LASTINTFROMIP,       1 },
-    { MSR_IA32_LASTINTTOIP,         1 },
-    { MSR_SM_LBR_SELECT,            1 },
-    { MSR_SM_LASTBRANCH_TOS,        1 },
-    { MSR_GM_LASTBRANCH_0_FROM_IP,  NUM_MSR_GM_LASTBRANCH_FROM_TO },
-    { MSR_GM_LASTBRANCH_0_TO_IP,    NUM_MSR_GM_LASTBRANCH_FROM_TO },
-    { 0, 0 }
-};
-
-static const struct lbr_info *last_branch_msr_get(void)
-{
-    switch ( boot_cpu_data.x86 )
-    {
-    case 6:
-        switch ( boot_cpu_data.x86_model )
-        {
-        /* Core2 Duo */
-        case 0x0f:
-        /* Enhanced Core */
-        case 0x17:
-        /* Xeon 7400 */
-        case 0x1d:
-            return c2_lbr;
-        /* Nehalem */
-        case 0x1a: case 0x1e: case 0x1f: case 0x2e:
-        /* Westmere */
-        case 0x25: case 0x2c: case 0x2f:
-        /* Sandy Bridge */
-        case 0x2a: case 0x2d:
-        /* Ivy Bridge */
-        case 0x3a: case 0x3e:
-        /* Haswell */
-        case 0x3c: case 0x3f: case 0x45: case 0x46:
-        /* Broadwell */
-        case 0x3d: case 0x47: case 0x4f: case 0x56:
-            return nh_lbr;
-        /* Skylake */
-        case 0x4e: case 0x5e:
-        /* Xeon Scalable */
-        case 0x55:
-        /* Cannon Lake */
-        case 0x66:
-        /* Goldmont Plus */
-        case 0x7a:
-        /* Ice Lake */
-        case 0x6a: case 0x6c: case 0x7d: case 0x7e:
-        /* Tiger Lake */
-        case 0x8c: case 0x8d:
-        /* Tremont */
-        case 0x86:
-        /* Kaby Lake */
-        case 0x8e: case 0x9e:
-        /* Comet Lake */
-        case 0xa5: case 0xa6:
-            return sk_lbr;
-        /* Atom */
-        case 0x1c: case 0x26: case 0x27: case 0x35: case 0x36:
-            return at_lbr;
-        /* Silvermont */
-        case 0x37: case 0x4a: case 0x4d: case 0x5a: case 0x5d:
-        /* Xeon Phi Knights Landing */
-        case 0x57:
-        /* Xeon Phi Knights Mill */
-        case 0x85:
-        /* Airmont */
-        case 0x4c:
-            return sm_lbr;
-        /* Goldmont */
-        case 0x5c: case 0x5f:
-            return gm_lbr;
-        }
-        break;
-
-    case 15:
-        switch ( boot_cpu_data.x86_model )
-        {
-        /* Pentium4/Xeon with em64t */
-        case 3: case 4: case 6:
-            return p4_lbr;
-        }
-        break;
-    }
-
-    return NULL;
-}
-
 enum
 {
     LBR_FORMAT_32                 = 0x0, /* 32-bit record format */
@@ -3224,7 +3226,7 @@ static void __init ler_to_fixup_check(void)
 
 static int is_last_branch_msr(u32 ecx)
 {
-    const struct lbr_info *lbr = last_branch_msr_get();
+    const struct lbr_info *lbr = model_specific_lbr;
 
     if ( lbr == NULL )
         return 0;
@@ -3563,7 +3565,7 @@ static int cf_check vmx_msr_write_intercept(
         if ( !(v->arch.hvm.vmx.lbr_flags & LBR_MSRS_INSERTED) &&
              (msr_content & IA32_DEBUGCTLMSR_LBR) )
         {
-            const struct lbr_info *lbr = last_branch_msr_get();
+            const struct lbr_info *lbr = model_specific_lbr;
 
             if ( unlikely(!lbr) )
             {
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.17


From xen-changelog-bounces@lists.xenproject.org Wed Feb 08 10:44:43 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 08 Feb 2023 10:44:43 +0000
Received: from list by lists.xenproject.org with outflank-mailman.491677.760891 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pPhwR-00030Z-8Y; Wed, 08 Feb 2023 10:44:43 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 491677.760891; Wed, 08 Feb 2023 10:44:43 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pPhwR-00030R-5x; Wed, 08 Feb 2023 10:44:43 +0000
Received: by outflank-mailman (input) for mailman id 491677;
 Wed, 08 Feb 2023 10:44:42 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pPhwQ-00030E-B5
 for xen-changelog@lists.xenproject.org; Wed, 08 Feb 2023 10:44:42 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pPhwQ-00077W-AK
 for xen-changelog@lists.xenproject.org; Wed, 08 Feb 2023 10:44:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pPhwQ-0005S5-9a
 for xen-changelog@lists.xenproject.org; Wed, 08 Feb 2023 10:44:42 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=RxJzHtlphTV9pJ4P0a4+9MX/QqqBx6l5lBkliOaNfq4=; b=en45OO41S2MwsFHIBjc1s1IeZp
	eco8x0vwZWEFVhmeP/hrx7MjF38FwoQ+YvesuhdOPGy8ZhOUysZct6IdtiONNqSdM7w5+nV3VmVay
	+3F66NhEZ3JWUsNY3WVF0gaeb7MIQvm5DgZnALLQE5Etm8QZG9/9RThXk1bTI9I2LaUI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.17] x86/vmx: Support for CPUs without model-specific LBR
Message-Id: <E1pPhwQ-0005S5-9a@xenbits.xenproject.org>
Date: Wed, 08 Feb 2023 10:44:42 +0000

commit e904d8ae01a0be53368c8c388f13bf4ffcbcdf6c
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Tue Feb 7 16:59:14 2023 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Feb 7 16:59:14 2023 +0100

    x86/vmx: Support for CPUs without model-specific LBR
    
    Ice Lake (server at least) has both architectural LBR and model-specific LBR.
    Sapphire Rapids does not have model-specific LBR at all.  I.e. On SPR and
    later, model_specific_lbr will always be NULL, so we must make changes to
    avoid reliably hitting the domain_crash().
    
    The Arch LBR spec states that CPUs without model-specific LBR implement
    MSR_DBG_CTL.LBR by discarding writes and always returning 0.
    
    Do this for any CPU for which we lack model-specific LBR information.
    
    Adjust the now-stale comment, now that the Arch LBR spec has created a way to
    signal "no model specific LBR" to guests.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Kevin Tian <kevin.tian@intel.com>
    master commit: 3edca52ce736297d7fcf293860cd94ef62638052
    master date: 2023-01-12 18:42:00 +0000
---
 xen/arch/x86/hvm/vmx/vmx.c | 31 ++++++++++++++++---------------
 1 file changed, 16 insertions(+), 15 deletions(-)

diff --git a/xen/arch/x86/hvm/vmx/vmx.c b/xen/arch/x86/hvm/vmx/vmx.c
index ad91464103..861f91f2af 100644
--- a/xen/arch/x86/hvm/vmx/vmx.c
+++ b/xen/arch/x86/hvm/vmx/vmx.c
@@ -3545,18 +3545,26 @@ static int cf_check vmx_msr_write_intercept(
         if ( msr_content & rsvd )
             goto gp_fault;
 
+        /*
+         * The Arch LBR spec (new in Ice Lake) states that CPUs with no
+         * model-specific LBRs implement MSR_DBG_CTL.LBR by discarding writes
+         * and always returning 0.
+         *
+         * Use this property in all cases where we don't know any
+         * model-specific LBR information, as it matches real hardware
+         * behaviour on post-Ice Lake systems.
+         */
+        if ( !model_specific_lbr )
+            msr_content &= ~IA32_DEBUGCTLMSR_LBR;
+
         /*
          * When a guest first enables LBR, arrange to save and restore the LBR
          * MSRs and allow the guest direct access.
          *
-         * MSR_DEBUGCTL and LBR has existed almost as long as MSRs have
-         * existed, and there is no architectural way to hide the feature, or
-         * fail the attempt to enable LBR.
-         *
-         * Unknown host LBR MSRs or hitting -ENOSPC with the guest load/save
-         * list are definitely hypervisor bugs, whereas -ENOMEM for allocating
-         * the load/save list is simply unlucky (and shouldn't occur with
-         * sensible management by the toolstack).
+         * Hitting -ENOSPC with the guest load/save list is definitely a
+         * hypervisor bug, whereas -ENOMEM for allocating the load/save list
+         * is simply unlucky (and shouldn't occur with sensible management by
+         * the toolstack).
          *
          * Either way, there is nothing we can do right now to recover, and
          * the guest won't execute correctly either.  Simply crash the domain
@@ -3567,13 +3575,6 @@ static int cf_check vmx_msr_write_intercept(
         {
             const struct lbr_info *lbr = model_specific_lbr;
 
-            if ( unlikely(!lbr) )
-            {
-                gprintk(XENLOG_ERR, "Unknown Host LBR MSRs\n");
-                domain_crash(v->domain);
-                return X86EMUL_OKAY;
-            }
-
             for ( ; lbr->count; lbr++ )
             {
                 unsigned int i;
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.17


From xen-changelog-bounces@lists.xenproject.org Wed Feb 08 10:44:53 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 08 Feb 2023 10:44:53 +0000
Received: from list by lists.xenproject.org with outflank-mailman.491678.760895 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pPhwb-00033B-AH; Wed, 08 Feb 2023 10:44:53 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 491678.760895; Wed, 08 Feb 2023 10: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 1pPhwb-000333-7P; Wed, 08 Feb 2023 10:44:53 +0000
Received: by outflank-mailman (input) for mailman id 491678;
 Wed, 08 Feb 2023 10:44:52 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pPhwa-00032v-E5
 for xen-changelog@lists.xenproject.org; Wed, 08 Feb 2023 10:44:52 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pPhwa-00077j-DR
 for xen-changelog@lists.xenproject.org; Wed, 08 Feb 2023 10:44:52 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pPhwa-0005SW-CZ
 for xen-changelog@lists.xenproject.org; Wed, 08 Feb 2023 10:44:52 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=8sb1YJRXKkmrwKnQfUznPfYulVIfY7DLo7e1CX+vMDw=; b=ifYwWRVhZrLjl0p1kM37rGhnmd
	YIc3YaJLa0+9R4PoKFBEbCivNarcxoUD9G0eDbhofDVcB4l8fnxk5KzPUp5BQiiYM3KkKVAOk1SRv
	9nRn5lxr0opAyGatnCOSh7HgPDeoZiIkZoFFebDKGIhqE4MWtY5viEQF2KT6MKIQBx2Q=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.17] x86/shadow: fix PAE check for top-level table unshadowing
Message-Id: <E1pPhwa-0005SW-CZ@xenbits.xenproject.org>
Date: Wed, 08 Feb 2023 10:44:52 +0000

commit 2d74e7035bd060d662f1c4f8522377be8021be92
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Feb 7 16:59:54 2023 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Feb 7 16:59:54 2023 +0100

    x86/shadow: fix PAE check for top-level table unshadowing
    
    Clearly within the for_each_vcpu() the vCPU of this loop is meant, not
    the (loop invariant) one the fault occurred on.
    
    Fixes: 3d5e6a3ff383 ("x86 hvm: implement HVMOP_pagetable_dying")
    Fixes: ef3b0d8d2c39 ("x86/shadow: shadow_table[] needs only one entry for PV-only configs")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
    master commit: f8fdceefbb1193ec81667eb40b83bc525cb71204
    master date: 2023-01-20 09:23:42 +0100
---
 xen/arch/x86/mm/shadow/multi.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/mm/shadow/multi.c b/xen/arch/x86/mm/shadow/multi.c
index 2370b30602..671bf8c228 100644
--- a/xen/arch/x86/mm/shadow/multi.c
+++ b/xen/arch/x86/mm/shadow/multi.c
@@ -2672,10 +2672,10 @@ static int cf_check sh_page_fault(
 #if GUEST_PAGING_LEVELS == 3
             unsigned int i;
 
-            for_each_shadow_table(v, i)
+            for_each_shadow_table(tmp, i)
             {
                 mfn_t smfn = pagetable_get_mfn(
-                                 v->arch.paging.shadow.shadow_table[i]);
+                                 tmp->arch.paging.shadow.shadow_table[i]);
 
                 if ( mfn_valid(smfn) && (mfn_x(smfn) != 0) )
                 {
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.17


From xen-changelog-bounces@lists.xenproject.org Wed Feb 08 10:45:03 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 08 Feb 2023 10:45:03 +0000
Received: from list by lists.xenproject.org with outflank-mailman.491679.760899 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pPhwl-00036Y-C7; Wed, 08 Feb 2023 10:45:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 491679.760899; Wed, 08 Feb 2023 10: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 1pPhwl-00036Q-9E; Wed, 08 Feb 2023 10:45:03 +0000
Received: by outflank-mailman (input) for mailman id 491679;
 Wed, 08 Feb 2023 10:45:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pPhwk-00036D-HC
 for xen-changelog@lists.xenproject.org; Wed, 08 Feb 2023 10:45:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pPhwk-00078O-GP
 for xen-changelog@lists.xenproject.org; Wed, 08 Feb 2023 10:45:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pPhwk-0005TG-Fd
 for xen-changelog@lists.xenproject.org; Wed, 08 Feb 2023 10:45:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=wLWAuMSD3QXlxnJCyFdGR8g3n4BZb9ElR+ikB0L7Hzk=; b=RSb+rqHNgATSiVowiRnCzyFljO
	0m7GVbqSeE59Hff/aF+wKBK+jPQoIzZ+WfvyC+TT0MGOfD22o+iIRVtnSba5yUMVbmploLqapfBGP
	/cgOGClxhai4bnJt1P7V8S/HtvQraZjlEsn3jKAU/nCBEPy5Te1m4LGzigLB13/LUN+M=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.17] build: fix building flask headers before descending in flask/ss/
Message-Id: <E1pPhwk-0005TG-Fd@xenbits.xenproject.org>
Date: Wed, 08 Feb 2023 10:45:02 +0000

commit 819a5d4ed8b79e21843d5960a7ab8fbd16f28233
Author:     Anthony PERARD <anthony.perard@citrix.com>
AuthorDate: Tue Feb 7 17:00:29 2023 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Feb 7 17:00:29 2023 +0100

    build: fix building flask headers before descending in flask/ss/
    
    Unfortunatly, adding prerequisite to "$(obj)/ss/built_in.o" doesn't
    work because we have "$(obj)/%/built_in.o: $(obj)/% ;" in Rules.mk.
    So, make is allow to try to build objects in "xsm/flask/ss/" before
    generating the headers.
    
    Adding a prerequisite on "$(obj)/ss" instead will fix the issue as
    that's the target used to run make in this subdirectory.
    
    Unfortunatly, that target is also used when running `make clean`, so
    we want to ignore it in this case. $(MAKECMDGOALS) can't be used in
    this case as it is empty, but we can guess which operation is done by
    looking at the list of loaded makefiles.
    
    Fixes: 7a3bcd2babcc ("build: build everything from the root dir, use obj=$subdir")
    Reported-by: "Daniel P. Smith" <dpsmith@apertussolutions.com>
    Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
    Acked-by: Daniel P. Smith <dpsmith@apertussolutions.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: d60324d8af9404014cfcc37bba09e9facfd02fcf
    master date: 2023-01-23 15:03:58 +0100
---
 xen/xsm/flask/Makefile | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/xen/xsm/flask/Makefile b/xen/xsm/flask/Makefile
index d25312f4fa..3fdcf7727e 100644
--- a/xen/xsm/flask/Makefile
+++ b/xen/xsm/flask/Makefile
@@ -16,7 +16,11 @@ FLASK_H_FILES := flask.h class_to_string.h initial_sid_to_string.h
 AV_H_FILES := av_perm_to_string.h av_permissions.h
 ALL_H_FILES := $(addprefix include/,$(FLASK_H_FILES) $(AV_H_FILES))
 
-$(addprefix $(obj)/,$(obj-y)) $(obj)/ss/built_in.o: $(addprefix $(obj)/,$(ALL_H_FILES))
+# Adding prerequisite to descending into ss/ folder only when not running
+# `make *clean`.
+ifeq ($(filter %/Makefile.clean,$(MAKEFILE_LIST)),)
+$(addprefix $(obj)/,$(obj-y)) $(obj)/ss: $(addprefix $(obj)/,$(ALL_H_FILES))
+endif
 extra-y += $(ALL_H_FILES)
 
 mkflask := $(srcdir)/policy/mkflask.sh
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.17


From xen-changelog-bounces@lists.xenproject.org Wed Feb 08 10:45:13 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 08 Feb 2023 10:45:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.491680.760903 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pPhwv-0003EZ-F4; Wed, 08 Feb 2023 10:45:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 491680.760903; Wed, 08 Feb 2023 10: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 1pPhwv-0003EQ-CK; Wed, 08 Feb 2023 10:45:13 +0000
Received: by outflank-mailman (input) for mailman id 491680;
 Wed, 08 Feb 2023 10:45:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pPhwu-0003AK-K7
 for xen-changelog@lists.xenproject.org; Wed, 08 Feb 2023 10:45:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pPhwu-00078b-JP
 for xen-changelog@lists.xenproject.org; Wed, 08 Feb 2023 10:45:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pPhwu-0005Tv-IZ
 for xen-changelog@lists.xenproject.org; Wed, 08 Feb 2023 10:45:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=xiKsBbjAdlJ6Tp2ZgO/oqP0J/9+y0iA8PHFGLg50sn0=; b=Cbm8rP1bBCpeZIeAubuV1UhWka
	ZaQb0rmu25CX0gglQ0OmMXiQY6eV7fCA820H57q5EqXQSfeBrMOoU6OWQooCz1uo+b7I2WJD25ybB
	1jUjCfHAw+qgtimVkNRfIZjAAeEf9u87zWVH98MymgOC3AbeuiASD3YZFWq6Ugs58IJ0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.17] ns16550: fix an incorrect assignment to uart->io_size
Message-Id: <E1pPhwu-0005Tv-IZ@xenbits.xenproject.org>
Date: Wed, 08 Feb 2023 10:45:12 +0000

commit d0127881376baeea1e4eb71d0f7b56d942147124
Author:     Ayan Kumar Halder <ayan.kumar.halder@amd.com>
AuthorDate: Tue Feb 7 17:00:47 2023 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Feb 7 17:00:47 2023 +0100

    ns16550: fix an incorrect assignment to uart->io_size
    
    uart->io_size represents the size in bytes. Thus, when serial_port.bit_width
    is assigned to it, it should be converted to size in bytes.
    
    Fixes: 17b516196c ("ns16550: add ACPI support for ARM only")
    Reported-by: Jan Beulich <jbeulich@suse.com>
    Signed-off-by: Ayan Kumar Halder <ayan.kumar.halder@amd.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
    master commit: 352c89f72ddb67b8d9d4e492203f8c77f85c8df1
    master date: 2023-01-24 16:54:38 +0100
---
 xen/drivers/char/ns16550.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/drivers/char/ns16550.c b/xen/drivers/char/ns16550.c
index 01a05c9aa8..ce013fb6a5 100644
--- a/xen/drivers/char/ns16550.c
+++ b/xen/drivers/char/ns16550.c
@@ -1875,7 +1875,7 @@ static int __init ns16550_acpi_uart_init(const void *data)
     uart->parity = spcr->parity;
     uart->stop_bits = spcr->stop_bits;
     uart->io_base = spcr->serial_port.address;
-    uart->io_size = spcr->serial_port.bit_width;
+    uart->io_size = DIV_ROUND_UP(spcr->serial_port.bit_width, BITS_PER_BYTE);
     uart->reg_shift = spcr->serial_port.bit_offset;
     uart->reg_width = spcr->serial_port.access_width;
 
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.17


From xen-changelog-bounces@lists.xenproject.org Wed Feb 08 10:45:23 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 08 Feb 2023 10:45:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.491681.760908 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pPhx5-0003Ij-Gr; Wed, 08 Feb 2023 10:45:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 491681.760908; Wed, 08 Feb 2023 10: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 1pPhx5-0003IG-Dk; Wed, 08 Feb 2023 10:45:23 +0000
Received: by outflank-mailman (input) for mailman id 491681;
 Wed, 08 Feb 2023 10:45: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 1pPhx4-0003H9-NY
 for xen-changelog@lists.xenproject.org; Wed, 08 Feb 2023 10:45:22 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pPhx4-0007AL-Mg
 for xen-changelog@lists.xenproject.org; Wed, 08 Feb 2023 10:45:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pPhx4-0005UQ-Lv
 for xen-changelog@lists.xenproject.org; Wed, 08 Feb 2023 10: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=TiIvmHwEOhAn0KTpC1n7QM1tkqDufMKX/eocnb/pWeI=; b=L7kQvhccW436rKPpg9M1n0RPuW
	BZzhO2yQ/FbxaQA4r7lVXunLR8eFQ/khTwng5YSIYMX2WscfezhWeSfoCiNRAIEP8b/3A+Dh3+0Mr
	3o2WYdrw+4St4iP2Nr2WAJxYdH+4YHwedKB1YNTm/AFdfrhYUi+jAiI03TwqqgWB/+gc=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.17] libxl: fix guest kexec - skip cpuid policy
Message-Id: <E1pPhx4-0005UQ-Lv@xenbits.xenproject.org>
Date: Wed, 08 Feb 2023 10:45:22 +0000

commit 3dae50283d9819c691a97f15b133124c00d39a2f
Author:     Jason Andryuk <jandryuk@gmail.com>
AuthorDate: Tue Feb 7 17:01:49 2023 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Feb 7 17:01:49 2023 +0100

    libxl: fix guest kexec - skip cpuid policy
    
    When a domain performs a kexec (soft reset), libxl__build_pre() is
    called with the existing domid.  Calling libxl__cpuid_legacy() on the
    existing domain fails since the cpuid policy has already been set, and
    the guest isn't rebuilt and doesn't kexec.
    
    xc: error: Failed to set d1's policy (err leaf 0xffffffff, subleaf 0xffffffff, msr 0xffffffff) (17 = File exists): Internal error
    libxl: error: libxl_cpuid.c:494:libxl__cpuid_legacy: Domain 1:Failed to apply CPUID policy: File exists
    libxl: error: libxl_create.c:1641:domcreate_rebuild_done: Domain 1:cannot (re-)build domain: -3
    libxl: error: libxl_xshelp.c:201:libxl__xs_read_mandatory: xenstore read failed: `/libxl/1/type': No such file or directory
    libxl: warning: libxl_dom.c:49:libxl__domain_type: unable to get domain type for domid=1, assuming HVM
    
    During a soft_reset, skip calling libxl__cpuid_legacy() to avoid the
    issue.  Before commit 34990446ca91, the libxl__cpuid_legacy() failure
    would have been ignored, so kexec would continue.
    
    Fixes: 34990446ca91 ("libxl: don't ignore the return value from xc_cpuid_apply_policy")
    Signed-off-by: Jason Andryuk <jandryuk@gmail.com>
    Reviewed-by: Anthony PERARD <anthony.perard@citrix.com>
    master commit: 1e454c2b5b1172e0fc7457e411ebaba61db8fc87
    master date: 2023-01-26 10:58:23 +0100
---
 tools/libs/light/libxl_create.c   | 2 ++
 tools/libs/light/libxl_dom.c      | 2 +-
 tools/libs/light/libxl_internal.h | 1 +
 3 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/tools/libs/light/libxl_create.c b/tools/libs/light/libxl_create.c
index 612eacfc7f..dbee32b7b7 100644
--- a/tools/libs/light/libxl_create.c
+++ b/tools/libs/light/libxl_create.c
@@ -2203,6 +2203,8 @@ static int do_domain_soft_reset(libxl_ctx *ctx,
                               aop_console_how);
     cdcs->domid_out = &domid_out;
 
+    state->soft_reset = true;
+
     dom_path = libxl__xs_get_dompath(gc, domid);
     if (!dom_path) {
         LOGD(ERROR, domid, "failed to read domain path");
diff --git a/tools/libs/light/libxl_dom.c b/tools/libs/light/libxl_dom.c
index b454f988fb..f6311eea6e 100644
--- a/tools/libs/light/libxl_dom.c
+++ b/tools/libs/light/libxl_dom.c
@@ -382,7 +382,7 @@ int libxl__build_pre(libxl__gc *gc, uint32_t domid,
     /* Construct a CPUID policy, but only for brand new domains.  Domains
      * being migrated-in/restored have CPUID handled during the
      * static_data_done() callback. */
-    if (!state->restore)
+    if (!state->restore && !state->soft_reset)
         rc = libxl__cpuid_legacy(ctx, domid, false, info);
 
 out:
diff --git a/tools/libs/light/libxl_internal.h b/tools/libs/light/libxl_internal.h
index a7c447c10e..cae160351f 100644
--- a/tools/libs/light/libxl_internal.h
+++ b/tools/libs/light/libxl_internal.h
@@ -1406,6 +1406,7 @@ typedef struct {
     /* Whether this domain is being migrated/restored, or booting fresh.  Only
      * applicable to the primary domain, not support domains (e.g. stub QEMU). */
     bool restore;
+    bool soft_reset;
 } libxl__domain_build_state;
 
 _hidden void libxl__domain_build_state_init(libxl__domain_build_state *s);
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.17


From xen-changelog-bounces@lists.xenproject.org Wed Feb 08 11:55:08 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 08 Feb 2023 11:55:08 +0000
Received: from list by lists.xenproject.org with outflank-mailman.491693.760922 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pPj2U-0002st-NS; Wed, 08 Feb 2023 11:55:02 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 491693.760922; Wed, 08 Feb 2023 11: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 1pPj2U-0002sk-KS; Wed, 08 Feb 2023 11:55:02 +0000
Received: by outflank-mailman (input) for mailman id 491693;
 Wed, 08 Feb 2023 11: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 1pPj2T-0002se-PW
 for xen-changelog@lists.xenproject.org; Wed, 08 Feb 2023 11:55:01 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pPj2T-0000dJ-Ny
 for xen-changelog@lists.xenproject.org; Wed, 08 Feb 2023 11:55:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pPj2T-0008Gb-Ml
 for xen-changelog@lists.xenproject.org; Wed, 08 Feb 2023 11:55:01 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=BC6+sOUW+ZIygqne9mZUZnHabvSKTcx8nNbz1K2V+JM=; b=J0EpzERYmCTm/hkNY16pzKAuUN
	95wCxamvaYoSVlC78CJKyRcHRruN5Wlxil1QE2IQFdI58b0XsSQrh+az04I8nT0H0dJzXlWyTRTmI
	bClTYXhCZSRKcTND0td4k9zmJfdex0J5xUX5bj0WFrpnwrzS/yVaTNz/cuB+1UQGefP8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.16] x86/S3: Restore Xen's MSR_PAT value on S3 resume
Message-Id: <E1pPj2T-0008Gb-Ml@xenbits.xenproject.org>
Date: Wed, 08 Feb 2023 11:55:01 +0000

commit 7b1b9849e8a0d7791866d6d21c45993dfe27836c
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Tue Feb 7 17:03:09 2023 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Feb 7 17:03:09 2023 +0100

    x86/S3: Restore Xen's MSR_PAT value on S3 resume
    
    There are two paths in the trampoline, and Xen's PAT needs setting up in both,
    not just the boot path.
    
    Fixes: 4304ff420e51 ("x86/S3: Drop {save,restore}_rest_processor_state() completely")
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 4d975798e11579fdf405b348543061129e01b0fb
    master date: 2023-01-10 21:21:30 +0000
---
 xen/arch/x86/boot/wakeup.S | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/xen/arch/x86/boot/wakeup.S b/xen/arch/x86/boot/wakeup.S
index c17d613b61..08447e1934 100644
--- a/xen/arch/x86/boot/wakeup.S
+++ b/xen/arch/x86/boot/wakeup.S
@@ -130,6 +130,11 @@ wakeup_32:
         and     %edi, %edx
         wrmsr
 1:
+        /* Set up PAT before enabling paging. */
+        mov     $XEN_MSR_PAT & 0xffffffff, %eax
+        mov     $XEN_MSR_PAT >> 32, %edx
+        mov     $MSR_IA32_CR_PAT, %ecx
+        wrmsr
 
         /* Set up EFER (Extended Feature Enable Register). */
         movl    $MSR_EFER,%ecx
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.16


From xen-changelog-bounces@lists.xenproject.org Wed Feb 08 11:55:12 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 08 Feb 2023 11:55:12 +0000
Received: from list by lists.xenproject.org with outflank-mailman.491694.760926 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pPj2e-0002w7-PA; Wed, 08 Feb 2023 11:55:12 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 491694.760926; Wed, 08 Feb 2023 11: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 1pPj2e-0002vz-M2; Wed, 08 Feb 2023 11:55:12 +0000
Received: by outflank-mailman (input) for mailman id 491694;
 Wed, 08 Feb 2023 11: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 1pPj2d-0002uV-S6
 for xen-changelog@lists.xenproject.org; Wed, 08 Feb 2023 11:55:11 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pPj2d-0000dk-RC
 for xen-changelog@lists.xenproject.org; Wed, 08 Feb 2023 11:55:11 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pPj2d-0008H3-Q8
 for xen-changelog@lists.xenproject.org; Wed, 08 Feb 2023 11:55:11 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=QP8WXrgTH7mfxyodIzXku95F2N+Re/ChwOW/zx4O+Uw=; b=oDdjJzoOIRDWkMLJ5nJuz8c16x
	jvrxEXEghEhJqEci9z4sfj22yF6Dyde8QXuMDaSlpjMj9bUd6KF00EjkJ0Z1yC3YTgUyhCZ3n4qYX
	ui6iMYXdfTOs0lJ0+qjGZgnZIbIQ47zbCikCIrBJ7YcAzZXiMqYEwiVd0OjfLF8BnqP0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.16] tools: Fix build with recent QEMU, use "--enable-trace-backends"
Message-Id: <E1pPj2d-0008H3-Q8@xenbits.xenproject.org>
Date: Wed, 08 Feb 2023 11:55:11 +0000

commit 998c03b2abfbf17ff96bccad1512de1ea18d0d75
Author:     Anthony PERARD <anthony.perard@citrix.com>
AuthorDate: Tue Feb 7 17:03:51 2023 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Feb 7 17:03:51 2023 +0100

    tools: Fix build with recent QEMU, use "--enable-trace-backends"
    
    The configure option "--enable-trace-backend" isn't accepted anymore
    and we should use "--enable-trace-backends" instead which was
    introduce in 2014 and allow multiple backends.
    
    "--enable-trace-backends" was introduced by:
        5b808275f3bb ("trace: Multi-backend tracing")
    The backward compatible option "--enable-trace-backend" is removed by
        10229ec3b0ff ("configure: remove backwards-compatibility and obsolete options")
    
    As we already use ./configure options that wouldn't be accepted by
    older version of QEMU's configure, we will simply use the new spelling
    for the option and avoid trying to detect which spelling to use.
    
    We already make use if "--firmwarepath=" which was introduced by
        3d5eecab4a5a ("Add --firmwarepath to configure")
    which already include the new spelling for "--enable-trace-backends".
    
    Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
    Reviewed-by: Jason Andryuk <jandryuk@gmail.com>
    master commit: e66d450b6e0ffec635639df993ab43ce28b3383f
    master date: 2023-01-11 10:45:29 +0100
---
 tools/Makefile | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/Makefile b/tools/Makefile
index 757a560be0..9b6b605ec9 100644
--- a/tools/Makefile
+++ b/tools/Makefile
@@ -218,9 +218,9 @@ subdir-all-qemu-xen-dir: qemu-xen-dir-find
 	mkdir -p qemu-xen-build; \
 	cd qemu-xen-build; \
 	if $$source/scripts/tracetool.py --check-backend --backend log ; then \
-		enable_trace_backend='--enable-trace-backend=log'; \
+		enable_trace_backend="--enable-trace-backends=log"; \
 	elif $$source/scripts/tracetool.py --check-backend --backend stderr ; then \
-		enable_trace_backend='--enable-trace-backend=stderr'; \
+		enable_trace_backend='--enable-trace-backends=stderr'; \
 	else \
 		enable_trace_backend='' ; \
 	fi ; \
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.16


From xen-changelog-bounces@lists.xenproject.org Wed Feb 08 11:55:23 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 08 Feb 2023 11:55:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.491695.760930 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pPj2p-00034R-QN; Wed, 08 Feb 2023 11:55:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 491695.760930; Wed, 08 Feb 2023 11: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 1pPj2p-00034J-Na; Wed, 08 Feb 2023 11:55:23 +0000
Received: by outflank-mailman (input) for mailman id 491695;
 Wed, 08 Feb 2023 11: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 1pPj2n-000347-VO
 for xen-changelog@lists.xenproject.org; Wed, 08 Feb 2023 11:55:21 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pPj2n-0000fa-UG
 for xen-changelog@lists.xenproject.org; Wed, 08 Feb 2023 11:55:21 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pPj2n-0008Hh-TS
 for xen-changelog@lists.xenproject.org; Wed, 08 Feb 2023 11:55:21 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=RTsPKJHyUEb0Z4E0USP1n6ul6DYqqfB9Z6CQciUJjyU=; b=iRN4+PVsQca9ePbSf9EDtamz8d
	o7sspnqs3izCY9T23mNTvo2J3Fq1t4oIV1Bu92QzLaBpdjTdR24vJ5Km4xZvTjIs8JSy7n2EmOmML
	6ODxBTRQS8BalOvFORjiJoR7mbyRKyehO+EjBX/RzXDuRQrFD4uWVvF1EoA8hQgDK1SA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.16] x86/vmx: Calculate model-specific LBRs once at start of day
Message-Id: <E1pPj2n-0008Hh-TS@xenbits.xenproject.org>
Date: Wed, 08 Feb 2023 11:55:21 +0000

commit 401e9e33a04c2a9887636ef58490c764543f0538
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Tue Feb 7 17:04:18 2023 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Feb 7 17:04:18 2023 +0100

    x86/vmx: Calculate model-specific LBRs once at start of day
    
    There is no point repeating this calculation at runtime, especially as it is
    in the fallback path of the WRSMR/RDMSR handlers.
    
    Move the infrastructure higher in vmx.c to avoid forward declarations,
    renaming last_branch_msr_get() to get_model_specific_lbr() to highlight that
    these are model-specific only.
    
    No practical change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Kevin Tian <kevin.tian@intel.com>
    master commit: e94af0d58f86c3a914b9cbbf4d9ed3d43b974771
    master date: 2023-01-12 18:42:00 +0000
---
 xen/arch/x86/hvm/vmx/vmx.c | 276 +++++++++++++++++++++++----------------------
 1 file changed, 139 insertions(+), 137 deletions(-)

diff --git a/xen/arch/x86/hvm/vmx/vmx.c b/xen/arch/x86/hvm/vmx/vmx.c
index 3f42765313..bc308d9df2 100644
--- a/xen/arch/x86/hvm/vmx/vmx.c
+++ b/xen/arch/x86/hvm/vmx/vmx.c
@@ -394,6 +394,142 @@ void vmx_pi_hooks_deassign(struct domain *d)
     domain_unpause(d);
 }
 
+static const struct lbr_info {
+    u32 base, count;
+} p4_lbr[] = {
+    { MSR_P4_LER_FROM_LIP,          1 },
+    { MSR_P4_LER_TO_LIP,            1 },
+    { MSR_P4_LASTBRANCH_TOS,        1 },
+    { MSR_P4_LASTBRANCH_0_FROM_LIP, NUM_MSR_P4_LASTBRANCH_FROM_TO },
+    { MSR_P4_LASTBRANCH_0_TO_LIP,   NUM_MSR_P4_LASTBRANCH_FROM_TO },
+    { 0, 0 }
+}, c2_lbr[] = {
+    { MSR_IA32_LASTINTFROMIP,       1 },
+    { MSR_IA32_LASTINTTOIP,         1 },
+    { MSR_C2_LASTBRANCH_TOS,        1 },
+    { MSR_C2_LASTBRANCH_0_FROM_IP,  NUM_MSR_C2_LASTBRANCH_FROM_TO },
+    { MSR_C2_LASTBRANCH_0_TO_IP,    NUM_MSR_C2_LASTBRANCH_FROM_TO },
+    { 0, 0 }
+}, nh_lbr[] = {
+    { MSR_IA32_LASTINTFROMIP,       1 },
+    { MSR_IA32_LASTINTTOIP,         1 },
+    { MSR_NHL_LBR_SELECT,           1 },
+    { MSR_NHL_LASTBRANCH_TOS,       1 },
+    { MSR_P4_LASTBRANCH_0_FROM_LIP, NUM_MSR_P4_LASTBRANCH_FROM_TO },
+    { MSR_P4_LASTBRANCH_0_TO_LIP,   NUM_MSR_P4_LASTBRANCH_FROM_TO },
+    { 0, 0 }
+}, sk_lbr[] = {
+    { MSR_IA32_LASTINTFROMIP,       1 },
+    { MSR_IA32_LASTINTTOIP,         1 },
+    { MSR_NHL_LBR_SELECT,           1 },
+    { MSR_NHL_LASTBRANCH_TOS,       1 },
+    { MSR_SKL_LASTBRANCH_0_FROM_IP, NUM_MSR_SKL_LASTBRANCH },
+    { MSR_SKL_LASTBRANCH_0_TO_IP,   NUM_MSR_SKL_LASTBRANCH },
+    { MSR_SKL_LASTBRANCH_0_INFO,    NUM_MSR_SKL_LASTBRANCH },
+    { 0, 0 }
+}, at_lbr[] = {
+    { MSR_IA32_LASTINTFROMIP,       1 },
+    { MSR_IA32_LASTINTTOIP,         1 },
+    { MSR_C2_LASTBRANCH_TOS,        1 },
+    { MSR_C2_LASTBRANCH_0_FROM_IP,  NUM_MSR_ATOM_LASTBRANCH_FROM_TO },
+    { MSR_C2_LASTBRANCH_0_TO_IP,    NUM_MSR_ATOM_LASTBRANCH_FROM_TO },
+    { 0, 0 }
+}, sm_lbr[] = {
+    { MSR_IA32_LASTINTFROMIP,       1 },
+    { MSR_IA32_LASTINTTOIP,         1 },
+    { MSR_SM_LBR_SELECT,            1 },
+    { MSR_SM_LASTBRANCH_TOS,        1 },
+    { MSR_C2_LASTBRANCH_0_FROM_IP,  NUM_MSR_ATOM_LASTBRANCH_FROM_TO },
+    { MSR_C2_LASTBRANCH_0_TO_IP,    NUM_MSR_ATOM_LASTBRANCH_FROM_TO },
+    { 0, 0 }
+}, gm_lbr[] = {
+    { MSR_IA32_LASTINTFROMIP,       1 },
+    { MSR_IA32_LASTINTTOIP,         1 },
+    { MSR_SM_LBR_SELECT,            1 },
+    { MSR_SM_LASTBRANCH_TOS,        1 },
+    { MSR_GM_LASTBRANCH_0_FROM_IP,  NUM_MSR_GM_LASTBRANCH_FROM_TO },
+    { MSR_GM_LASTBRANCH_0_TO_IP,    NUM_MSR_GM_LASTBRANCH_FROM_TO },
+    { 0, 0 }
+};
+static const struct lbr_info *__read_mostly model_specific_lbr;
+
+static const struct lbr_info *__init get_model_specific_lbr(void)
+{
+    switch ( boot_cpu_data.x86 )
+    {
+    case 6:
+        switch ( boot_cpu_data.x86_model )
+        {
+        /* Core2 Duo */
+        case 0x0f:
+        /* Enhanced Core */
+        case 0x17:
+        /* Xeon 7400 */
+        case 0x1d:
+            return c2_lbr;
+        /* Nehalem */
+        case 0x1a: case 0x1e: case 0x1f: case 0x2e:
+        /* Westmere */
+        case 0x25: case 0x2c: case 0x2f:
+        /* Sandy Bridge */
+        case 0x2a: case 0x2d:
+        /* Ivy Bridge */
+        case 0x3a: case 0x3e:
+        /* Haswell */
+        case 0x3c: case 0x3f: case 0x45: case 0x46:
+        /* Broadwell */
+        case 0x3d: case 0x47: case 0x4f: case 0x56:
+            return nh_lbr;
+        /* Skylake */
+        case 0x4e: case 0x5e:
+        /* Xeon Scalable */
+        case 0x55:
+        /* Cannon Lake */
+        case 0x66:
+        /* Goldmont Plus */
+        case 0x7a:
+        /* Ice Lake */
+        case 0x6a: case 0x6c: case 0x7d: case 0x7e:
+        /* Tiger Lake */
+        case 0x8c: case 0x8d:
+        /* Tremont */
+        case 0x86:
+        /* Kaby Lake */
+        case 0x8e: case 0x9e:
+        /* Comet Lake */
+        case 0xa5: case 0xa6:
+            return sk_lbr;
+        /* Atom */
+        case 0x1c: case 0x26: case 0x27: case 0x35: case 0x36:
+            return at_lbr;
+        /* Silvermont */
+        case 0x37: case 0x4a: case 0x4d: case 0x5a: case 0x5d:
+        /* Xeon Phi Knights Landing */
+        case 0x57:
+        /* Xeon Phi Knights Mill */
+        case 0x85:
+        /* Airmont */
+        case 0x4c:
+            return sm_lbr;
+        /* Goldmont */
+        case 0x5c: case 0x5f:
+            return gm_lbr;
+        }
+        break;
+
+    case 15:
+        switch ( boot_cpu_data.x86_model )
+        {
+        /* Pentium4/Xeon with em64t */
+        case 3: case 4: case 6:
+            return p4_lbr;
+        }
+        break;
+    }
+
+    return NULL;
+}
+
 static int vmx_domain_initialise(struct domain *d)
 {
     static const struct arch_csw csw = {
@@ -2812,6 +2948,7 @@ const struct hvm_function_table * __init start_vmx(void)
         vmx_function_table.get_guest_bndcfgs = vmx_get_guest_bndcfgs;
     }
 
+    model_specific_lbr = get_model_specific_lbr();
     lbr_tsx_fixup_check();
     ler_to_fixup_check();
 
@@ -2958,141 +3095,6 @@ static int vmx_cr_access(cr_access_qual_t qual)
     return X86EMUL_OKAY;
 }
 
-static const struct lbr_info {
-    u32 base, count;
-} p4_lbr[] = {
-    { MSR_P4_LER_FROM_LIP,          1 },
-    { MSR_P4_LER_TO_LIP,            1 },
-    { MSR_P4_LASTBRANCH_TOS,        1 },
-    { MSR_P4_LASTBRANCH_0_FROM_LIP, NUM_MSR_P4_LASTBRANCH_FROM_TO },
-    { MSR_P4_LASTBRANCH_0_TO_LIP,   NUM_MSR_P4_LASTBRANCH_FROM_TO },
-    { 0, 0 }
-}, c2_lbr[] = {
-    { MSR_IA32_LASTINTFROMIP,       1 },
-    { MSR_IA32_LASTINTTOIP,         1 },
-    { MSR_C2_LASTBRANCH_TOS,        1 },
-    { MSR_C2_LASTBRANCH_0_FROM_IP,  NUM_MSR_C2_LASTBRANCH_FROM_TO },
-    { MSR_C2_LASTBRANCH_0_TO_IP,    NUM_MSR_C2_LASTBRANCH_FROM_TO },
-    { 0, 0 }
-}, nh_lbr[] = {
-    { MSR_IA32_LASTINTFROMIP,       1 },
-    { MSR_IA32_LASTINTTOIP,         1 },
-    { MSR_NHL_LBR_SELECT,           1 },
-    { MSR_NHL_LASTBRANCH_TOS,       1 },
-    { MSR_P4_LASTBRANCH_0_FROM_LIP, NUM_MSR_P4_LASTBRANCH_FROM_TO },
-    { MSR_P4_LASTBRANCH_0_TO_LIP,   NUM_MSR_P4_LASTBRANCH_FROM_TO },
-    { 0, 0 }
-}, sk_lbr[] = {
-    { MSR_IA32_LASTINTFROMIP,       1 },
-    { MSR_IA32_LASTINTTOIP,         1 },
-    { MSR_NHL_LBR_SELECT,           1 },
-    { MSR_NHL_LASTBRANCH_TOS,       1 },
-    { MSR_SKL_LASTBRANCH_0_FROM_IP, NUM_MSR_SKL_LASTBRANCH },
-    { MSR_SKL_LASTBRANCH_0_TO_IP,   NUM_MSR_SKL_LASTBRANCH },
-    { MSR_SKL_LASTBRANCH_0_INFO,    NUM_MSR_SKL_LASTBRANCH },
-    { 0, 0 }
-}, at_lbr[] = {
-    { MSR_IA32_LASTINTFROMIP,       1 },
-    { MSR_IA32_LASTINTTOIP,         1 },
-    { MSR_C2_LASTBRANCH_TOS,        1 },
-    { MSR_C2_LASTBRANCH_0_FROM_IP,  NUM_MSR_ATOM_LASTBRANCH_FROM_TO },
-    { MSR_C2_LASTBRANCH_0_TO_IP,    NUM_MSR_ATOM_LASTBRANCH_FROM_TO },
-    { 0, 0 }
-}, sm_lbr[] = {
-    { MSR_IA32_LASTINTFROMIP,       1 },
-    { MSR_IA32_LASTINTTOIP,         1 },
-    { MSR_SM_LBR_SELECT,            1 },
-    { MSR_SM_LASTBRANCH_TOS,        1 },
-    { MSR_C2_LASTBRANCH_0_FROM_IP,  NUM_MSR_ATOM_LASTBRANCH_FROM_TO },
-    { MSR_C2_LASTBRANCH_0_TO_IP,    NUM_MSR_ATOM_LASTBRANCH_FROM_TO },
-    { 0, 0 }
-}, gm_lbr[] = {
-    { MSR_IA32_LASTINTFROMIP,       1 },
-    { MSR_IA32_LASTINTTOIP,         1 },
-    { MSR_SM_LBR_SELECT,            1 },
-    { MSR_SM_LASTBRANCH_TOS,        1 },
-    { MSR_GM_LASTBRANCH_0_FROM_IP,  NUM_MSR_GM_LASTBRANCH_FROM_TO },
-    { MSR_GM_LASTBRANCH_0_TO_IP,    NUM_MSR_GM_LASTBRANCH_FROM_TO },
-    { 0, 0 }
-};
-
-static const struct lbr_info *last_branch_msr_get(void)
-{
-    switch ( boot_cpu_data.x86 )
-    {
-    case 6:
-        switch ( boot_cpu_data.x86_model )
-        {
-        /* Core2 Duo */
-        case 0x0f:
-        /* Enhanced Core */
-        case 0x17:
-        /* Xeon 7400 */
-        case 0x1d:
-            return c2_lbr;
-        /* Nehalem */
-        case 0x1a: case 0x1e: case 0x1f: case 0x2e:
-        /* Westmere */
-        case 0x25: case 0x2c: case 0x2f:
-        /* Sandy Bridge */
-        case 0x2a: case 0x2d:
-        /* Ivy Bridge */
-        case 0x3a: case 0x3e:
-        /* Haswell */
-        case 0x3c: case 0x3f: case 0x45: case 0x46:
-        /* Broadwell */
-        case 0x3d: case 0x47: case 0x4f: case 0x56:
-            return nh_lbr;
-        /* Skylake */
-        case 0x4e: case 0x5e:
-        /* Xeon Scalable */
-        case 0x55:
-        /* Cannon Lake */
-        case 0x66:
-        /* Goldmont Plus */
-        case 0x7a:
-        /* Ice Lake */
-        case 0x6a: case 0x6c: case 0x7d: case 0x7e:
-        /* Tiger Lake */
-        case 0x8c: case 0x8d:
-        /* Tremont */
-        case 0x86:
-        /* Kaby Lake */
-        case 0x8e: case 0x9e:
-        /* Comet Lake */
-        case 0xa5: case 0xa6:
-            return sk_lbr;
-        /* Atom */
-        case 0x1c: case 0x26: case 0x27: case 0x35: case 0x36:
-            return at_lbr;
-        /* Silvermont */
-        case 0x37: case 0x4a: case 0x4d: case 0x5a: case 0x5d:
-        /* Xeon Phi Knights Landing */
-        case 0x57:
-        /* Xeon Phi Knights Mill */
-        case 0x85:
-        /* Airmont */
-        case 0x4c:
-            return sm_lbr;
-        /* Goldmont */
-        case 0x5c: case 0x5f:
-            return gm_lbr;
-        }
-        break;
-
-    case 15:
-        switch ( boot_cpu_data.x86_model )
-        {
-        /* Pentium4/Xeon with em64t */
-        case 3: case 4: case 6:
-            return p4_lbr;
-        }
-        break;
-    }
-
-    return NULL;
-}
-
 enum
 {
     LBR_FORMAT_32                 = 0x0, /* 32-bit record format */
@@ -3199,7 +3201,7 @@ static void __init ler_to_fixup_check(void)
 
 static int is_last_branch_msr(u32 ecx)
 {
-    const struct lbr_info *lbr = last_branch_msr_get();
+    const struct lbr_info *lbr = model_specific_lbr;
 
     if ( lbr == NULL )
         return 0;
@@ -3536,7 +3538,7 @@ static int vmx_msr_write_intercept(unsigned int msr, uint64_t msr_content)
         if ( !(v->arch.hvm.vmx.lbr_flags & LBR_MSRS_INSERTED) &&
              (msr_content & IA32_DEBUGCTLMSR_LBR) )
         {
-            const struct lbr_info *lbr = last_branch_msr_get();
+            const struct lbr_info *lbr = model_specific_lbr;
 
             if ( unlikely(!lbr) )
             {
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.16


From xen-changelog-bounces@lists.xenproject.org Wed Feb 08 11:55:33 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 08 Feb 2023 11:55:33 +0000
Received: from list by lists.xenproject.org with outflank-mailman.491696.760934 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pPj2z-00037i-Tr; Wed, 08 Feb 2023 11:55:33 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 491696.760934; Wed, 08 Feb 2023 11: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 1pPj2z-00037a-R3; Wed, 08 Feb 2023 11:55:33 +0000
Received: by outflank-mailman (input) for mailman id 491696;
 Wed, 08 Feb 2023 11: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 1pPj2y-00037M-21
 for xen-changelog@lists.xenproject.org; Wed, 08 Feb 2023 11:55:32 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pPj2y-0000fv-1I
 for xen-changelog@lists.xenproject.org; Wed, 08 Feb 2023 11:55:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pPj2y-0008IM-0N
 for xen-changelog@lists.xenproject.org; Wed, 08 Feb 2023 11:55:32 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Q/TAoDOzHHmeZNaxCPsVDkYst7dOq3o9UlnXgu9aZSM=; b=bfsENKnEuEnOtBiua9kpPhaWVQ
	FwxBpABa4Y4yrJ5jjGC4sd87dPPpkiWaSzkrgtx2N7p909NuJOPPYoFqoYC44yQb6J2AWp/1CF5Zg
	MZzIJLFimc3ewP2uHDWd/WH7rODSP52O/SMRofbN8PtlhMykkkqTbE7czz/CRyz3PgSE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.16] x86/vmx: Support for CPUs without model-specific LBR
Message-Id: <E1pPj2y-0008IM-0N@xenbits.xenproject.org>
Date: Wed, 08 Feb 2023 11:55:32 +0000

commit 9f425039ca50e8cc8db350ec54d8a7cd4175f417
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Tue Feb 7 17:04:49 2023 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Feb 7 17:04:49 2023 +0100

    x86/vmx: Support for CPUs without model-specific LBR
    
    Ice Lake (server at least) has both architectural LBR and model-specific LBR.
    Sapphire Rapids does not have model-specific LBR at all.  I.e. On SPR and
    later, model_specific_lbr will always be NULL, so we must make changes to
    avoid reliably hitting the domain_crash().
    
    The Arch LBR spec states that CPUs without model-specific LBR implement
    MSR_DBG_CTL.LBR by discarding writes and always returning 0.
    
    Do this for any CPU for which we lack model-specific LBR information.
    
    Adjust the now-stale comment, now that the Arch LBR spec has created a way to
    signal "no model specific LBR" to guests.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Kevin Tian <kevin.tian@intel.com>
    master commit: 3edca52ce736297d7fcf293860cd94ef62638052
    master date: 2023-01-12 18:42:00 +0000
---
 xen/arch/x86/hvm/vmx/vmx.c | 31 ++++++++++++++++---------------
 1 file changed, 16 insertions(+), 15 deletions(-)

diff --git a/xen/arch/x86/hvm/vmx/vmx.c b/xen/arch/x86/hvm/vmx/vmx.c
index bc308d9df2..094141be9a 100644
--- a/xen/arch/x86/hvm/vmx/vmx.c
+++ b/xen/arch/x86/hvm/vmx/vmx.c
@@ -3518,18 +3518,26 @@ static int vmx_msr_write_intercept(unsigned int msr, uint64_t msr_content)
         if ( msr_content & rsvd )
             goto gp_fault;
 
+        /*
+         * The Arch LBR spec (new in Ice Lake) states that CPUs with no
+         * model-specific LBRs implement MSR_DBG_CTL.LBR by discarding writes
+         * and always returning 0.
+         *
+         * Use this property in all cases where we don't know any
+         * model-specific LBR information, as it matches real hardware
+         * behaviour on post-Ice Lake systems.
+         */
+        if ( !model_specific_lbr )
+            msr_content &= ~IA32_DEBUGCTLMSR_LBR;
+
         /*
          * When a guest first enables LBR, arrange to save and restore the LBR
          * MSRs and allow the guest direct access.
          *
-         * MSR_DEBUGCTL and LBR has existed almost as long as MSRs have
-         * existed, and there is no architectural way to hide the feature, or
-         * fail the attempt to enable LBR.
-         *
-         * Unknown host LBR MSRs or hitting -ENOSPC with the guest load/save
-         * list are definitely hypervisor bugs, whereas -ENOMEM for allocating
-         * the load/save list is simply unlucky (and shouldn't occur with
-         * sensible management by the toolstack).
+         * Hitting -ENOSPC with the guest load/save list is definitely a
+         * hypervisor bug, whereas -ENOMEM for allocating the load/save list
+         * is simply unlucky (and shouldn't occur with sensible management by
+         * the toolstack).
          *
          * Either way, there is nothing we can do right now to recover, and
          * the guest won't execute correctly either.  Simply crash the domain
@@ -3540,13 +3548,6 @@ static int vmx_msr_write_intercept(unsigned int msr, uint64_t msr_content)
         {
             const struct lbr_info *lbr = model_specific_lbr;
 
-            if ( unlikely(!lbr) )
-            {
-                gprintk(XENLOG_ERR, "Unknown Host LBR MSRs\n");
-                domain_crash(v->domain);
-                return X86EMUL_OKAY;
-            }
-
             for ( ; lbr->count; lbr++ )
             {
                 unsigned int i;
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.16


From xen-changelog-bounces@lists.xenproject.org Wed Feb 08 11:55:44 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 08 Feb 2023 11:55:44 +0000
Received: from list by lists.xenproject.org with outflank-mailman.491697.760938 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pPj39-0003A9-VE; Wed, 08 Feb 2023 11:55:43 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 491697.760938; Wed, 08 Feb 2023 11: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 1pPj39-0003A2-SX; Wed, 08 Feb 2023 11:55:43 +0000
Received: by outflank-mailman (input) for mailman id 491697;
 Wed, 08 Feb 2023 11: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 1pPj38-00039p-86
 for xen-changelog@lists.xenproject.org; Wed, 08 Feb 2023 11:55:42 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pPj38-0000gR-5a
 for xen-changelog@lists.xenproject.org; Wed, 08 Feb 2023 11:55:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pPj38-0008JQ-4Y
 for xen-changelog@lists.xenproject.org; Wed, 08 Feb 2023 11:55:42 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=xH7B6iuBgjBrtM2M9iLodMFRqeA7w7EdeVdW62jIRvo=; b=QykCCTMDZZuCfnPQFzg/1n7z4a
	yvnnifAlKS6WvdE22gDw1Z+GzkII47tCpFQ6z13pnWxQY1xKbeGKrBCpVyg6CXUA2zsLszJhql7CM
	S8DEwXEIcqiUJgzS7dWu2WnNSAX3Fvpt2hgvJEKEYUE437r9sVWwqOA8Ez3mWwvDRTFw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.16] x86/shadow: fix PAE check for top-level table unshadowing
Message-Id: <E1pPj38-0008JQ-4Y@xenbits.xenproject.org>
Date: Wed, 08 Feb 2023 11:55:42 +0000

commit 1550835b381a18fc0e972e5d04925e02fab31553
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Feb 7 17:05:22 2023 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Feb 7 17:05:22 2023 +0100

    x86/shadow: fix PAE check for top-level table unshadowing
    
    Clearly within the for_each_vcpu() the vCPU of this loop is meant, not
    the (loop invariant) one the fault occurred on.
    
    Fixes: 3d5e6a3ff383 ("x86 hvm: implement HVMOP_pagetable_dying")
    Fixes: ef3b0d8d2c39 ("x86/shadow: shadow_table[] needs only one entry for PV-only configs")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
    master commit: f8fdceefbb1193ec81667eb40b83bc525cb71204
    master date: 2023-01-20 09:23:42 +0100
---
 xen/arch/x86/mm/shadow/multi.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/mm/shadow/multi.c b/xen/arch/x86/mm/shadow/multi.c
index c07af0bd99..f7acd18a36 100644
--- a/xen/arch/x86/mm/shadow/multi.c
+++ b/xen/arch/x86/mm/shadow/multi.c
@@ -2665,10 +2665,10 @@ static int sh_page_fault(struct vcpu *v,
 #if GUEST_PAGING_LEVELS == 3
             unsigned int i;
 
-            for_each_shadow_table(v, i)
+            for_each_shadow_table(tmp, i)
             {
                 mfn_t smfn = pagetable_get_mfn(
-                                 v->arch.paging.shadow.shadow_table[i]);
+                                 tmp->arch.paging.shadow.shadow_table[i]);
 
                 if ( mfn_valid(smfn) && (mfn_x(smfn) != 0) )
                 {
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.16


From xen-changelog-bounces@lists.xenproject.org Wed Feb 08 11:55:54 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 08 Feb 2023 11:55:54 +0000
Received: from list by lists.xenproject.org with outflank-mailman.491698.760942 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pPj3K-0003CY-0Z; Wed, 08 Feb 2023 11:55:54 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 491698.760942; Wed, 08 Feb 2023 11: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 1pPj3J-0003CQ-UF; Wed, 08 Feb 2023 11:55:53 +0000
Received: by outflank-mailman (input) for mailman id 491698;
 Wed, 08 Feb 2023 11:55:52 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pPj3I-0003CF-9e
 for xen-changelog@lists.xenproject.org; Wed, 08 Feb 2023 11:55:52 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pPj3I-0000gc-8f
 for xen-changelog@lists.xenproject.org; Wed, 08 Feb 2023 11:55:52 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pPj3I-0008K9-7x
 for xen-changelog@lists.xenproject.org; Wed, 08 Feb 2023 11:55:52 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=o/i0Tqmf5PhNoKrWxc2OqfoAf1uATJY4YBtM5PDu3r4=; b=hjMd5ah/sJixhFuVAO1aa1pLvx
	sg4/NFJ2vQRU7OURBu0QvrfB9BRpuATnG3K6l9d4qejFjkZYTCgo8ciKBQgvZQ3t4FptWWTC32/9J
	+5sK9rm9f5Yw28l+6Z/26CrWh4c178YRZOCHRUp+WqvPcSEN9okHej0D0MOJt+9ZaEBo=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.16] ns16550: fix an incorrect assignment to uart->io_size
Message-Id: <E1pPj3I-0008K9-7x@xenbits.xenproject.org>
Date: Wed, 08 Feb 2023 11:55:52 +0000

commit 0fd9ad2b9c0c9d9c4879a566f1788d3e9cd38ef6
Author:     Ayan Kumar Halder <ayan.kumar.halder@amd.com>
AuthorDate: Tue Feb 7 17:05:56 2023 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Feb 7 17:05:56 2023 +0100

    ns16550: fix an incorrect assignment to uart->io_size
    
    uart->io_size represents the size in bytes. Thus, when serial_port.bit_width
    is assigned to it, it should be converted to size in bytes.
    
    Fixes: 17b516196c ("ns16550: add ACPI support for ARM only")
    Reported-by: Jan Beulich <jbeulich@suse.com>
    Signed-off-by: Ayan Kumar Halder <ayan.kumar.halder@amd.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
    master commit: 352c89f72ddb67b8d9d4e492203f8c77f85c8df1
    master date: 2023-01-24 16:54:38 +0100
---
 xen/drivers/char/ns16550.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/drivers/char/ns16550.c b/xen/drivers/char/ns16550.c
index 2d2bd2a024..5dd4d723f5 100644
--- a/xen/drivers/char/ns16550.c
+++ b/xen/drivers/char/ns16550.c
@@ -1780,7 +1780,7 @@ static int __init ns16550_acpi_uart_init(const void *data)
     uart->parity = spcr->parity;
     uart->stop_bits = spcr->stop_bits;
     uart->io_base = spcr->serial_port.address;
-    uart->io_size = spcr->serial_port.bit_width;
+    uart->io_size = DIV_ROUND_UP(spcr->serial_port.bit_width, BITS_PER_BYTE);
     uart->reg_shift = spcr->serial_port.bit_offset;
     uart->reg_width = spcr->serial_port.access_width;
 
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.16


From xen-changelog-bounces@lists.xenproject.org Wed Feb 08 11:56:04 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 08 Feb 2023 11:56:04 +0000
Received: from list by lists.xenproject.org with outflank-mailman.491699.760946 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pPj3U-0003FB-2J; Wed, 08 Feb 2023 11:56:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 491699.760946; Wed, 08 Feb 2023 11:56:04 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pPj3T-0003F3-Vl; Wed, 08 Feb 2023 11:56:03 +0000
Received: by outflank-mailman (input) for mailman id 491699;
 Wed, 08 Feb 2023 11:56:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pPj3S-0003Ep-Cl
 for xen-changelog@lists.xenproject.org; Wed, 08 Feb 2023 11:56:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pPj3S-0000h4-C2
 for xen-changelog@lists.xenproject.org; Wed, 08 Feb 2023 11:56:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pPj3S-0008Ku-BD
 for xen-changelog@lists.xenproject.org; Wed, 08 Feb 2023 11:56:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Fz6a6ZiHoDHkyQSFbZEewKZ92/eVfgDHiOfLj2ttSfU=; b=xwdFrZN123moN7ww00olCfZAqM
	HiqnosQ1XPZZ2ebXY6WlNdrLKjjBBTR2h220nqFTMgSrofulB+BdGhSNzY6xryhV3rjV/xD3VkAL6
	wb+Lnv9cItb+Uu+c32uJLoW8CTRne1m/XqtMSQKE+hQvXHwXvczW8LX7LbUZPCa54hHo=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.16] libxl: fix guest kexec - skip cpuid policy
Message-Id: <E1pPj3S-0008Ku-BD@xenbits.xenproject.org>
Date: Wed, 08 Feb 2023 11:56:02 +0000

commit 6e081438bf8ef616d0123aab7a743476d8114ef6
Author:     Jason Andryuk <jandryuk@gmail.com>
AuthorDate: Tue Feb 7 17:06:47 2023 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Feb 7 17:06:47 2023 +0100

    libxl: fix guest kexec - skip cpuid policy
    
    When a domain performs a kexec (soft reset), libxl__build_pre() is
    called with the existing domid.  Calling libxl__cpuid_legacy() on the
    existing domain fails since the cpuid policy has already been set, and
    the guest isn't rebuilt and doesn't kexec.
    
    xc: error: Failed to set d1's policy (err leaf 0xffffffff, subleaf 0xffffffff, msr 0xffffffff) (17 = File exists): Internal error
    libxl: error: libxl_cpuid.c:494:libxl__cpuid_legacy: Domain 1:Failed to apply CPUID policy: File exists
    libxl: error: libxl_create.c:1641:domcreate_rebuild_done: Domain 1:cannot (re-)build domain: -3
    libxl: error: libxl_xshelp.c:201:libxl__xs_read_mandatory: xenstore read failed: `/libxl/1/type': No such file or directory
    libxl: warning: libxl_dom.c:49:libxl__domain_type: unable to get domain type for domid=1, assuming HVM
    
    During a soft_reset, skip calling libxl__cpuid_legacy() to avoid the
    issue.  Before commit 34990446ca91, the libxl__cpuid_legacy() failure
    would have been ignored, so kexec would continue.
    
    Fixes: 34990446ca91 ("libxl: don't ignore the return value from xc_cpuid_apply_policy")
    Signed-off-by: Jason Andryuk <jandryuk@gmail.com>
    Reviewed-by: Anthony PERARD <anthony.perard@citrix.com>
    master commit: 1e454c2b5b1172e0fc7457e411ebaba61db8fc87
    master date: 2023-01-26 10:58:23 +0100
---
 tools/libs/light/libxl_create.c   | 2 ++
 tools/libs/light/libxl_dom.c      | 2 +-
 tools/libs/light/libxl_internal.h | 1 +
 3 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/tools/libs/light/libxl_create.c b/tools/libs/light/libxl_create.c
index 885675591f..2e6357a9d7 100644
--- a/tools/libs/light/libxl_create.c
+++ b/tools/libs/light/libxl_create.c
@@ -2176,6 +2176,8 @@ static int do_domain_soft_reset(libxl_ctx *ctx,
                               aop_console_how);
     cdcs->domid_out = &domid_out;
 
+    state->soft_reset = true;
+
     dom_path = libxl__xs_get_dompath(gc, domid);
     if (!dom_path) {
         LOGD(ERROR, domid, "failed to read domain path");
diff --git a/tools/libs/light/libxl_dom.c b/tools/libs/light/libxl_dom.c
index 73fccd9243..a2bd2395fa 100644
--- a/tools/libs/light/libxl_dom.c
+++ b/tools/libs/light/libxl_dom.c
@@ -384,7 +384,7 @@ int libxl__build_pre(libxl__gc *gc, uint32_t domid,
     /* Construct a CPUID policy, but only for brand new domains.  Domains
      * being migrated-in/restored have CPUID handled during the
      * static_data_done() callback. */
-    if (!state->restore)
+    if (!state->restore && !state->soft_reset)
         rc = libxl__cpuid_legacy(ctx, domid, false, info);
 
 out:
diff --git a/tools/libs/light/libxl_internal.h b/tools/libs/light/libxl_internal.h
index 0b4671318c..ee6a251700 100644
--- a/tools/libs/light/libxl_internal.h
+++ b/tools/libs/light/libxl_internal.h
@@ -1407,6 +1407,7 @@ typedef struct {
     /* Whether this domain is being migrated/restored, or booting fresh.  Only
      * applicable to the primary domain, not support domains (e.g. stub QEMU). */
     bool restore;
+    bool soft_reset;
 } libxl__domain_build_state;
 
 _hidden void libxl__domain_build_state_init(libxl__domain_build_state *s);
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.16


From xen-changelog-bounces@lists.xenproject.org Thu Feb 09 02:55:08 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 09 Feb 2023 02:55:08 +0000
Received: from list by lists.xenproject.org with outflank-mailman.492125.761546 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pPx5T-00053h-GY; Thu, 09 Feb 2023 02:55:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 492125.761546; Thu, 09 Feb 2023 02: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 1pPx5T-00053Y-CH; Thu, 09 Feb 2023 02:55:03 +0000
Received: by outflank-mailman (input) for mailman id 492125;
 Thu, 09 Feb 2023 02:55:01 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pPx5R-00053Q-NR
 for xen-changelog@lists.xenproject.org; Thu, 09 Feb 2023 02:55:01 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pPx5R-0005Ng-L1
 for xen-changelog@lists.xenproject.org; Thu, 09 Feb 2023 02:55:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pPx5R-0000cm-Ja
 for xen-changelog@lists.xenproject.org; Thu, 09 Feb 2023 02:55:01 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=x2kjGFEddPwryzsngVlwMGaGfcNoGghpYk3VDnJuc2c=; b=kahrzNLXsd04nG/HfwysyHy9DQ
	3iLEL+/3uKGGKRft2Pna/bcunPylXs/Oqbp2i4AEFgjTRPNzcAG1Z9Br40xE2Op/irmnp0PsZUTzD
	6la5frf5L9/Jh+pjNkNr/jaV7DvxL5fray+DS/8luq7ZrwnhiMz8RVkl1T6FK9RMgvok=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] libs: Fix auto-generation of version-script for unstable libs
Message-Id: <E1pPx5R-0000cm-Ja@xenbits.xenproject.org>
Date: Thu, 09 Feb 2023 02:55:01 +0000

commit 98d95437edb64bfd93b9dc238d6dd72ea09d9624
Author:     Anthony PERARD <anthony.perard@citrix.com>
AuthorDate: Tue Feb 7 15:17:53 2023 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Feb 7 15:17:53 2023 +0100

    libs: Fix auto-generation of version-script for unstable libs
    
    When there isn't a version-script for a shared library (like for
    unstable libs), we create one based on the current Xen version. But
    that version-script became out-of-date as soon as Xen's version
    changes and make as no way to regenerate the version-script on
    rebuild.
    
    For unstable libs, we only needs the symver to be different from a
    previous release of Xen. There's an option "--default-symver" which
    allow to use the soname as symver and as the soname have the Xen
    release version, it will be different for every release. With
    --default-symver we don't need to generate a version-script.
    
    But we also need to know if there's already an existing version script
    , for that we introduce $(version-script) to be used to point to the
    path of the existing script. (Guessing if a version script exist for a
    stable library with for example $(wildcard) won't work as a file will
    exist when building the library without this patch.)
    
    We don't need the version-script unless we are making the shared
    library so it is removed from the "all" target.
    
    Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 .gitignore                        |  6 ------
 tools/libs/call/Makefile          |  1 +
 tools/libs/ctrl/Makefile          |  3 ---
 tools/libs/devicemodel/Makefile   |  1 +
 tools/libs/evtchn/Makefile        |  1 +
 tools/libs/foreignmemory/Makefile |  1 +
 tools/libs/gnttab/Makefile        |  1 +
 tools/libs/guest/Makefile         |  3 ---
 tools/libs/hypfs/Makefile         |  1 +
 tools/libs/libs.mk                | 10 ++++------
 tools/libs/light/Makefile         |  1 -
 tools/libs/stat/Makefile          |  2 +-
 tools/libs/store/Makefile         |  1 +
 tools/libs/toolcore/Makefile      |  1 +
 tools/libs/toollog/Makefile       |  1 +
 tools/libs/util/Makefile          |  3 ---
 tools/libs/vchan/Makefile         |  3 ---
 17 files changed, 14 insertions(+), 26 deletions(-)

diff --git a/.gitignore b/.gitignore
index 5b30d8fc36..beac034784 100644
--- a/.gitignore
+++ b/.gitignore
@@ -110,8 +110,6 @@ tools/config.cache
 config/Tools.mk
 config/Stubdom.mk
 config/Docs.mk
-tools/libs/ctrl/libxenctrl.map
-tools/libs/guest/libxenguest.map
 tools/libs/guest/xc_bitops.h
 tools/libs/guest/xc_core.h
 tools/libs/guest/xc_core_arm.h
@@ -121,7 +119,6 @@ tools/libs/light/_*.[ch]
 tools/libs/light/*.pyc
 tools/libs/light/_libxl.api-for-check
 tools/libs/light/*.api-ok
-tools/libs/light/libxenlight.map
 tools/libs/light/libxl-save-helper
 tools/libs/light/dsdt*
 tools/libs/light/mk_dsdt
@@ -131,13 +128,10 @@ tools/libs/light/testidl.c
 tools/libs/light/test_timedereg
 tools/libs/light/test_fdderegrace
 tools/libs/light/tmp.*
-tools/libs/stat/libxenstat.map
 tools/libs/store/list.h
 tools/libs/store/utils.h
 tools/libs/store/xs_lib.c
 tools/libs/util/libxlu_cfg_y.output
-tools/libs/util/libxenutil.map
-tools/libs/vchan/libxenvchan.map
 tools/debugger/gdb/gdb-6.2.1-linux-i386-xen/*
 tools/debugger/gdb/gdb-6.2.1/*
 tools/debugger/gdb/gdb-6.2.1.tar.bz2
diff --git a/tools/libs/call/Makefile b/tools/libs/call/Makefile
index 103f5ad360..56a964b517 100644
--- a/tools/libs/call/Makefile
+++ b/tools/libs/call/Makefile
@@ -3,6 +3,7 @@ include $(XEN_ROOT)/tools/Rules.mk
 
 MAJOR    = 1
 MINOR    = 3
+version-script := libxencall.map
 
 include Makefile.common
 
diff --git a/tools/libs/ctrl/Makefile b/tools/libs/ctrl/Makefile
index 93442ab389..094e84b8d8 100644
--- a/tools/libs/ctrl/Makefile
+++ b/tools/libs/ctrl/Makefile
@@ -10,6 +10,3 @@ PKG_CONFIG_NAME := Xencontrol
 NO_HEADERS_CHK := y
 
 include $(XEN_ROOT)/tools/libs/libs.mk
-
-clean::
-	rm -f libxenctrl.map
diff --git a/tools/libs/devicemodel/Makefile b/tools/libs/devicemodel/Makefile
index b70dd774e4..20d1d112e7 100644
--- a/tools/libs/devicemodel/Makefile
+++ b/tools/libs/devicemodel/Makefile
@@ -3,6 +3,7 @@ include $(XEN_ROOT)/tools/Rules.mk
 
 MAJOR    = 1
 MINOR    = 4
+version-script := libxendevicemodel.map
 
 include Makefile.common
 
diff --git a/tools/libs/evtchn/Makefile b/tools/libs/evtchn/Makefile
index 3dad3840c6..18cdaab89e 100644
--- a/tools/libs/evtchn/Makefile
+++ b/tools/libs/evtchn/Makefile
@@ -3,6 +3,7 @@ include $(XEN_ROOT)/tools/Rules.mk
 
 MAJOR    = 1
 MINOR    = 2
+version-script := libxenevtchn.map
 
 include Makefile.common
 
diff --git a/tools/libs/foreignmemory/Makefile b/tools/libs/foreignmemory/Makefile
index b70dd774e4..81398e88b1 100644
--- a/tools/libs/foreignmemory/Makefile
+++ b/tools/libs/foreignmemory/Makefile
@@ -3,6 +3,7 @@ include $(XEN_ROOT)/tools/Rules.mk
 
 MAJOR    = 1
 MINOR    = 4
+version-script := libxenforeignmemory.map
 
 include Makefile.common
 
diff --git a/tools/libs/gnttab/Makefile b/tools/libs/gnttab/Makefile
index 3dad3840c6..4528830bdc 100644
--- a/tools/libs/gnttab/Makefile
+++ b/tools/libs/gnttab/Makefile
@@ -3,6 +3,7 @@ include $(XEN_ROOT)/tools/Rules.mk
 
 MAJOR    = 1
 MINOR    = 2
+version-script := libxengnttab.map
 
 include Makefile.common
 
diff --git a/tools/libs/guest/Makefile b/tools/libs/guest/Makefile
index 19d3ff2fdb..93338a9301 100644
--- a/tools/libs/guest/Makefile
+++ b/tools/libs/guest/Makefile
@@ -14,6 +14,3 @@ NO_HEADERS_CHK := y
 include $(XEN_ROOT)/tools/libs/libs.mk
 
 libxenguest.so.$(MAJOR).$(MINOR): LDLIBS += $(ZLIB_LIBS) -lz
-
-clean::
-	rm -f libxenguest.map
diff --git a/tools/libs/hypfs/Makefile b/tools/libs/hypfs/Makefile
index 630e1e6f3e..7fae5c750d 100644
--- a/tools/libs/hypfs/Makefile
+++ b/tools/libs/hypfs/Makefile
@@ -3,6 +3,7 @@ include $(XEN_ROOT)/tools/Rules.mk
 
 MAJOR    = 1
 MINOR    = 0
+version-script := libxenhypfs.map
 
 LDLIBS += -lz
 
diff --git a/tools/libs/libs.mk b/tools/libs/libs.mk
index 3eb91fc8f3..0e4b5e0bd0 100644
--- a/tools/libs/libs.mk
+++ b/tools/libs/libs.mk
@@ -4,6 +4,7 @@
 #   PKG_CONFIG: name of pkg-config file (xen$(LIBNAME).pc if empty)
 #   MAJOR:   major version of lib (Xen version if empty)
 #   MINOR:   minor version of lib (0 if empty)
+#   version-script: Specify the name of a version script to the linker.
 
 LIBNAME := $(notdir $(CURDIR))
 
@@ -53,7 +54,7 @@ $(PKG_CONFIG_LOCAL): PKG_CONFIG_INCDIR = $(XEN_INCLUDE)
 $(PKG_CONFIG_LOCAL): PKG_CONFIG_LIBDIR = $(CURDIR)
 
 .PHONY: all
-all: $(TARGETS) $(PKG_CONFIG_LOCAL) libxen$(LIBNAME).map $(LIBHEADERS)
+all: $(TARGETS) $(PKG_CONFIG_LOCAL) $(LIBHEADERS)
 
 ifneq ($(NO_HEADERS_CHK),y)
 all: headers.chk
@@ -71,9 +72,6 @@ headers.lst: FORCE
 	@{ set -e; $(foreach h,$(LIBHEADERS),echo $(h);) } > $@.tmp
 	@$(call move-if-changed,$@.tmp,$@)
 
-libxen$(LIBNAME).map:
-	echo 'VERS_$(MAJOR).$(MINOR) { global: *; };' >$@
-
 lib$(LIB_FILE_NAME).a: $(OBJS-y)
 	$(AR) rc $@ $^
 
@@ -82,8 +80,8 @@ lib$(LIB_FILE_NAME).so: lib$(LIB_FILE_NAME).so.$(MAJOR)
 lib$(LIB_FILE_NAME).so.$(MAJOR): lib$(LIB_FILE_NAME).so.$(MAJOR).$(MINOR)
 	$(SYMLINK_SHLIB) $< $@
 
-lib$(LIB_FILE_NAME).so.$(MAJOR).$(MINOR): $(PIC_OBJS) libxen$(LIBNAME).map
-	$(CC) $(LDFLAGS) $(PTHREAD_LDFLAGS) -Wl,$(SONAME_LDFLAG) -Wl,lib$(LIB_FILE_NAME).so.$(MAJOR) -Wl,--version-script=libxen$(LIBNAME).map $(SHLIB_LDFLAGS) -o $@ $(PIC_OBJS) $(LDLIBS) $(APPEND_LDFLAGS)
+lib$(LIB_FILE_NAME).so.$(MAJOR).$(MINOR): $(PIC_OBJS) $(version-script)
+	$(CC) $(LDFLAGS) $(PTHREAD_LDFLAGS) -Wl,$(SONAME_LDFLAG) -Wl,lib$(LIB_FILE_NAME).so.$(MAJOR) -Wl,$(if $(version-script),--version-script=$(version-script),--default-symver) $(SHLIB_LDFLAGS) -o $@ $(PIC_OBJS) $(LDLIBS) $(APPEND_LDFLAGS)
 
 # If abi-dumper is available, write out the ABI analysis
 ifneq ($(ABI_DUMPER),)
diff --git a/tools/libs/light/Makefile b/tools/libs/light/Makefile
index 4fddcc6f51..cd3fa855e1 100644
--- a/tools/libs/light/Makefile
+++ b/tools/libs/light/Makefile
@@ -262,6 +262,5 @@ clean::
 	$(RM) testidl.c.new testidl.c *.api-ok
 	$(RM) $(TEST_PROGS) libxenlight_test.so libxl_test_*.opic
 	$(RM) -r __pycache__
-	$(RM) libxenlight.map
 	$(RM) $(AUTOSRCS) $(AUTOINCS)
 	$(MAKE) -C $(ACPI_PATH) ACPI_BUILD_DIR=$(CURDIR) clean
diff --git a/tools/libs/stat/Makefile b/tools/libs/stat/Makefile
index 7eaf50e91e..ee5c42bf7b 100644
--- a/tools/libs/stat/Makefile
+++ b/tools/libs/stat/Makefile
@@ -134,4 +134,4 @@ uninstall:: uninstall-perl-bindings
 endif
 
 clean::
-	$(RM) libxenstat.map $(BINDINGS) $(BINDINGSRC)
+	$(RM) $(BINDINGS) $(BINDINGSRC)
diff --git a/tools/libs/store/Makefile b/tools/libs/store/Makefile
index 3557a8c76d..daed9d148f 100644
--- a/tools/libs/store/Makefile
+++ b/tools/libs/store/Makefile
@@ -3,6 +3,7 @@ include $(XEN_ROOT)/tools/Rules.mk
 
 MAJOR = 4
 MINOR = 0
+version-script := libxenstore.map
 
 ifeq ($(CONFIG_Linux),y)
 LDLIBS += -ldl
diff --git a/tools/libs/toolcore/Makefile b/tools/libs/toolcore/Makefile
index 0d92b68b3b..20671dadd0 100644
--- a/tools/libs/toolcore/Makefile
+++ b/tools/libs/toolcore/Makefile
@@ -3,6 +3,7 @@ include $(XEN_ROOT)/tools/Rules.mk
 
 MAJOR	= 1
 MINOR	= 0
+version-script := libxentoolcore.map
 
 LIBHEADER := xentoolcore.h
 
diff --git a/tools/libs/toollog/Makefile b/tools/libs/toollog/Makefile
index 2361b8cbf1..d612227c85 100644
--- a/tools/libs/toollog/Makefile
+++ b/tools/libs/toollog/Makefile
@@ -3,6 +3,7 @@ include $(XEN_ROOT)/tools/Rules.mk
 
 MAJOR	= 1
 MINOR	= 0
+version-script := libxentoollog.map
 
 include Makefile.common
 
diff --git a/tools/libs/util/Makefile b/tools/libs/util/Makefile
index 493d2e00be..e016baf888 100644
--- a/tools/libs/util/Makefile
+++ b/tools/libs/util/Makefile
@@ -47,6 +47,3 @@ $(OBJS-y) $(PIC_OBJS): $(AUTOINCS)
 %.c %.h:: %.l
 	@rm -f $*.[ch]
 	$(FLEX) --header-file=$*.h --outfile=$*.c $<
-
-clean::
-	$(RM) libxenutil.map
diff --git a/tools/libs/vchan/Makefile b/tools/libs/vchan/Makefile
index ac2bff66f5..a1ef60ac8e 100644
--- a/tools/libs/vchan/Makefile
+++ b/tools/libs/vchan/Makefile
@@ -11,6 +11,3 @@ OBJS-y += io.o
 NO_HEADERS_CHK := y
 
 include $(XEN_ROOT)/tools/libs/libs.mk
-
-clean::
-	rm -f libxenvchan.map
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Feb 09 02:55:13 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 09 Feb 2023 02:55:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.492126.761548 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pPx5d-0005EO-Go; Thu, 09 Feb 2023 02:55:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 492126.761548; Thu, 09 Feb 2023 02:55:13 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pPx5d-0005EG-Dy; Thu, 09 Feb 2023 02:55:13 +0000
Received: by outflank-mailman (input) for mailman id 492126;
 Thu, 09 Feb 2023 02:55:11 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pPx5b-00055m-Q3
 for xen-changelog@lists.xenproject.org; Thu, 09 Feb 2023 02:55:11 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pPx5b-0005Nx-P8
 for xen-changelog@lists.xenproject.org; Thu, 09 Feb 2023 02:55:11 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pPx5b-0000dN-NL
 for xen-changelog@lists.xenproject.org; Thu, 09 Feb 2023 02:55:11 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Lu+X3u1Z0wBijmUQwhZU/ia06Ox3uD0LaasPbho++HQ=; b=yLrcTOhThsEzekjMDxTasdtj6S
	Ow8r55nv6ZBH7GnvWru4BmKcuNa3up8rA+AwcACsdtoV02a5iYBNjSjh7am8Sp65YL6coh+SYnUZu
	Ae4JXNH3qovzfw64wUA22SKMGFNgL+CJ+SJdCwPfV46Ufubo40w3CyLnrXBHGW1bzmBk=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] libxl/x86: use public interface TSC mode definitions
Message-Id: <E1pPx5b-0000dN-NL@xenbits.xenproject.org>
Date: Thu, 09 Feb 2023 02:55:11 +0000

commit be4be3238dc8d80bb98d3486d44623aae9c1621a
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Feb 7 15:18:18 2023 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Feb 7 15:18:18 2023 +0100

    libxl/x86: use public interface TSC mode definitions
    
    Now that they're properly represented in the public interface, stop
    using literal numbers.
    
    No functional change intended.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Juergen Gross <jgross@suse.com>
    Acked-by: Anthony PERARD <anthony.perard@citrix.com>
---
 tools/libs/light/libxl_x86.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/tools/libs/light/libxl_x86.c b/tools/libs/light/libxl_x86.c
index 7484a5745e..d16573e72c 100644
--- a/tools/libs/light/libxl_x86.c
+++ b/tools/libs/light/libxl_x86.c
@@ -1,5 +1,6 @@
 #include "libxl_internal.h"
 #include "libxl_arch.h"
+#include <xen/arch-x86/cpuid.h>
 
 int libxl__arch_domain_prepare_config(libxl__gc *gc,
                                       libxl_domain_config *d_config,
@@ -486,13 +487,13 @@ int libxl__arch_domain_create(libxl__gc *gc,
 
     switch (d_config->b_info.tsc_mode) {
     case LIBXL_TSC_MODE_DEFAULT:
-        tsc_mode = 0;
+        tsc_mode = XEN_CPUID_TSC_MODE_DEFAULT;
         break;
     case LIBXL_TSC_MODE_ALWAYS_EMULATE:
-        tsc_mode = 1;
+        tsc_mode = XEN_CPUID_TSC_MODE_ALWAYS_EMULATE;
         break;
     case LIBXL_TSC_MODE_NATIVE:
-        tsc_mode = 2;
+        tsc_mode = XEN_CPUID_TSC_MODE_NEVER_EMULATE;
         break;
     case LIBXL_TSC_MODE_NATIVE_PARAVIRT:
         LOGD(ERROR, domid, "TSC Mode native_paravirt (a.k.a PVRDTSCP) has been removed");
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Feb 09 02:55:23 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 09 Feb 2023 02:55:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.492127.761552 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pPx5n-0005Iu-Im; Thu, 09 Feb 2023 02:55:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 492127.761552; Thu, 09 Feb 2023 02:55:23 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pPx5n-0005Im-Fb; Thu, 09 Feb 2023 02:55:23 +0000
Received: by outflank-mailman (input) for mailman id 492127;
 Thu, 09 Feb 2023 02: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 1pPx5l-0005IU-Uv
 for xen-changelog@lists.xenproject.org; Thu, 09 Feb 2023 02:55:21 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pPx5l-0005Po-U7
 for xen-changelog@lists.xenproject.org; Thu, 09 Feb 2023 02:55:21 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pPx5l-0000ds-SY
 for xen-changelog@lists.xenproject.org; Thu, 09 Feb 2023 02:55:21 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=g77lVS4E8RjytgG/12Cvkzt2aDIZkjJBjuQyZlXq/Mg=; b=OImFKfYmjZICJrxkUD99yES3P2
	wC+rsvhHn6gS0gRVnqFke3K9hIL96UIuOEPrfb7/WdVGO2n7DNT8qPsMAKKVA2fVgXU8OcrkJYOJ5
	lARGhaA9ZhNs4w/QG+18XCL+vZqNe8CNvJviGDMy4CpXl341s7oA8+1eHY0hs+2TMYzk=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86: do not include asm/hvm/support.h when not used
Message-Id: <E1pPx5l-0000ds-SY@xenbits.xenproject.org>
Date: Thu, 09 Feb 2023 02:55:21 +0000

commit c0e202194bfcb413d7cf662b333550ed444c469b
Author:     Xenia Ragiadakou <burzalodowa@gmail.com>
AuthorDate: Tue Feb 7 15:19:02 2023 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Feb 7 15:19:02 2023 +0100

    x86: do not include asm/hvm/support.h when not used
    
    When none of the declarations and macro definitions in asm/hvm/support.h is
    referred in the file, do not include the header.
    
    To fix subsequent build errors, which were not triggered before due to the
    indirect inclusion of the missing headers by asm/hvm/support.h, include any
    missing headers.
    
    No functional change intended.
    
    Signed-off-by: Xenia Ragiadakou <burzalodowa@gmail.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/cpu/amd.c                  | 2 +-
 xen/arch/x86/cpu/intel.c                | 2 +-
 xen/arch/x86/cpu/vpmu.c                 | 1 -
 xen/arch/x86/cpu/vpmu_intel.c           | 1 -
 xen/arch/x86/crash.c                    | 1 -
 xen/arch/x86/domain.c                   | 1 -
 xen/arch/x86/domctl.c                   | 1 -
 xen/arch/x86/emul-i8254.c               | 2 +-
 xen/arch/x86/hvm/hpet.c                 | 2 +-
 xen/arch/x86/hvm/io.c                   | 1 -
 xen/arch/x86/hvm/irq.c                  | 2 +-
 xen/arch/x86/hvm/pmtimer.c              | 3 ++-
 xen/arch/x86/hvm/rtc.c                  | 3 ++-
 xen/arch/x86/hvm/save.c                 | 2 --
 xen/arch/x86/hvm/stdvga.c               | 1 -
 xen/arch/x86/hvm/svm/emulate.c          | 1 -
 xen/arch/x86/hvm/svm/intr.c             | 1 -
 xen/arch/x86/hvm/svm/vmcb.c             | 1 -
 xen/arch/x86/hvm/viridian/synic.c       | 1 -
 xen/arch/x86/hvm/viridian/time.c        | 1 -
 xen/arch/x86/hvm/viridian/viridian.c    | 1 -
 xen/arch/x86/hvm/vmx/intr.c             | 1 -
 xen/arch/x86/hvm/vmx/vmcs.c             | 1 -
 xen/arch/x86/hvm/vmx/vvmx.c             | 1 +
 xen/arch/x86/hvm/vpic.c                 | 2 +-
 xen/arch/x86/hvm/vpt.c                  | 2 +-
 xen/arch/x86/i387.c                     | 1 -
 xen/arch/x86/include/asm/hvm/vmx/vmx.h  | 2 +-
 xen/arch/x86/mm/altp2m.c                | 1 -
 xen/arch/x86/mm/hap/nested_ept.c        | 1 -
 xen/arch/x86/mm/hap/nested_hap.c        | 1 -
 xen/arch/x86/oprofile/op_model_athlon.c | 2 +-
 xen/arch/x86/oprofile/xenoprof.c        | 1 -
 xen/arch/x86/smp.c                      | 1 -
 xen/arch/x86/sysctl.c                   | 1 -
 xen/arch/x86/x86_64/traps.c             | 1 -
 xen/arch/x86/xstate.c                   | 1 -
 xen/drivers/passthrough/x86/hvm.c       | 1 -
 38 files changed, 14 insertions(+), 38 deletions(-)

diff --git a/xen/arch/x86/cpu/amd.c b/xen/arch/x86/cpu/amd.c
index 1ddb55cbe5..caafe44740 100644
--- a/xen/arch/x86/cpu/amd.c
+++ b/xen/arch/x86/cpu/amd.c
@@ -4,12 +4,12 @@
 #include <xen/param.h>
 #include <xen/smp.h>
 #include <xen/pci.h>
+#include <xen/sched.h>
 #include <xen/warning.h>
 #include <asm/io.h>
 #include <asm/msr.h>
 #include <asm/processor.h>
 #include <asm/amd.h>
-#include <asm/hvm/support.h>
 #include <asm/spec_ctrl.h>
 #include <asm/acpi.h>
 #include <asm/apic.h>
diff --git a/xen/arch/x86/cpu/intel.c b/xen/arch/x86/cpu/intel.c
index dc6a0c7807..71fc1a1e18 100644
--- a/xen/arch/x86/cpu/intel.c
+++ b/xen/arch/x86/cpu/intel.c
@@ -1,5 +1,6 @@
 #include <xen/init.h>
 #include <xen/kernel.h>
+#include <xen/sched.h>
 #include <xen/string.h>
 #include <xen/bitops.h>
 #include <xen/smp.h>
@@ -10,7 +11,6 @@
 #include <asm/apic.h>
 #include <asm/i387.h>
 #include <mach_apic.h>
-#include <asm/hvm/support.h>
 
 #include "cpu.h"
 
diff --git a/xen/arch/x86/cpu/vpmu.c b/xen/arch/x86/cpu/vpmu.c
index 33e2fca8cd..b6b7342fb4 100644
--- a/xen/arch/x86/cpu/vpmu.c
+++ b/xen/arch/x86/cpu/vpmu.c
@@ -30,7 +30,6 @@
 #include <asm/nmi.h>
 #include <asm/p2m.h>
 #include <asm/vpmu.h>
-#include <asm/hvm/support.h>
 #include <asm/apic.h>
 #include <irq_vectors.h>
 #include <public/pmu.h>
diff --git a/xen/arch/x86/cpu/vpmu_intel.c b/xen/arch/x86/cpu/vpmu_intel.c
index b91d818be0..a8df52579d 100644
--- a/xen/arch/x86/cpu/vpmu_intel.c
+++ b/xen/arch/x86/cpu/vpmu_intel.c
@@ -29,7 +29,6 @@
 #include <asm/msr.h>
 #include <asm/msr-index.h>
 #include <asm/vpmu.h>
-#include <asm/hvm/support.h>
 #include <asm/hvm/vlapic.h>
 #include <asm/hvm/vmx/vmx.h>
 #include <asm/hvm/vmx/vmcs.h>
diff --git a/xen/arch/x86/crash.c b/xen/arch/x86/crash.c
index 99089f77a7..7850f0af24 100644
--- a/xen/arch/x86/crash.c
+++ b/xen/arch/x86/crash.c
@@ -24,7 +24,6 @@
 #include <xen/keyhandler.h>
 #include <public/xen.h>
 #include <asm/shared.h>
-#include <asm/hvm/support.h>
 #include <asm/apic.h>
 #include <asm/io_apic.h>
 #include <xen/iommu.h>
diff --git a/xen/arch/x86/domain.c b/xen/arch/x86/domain.c
index a3c88cd729..db3ebf062d 100644
--- a/xen/arch/x86/domain.c
+++ b/xen/arch/x86/domain.c
@@ -52,7 +52,6 @@
 #include <asm/ldt.h>
 #include <asm/hvm/hvm.h>
 #include <asm/hvm/nestedhvm.h>
-#include <asm/hvm/support.h>
 #include <asm/hvm/svm/svm.h>
 #include <asm/hvm/viridian.h>
 #include <asm/debugreg.h>
diff --git a/xen/arch/x86/domctl.c b/xen/arch/x86/domctl.c
index e9bfbc57a7..2118fcad5d 100644
--- a/xen/arch/x86/domctl.c
+++ b/xen/arch/x86/domctl.c
@@ -25,7 +25,6 @@
 #include <asm/irq.h>
 #include <asm/hvm/emulate.h>
 #include <asm/hvm/hvm.h>
-#include <asm/hvm/support.h>
 #include <asm/processor.h>
 #include <asm/acpi.h> /* for hvm_acpi_power_button */
 #include <xen/hypercall.h> /* for arch_do_domctl */
diff --git a/xen/arch/x86/emul-i8254.c b/xen/arch/x86/emul-i8254.c
index 18894b6348..1688b7e458 100644
--- a/xen/arch/x86/emul-i8254.c
+++ b/xen/arch/x86/emul-i8254.c
@@ -34,7 +34,7 @@
 #include <asm/time.h>
 #include <asm/hvm/hvm.h>
 #include <asm/hvm/io.h>
-#include <asm/hvm/support.h>
+#include <asm/hvm/save.h>
 #include <asm/hvm/vpt.h>
 #include <asm/current.h>
 
diff --git a/xen/arch/x86/hvm/hpet.c b/xen/arch/x86/hvm/hpet.c
index 45c7b9b406..c65e1b27d0 100644
--- a/xen/arch/x86/hvm/hpet.c
+++ b/xen/arch/x86/hvm/hpet.c
@@ -18,7 +18,7 @@
 
 #include <asm/hvm/vpt.h>
 #include <asm/hvm/io.h>
-#include <asm/hvm/support.h>
+#include <asm/hvm/save.h>
 #include <asm/hvm/trace.h>
 #include <asm/current.h>
 #include <asm/hpet.h>
diff --git a/xen/arch/x86/hvm/io.c b/xen/arch/x86/hvm/io.c
index 0309d05cfd..5ae209d3b6 100644
--- a/xen/arch/x86/hvm/io.c
+++ b/xen/arch/x86/hvm/io.c
@@ -36,7 +36,6 @@
 #include <asm/shadow.h>
 #include <asm/p2m.h>
 #include <asm/hvm/hvm.h>
-#include <asm/hvm/support.h>
 #include <asm/hvm/vpt.h>
 #include <asm/hvm/vpic.h>
 #include <asm/hvm/vlapic.h>
diff --git a/xen/arch/x86/hvm/irq.c b/xen/arch/x86/hvm/irq.c
index d93ffe4546..4fe87a71c1 100644
--- a/xen/arch/x86/hvm/irq.c
+++ b/xen/arch/x86/hvm/irq.c
@@ -24,7 +24,7 @@
 #include <xen/irq.h>
 #include <xen/keyhandler.h>
 #include <asm/hvm/domain.h>
-#include <asm/hvm/support.h>
+#include <asm/hvm/save.h>
 #include <asm/msi.h>
 #include <public/hvm/params.h>
 
diff --git a/xen/arch/x86/hvm/pmtimer.c b/xen/arch/x86/hvm/pmtimer.c
index 2a89bbdfa5..b89d0fd53b 100644
--- a/xen/arch/x86/hvm/pmtimer.c
+++ b/xen/arch/x86/hvm/pmtimer.c
@@ -17,9 +17,10 @@
  * this program; If not, see <http://www.gnu.org/licenses/>.
  */
 
+#include <xen/sched.h>
 #include <asm/hvm/vpt.h>
 #include <asm/hvm/io.h>
-#include <asm/hvm/support.h>
+#include <asm/hvm/save.h>
 #include <asm/acpi.h> /* for hvm_acpi_power_button prototype */
 #include <public/hvm/params.h>
 
diff --git a/xen/arch/x86/hvm/rtc.c b/xen/arch/x86/hvm/rtc.c
index d21925db08..44f2fb668d 100644
--- a/xen/arch/x86/hvm/rtc.c
+++ b/xen/arch/x86/hvm/rtc.c
@@ -22,10 +22,11 @@
  * IN THE SOFTWARE.
  */
 
+#include <xen/sched.h>
 #include <asm/mc146818rtc.h>
 #include <asm/hvm/vpt.h>
 #include <asm/hvm/io.h>
-#include <asm/hvm/support.h>
+#include <asm/hvm/save.h>
 #include <asm/current.h>
 #include <xen/trace.h>
 #include <public/hvm/params.h>
diff --git a/xen/arch/x86/hvm/save.c b/xen/arch/x86/hvm/save.c
index 86c82cbd74..c1675e3d9f 100644
--- a/xen/arch/x86/hvm/save.c
+++ b/xen/arch/x86/hvm/save.c
@@ -24,8 +24,6 @@
 #include <xen/softirq.h>
 #include <xen/version.h>
 
-#include <asm/hvm/support.h>
-
 #include <public/hvm/save.h>
 
 void arch_hvm_save(struct domain *d, struct hvm_save_header *hdr)
diff --git a/xen/arch/x86/hvm/stdvga.c b/xen/arch/x86/hvm/stdvga.c
index be8200c8d0..798a9a0549 100644
--- a/xen/arch/x86/hvm/stdvga.c
+++ b/xen/arch/x86/hvm/stdvga.c
@@ -31,7 +31,6 @@
 #include <xen/types.h>
 #include <xen/sched.h>
 #include <xen/domain_page.h>
-#include <asm/hvm/support.h>
 #include <xen/numa.h>
 #include <xen/paging.h>
 
diff --git a/xen/arch/x86/hvm/svm/emulate.c b/xen/arch/x86/hvm/svm/emulate.c
index 635b3705f7..16fc134883 100644
--- a/xen/arch/x86/hvm/svm/emulate.c
+++ b/xen/arch/x86/hvm/svm/emulate.c
@@ -22,7 +22,6 @@
 #include <asm/msr.h>
 #include <asm/hvm/emulate.h>
 #include <asm/hvm/hvm.h>
-#include <asm/hvm/support.h>
 #include <asm/hvm/svm/svm.h>
 #include <asm/hvm/svm/vmcb.h>
 #include <asm/hvm/svm/emulate.h>
diff --git a/xen/arch/x86/hvm/svm/intr.c b/xen/arch/x86/hvm/svm/intr.c
index 7f815d2307..9525f35593 100644
--- a/xen/arch/x86/hvm/svm/intr.c
+++ b/xen/arch/x86/hvm/svm/intr.c
@@ -27,7 +27,6 @@
 #include <asm/paging.h>
 #include <asm/hvm/hvm.h>
 #include <asm/hvm/io.h>
-#include <asm/hvm/support.h>
 #include <asm/hvm/vlapic.h>
 #include <asm/hvm/svm/svm.h>
 #include <asm/hvm/svm/intr.h>
diff --git a/xen/arch/x86/hvm/svm/vmcb.c b/xen/arch/x86/hvm/svm/vmcb.c
index 0fc57dfd71..305d4767e3 100644
--- a/xen/arch/x86/hvm/svm/vmcb.c
+++ b/xen/arch/x86/hvm/svm/vmcb.c
@@ -26,7 +26,6 @@
 #include <asm/hvm/svm/vmcb.h>
 #include <asm/msr-index.h>
 #include <asm/p2m.h>
-#include <asm/hvm/support.h>
 #include <asm/hvm/svm/svm.h>
 #include <asm/hvm/svm/svmdebug.h>
 #include <asm/spec_ctrl.h>
diff --git a/xen/arch/x86/hvm/viridian/synic.c b/xen/arch/x86/hvm/viridian/synic.c
index 856bb898b8..83d7addfc3 100644
--- a/xen/arch/x86/hvm/viridian/synic.c
+++ b/xen/arch/x86/hvm/viridian/synic.c
@@ -13,7 +13,6 @@
 
 #include <asm/apic.h>
 #include <asm/guest/hyperv-tlfs.h>
-#include <asm/hvm/support.h>
 #include <asm/hvm/vlapic.h>
 
 #include "private.h"
diff --git a/xen/arch/x86/hvm/viridian/time.c b/xen/arch/x86/hvm/viridian/time.c
index b56fd67662..a3ea3fa067 100644
--- a/xen/arch/x86/hvm/viridian/time.c
+++ b/xen/arch/x86/hvm/viridian/time.c
@@ -15,7 +15,6 @@
 #include <asm/event.h>
 #include <asm/guest/hyperv.h>
 #include <asm/guest/hyperv-tlfs.h>
-#include <asm/hvm/support.h>
 
 #include "private.h"
 
diff --git a/xen/arch/x86/hvm/viridian/viridian.c b/xen/arch/x86/hvm/viridian/viridian.c
index 2937ddd3a8..7405c117bc 100644
--- a/xen/arch/x86/hvm/viridian/viridian.c
+++ b/xen/arch/x86/hvm/viridian/viridian.c
@@ -16,7 +16,6 @@
 #include <asm/paging.h>
 #include <asm/p2m.h>
 #include <asm/apic.h>
-#include <asm/hvm/support.h>
 #include <public/sched.h>
 #include <public/hvm/hvm_op.h>
 
diff --git a/xen/arch/x86/hvm/vmx/intr.c b/xen/arch/x86/hvm/vmx/intr.c
index 13bbe8430d..6a8316de0e 100644
--- a/xen/arch/x86/hvm/vmx/intr.c
+++ b/xen/arch/x86/hvm/vmx/intr.c
@@ -29,7 +29,6 @@
 #include <asm/msr.h>
 #include <asm/hvm/hvm.h>
 #include <asm/hvm/io.h>
-#include <asm/hvm/support.h>
 #include <asm/hvm/vmx/vmx.h>
 #include <asm/hvm/vmx/vmcs.h>
 #include <asm/hvm/vpic.h>
diff --git a/xen/arch/x86/hvm/vmx/vmcs.c b/xen/arch/x86/hvm/vmx/vmcs.c
index 7d8bfeb539..09edbd23b3 100644
--- a/xen/arch/x86/hvm/vmx/vmcs.c
+++ b/xen/arch/x86/hvm/vmx/vmcs.c
@@ -33,7 +33,6 @@
 #include <asm/hvm/hvm.h>
 #include <asm/hvm/io.h>
 #include <asm/hvm/nestedhvm.h>
-#include <asm/hvm/support.h>
 #include <asm/hvm/vmx/vmx.h>
 #include <asm/hvm/vmx/vvmx.h>
 #include <asm/hvm/vmx/vmcs.h>
diff --git a/xen/arch/x86/hvm/vmx/vvmx.c b/xen/arch/x86/hvm/vmx/vvmx.c
index f8fe8d0c14..674cdabb07 100644
--- a/xen/arch/x86/hvm/vmx/vvmx.c
+++ b/xen/arch/x86/hvm/vmx/vvmx.c
@@ -24,6 +24,7 @@
 #include <asm/types.h>
 #include <asm/mtrr.h>
 #include <asm/p2m.h>
+#include <asm/hvm/support.h>
 #include <asm/hvm/vmx/vmx.h>
 #include <asm/hvm/vmx/vvmx.h>
 #include <asm/hvm/nestedhvm.h>
diff --git a/xen/arch/x86/hvm/vpic.c b/xen/arch/x86/hvm/vpic.c
index b3cafaab8f..17e15720f0 100644
--- a/xen/arch/x86/hvm/vpic.c
+++ b/xen/arch/x86/hvm/vpic.c
@@ -32,7 +32,7 @@
 #include <xen/trace.h>
 #include <asm/hvm/hvm.h>
 #include <asm/hvm/io.h>
-#include <asm/hvm/support.h>
+#include <asm/hvm/save.h>
 
 #define vpic_domain(v) (container_of((v), struct domain, \
                         arch.hvm.vpic[!vpic->is_master]))
diff --git a/xen/arch/x86/hvm/vpt.c b/xen/arch/x86/hvm/vpt.c
index cb1d81bf9e..621f5bb88b 100644
--- a/xen/arch/x86/hvm/vpt.c
+++ b/xen/arch/x86/hvm/vpt.c
@@ -16,8 +16,8 @@
  * this program; If not, see <http://www.gnu.org/licenses/>.
  */
 
+#include <xen/sched.h>
 #include <xen/time.h>
-#include <asm/hvm/support.h>
 #include <asm/hvm/vpt.h>
 #include <asm/event.h>
 #include <asm/apic.h>
diff --git a/xen/arch/x86/i387.c b/xen/arch/x86/i387.c
index 677f571792..d824f2bb52 100644
--- a/xen/arch/x86/i387.c
+++ b/xen/arch/x86/i387.c
@@ -11,7 +11,6 @@
 #include <xen/sched.h>
 #include <asm/current.h>
 #include <asm/processor.h>
-#include <asm/hvm/support.h>
 #include <asm/i387.h>
 #include <asm/xstate.h>
 #include <asm/asm_defns.h>
diff --git a/xen/arch/x86/include/asm/hvm/vmx/vmx.h b/xen/arch/x86/include/asm/hvm/vmx/vmx.h
index 96a9f07ca5..234da4a7f4 100644
--- a/xen/arch/x86/include/asm/hvm/vmx/vmx.h
+++ b/xen/arch/x86/include/asm/hvm/vmx/vmx.h
@@ -23,8 +23,8 @@
 #include <asm/regs.h>
 #include <asm/asm_defns.h>
 #include <asm/processor.h>
+#include <asm/p2m.h>
 #include <asm/i387.h>
-#include <asm/hvm/support.h>
 #include <asm/hvm/trace.h>
 #include <asm/hvm/vmx/vmcs.h>
 
diff --git a/xen/arch/x86/mm/altp2m.c b/xen/arch/x86/mm/altp2m.c
index 8be6eaf242..07393befee 100644
--- a/xen/arch/x86/mm/altp2m.c
+++ b/xen/arch/x86/mm/altp2m.c
@@ -15,7 +15,6 @@
  * this program; If not, see <http://www.gnu.org/licenses/>.
  */
 
-#include <asm/hvm/support.h>
 #include <asm/hvm/hvm.h>
 #include <asm/p2m.h>
 #include <asm/altp2m.h>
diff --git a/xen/arch/x86/mm/hap/nested_ept.c b/xen/arch/x86/mm/hap/nested_ept.c
index 23fb3889b7..605e47c16c 100644
--- a/xen/arch/x86/mm/hap/nested_ept.c
+++ b/xen/arch/x86/mm/hap/nested_ept.c
@@ -25,7 +25,6 @@
 #include <asm/p2m.h>
 #include <asm/mem_sharing.h>
 #include <asm/hap.h>
-#include <asm/hvm/support.h>
 
 #include <asm/hvm/nestedhvm.h>
 
diff --git a/xen/arch/x86/mm/hap/nested_hap.c b/xen/arch/x86/mm/hap/nested_hap.c
index b19f657c27..098e8e5d4c 100644
--- a/xen/arch/x86/mm/hap/nested_hap.c
+++ b/xen/arch/x86/mm/hap/nested_hap.c
@@ -27,7 +27,6 @@
 #include <asm/p2m.h>
 #include <asm/mem_sharing.h>
 #include <asm/hap.h>
-#include <asm/hvm/support.h>
 
 #include <asm/hvm/nestedhvm.h>
 
diff --git a/xen/arch/x86/oprofile/op_model_athlon.c b/xen/arch/x86/oprofile/op_model_athlon.c
index 7bc5853a6c..69fd3fcc86 100644
--- a/xen/arch/x86/oprofile/op_model_athlon.c
+++ b/xen/arch/x86/oprofile/op_model_athlon.c
@@ -10,6 +10,7 @@
  * @author Graydon Hoare
  */
 
+#include <xen/sched.h>
 #include <xen/types.h>
 #include <asm/msr.h>
 #include <asm/io.h>
@@ -18,7 +19,6 @@
 #include <xen/xenoprof.h>
 #include <asm/regs.h>
 #include <asm/current.h>
-#include <asm/hvm/support.h>
 #include <xen/pci_regs.h>
 #include <xen/pci_ids.h>
 
diff --git a/xen/arch/x86/oprofile/xenoprof.c b/xen/arch/x86/oprofile/xenoprof.c
index b20f26bbe5..247a0deca8 100644
--- a/xen/arch/x86/oprofile/xenoprof.c
+++ b/xen/arch/x86/oprofile/xenoprof.c
@@ -12,7 +12,6 @@
 #include <xen/sched.h>
 #include <xen/xenoprof.h>
 #include <public/xenoprof.h>
-#include <asm/hvm/support.h>
 
 #include "op_counter.h"
 
diff --git a/xen/arch/x86/smp.c b/xen/arch/x86/smp.c
index b42603c351..3a331cbdbc 100644
--- a/xen/arch/x86/smp.c
+++ b/xen/arch/x86/smp.c
@@ -21,7 +21,6 @@
 #include <asm/flushtlb.h>
 #include <asm/hardirq.h>
 #include <asm/hpet.h>
-#include <asm/hvm/support.h>
 #include <asm/setup.h>
 #include <irq_vectors.h>
 #include <mach_apic.h>
diff --git a/xen/arch/x86/sysctl.c b/xen/arch/x86/sysctl.c
index f82abc2488..f42a3b843b 100644
--- a/xen/arch/x86/sysctl.c
+++ b/xen/arch/x86/sysctl.c
@@ -22,7 +22,6 @@
 #include <xen/iocap.h>
 #include <asm/irq.h>
 #include <asm/hvm/hvm.h>
-#include <asm/hvm/support.h>
 #include <asm/processor.h>
 #include <asm/setup.h>
 #include <asm/smp.h>
diff --git a/xen/arch/x86/x86_64/traps.c b/xen/arch/x86/x86_64/traps.c
index f8cb8d9a94..f4d17b4830 100644
--- a/xen/arch/x86/x86_64/traps.c
+++ b/xen/arch/x86/x86_64/traps.c
@@ -23,7 +23,6 @@
 #include <asm/page.h>
 #include <asm/shared.h>
 #include <asm/hvm/hvm.h>
-#include <asm/hvm/support.h>
 
 
 static void print_xen_info(void)
diff --git a/xen/arch/x86/xstate.c b/xen/arch/x86/xstate.c
index 3b32bdc51c..d481e1db3e 100644
--- a/xen/arch/x86/xstate.c
+++ b/xen/arch/x86/xstate.c
@@ -10,7 +10,6 @@
 #include <xen/sched.h>
 #include <asm/current.h>
 #include <asm/processor.h>
-#include <asm/hvm/support.h>
 #include <asm/i387.h>
 #include <asm/xstate.h>
 #include <asm/asm_defns.h>
diff --git a/xen/drivers/passthrough/x86/hvm.c b/xen/drivers/passthrough/x86/hvm.c
index a16e0e5344..dd09ec22f1 100644
--- a/xen/drivers/passthrough/x86/hvm.c
+++ b/xen/drivers/passthrough/x86/hvm.c
@@ -22,7 +22,6 @@
 #include <xen/cpu.h>
 #include <xen/irq.h>
 #include <asm/hvm/irq.h>
-#include <asm/hvm/support.h>
 #include <asm/io_apic.h>
 
 /*
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Feb 10 10:22:08 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 10 Feb 2023 10:22:08 +0000
Received: from list by lists.xenproject.org with outflank-mailman.493226.763033 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pQQXb-000210-3S; Fri, 10 Feb 2023 10:22:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 493226.763033; Fri, 10 Feb 2023 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 1pQQXb-00020s-08; Fri, 10 Feb 2023 10:22:03 +0000
Received: by outflank-mailman (input) for mailman id 493226;
 Fri, 10 Feb 2023 10: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 1pQQXZ-00020k-PH
 for xen-changelog@lists.xenproject.org; Fri, 10 Feb 2023 10:22:01 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pQQXZ-0002If-Mx
 for xen-changelog@lists.xenproject.org; Fri, 10 Feb 2023 10:22:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pQQXZ-0005Rw-Ls
 for xen-changelog@lists.xenproject.org; Fri, 10 Feb 2023 10:22:01 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=BfMeEtwVYJOuDvIJjTq7xqFDeyIVX9SI+JOnxxHZkw8=; b=sZQh8Jf8aT+mL8BdQQJWrgJZZf
	kkD8RN1+6MUIxxoU8YAMlMiJ3L0SHoKSus15yiK7ztlx/9z4mpl0xiYekC9HjmTNKsy1P1DFY0fX7
	0yDwyVTTrOrpGqhKa9wKaJF2kjAcBddTl431t6v4eof7C4YP6w3vdGbOz8S2h0SJV9ac=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.17] tools/ocaml/xenctrl: Make domain_getinfolist tail recursive
Message-Id: <E1pQQXZ-0005Rw-Ls@xenbits.xenproject.org>
Date: Fri, 10 Feb 2023 10:22:01 +0000

commit 03f545b6cf3220b4647677b588e5525a781a4813
Author:     Edwin Török <edvin.torok@citrix.com>
AuthorDate: Tue Nov 1 17:59:16 2022 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Feb 9 15:55:25 2023 +0000

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

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


From xen-changelog-bounces@lists.xenproject.org Fri Feb 10 10:22:13 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 10 Feb 2023 10:22:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.493227.763036 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pQQXl-00022q-4F; Fri, 10 Feb 2023 10:22:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 493227.763036; Fri, 10 Feb 2023 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 1pQQXl-00022j-1h; Fri, 10 Feb 2023 10:22:13 +0000
Received: by outflank-mailman (input) for mailman id 493227;
 Fri, 10 Feb 2023 10:22: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 1pQQXj-00022X-RD
 for xen-changelog@lists.xenproject.org; Fri, 10 Feb 2023 10:22:11 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pQQXj-0002J9-Q3
 for xen-changelog@lists.xenproject.org; Fri, 10 Feb 2023 10:22:11 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pQQXj-0005SN-P5
 for xen-changelog@lists.xenproject.org; Fri, 10 Feb 2023 10:22:11 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Cp5z3QqzrZfybyNlhm04P6sDCKuaj5tAYGzWGn1G3lY=; b=cJGN8QqFbd4qTxewGoDt7rJHFu
	l2cCozp6vV6DIO4z0ydyMva2gMtYp8fF0RB9xiNKV3v4Rw3zVtqmuiH3oQa+FZ4qEbhXTqRP2TFyV
	m5zZqLNhzXoMTHY5Wt589uN42UN/F7NLsQYl+DHUAqtCp37msowyUHrP+etaYzjwfV00=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.17] tools/ocaml/xenctrl: Use larger chunksize in domain_getinfolist
Message-Id: <E1pQQXj-0005SN-P5@xenbits.xenproject.org>
Date: Fri, 10 Feb 2023 10:22:11 +0000

commit 5d8f9cfa166c55a308856e7b021d778350edbd6c
Author:     Edwin Török <edvin.torok@citrix.com>
AuthorDate: Tue Nov 1 17:59:17 2022 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Feb 9 15:55:25 2023 +0000

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

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


From xen-changelog-bounces@lists.xenproject.org Fri Feb 10 10:22:23 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 10 Feb 2023 10:22:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.493228.763041 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pQQXv-000267-6D; Fri, 10 Feb 2023 10:22:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 493228.763041; Fri, 10 Feb 2023 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 1pQQXv-00025x-3I; Fri, 10 Feb 2023 10:22:23 +0000
Received: by outflank-mailman (input) for mailman id 493228;
 Fri, 10 Feb 2023 10:22: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 1pQQXt-00025d-U8
 for xen-changelog@lists.xenproject.org; Fri, 10 Feb 2023 10:22:21 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pQQXt-0002JS-TO
 for xen-changelog@lists.xenproject.org; Fri, 10 Feb 2023 10:22:21 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pQQXt-0005Ss-SC
 for xen-changelog@lists.xenproject.org; Fri, 10 Feb 2023 10:22:21 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=gQ3DRZW7gQOKMJ+B0Bq+Oosey8cJTxiNaxYWsfPmKbU=; b=wROMD5Vrcu4ZAVWtL4c+ciftu1
	wZun0GVmEoWRX+W8qKEsoeIb9xnlVemoVLNmnHd5T87spZB4i/iavmNWkQAo22H5OclUwMyLAJ4Ld
	EOKIH96wC9CR4Tf3oMxMOdJ6IIwVAVHNTejOGdwJH+G5CzprKX0AqOlsUJKng60Np6uA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.17] tools/ocaml/xb,mmap: Use Data_abstract_val wrapper
Message-Id: <E1pQQXt-0005Ss-SC@xenbits.xenproject.org>
Date: Fri, 10 Feb 2023 10:22:21 +0000

commit 7d516fc87637dc551494f8eca08f106f578f7112
Author:     Edwin Török <edvin.torok@citrix.com>
AuthorDate: Fri Dec 16 18:25:10 2022 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Feb 9 15:55:25 2023 +0000

    tools/ocaml/xb,mmap: Use Data_abstract_val wrapper
    
    This is not strictly necessary since it is essentially a no-op currently: a
    cast to void * and value *, even in OCaml 5.0.
    
    However it does make it clearer that what we have here is not a regular OCaml
    value, but one allocated with Abstract_tag or Custom_tag, and follows the
    example from the manual more closely:
    https://v2.ocaml.org/manual/intfc.html#ss:c-outside-head
    
    It also makes it clearer that these modules have been reviewed for
    compat with OCaml 5.0.
    
    We cannot use OCaml finalizers here, because we want exact control over when
    to unmap these pages from remote domains.
    
    No functional change.
    
    Signed-off-by: Edwin Török <edvin.torok@citrix.com>
    Acked-by: Christian Lindig <christian.lindig@citrix.com>
    (cherry picked from commit d2ccc637111d6dbcf808aaffeec7a46f0b1e1c81)
---
 tools/ocaml/libs/mmap/mmap_stubs.h    | 4 ++++
 tools/ocaml/libs/mmap/xenmmap_stubs.c | 2 +-
 tools/ocaml/libs/xb/xs_ring_stubs.c   | 2 +-
 3 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/tools/ocaml/libs/mmap/mmap_stubs.h b/tools/ocaml/libs/mmap/mmap_stubs.h
index 65e4239890..f4784e4715 100644
--- a/tools/ocaml/libs/mmap/mmap_stubs.h
+++ b/tools/ocaml/libs/mmap/mmap_stubs.h
@@ -30,4 +30,8 @@ struct mmap_interface
 	int len;
 };
 
+#ifndef Data_abstract_val
+#define Data_abstract_val(x) ((void *)Op_val(x))
+#endif
+
 #endif
diff --git a/tools/ocaml/libs/mmap/xenmmap_stubs.c b/tools/ocaml/libs/mmap/xenmmap_stubs.c
index e2ce088e25..e03951d781 100644
--- a/tools/ocaml/libs/mmap/xenmmap_stubs.c
+++ b/tools/ocaml/libs/mmap/xenmmap_stubs.c
@@ -28,7 +28,7 @@
 #include <caml/fail.h>
 #include <caml/callback.h>
 
-#define Intf_val(a) ((struct mmap_interface *) a)
+#define Intf_val(a) ((struct mmap_interface *)Data_abstract_val(a))
 
 static int mmap_interface_init(struct mmap_interface *intf,
                                int fd, int pflag, int mflag,
diff --git a/tools/ocaml/libs/xb/xs_ring_stubs.c b/tools/ocaml/libs/xb/xs_ring_stubs.c
index 7a91fdee75..1f58524535 100644
--- a/tools/ocaml/libs/xb/xs_ring_stubs.c
+++ b/tools/ocaml/libs/xb/xs_ring_stubs.c
@@ -35,7 +35,7 @@
 #include <sys/mman.h>
 #include "mmap_stubs.h"
 
-#define GET_C_STRUCT(a) ((struct mmap_interface *) a)
+#define GET_C_STRUCT(a) ((struct mmap_interface *)Data_abstract_val(a))
 
 /*
  * Bytes_val has been introduced by Ocaml 4.06.1. So define our own version
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.17


From xen-changelog-bounces@lists.xenproject.org Fri Feb 10 10:22:33 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 10 Feb 2023 10:22:33 +0000
Received: from list by lists.xenproject.org with outflank-mailman.493229.763045 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pQQY5-000294-7O; Fri, 10 Feb 2023 10:22:33 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 493229.763045; Fri, 10 Feb 2023 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 1pQQY5-00028w-4k; Fri, 10 Feb 2023 10:22:33 +0000
Received: by outflank-mailman (input) for mailman id 493229;
 Fri, 10 Feb 2023 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 1pQQY4-00028g-13
 for xen-changelog@lists.xenproject.org; Fri, 10 Feb 2023 10:22:32 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pQQY4-0002Jf-0K
 for xen-changelog@lists.xenproject.org; Fri, 10 Feb 2023 10:22:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pQQY3-0005TJ-VX
 for xen-changelog@lists.xenproject.org; Fri, 10 Feb 2023 10:22:31 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=RprAZLxSeLZz7ExWJ33wMFUPKpKE+B7s8i3aq4i/exM=; b=QF6e/R2n0Ci6NiFnuNpLpzZZB0
	FZ0o6rucRM8ahdWYcAgRhsmzpL/Z9A6zSmup6q+t0AZlNvldEzF/cAwt+navz1MME+hxWXevrrBqy
	8JhG5H6+agxfPORMnUX20EaYQFIW//6Tt5HuYt13f12q691b3vAIM5WuNQnCRHQV77E4=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.17] tools/ocaml/xb: Drop Xs_ring.write
Message-Id: <E1pQQY3-0005TJ-VX@xenbits.xenproject.org>
Date: Fri, 10 Feb 2023 10:22:31 +0000

commit f0e653fb4aea77210b8096c170e82de3c2039d89
Author:     Edwin Török <edvin.torok@citrix.com>
AuthorDate: Fri Dec 16 18:25:20 2022 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Feb 9 15:55:25 2023 +0000

    tools/ocaml/xb: Drop Xs_ring.write
    
    This function is unusued (only Xs_ring.write_substring is used), and the
    bytes/string conversion here is backwards: the C stub implements the bytes
    version and then we use a Bytes.unsafe_of_string to convert a string into
    bytes.
    
    However the operation here really is read-only: we read from the string and
    write it to the ring, so the C stub should implement the read-only string
    version, and if needed we could use Bytes.unsafe_to_string to be able to send
    'bytes'. However that is not necessary as the 'bytes' version is dropped above.
    
    Signed-off-by: Edwin Török <edvin.torok@citrix.com>
    Acked-by: Christian Lindig <christian.lindig@citrix.com>
    (cherry picked from commit 01f139215e678c2dc7d4bb3f9f2777069bb1b091)
---
 tools/ocaml/libs/xb/xs_ring.ml      | 5 +----
 tools/ocaml/libs/xb/xs_ring_stubs.c | 2 +-
 2 files changed, 2 insertions(+), 5 deletions(-)

diff --git a/tools/ocaml/libs/xb/xs_ring.ml b/tools/ocaml/libs/xb/xs_ring.ml
index db7f86bd27..dd5e014a33 100644
--- a/tools/ocaml/libs/xb/xs_ring.ml
+++ b/tools/ocaml/libs/xb/xs_ring.ml
@@ -25,14 +25,11 @@ module Server_features = Set.Make(struct
 end)
 
 external read: Xenmmap.mmap_interface -> bytes -> int -> int = "ml_interface_read"
-external write: Xenmmap.mmap_interface -> bytes -> int -> int = "ml_interface_write"
+external write_substring: Xenmmap.mmap_interface -> string -> int -> int = "ml_interface_write"
 
 external _internal_set_server_features: Xenmmap.mmap_interface -> int -> unit = "ml_interface_set_server_features" [@@noalloc]
 external _internal_get_server_features: Xenmmap.mmap_interface -> int = "ml_interface_get_server_features" [@@noalloc]
 
-let write_substring mmap buff len =
-	write mmap (Bytes.unsafe_of_string buff) len
-
 let get_server_features mmap =
 	(* NB only one feature currently defined above *)
 	let x = _internal_get_server_features mmap in
diff --git a/tools/ocaml/libs/xb/xs_ring_stubs.c b/tools/ocaml/libs/xb/xs_ring_stubs.c
index 1f58524535..1243c63f03 100644
--- a/tools/ocaml/libs/xb/xs_ring_stubs.c
+++ b/tools/ocaml/libs/xb/xs_ring_stubs.c
@@ -112,7 +112,7 @@ CAMLprim value ml_interface_write(value ml_interface,
 	CAMLlocal1(ml_result);
 
 	struct mmap_interface *interface = GET_C_STRUCT(ml_interface);
-	const unsigned char *buffer = Bytes_val(ml_buffer);
+	const char *buffer = String_val(ml_buffer);
 	int len = Int_val(ml_len);
 	int result;
 
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.17


From xen-changelog-bounces@lists.xenproject.org Fri Feb 10 10:22:43 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 10 Feb 2023 10:22:43 +0000
Received: from list by lists.xenproject.org with outflank-mailman.493230.763048 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pQQYF-0002Bn-8l; Fri, 10 Feb 2023 10:22:43 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 493230.763048; Fri, 10 Feb 2023 10: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 1pQQYF-0002Bg-6D; Fri, 10 Feb 2023 10:22:43 +0000
Received: by outflank-mailman (input) for mailman id 493230;
 Fri, 10 Feb 2023 10:22:42 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pQQYE-0002BX-5D
 for xen-changelog@lists.xenproject.org; Fri, 10 Feb 2023 10:22:42 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pQQYE-0002Ju-4c
 for xen-changelog@lists.xenproject.org; Fri, 10 Feb 2023 10:22:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pQQYE-0005Tv-2W
 for xen-changelog@lists.xenproject.org; Fri, 10 Feb 2023 10:22:42 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=4t7PdKBn/vScPbY0ZJSJ7nqE4buwOgMkSMZW1FQFV4Q=; b=cBS5x8HS99QNqlSZVByv4l9+cL
	/aOlsdEqcPoukXgnT1wsWUHZwnMmBLbXGgaZ2KFZt8NbOCqMeZCpA3AuQSr5lnltD5IoAxsQLaXc4
	ChJNelj4xeIbEwcsNOvDS3jHY4NF/+BSJ6A0yBNjhn22RT5fQAxUf8lIGqwCQtWnBSx4=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.17] tools/oxenstored: validate config file before live update
Message-Id: <E1pQQYE-0005Tv-2W@xenbits.xenproject.org>
Date: Fri, 10 Feb 2023 10:22:42 +0000

commit e74d868b48d55dfb20f5a41ec20fbec93d8e5deb
Author:     Edwin Török <edvin.torok@citrix.com>
AuthorDate: Tue May 11 15:56:50 2021 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Feb 9 15:55:25 2023 +0000

    tools/oxenstored: validate config file before live update
    
    The configuration file can contain typos or various errors that could prevent
    live update from succeeding (e.g. a flag only valid on a different version).
    Unknown entries in the config file would be ignored on startup normally,
    add a strict --config-test that live-update can use to check that the config file
    is valid *for the new binary*.
    
    For compatibility with running old code during live update recognize
    --live --help as an equivalent to --config-test.
    
    Signed-off-by: Edwin Török <edvin.torok@citrix.com>
    Acked-by: Christian Lindig <christian.lindig@citrix.com>
    (cherry picked from commit e6f07052ce4a0f0b7d4dc522d87465efb2d9ee86)
---
 tools/ocaml/xenstored/parse_arg.ml | 26 ++++++++++++++++++++++++++
 tools/ocaml/xenstored/xenstored.ml | 11 +++++++++--
 2 files changed, 35 insertions(+), 2 deletions(-)

diff --git a/tools/ocaml/xenstored/parse_arg.ml b/tools/ocaml/xenstored/parse_arg.ml
index 7c0478e76a..5e4ca6f1f7 100644
--- a/tools/ocaml/xenstored/parse_arg.ml
+++ b/tools/ocaml/xenstored/parse_arg.ml
@@ -26,8 +26,14 @@ type config =
 	restart: bool;
 	live_reload: bool;
 	disable_socket: bool;
+	config_test: bool;
 }
 
+let get_config_filename config_file =
+	match config_file with
+	| Some name -> name
+	| None	    -> Define.default_config_dir ^ "/oxenstored.conf"
+
 let do_argv =
 	let pidfile = ref "" and tracefile = ref "" (* old xenstored compatibility *)
 	and domain_init = ref true
@@ -38,6 +44,8 @@ let do_argv =
 	and restart = ref false
 	and live_reload = ref false
 	and disable_socket = ref false
+	and config_test = ref false
+	and help = ref false
 	in
 
 	let speclist =
@@ -55,10 +63,27 @@ let do_argv =
 		  ("-T", Arg.Set_string tracefile, ""); (* for compatibility *)
 		  ("--restart", Arg.Set restart, "Read database on starting");
 		  ("--live", Arg.Set live_reload, "Read live dump on startup");
+		  ("--config-test", Arg.Set config_test, "Test validity of config file");
 		  ("--disable-socket", Arg.Unit (fun () -> disable_socket := true), "Disable socket");
+		  ("--help", Arg.Set help, "Display this list of options")
 		] in
 	let usage_msg = "usage : xenstored [--config-file <filename>] [--no-domain-init] [--help] [--no-fork] [--reraise-top-level] [--restart] [--disable-socket]" in
 	Arg.parse speclist (fun _ -> ()) usage_msg;
+	let () =
+		if !help then begin
+			if !live_reload then
+				(*
+				 * Transform --live --help into --config-test for backward compat with
+				 * running code during live update.
+				 * Caller will validate config and exit
+				 *)
+				config_test := true
+			else begin
+				Arg.usage_string speclist usage_msg |> print_endline;
+				exit 0
+			end
+		end
+	in
 	{
 		domain_init = !domain_init;
 		activate_access_log = !activate_access_log;
@@ -70,4 +95,5 @@ let do_argv =
 		restart = !restart;
 		live_reload = !live_reload;
 		disable_socket = !disable_socket;
+		config_test = !config_test;
 	}
diff --git a/tools/ocaml/xenstored/xenstored.ml b/tools/ocaml/xenstored/xenstored.ml
index 4d5851c5cb..e2638a5af2 100644
--- a/tools/ocaml/xenstored/xenstored.ml
+++ b/tools/ocaml/xenstored/xenstored.ml
@@ -88,7 +88,7 @@ let default_pidfile = Paths.xen_run_dir ^ "/xenstored.pid"
 
 let ring_scan_interval = ref 20
 
-let parse_config filename =
+let parse_config ?(strict=false) filename =
 	let pidfile = ref default_pidfile in
 	let options = [
 		("merge-activate", Config.Set_bool Transaction.do_coalesce);
@@ -129,11 +129,12 @@ let parse_config filename =
 		("xenstored-port", Config.Set_string Domains.xenstored_port); ] in
 	begin try Config.read filename options (fun _ _ -> raise Not_found)
 	with
-	| Config.Error err -> List.iter (fun (k, e) ->
+	| Config.Error err as e -> List.iter (fun (k, e) ->
 		match e with
 		| "unknown key" -> eprintf "config: unknown key %s\n" k
 		| _             -> eprintf "config: %s: %s\n" k e
 		) err;
+		if strict then raise e
 	| Sys_error m -> eprintf "error: config: %s\n" m;
 	end;
 	!pidfile
@@ -358,6 +359,12 @@ let tweak_gc () =
 let () =
 	Printexc.set_uncaught_exception_handler Logging.fallback_exception_handler;
 	let cf = do_argv in
+	if cf.config_test then begin
+		let path = config_filename cf in
+		let _pidfile:string = parse_config ~strict:true path in
+		Printf.printf "Configuration valid at %s\n%!" path;
+		exit 0
+	end;
 	let pidfile =
 		if Sys.file_exists (config_filename cf) then
 			parse_config (config_filename cf)
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.17


From xen-changelog-bounces@lists.xenproject.org Fri Feb 10 10:22:53 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 10 Feb 2023 10:22:53 +0000
Received: from list by lists.xenproject.org with outflank-mailman.493231.763053 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pQQYP-0002Eg-AD; Fri, 10 Feb 2023 10:22:53 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 493231.763053; Fri, 10 Feb 2023 10:22:53 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pQQYP-0002EZ-7h; Fri, 10 Feb 2023 10:22:53 +0000
Received: by outflank-mailman (input) for mailman id 493231;
 Fri, 10 Feb 2023 10:22: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 1pQQYO-0002EP-8R
 for xen-changelog@lists.xenproject.org; Fri, 10 Feb 2023 10:22:52 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pQQYO-0002K5-7n
 for xen-changelog@lists.xenproject.org; Fri, 10 Feb 2023 10:22:52 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pQQYO-0005Vz-6r
 for xen-changelog@lists.xenproject.org; Fri, 10 Feb 2023 10:22:52 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=PCcxBDm/DLhwQ/pzTzyLVJObPNtOr88SEJHMgdEuvXA=; b=cg6/44tD0kc4g4N1wwwSL06GAW
	5ODwhEWVqn0BypdK7LQnalnKdCdmLpQUW2izQSsRjNfJa4A3GlM+2OtiQzAYWdriJYOSjwIdk9Ad3
	Y6IG34zSwQ0v30i7Wl/SwU4/qpGOHRROuWDCo07jSjy6OrGj1blPbzP+r5J68szz9Ceo=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.17] tools/ocaml/libs: Don't declare stubs as taking void
Message-Id: <E1pQQYO-0005Vz-6r@xenbits.xenproject.org>
Date: Fri, 10 Feb 2023 10:22:52 +0000

commit 2c21e1bee6d62cbd523069e839086addf35da9f2
Author:     Edwin Török <edwin.torok@cloud.com>
AuthorDate: Thu Jan 12 11:28:29 2023 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Feb 9 15:55:25 2023 +0000

    tools/ocaml/libs: Don't declare stubs as taking void
    
    There is no such thing as an Ocaml function (C stub or otherwise) taking no
    parameters.  In the absence of any other parameters, unit is still passed.
    
    This doesn't explode with any ABI we care about, but would malfunction for an
    ABI environment such as stdcall.
    
    Fixes: c3afd398ba7f ("ocaml: Add XS bindings.")
    Fixes: 8b7ce06a2d34 ("ocaml: Add XC bindings.")
    Signed-off-by: Edwin Török <edwin.torok@cloud.com>
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Christian Lindig <christian.lindig@citrix.com>
    (cherry picked from commit ff8b560be80b9211c303d74df7e4b3921d2bb8ca)
---
 tools/ocaml/libs/xb/xenbus_stubs.c  | 5 ++---
 tools/ocaml/libs/xc/xenctrl_stubs.c | 4 ++--
 2 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/tools/ocaml/libs/xb/xenbus_stubs.c b/tools/ocaml/libs/xb/xenbus_stubs.c
index 3065181a55..97116b0782 100644
--- a/tools/ocaml/libs/xb/xenbus_stubs.c
+++ b/tools/ocaml/libs/xb/xenbus_stubs.c
@@ -30,10 +30,9 @@
 #include <xenctrl.h>
 #include <xen/io/xs_wire.h>
 
-CAMLprim value stub_header_size(void)
+CAMLprim value stub_header_size(value unit)
 {
-	CAMLparam0();
-	CAMLreturn(Val_int(sizeof(struct xsd_sockmsg)));
+	return Val_int(sizeof(struct xsd_sockmsg));
 }
 
 CAMLprim value stub_header_of_string(value s)
diff --git a/tools/ocaml/libs/xc/xenctrl_stubs.c b/tools/ocaml/libs/xc/xenctrl_stubs.c
index f37848ae0b..6eb0ea69da 100644
--- a/tools/ocaml/libs/xc/xenctrl_stubs.c
+++ b/tools/ocaml/libs/xc/xenctrl_stubs.c
@@ -67,9 +67,9 @@ static void Noreturn failwith_xc(xc_interface *xch)
 	caml_raise_with_string(*caml_named_value("xc.error"), error_str);
 }
 
-CAMLprim value stub_xc_interface_open(void)
+CAMLprim value stub_xc_interface_open(value unit)
 {
-	CAMLparam0();
+	CAMLparam1(unit);
         xc_interface *xch;
 
 	/* Don't assert XC_OPENFLAG_NON_REENTRANT because these bindings
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.17


From xen-changelog-bounces@lists.xenproject.org Fri Feb 10 10:23:03 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 10 Feb 2023 10:23:03 +0000
Received: from list by lists.xenproject.org with outflank-mailman.493232.763057 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pQQYZ-0002HA-CF; Fri, 10 Feb 2023 10:23:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 493232.763057; Fri, 10 Feb 2023 10:23: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 1pQQYZ-0002H2-9A; Fri, 10 Feb 2023 10:23:03 +0000
Received: by outflank-mailman (input) for mailman id 493232;
 Fri, 10 Feb 2023 10:23: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 1pQQYY-0002Gs-Bc
 for xen-changelog@lists.xenproject.org; Fri, 10 Feb 2023 10:23:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pQQYY-0002KX-Ax
 for xen-changelog@lists.xenproject.org; Fri, 10 Feb 2023 10:23:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pQQYY-0005WZ-9z
 for xen-changelog@lists.xenproject.org; Fri, 10 Feb 2023 10: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=frqYTNWFGfKka97DeHcpha95wt+XGG2w+XPhF84tJlU=; b=0Z7ic9gmMwUj8bwLeFv819NYFj
	PDIosViHQyb1n8G5zkKZhU0bJ9Ro/mfXlx9tL4etg3kzpj1nHqc8PZS1wGNREPqZrCYuEKgMZvsob
	vRhJOE8UqcpE8gkI8dPQGUJUjRyklRK9cU3sQUAnTDqt03BeAvPq/WYSQ3TYQ1exjEBs=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.17] tools/ocaml/libs: Allocate the correct amount of memory for Abstract_tag
Message-Id: <E1pQQYY-0005WZ-9z@xenbits.xenproject.org>
Date: Fri, 10 Feb 2023 10:23:02 +0000

commit 5797b798a542a7e5be34698463152cb92f18776f
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Tue Jan 31 10:59:42 2023 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Feb 9 15:55:25 2023 +0000

    tools/ocaml/libs: Allocate the correct amount of memory for Abstract_tag
    
    caml_alloc() takes units of Wsize (word size), not bytes.  As a consequence,
    we're allocating 4 or 8 times too much memory.
    
    Ocaml has a helper, Wsize_bsize(), but it truncates cases which aren't an
    exact multiple.  Use a BUILD_BUG_ON() to cover the potential for truncation,
    as there's no rounding-up form of the helper.
    
    Fixes: 8b7ce06a2d34 ("ocaml: Add XC bindings.")
    Fixes: d3e649277a13 ("ocaml: add mmap bindings implementation.")
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Christian Lindig <christian.lindig@citrix.com>
    (cherry picked from commit 36eb2de31b6ecb8787698fb1a701bd708c8971b2)
---
 tools/ocaml/libs/mmap/Makefile        | 2 ++
 tools/ocaml/libs/mmap/xenmmap_stubs.c | 6 +++++-
 tools/ocaml/libs/xc/xenctrl_stubs.c   | 5 ++++-
 3 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/tools/ocaml/libs/mmap/Makefile b/tools/ocaml/libs/mmap/Makefile
index a621537135..855b8b2c98 100644
--- a/tools/ocaml/libs/mmap/Makefile
+++ b/tools/ocaml/libs/mmap/Makefile
@@ -2,6 +2,8 @@ OCAML_TOPLEVEL=$(CURDIR)/../..
 XEN_ROOT=$(OCAML_TOPLEVEL)/../..
 include $(OCAML_TOPLEVEL)/common.make
 
+CFLAGS += $(CFLAGS_xeninclude)
+
 OBJS = xenmmap
 INTF = $(foreach obj, $(OBJS),$(obj).cmi)
 LIBS = xenmmap.cma xenmmap.cmxa
diff --git a/tools/ocaml/libs/mmap/xenmmap_stubs.c b/tools/ocaml/libs/mmap/xenmmap_stubs.c
index e03951d781..d623ad390e 100644
--- a/tools/ocaml/libs/mmap/xenmmap_stubs.c
+++ b/tools/ocaml/libs/mmap/xenmmap_stubs.c
@@ -21,6 +21,8 @@
 #include <errno.h>
 #include "mmap_stubs.h"
 
+#include <xen-tools/libs.h>
+
 #include <caml/mlvalues.h>
 #include <caml/memory.h>
 #include <caml/alloc.h>
@@ -59,7 +61,9 @@ CAMLprim value stub_mmap_init(value fd, value pflag, value mflag,
 	default: caml_invalid_argument("maptype");
 	}
 
-	result = caml_alloc(sizeof(struct mmap_interface), Abstract_tag);
+	BUILD_BUG_ON((sizeof(struct mmap_interface) % sizeof(value)) != 0);
+	result = caml_alloc(Wsize_bsize(sizeof(struct mmap_interface)),
+			    Abstract_tag);
 
 	if (mmap_interface_init(Intf_val(result), Int_val(fd),
 	                        c_pflag, c_mflag,
diff --git a/tools/ocaml/libs/xc/xenctrl_stubs.c b/tools/ocaml/libs/xc/xenctrl_stubs.c
index 6eb0ea69da..e25367531b 100644
--- a/tools/ocaml/libs/xc/xenctrl_stubs.c
+++ b/tools/ocaml/libs/xc/xenctrl_stubs.c
@@ -956,7 +956,10 @@ CAMLprim value stub_map_foreign_range(value xch, value dom,
 	uint32_t c_dom;
 	unsigned long c_mfn;
 
-	result = caml_alloc(sizeof(struct mmap_interface), Abstract_tag);
+	BUILD_BUG_ON((sizeof(struct mmap_interface) % sizeof(value)) != 0);
+	result = caml_alloc(Wsize_bsize(sizeof(struct mmap_interface)),
+			    Abstract_tag);
+
 	intf = (struct mmap_interface *) result;
 
 	intf->len = Int_val(size);
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.17


From xen-changelog-bounces@lists.xenproject.org Fri Feb 10 10:23:13 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 10 Feb 2023 10:23:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.493233.763061 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pQQYj-0002KV-Ea; Fri, 10 Feb 2023 10:23:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 493233.763061; Fri, 10 Feb 2023 10:23: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 1pQQYj-0002KO-C3; Fri, 10 Feb 2023 10:23:13 +0000
Received: by outflank-mailman (input) for mailman id 493233;
 Fri, 10 Feb 2023 10:23: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 1pQQYi-0002KD-Et
 for xen-changelog@lists.xenproject.org; Fri, 10 Feb 2023 10:23:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pQQYi-0002Ky-EB
 for xen-changelog@lists.xenproject.org; Fri, 10 Feb 2023 10:23:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pQQYi-0005X3-DE
 for xen-changelog@lists.xenproject.org; Fri, 10 Feb 2023 10: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=lWxoM2DGKfxFxi0Jjx1tK5JgVNNJyId4zq6s1vzLppQ=; b=PPA3iuorHGi+zpkgDQArJO+6Jh
	QukRbrPJ7flD6Mfa7OgLoU/ID99N+uXSRAWIW4aUPkrQX2rMEief+0eHVpiE0TsxppL8ndETiGZ6S
	Rq+0/FrzIvXZzlUfEv1rg6zKs3VkNMDVH7mxkmXUzW9VzIhuUwXBXvjgjUqrOxTmXJ9M=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.17] tools/ocaml/evtchn: Don't reference Custom objects with the GC lock released
Message-Id: <E1pQQYi-0005X3-DE@xenbits.xenproject.org>
Date: Fri, 10 Feb 2023 10:23:12 +0000

commit 021b82cc0c71ba592439f175c1ededa800b172a9
Author:     Edwin Török <edwin.torok@cloud.com>
AuthorDate: Thu Jan 12 17:48:29 2023 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Feb 9 15:55:25 2023 +0000

    tools/ocaml/evtchn: Don't reference Custom objects with the GC lock released
    
    The modification to the _H() macro for Ocaml 5 support introduced a subtle
    bug.  From the manual:
    
      https://ocaml.org/manual/intfc.html#ss:parallel-execution-long-running-c-code
    
    "After caml_release_runtime_system() was called and until
    caml_acquire_runtime_system() is called, the C code must not access any OCaml
    data, nor call any function of the run-time system, nor call back into OCaml
    code."
    
    Previously, the value was a naked C pointer, so dereferencing it wasn't
    "accessing any Ocaml data", but the fix to avoid naked C pointers added a
    layer of indirection through an Ocaml Custom object, meaning that the common
    pattern of using _H() in a blocking section is unsafe.
    
    In order to fix:
    
     * Drop the _H() macro and replace it with a static inline xce_of_val().
     * Opencode the assignment into Data_custom_val() in the two constructors.
     * Rename "value xce" parameters to "value xce_val" so we can consistently
       have "xenevtchn_handle *xce" on the stack, and obtain the pointer with the
       GC lock still held.
    
    Fixes: 22d5affdf0ce ("tools/ocaml/evtchn: OCaml 5 support, fix potential resource leak")
    Signed-off-by: Edwin Török <edwin.torok@cloud.com>
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Christian Lindig <christian.lindig@citrix.com>
    (cherry picked from commit 2636d8ff7a670c4d2485757dbe966e36c259a960)
---
 tools/ocaml/libs/eventchn/xeneventchn_stubs.c | 60 ++++++++++++++++-----------
 1 file changed, 35 insertions(+), 25 deletions(-)

diff --git a/tools/ocaml/libs/eventchn/xeneventchn_stubs.c b/tools/ocaml/libs/eventchn/xeneventchn_stubs.c
index aa8a69cc1e..d7881ca95f 100644
--- a/tools/ocaml/libs/eventchn/xeneventchn_stubs.c
+++ b/tools/ocaml/libs/eventchn/xeneventchn_stubs.c
@@ -33,11 +33,14 @@
 #include <caml/fail.h>
 #include <caml/signals.h>
 
-#define _H(__h) (*((xenevtchn_handle **)Data_custom_val(__h)))
+static inline xenevtchn_handle *xce_of_val(value v)
+{
+	return *(xenevtchn_handle **)Data_custom_val(v);
+}
 
 static void stub_evtchn_finalize(value v)
 {
-	xenevtchn_close(_H(v));
+	xenevtchn_close(xce_of_val(v));
 }
 
 static struct custom_operations xenevtchn_ops = {
@@ -68,7 +71,7 @@ CAMLprim value stub_eventchn_init(value cloexec)
 		caml_failwith("open failed");
 
 	result = caml_alloc_custom(&xenevtchn_ops, sizeof(xce), 0, 1);
-	_H(result) = xce;
+	*(xenevtchn_handle **)Data_custom_val(result) = xce;
 
 	CAMLreturn(result);
 }
@@ -87,18 +90,19 @@ CAMLprim value stub_eventchn_fdopen(value fdval)
 		caml_failwith("evtchn fdopen failed");
 
 	result = caml_alloc_custom(&xenevtchn_ops, sizeof(xce), 0, 1);
-	_H(result) = xce;
+	*(xenevtchn_handle **)Data_custom_val(result) = xce;
 
 	CAMLreturn(result);
 }
 
-CAMLprim value stub_eventchn_fd(value xce)
+CAMLprim value stub_eventchn_fd(value xce_val)
 {
-	CAMLparam1(xce);
+	CAMLparam1(xce_val);
 	CAMLlocal1(result);
+	xenevtchn_handle *xce = xce_of_val(xce_val);
 	int fd;
 
-	fd = xenevtchn_fd(_H(xce));
+	fd = xenevtchn_fd(xce);
 	if (fd == -1)
 		caml_failwith("evtchn fd failed");
 
@@ -107,13 +111,14 @@ CAMLprim value stub_eventchn_fd(value xce)
 	CAMLreturn(result);
 }
 
-CAMLprim value stub_eventchn_notify(value xce, value port)
+CAMLprim value stub_eventchn_notify(value xce_val, value port)
 {
-	CAMLparam2(xce, port);
+	CAMLparam2(xce_val, port);
+	xenevtchn_handle *xce = xce_of_val(xce_val);
 	int rc;
 
 	caml_enter_blocking_section();
-	rc = xenevtchn_notify(_H(xce), Int_val(port));
+	rc = xenevtchn_notify(xce, Int_val(port));
 	caml_leave_blocking_section();
 
 	if (rc == -1)
@@ -122,15 +127,16 @@ CAMLprim value stub_eventchn_notify(value xce, value port)
 	CAMLreturn(Val_unit);
 }
 
-CAMLprim value stub_eventchn_bind_interdomain(value xce, value domid,
+CAMLprim value stub_eventchn_bind_interdomain(value xce_val, value domid,
                                               value remote_port)
 {
-	CAMLparam3(xce, domid, remote_port);
+	CAMLparam3(xce_val, domid, remote_port);
 	CAMLlocal1(port);
+	xenevtchn_handle *xce = xce_of_val(xce_val);
 	xenevtchn_port_or_error_t rc;
 
 	caml_enter_blocking_section();
-	rc = xenevtchn_bind_interdomain(_H(xce), Int_val(domid), Int_val(remote_port));
+	rc = xenevtchn_bind_interdomain(xce, Int_val(domid), Int_val(remote_port));
 	caml_leave_blocking_section();
 
 	if (rc == -1)
@@ -140,14 +146,15 @@ CAMLprim value stub_eventchn_bind_interdomain(value xce, value domid,
 	CAMLreturn(port);
 }
 
-CAMLprim value stub_eventchn_bind_virq(value xce, value virq_type)
+CAMLprim value stub_eventchn_bind_virq(value xce_val, value virq_type)
 {
-	CAMLparam2(xce, virq_type);
+	CAMLparam2(xce_val, virq_type);
 	CAMLlocal1(port);
+	xenevtchn_handle *xce = xce_of_val(xce_val);
 	xenevtchn_port_or_error_t rc;
 
 	caml_enter_blocking_section();
-	rc = xenevtchn_bind_virq(_H(xce), Int_val(virq_type));
+	rc = xenevtchn_bind_virq(xce, Int_val(virq_type));
 	caml_leave_blocking_section();
 
 	if (rc == -1)
@@ -157,13 +164,14 @@ CAMLprim value stub_eventchn_bind_virq(value xce, value virq_type)
 	CAMLreturn(port);
 }
 
-CAMLprim value stub_eventchn_unbind(value xce, value port)
+CAMLprim value stub_eventchn_unbind(value xce_val, value port)
 {
-	CAMLparam2(xce, port);
+	CAMLparam2(xce_val, port);
+	xenevtchn_handle *xce = xce_of_val(xce_val);
 	int rc;
 
 	caml_enter_blocking_section();
-	rc = xenevtchn_unbind(_H(xce), Int_val(port));
+	rc = xenevtchn_unbind(xce, Int_val(port));
 	caml_leave_blocking_section();
 
 	if (rc == -1)
@@ -172,14 +180,15 @@ CAMLprim value stub_eventchn_unbind(value xce, value port)
 	CAMLreturn(Val_unit);
 }
 
-CAMLprim value stub_eventchn_pending(value xce)
+CAMLprim value stub_eventchn_pending(value xce_val)
 {
-	CAMLparam1(xce);
+	CAMLparam1(xce_val);
 	CAMLlocal1(result);
+	xenevtchn_handle *xce = xce_of_val(xce_val);
 	xenevtchn_port_or_error_t port;
 
 	caml_enter_blocking_section();
-	port = xenevtchn_pending(_H(xce));
+	port = xenevtchn_pending(xce);
 	caml_leave_blocking_section();
 
 	if (port == -1)
@@ -189,16 +198,17 @@ CAMLprim value stub_eventchn_pending(value xce)
 	CAMLreturn(result);
 }
 
-CAMLprim value stub_eventchn_unmask(value xce, value _port)
+CAMLprim value stub_eventchn_unmask(value xce_val, value _port)
 {
-	CAMLparam2(xce, _port);
+	CAMLparam2(xce_val, _port);
+	xenevtchn_handle *xce = xce_of_val(xce_val);
 	evtchn_port_t port;
 	int rc;
 
 	port = Int_val(_port);
 
 	caml_enter_blocking_section();
-	rc = xenevtchn_unmask(_H(xce), port);
+	rc = xenevtchn_unmask(xce, port);
 	caml_leave_blocking_section();
 
 	if (rc)
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.17


From xen-changelog-bounces@lists.xenproject.org Fri Feb 10 10:23:23 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 10 Feb 2023 10:23:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.493234.763065 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pQQYt-0002OS-Gx; Fri, 10 Feb 2023 10:23:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 493234.763065; Fri, 10 Feb 2023 10:23: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 1pQQYt-0002OL-Dh; Fri, 10 Feb 2023 10:23:23 +0000
Received: by outflank-mailman (input) for mailman id 493234;
 Fri, 10 Feb 2023 10:23: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 1pQQYs-0002OB-IE
 for xen-changelog@lists.xenproject.org; Fri, 10 Feb 2023 10:23:22 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pQQYs-0002LF-HX
 for xen-changelog@lists.xenproject.org; Fri, 10 Feb 2023 10:23:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pQQYs-0005Xb-GM
 for xen-changelog@lists.xenproject.org; Fri, 10 Feb 2023 10: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=dOuUkdfSL46UJCsjxlluZQk4qq2VUWSlaUf8I1v4Uuk=; b=BcNIutkzEBmB6tVOI5vWU6+i4q
	6cuaeq/+yLcJkMrtj6ocgHBlOl429H68+/dxa34YLgKy1uDAlWqEdcMBVCdTOIsNsMYKpiXOsNccr
	9YRiJmLqzV6vZ2O1Nbq6DDB3B7IIB+m5kuBXEAu9sGo2dD5Uw7KS3cjpm4nFqR3fYTa8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.17] tools/ocaml/xc: Fix binding for xc_domain_assign_device()
Message-Id: <E1pQQYs-0005Xb-GM@xenbits.xenproject.org>
Date: Fri, 10 Feb 2023 10:23:22 +0000

commit afdcc108566e5a4ee352b6427c98ebad6885a81d
Author:     Edwin Török <edwin.torok@cloud.com>
AuthorDate: Thu Jan 12 11:38:38 2023 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Feb 9 15:55:25 2023 +0000

    tools/ocaml/xc: Fix binding for xc_domain_assign_device()
    
    The patch adding this binding was plain broken, and unreviewed.  It modified
    the C stub to add a 4th parameter without an equivalent adjustment in the
    Ocaml side of the bindings.
    
    In 64bit builds, this causes us to dereference whatever dead value is in %rcx
    when trying to interpret the rflags parameter.
    
    This has gone unnoticed because Xapi doesn't use this binding (it has its
    own), but unbreak the binding by passing RDM_RELAXED unconditionally for
    now (matching the libxl default behaviour).
    
    Fixes: 9b34056cb4 ("tools: extend xc_assign_device() to support rdm reservation policy")
    Signed-off-by: Edwin Török <edwin.torok@cloud.com>
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Christian Lindig <christian.lindig@citrix.com>
    (cherry picked from commit 4250683842104f02996428f93927a035c8e19266)
---
 tools/ocaml/libs/xc/xenctrl_stubs.c | 17 +++++------------
 1 file changed, 5 insertions(+), 12 deletions(-)

diff --git a/tools/ocaml/libs/xc/xenctrl_stubs.c b/tools/ocaml/libs/xc/xenctrl_stubs.c
index e25367531b..f376d94334 100644
--- a/tools/ocaml/libs/xc/xenctrl_stubs.c
+++ b/tools/ocaml/libs/xc/xenctrl_stubs.c
@@ -1139,17 +1139,12 @@ CAMLprim value stub_xc_domain_test_assign_device(value xch, value domid, value d
 	CAMLreturn(Val_bool(ret == 0));
 }
 
-static int domain_assign_device_rdm_flag_table[] = {
-    XEN_DOMCTL_DEV_RDM_RELAXED,
-};
-
-CAMLprim value stub_xc_domain_assign_device(value xch, value domid, value desc,
-                                            value rflag)
+CAMLprim value stub_xc_domain_assign_device(value xch, value domid, value desc)
 {
-	CAMLparam4(xch, domid, desc, rflag);
+	CAMLparam3(xch, domid, desc);
 	int ret;
 	int domain, bus, dev, func;
-	uint32_t sbdf, flag;
+	uint32_t sbdf;
 
 	domain = Int_val(Field(desc, 0));
 	bus = Int_val(Field(desc, 1));
@@ -1157,10 +1152,8 @@ CAMLprim value stub_xc_domain_assign_device(value xch, value domid, value desc,
 	func = Int_val(Field(desc, 3));
 	sbdf = encode_sbdf(domain, bus, dev, func);
 
-	ret = Int_val(Field(rflag, 0));
-	flag = domain_assign_device_rdm_flag_table[ret];
-
-	ret = xc_assign_device(_H(xch), _D(domid), sbdf, flag);
+	ret = xc_assign_device(_H(xch), _D(domid), sbdf,
+			       XEN_DOMCTL_DEV_RDM_RELAXED);
 
 	if (ret < 0)
 		failwith_xc(_H(xch));
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.17


From xen-changelog-bounces@lists.xenproject.org Fri Feb 10 10:23:34 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 10 Feb 2023 10:23:34 +0000
Received: from list by lists.xenproject.org with outflank-mailman.493235.763068 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pQQZ4-0002Rc-Hr; Fri, 10 Feb 2023 10:23:34 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 493235.763068; Fri, 10 Feb 2023 10: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 1pQQZ4-0002RU-FC; Fri, 10 Feb 2023 10:23:34 +0000
Received: by outflank-mailman (input) for mailman id 493235;
 Fri, 10 Feb 2023 10:23: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 1pQQZ2-0002RJ-LT
 for xen-changelog@lists.xenproject.org; Fri, 10 Feb 2023 10:23:32 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pQQZ2-0002LQ-Ke
 for xen-changelog@lists.xenproject.org; Fri, 10 Feb 2023 10:23:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pQQZ2-0005YH-Jn
 for xen-changelog@lists.xenproject.org; Fri, 10 Feb 2023 10: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=nSvHQ5SIdPlHIChqDUqqtrRFYLFB4yVB2y3TqaqT9Hg=; b=qe0oc/0b8nVqsppJVqGYfdzEQK
	vkffxBvW1Sw7g4gvFcNKr219jYHNlCnG31yiMbPfFsFPBygeD+WaAcKce+5fpFUDe8kkK43fGOBz1
	1S42140xPGCxh6mejHfplnTbdGBIdHfFBtofbWYVszbUQet5wP4yYY5IX5IPBC/fqQZk=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.17] tools/ocaml/xc: Don't reference Abstract_Tag objects with the GC lock released
Message-Id: <E1pQQZ2-0005YH-Jn@xenbits.xenproject.org>
Date: Fri, 10 Feb 2023 10:23:32 +0000

commit bf935b1ff7cc76b2d25f877e56a359afaafcac1f
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Tue Jan 31 17:19:30 2023 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Feb 9 15:55:25 2023 +0000

    tools/ocaml/xc: Don't reference Abstract_Tag objects with the GC lock released
    
    The intf->{addr,len} references in the xc_map_foreign_range() call are unsafe.
    From the manual:
    
      https://ocaml.org/manual/intfc.html#ss:parallel-execution-long-running-c-code
    
    "After caml_release_runtime_system() was called and until
    caml_acquire_runtime_system() is called, the C code must not access any OCaml
    data, nor call any function of the run-time system, nor call back into OCaml
    code."
    
    More than what the manual says, the intf pointer is (potentially) invalidated
    by caml_enter_blocking_section() if another thread happens to perform garbage
    collection at just the right (wrong) moment.
    
    Rewrite the logic.  There's no need to stash data in the Ocaml object until
    the success path at the very end.
    
    Fixes: 8b7ce06a2d34 ("ocaml: Add XC bindings.")
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Christian Lindig <christian.lindig@citrix.com>
    (cherry picked from commit 9e7c74e6f9fd2e44df1212643b80af9032b45b07)
---
 tools/ocaml/libs/xc/xenctrl_stubs.c | 23 +++++++++++------------
 1 file changed, 11 insertions(+), 12 deletions(-)

diff --git a/tools/ocaml/libs/xc/xenctrl_stubs.c b/tools/ocaml/libs/xc/xenctrl_stubs.c
index f376d94334..facb561577 100644
--- a/tools/ocaml/libs/xc/xenctrl_stubs.c
+++ b/tools/ocaml/libs/xc/xenctrl_stubs.c
@@ -953,26 +953,25 @@ CAMLprim value stub_map_foreign_range(value xch, value dom,
 	CAMLparam4(xch, dom, size, mfn);
 	CAMLlocal1(result);
 	struct mmap_interface *intf;
-	uint32_t c_dom;
-	unsigned long c_mfn;
+	unsigned long c_mfn = Nativeint_val(mfn);
+	int len = Int_val(size);
+	void *ptr;
 
 	BUILD_BUG_ON((sizeof(struct mmap_interface) % sizeof(value)) != 0);
 	result = caml_alloc(Wsize_bsize(sizeof(struct mmap_interface)),
 			    Abstract_tag);
 
-	intf = (struct mmap_interface *) result;
-
-	intf->len = Int_val(size);
-
-	c_dom = _D(dom);
-	c_mfn = Nativeint_val(mfn);
 	caml_enter_blocking_section();
-	intf->addr = xc_map_foreign_range(_H(xch), c_dom,
-	                                  intf->len, PROT_READ|PROT_WRITE,
-	                                  c_mfn);
+	ptr = xc_map_foreign_range(_H(xch), _D(dom), len,
+				   PROT_READ|PROT_WRITE, c_mfn);
 	caml_leave_blocking_section();
-	if (!intf->addr)
+
+	if (!ptr)
 		caml_failwith("xc_map_foreign_range error");
+
+	intf = Data_abstract_val(result);
+	*intf = (struct mmap_interface){ ptr, len };
+
 	CAMLreturn(result);
 }
 
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.17


From xen-changelog-bounces@lists.xenproject.org Fri Feb 10 10:23:44 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 10 Feb 2023 10:23:44 +0000
Received: from list by lists.xenproject.org with outflank-mailman.493236.763073 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pQQZE-0002Ty-JP; Fri, 10 Feb 2023 10:23:44 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 493236.763073; Fri, 10 Feb 2023 10: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 1pQQZE-0002Tq-Gc; Fri, 10 Feb 2023 10:23:44 +0000
Received: by outflank-mailman (input) for mailman id 493236;
 Fri, 10 Feb 2023 10:23: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 1pQQZC-0002Te-OI
 for xen-changelog@lists.xenproject.org; Fri, 10 Feb 2023 10:23:42 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pQQZC-0002LU-Nf
 for xen-changelog@lists.xenproject.org; Fri, 10 Feb 2023 10:23:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pQQZC-0005Ym-Mm
 for xen-changelog@lists.xenproject.org; Fri, 10 Feb 2023 10: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=k2GrwkAf/3agcosJ17bJ9afxlioMapr+JNkRhn07TF8=; b=p/ZutF+CUgJ9xBLU6vFblDSA7N
	Y39nHqeB0qr0nwnDNf/R5CnLVipBtbRLEV5gjQMiHKGn+I86kyWLgVr855zEeZlGO+Vc9GUiVCLuX
	OmF6dQfU/QXpp7FSuQXEkDlUXoMhFTeG50wF9X3ZnWMcZBpfqTvwTDMSQStTkfJtLlek=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.17] tools/ocaml/libs: Fix memory/resource leaks with caml_alloc_custom()
Message-Id: <E1pQQZC-0005Ym-Mm@xenbits.xenproject.org>
Date: Fri, 10 Feb 2023 10:23:42 +0000

commit 587823eca162d063027faf1826ec3544f0a06e78
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Wed Feb 1 11:27:42 2023 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Feb 9 15:55:25 2023 +0000

    tools/ocaml/libs: Fix memory/resource leaks with caml_alloc_custom()
    
    All caml_alloc_*() functions can throw exceptions, and longjump out of
    context.  If this happens, we leak the xch/xce handle.
    
    Reorder the logic to allocate the the Ocaml object first.
    
    Fixes: 8b3c06a3e545 ("tools/ocaml/xenctrl: OCaml 5 support, fix use-after-free")
    Fixes: 22d5affdf0ce ("tools/ocaml/evtchn: OCaml 5 support, fix potential resource leak")
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Christian Lindig <christian.lindig@citrix.com>
    (cherry picked from commit d69ccf52ad467ccc22029172a8e61dc621187889)
---
 tools/ocaml/libs/eventchn/xeneventchn_stubs.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/tools/ocaml/libs/eventchn/xeneventchn_stubs.c b/tools/ocaml/libs/eventchn/xeneventchn_stubs.c
index d7881ca95f..de2fc29292 100644
--- a/tools/ocaml/libs/eventchn/xeneventchn_stubs.c
+++ b/tools/ocaml/libs/eventchn/xeneventchn_stubs.c
@@ -63,6 +63,8 @@ CAMLprim value stub_eventchn_init(value cloexec)
 	if ( !Bool_val(cloexec) )
 		flags |= XENEVTCHN_NO_CLOEXEC;
 
+	result = caml_alloc_custom(&xenevtchn_ops, sizeof(xce), 0, 1);
+
 	caml_enter_blocking_section();
 	xce = xenevtchn_open(NULL, flags);
 	caml_leave_blocking_section();
@@ -70,7 +72,6 @@ CAMLprim value stub_eventchn_init(value cloexec)
 	if (xce == NULL)
 		caml_failwith("open failed");
 
-	result = caml_alloc_custom(&xenevtchn_ops, sizeof(xce), 0, 1);
 	*(xenevtchn_handle **)Data_custom_val(result) = xce;
 
 	CAMLreturn(result);
@@ -82,6 +83,8 @@ CAMLprim value stub_eventchn_fdopen(value fdval)
 	CAMLlocal1(result);
 	xenevtchn_handle *xce;
 
+	result = caml_alloc_custom(&xenevtchn_ops, sizeof(xce), 0, 1);
+
 	caml_enter_blocking_section();
 	xce = xenevtchn_fdopen(NULL, Int_val(fdval), 0);
 	caml_leave_blocking_section();
@@ -89,7 +92,6 @@ CAMLprim value stub_eventchn_fdopen(value fdval)
 	if (xce == NULL)
 		caml_failwith("evtchn fdopen failed");
 
-	result = caml_alloc_custom(&xenevtchn_ops, sizeof(xce), 0, 1);
 	*(xenevtchn_handle **)Data_custom_val(result) = xce;
 
 	CAMLreturn(result);
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.17


From xen-changelog-bounces@lists.xenproject.org Fri Feb 10 12:11:07 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 10 Feb 2023 12:11:07 +0000
Received: from list by lists.xenproject.org with outflank-mailman.493359.763251 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pQSF5-0006I8-TG; Fri, 10 Feb 2023 12:11:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 493359.763251; Fri, 10 Feb 2023 12:11:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pQSF5-0006I0-QS; Fri, 10 Feb 2023 12:11:03 +0000
Received: by outflank-mailman (input) for mailman id 493359;
 Fri, 10 Feb 2023 12: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 1pQSF4-0006Hs-JX
 for xen-changelog@lists.xenproject.org; Fri, 10 Feb 2023 12:11:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pQSF4-0004po-Gr
 for xen-changelog@lists.xenproject.org; Fri, 10 Feb 2023 12:11:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pQSF4-0001zy-Fq
 for xen-changelog@lists.xenproject.org; Fri, 10 Feb 2023 12:11:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=F1EyrLftZNnaz6My4aA9OQn255Rr57axD4B5Dernv8Q=; b=pOWZcNrPdueyDn/qREsPXKA2Hz
	Mbvwk23cjQXeKYt+VVhtxaopjVMryi/MnKcl5xmHheBHu3jDD3gCGn6Ru4gOtR1/jsS9av0q4sshi
	4C0UIUNWlQdy2Wl6czMUWlnHQF1amZkSq9yBKzruElI+I7HVTTPfuZSnkW3XvcYUYElA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/riscv: change ISA to r64G
Message-Id: <E1pQSF4-0001zy-Fq@xenbits.xenproject.org>
Date: Fri, 10 Feb 2023 12:11:02 +0000

commit 48aabc5de261177c011a55732afbe09373acf465
Author:     Oleksii Kurochko <oleksii.kurochko@gmail.com>
AuthorDate: Wed Feb 8 09:20:33 2023 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Feb 8 09:20:33 2023 +0100

    xen/riscv: change ISA to r64G
    
    Work with some registers requires csr command which is part of
    Zicsr.
    
    Also ISA was changed from r64ima to r64g where G is represented the
    “IMAFDZicsr Zifencei” base and extensions so basically it is the same
    as it was before plus additional extensions we will need in the
    nearest future.
    
    Signed-off-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
    Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
---
 xen/arch/riscv/Kconfig | 14 +++++++++-----
 xen/arch/riscv/arch.mk |  2 +-
 2 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/xen/arch/riscv/Kconfig b/xen/arch/riscv/Kconfig
index 468e250c86..f382b36f6c 100644
--- a/xen/arch/riscv/Kconfig
+++ b/xen/arch/riscv/Kconfig
@@ -19,15 +19,19 @@ menu "ISA Selection"
 
 choice
 	prompt "Base ISA"
-	default RISCV_ISA_RV64IMA if RISCV_64
+	default RISCV_ISA_RV64G if RISCV_64
 	help
 	  This selects the base ISA extensions that Xen will target.
 
-config RISCV_ISA_RV64IMA
-	bool "RV64IMA"
+config RISCV_ISA_RV64G
+	bool "RV64G"
 	help
-	  Use the RV64I base ISA, plus the "M" and "A" extensions
-	  for integer multiply/divide and atomic instructions, respectively.
+	  Use the RV64I base ISA, plus
+	  "M" for multiply/divide,
+	  "A" for atomic instructions,
+	  “F”/"D" for  {single/double}-precision floating-point instructions,
+	  "Zicsr" for control and status register access,
+	  "Zifencei" for instruction-fetch fence.
 
 endchoice
 
diff --git a/xen/arch/riscv/arch.mk b/xen/arch/riscv/arch.mk
index 012dc677c3..45fe858ee0 100644
--- a/xen/arch/riscv/arch.mk
+++ b/xen/arch/riscv/arch.mk
@@ -3,7 +3,7 @@
 
 CFLAGS-$(CONFIG_RISCV_64) += -mabi=lp64
 
-riscv-march-$(CONFIG_RISCV_ISA_RV64IMA) := rv64ima
+riscv-march-$(CONFIG_RISCV_ISA_RV64G) := rv64g
 riscv-march-$(CONFIG_RISCV_ISA_C)       := $(riscv-march-y)c
 
 # Note that -mcmodel=medany is used so that Xen can be mapped
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Feb 10 12:11:13 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 10 Feb 2023 12:11:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.493360.763255 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pQSFF-0006Jv-Ux; Fri, 10 Feb 2023 12:11:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 493360.763255; Fri, 10 Feb 2023 12:11:13 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pQSFF-0006Jo-S2; Fri, 10 Feb 2023 12:11:13 +0000
Received: by outflank-mailman (input) for mailman id 493360;
 Fri, 10 Feb 2023 12: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 1pQSFE-0006Ji-Kl
 for xen-changelog@lists.xenproject.org; Fri, 10 Feb 2023 12:11:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pQSFE-0004qB-Jx
 for xen-changelog@lists.xenproject.org; Fri, 10 Feb 2023 12:11:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pQSFE-00020c-Iw
 for xen-changelog@lists.xenproject.org; Fri, 10 Feb 2023 12:11:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=FYdFlkKBW9R9g/cdknpK5rtmbXNqwVq6iPfQ9FPCEw4=; b=go8Yr1ppTkFd8kL5T2wXuYSp7u
	Ikb40gq7P9BYcS/NGph24gOMiVoVzh7rFYsN3uCFqcKDzgWxwtSfsBOprN8A/lE92ucAq4XgGb7kU
	717bfwtuiZqV1g5Chx0gAWp2ifPd/n+LjHz8iL0uFN/meIHT6gTV8/WVl0Vr2qraemvg=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/riscv: add <asm/riscv_encoding.h header
Message-Id: <E1pQSFE-00020c-Iw@xenbits.xenproject.org>
Date: Fri, 10 Feb 2023 12:11:12 +0000

commit aa492912a64c051e4d3a9246c0d8d7b0f5269152
Author:     Oleksii Kurochko <oleksii.kurochko@gmail.com>
AuthorDate: Wed Feb 8 09:20:35 2023 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Feb 8 09:20:35 2023 +0100

    xen/riscv: add <asm/riscv_encoding.h header
    
    The following changes were done in Xen code base in comparison with OpenSBI:
      * Remove "#include <sbi/sbi_const.h>" as most of the stuff inside
        it is present in Xen code base.
      * Add macros _UL and _ULL as they were in <sbi/sbi_const.h> before
      * Add SATP32_MODE_SHIFT/SATP64_MODE_SHIFT/SATP_MODE_SHIFT as they will
        be used in riscv/mm.c
      * Add CAUSE_IRQ_FLAG which is going to be used insised exception
        handler
      * Change ulong to unsigned long in macros REG_PTR(...)
      * Change s32 to int32_t
    
    Originally authored by Anup Patel <anup.patel@wdc.com>
    
    Origin: https://github.com/riscv-software-src/opensbi.git c45992cc2b12
    Signed-off-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
    Acked-by: Alistair Francis <alistair.francis@wdc.com>
---
 xen/arch/riscv/include/asm/riscv_encoding.h | 927 ++++++++++++++++++++++++++++
 1 file changed, 927 insertions(+)

diff --git a/xen/arch/riscv/include/asm/riscv_encoding.h b/xen/arch/riscv/include/asm/riscv_encoding.h
new file mode 100644
index 0000000000..43dd4f6981
--- /dev/null
+++ b/xen/arch/riscv/include/asm/riscv_encoding.h
@@ -0,0 +1,927 @@
+/*
+ * SPDX-License-Identifier: BSD-2-Clause
+ *
+ * Copyright (c) 2019 Western Digital Corporation or its affiliates.
+ *
+ * Authors:
+ *   Anup Patel <anup.patel@wdc.com>
+ */
+
+#ifndef __RISCV_ENCODING_H__
+#define __RISCV_ENCODING_H__
+
+#define _UL(X) _AC(X, UL)
+#define _ULL(X) _AC(X, ULL)
+
+/* clang-format off */
+#define MSTATUS_SIE			_UL(0x00000002)
+#define MSTATUS_MIE			_UL(0x00000008)
+#define MSTATUS_SPIE_SHIFT		5
+#define MSTATUS_SPIE			(_UL(1) << MSTATUS_SPIE_SHIFT)
+#define MSTATUS_UBE			_UL(0x00000040)
+#define MSTATUS_MPIE			_UL(0x00000080)
+#define MSTATUS_SPP_SHIFT		8
+#define MSTATUS_SPP			(_UL(1) << MSTATUS_SPP_SHIFT)
+#define MSTATUS_MPP_SHIFT		11
+#define MSTATUS_MPP			(_UL(3) << MSTATUS_MPP_SHIFT)
+#define MSTATUS_FS			_UL(0x00006000)
+#define MSTATUS_XS			_UL(0x00018000)
+#define MSTATUS_VS			_UL(0x00000600)
+#define MSTATUS_MPRV			_UL(0x00020000)
+#define MSTATUS_SUM			_UL(0x00040000)
+#define MSTATUS_MXR			_UL(0x00080000)
+#define MSTATUS_TVM			_UL(0x00100000)
+#define MSTATUS_TW			_UL(0x00200000)
+#define MSTATUS_TSR			_UL(0x00400000)
+#define MSTATUS32_SD			_UL(0x80000000)
+#if __riscv_xlen == 64
+#define MSTATUS_UXL			_ULL(0x0000000300000000)
+#define MSTATUS_SXL			_ULL(0x0000000C00000000)
+#define MSTATUS_SBE			_ULL(0x0000001000000000)
+#define MSTATUS_MBE			_ULL(0x0000002000000000)
+#define MSTATUS_GVA			_ULL(0x0000004000000000)
+#define MSTATUS_GVA_SHIFT		38
+#define MSTATUS_MPV			_ULL(0x0000008000000000)
+#else
+#define MSTATUSH_SBE			_UL(0x00000010)
+#define MSTATUSH_MBE			_UL(0x00000020)
+#define MSTATUSH_GVA			_UL(0x00000040)
+#define MSTATUSH_GVA_SHIFT		6
+#define MSTATUSH_MPV			_UL(0x00000080)
+#endif
+#define MSTATUS32_SD			_UL(0x80000000)
+#define MSTATUS64_SD			_ULL(0x8000000000000000)
+
+#define SSTATUS_SIE			MSTATUS_SIE
+#define SSTATUS_SPIE_SHIFT		MSTATUS_SPIE_SHIFT
+#define SSTATUS_SPIE			MSTATUS_SPIE
+#define SSTATUS_SPP_SHIFT		MSTATUS_SPP_SHIFT
+#define SSTATUS_SPP			MSTATUS_SPP
+#define SSTATUS_FS			MSTATUS_FS
+#define SSTATUS_XS			MSTATUS_XS
+#define SSTATUS_VS			MSTATUS_VS
+#define SSTATUS_SUM			MSTATUS_SUM
+#define SSTATUS_MXR			MSTATUS_MXR
+#define SSTATUS32_SD			MSTATUS32_SD
+#define SSTATUS64_UXL			MSTATUS_UXL
+#define SSTATUS64_SD			MSTATUS64_SD
+
+#if __riscv_xlen == 64
+#define HSTATUS_VSXL			_UL(0x300000000)
+#define HSTATUS_VSXL_SHIFT		32
+#endif
+#define HSTATUS_VTSR			_UL(0x00400000)
+#define HSTATUS_VTW			_UL(0x00200000)
+#define HSTATUS_VTVM			_UL(0x00100000)
+#define HSTATUS_VGEIN			_UL(0x0003f000)
+#define HSTATUS_VGEIN_SHIFT		12
+#define HSTATUS_HU			_UL(0x00000200)
+#define HSTATUS_SPVP			_UL(0x00000100)
+#define HSTATUS_SPV			_UL(0x00000080)
+#define HSTATUS_GVA			_UL(0x00000040)
+#define HSTATUS_VSBE			_UL(0x00000020)
+
+#define IRQ_S_SOFT			1
+#define IRQ_VS_SOFT			2
+#define IRQ_M_SOFT			3
+#define IRQ_S_TIMER			5
+#define IRQ_VS_TIMER			6
+#define IRQ_M_TIMER			7
+#define IRQ_S_EXT			9
+#define IRQ_VS_EXT			10
+#define IRQ_M_EXT			11
+#define IRQ_S_GEXT			12
+#define IRQ_PMU_OVF			13
+
+#define MIP_SSIP			(_UL(1) << IRQ_S_SOFT)
+#define MIP_VSSIP			(_UL(1) << IRQ_VS_SOFT)
+#define MIP_MSIP			(_UL(1) << IRQ_M_SOFT)
+#define MIP_STIP			(_UL(1) << IRQ_S_TIMER)
+#define MIP_VSTIP			(_UL(1) << IRQ_VS_TIMER)
+#define MIP_MTIP			(_UL(1) << IRQ_M_TIMER)
+#define MIP_SEIP			(_UL(1) << IRQ_S_EXT)
+#define MIP_VSEIP			(_UL(1) << IRQ_VS_EXT)
+#define MIP_MEIP			(_UL(1) << IRQ_M_EXT)
+#define MIP_SGEIP			(_UL(1) << IRQ_S_GEXT)
+#define MIP_LCOFIP			(_UL(1) << IRQ_PMU_OVF)
+
+#define SIP_SSIP			MIP_SSIP
+#define SIP_STIP			MIP_STIP
+
+#define PRV_U				_UL(0)
+#define PRV_S				_UL(1)
+#define PRV_M				_UL(3)
+
+#define SATP32_MODE			_UL(0x80000000)
+#define SATP32_MODE_SHIFT		31
+#define SATP32_ASID			_UL(0x7FC00000)
+#define SATP32_PPN			_UL(0x003FFFFF)
+#define SATP64_MODE			_ULL(0xF000000000000000)
+#define SATP64_MODE_SHIFT		60
+#define SATP64_ASID			_ULL(0x0FFFF00000000000)
+#define SATP64_PPN			_ULL(0x00000FFFFFFFFFFF)
+
+#define SATP_MODE_OFF			_UL(0)
+#define SATP_MODE_SV32			_UL(1)
+#define SATP_MODE_SV39			_UL(8)
+#define SATP_MODE_SV48			_UL(9)
+#define SATP_MODE_SV57			_UL(10)
+#define SATP_MODE_SV64			_UL(11)
+
+#define HGATP_MODE_OFF			_UL(0)
+#define HGATP_MODE_SV32X4		_UL(1)
+#define HGATP_MODE_SV39X4		_UL(8)
+#define HGATP_MODE_SV48X4		_UL(9)
+
+#define HGATP32_MODE_SHIFT		31
+#define HGATP32_VMID_SHIFT		22
+#define HGATP32_VMID_MASK		_UL(0x1FC00000)
+#define HGATP32_PPN			_UL(0x003FFFFF)
+
+#define HGATP64_MODE_SHIFT		60
+#define HGATP64_VMID_SHIFT		44
+#define HGATP64_VMID_MASK		_ULL(0x03FFF00000000000)
+#define HGATP64_PPN			_ULL(0x00000FFFFFFFFFFF)
+
+#define PMP_R				_UL(0x01)
+#define PMP_W				_UL(0x02)
+#define PMP_X				_UL(0x04)
+#define PMP_A				_UL(0x18)
+#define PMP_A_TOR			_UL(0x08)
+#define PMP_A_NA4			_UL(0x10)
+#define PMP_A_NAPOT			_UL(0x18)
+#define PMP_L				_UL(0x80)
+
+#define PMP_SHIFT			2
+#define PMP_COUNT			64
+#if __riscv_xlen == 64
+#define PMP_ADDR_MASK			((_ULL(0x1) << 54) - 1)
+#else
+#define PMP_ADDR_MASK			_UL(0xFFFFFFFF)
+#endif
+
+#if __riscv_xlen == 64
+#define MSTATUS_SD			MSTATUS64_SD
+#define SSTATUS_SD			SSTATUS64_SD
+#define SATP_MODE			SATP64_MODE
+#define SATP_MODE_SHIFT			SATP64_MODE_SHIFT
+
+#define HGATP_PPN			HGATP64_PPN
+#define HGATP_VMID_SHIFT		HGATP64_VMID_SHIFT
+#define HGATP_VMID_MASK			HGATP64_VMID_MASK
+#define HGATP_MODE_SHIFT		HGATP64_MODE_SHIFT
+#else
+#define MSTATUS_SD			MSTATUS32_SD
+#define SSTATUS_SD			SSTATUS32_SD
+#define SATP_MODE			SATP32_MODE
+#define SATP_MODE_SHIFT			SATP32_MODE_SHIFT
+
+#define HGATP_PPN			HGATP32_PPN
+#define HGATP_VMID_SHIFT		HGATP32_VMID_SHIFT
+#define HGATP_VMID_MASK			HGATP32_VMID_MASK
+#define HGATP_MODE_SHIFT		HGATP32_MODE_SHIFT
+#endif
+
+#define TOPI_IID_SHIFT			16
+#define TOPI_IID_MASK			0xfff
+#define TOPI_IPRIO_MASK		0xff
+
+#if __riscv_xlen == 64
+#define MHPMEVENT_OF			(_UL(1) << 63)
+#define MHPMEVENT_MINH			(_UL(1) << 62)
+#define MHPMEVENT_SINH			(_UL(1) << 61)
+#define MHPMEVENT_UINH			(_UL(1) << 60)
+#define MHPMEVENT_VSINH			(_UL(1) << 59)
+#define MHPMEVENT_VUINH			(_UL(1) << 58)
+#else
+#define MHPMEVENTH_OF			(_ULL(1) << 31)
+#define MHPMEVENTH_MINH			(_ULL(1) << 30)
+#define MHPMEVENTH_SINH			(_ULL(1) << 29)
+#define MHPMEVENTH_UINH			(_ULL(1) << 28)
+#define MHPMEVENTH_VSINH		(_ULL(1) << 27)
+#define MHPMEVENTH_VUINH		(_ULL(1) << 26)
+
+#define MHPMEVENT_OF			(MHPMEVENTH_OF << 32)
+#define MHPMEVENT_MINH			(MHPMEVENTH_MINH << 32)
+#define MHPMEVENT_SINH			(MHPMEVENTH_SINH << 32)
+#define MHPMEVENT_UINH			(MHPMEVENTH_UINH << 32)
+#define MHPMEVENT_VSINH			(MHPMEVENTH_VSINH << 32)
+#define MHPMEVENT_VUINH			(MHPMEVENTH_VUINH << 32)
+
+#endif
+
+#define MHPMEVENT_SSCOF_MASK		_ULL(0xFFFF000000000000)
+
+#if __riscv_xlen > 32
+#define ENVCFG_STCE			(_ULL(1) << 63)
+#define ENVCFG_PBMTE			(_ULL(1) << 62)
+#else
+#define ENVCFGH_STCE			(_UL(1) << 31)
+#define ENVCFGH_PBMTE			(_UL(1) << 30)
+#endif
+#define ENVCFG_CBZE			(_UL(1) << 7)
+#define ENVCFG_CBCFE			(_UL(1) << 6)
+#define ENVCFG_CBIE_SHIFT		4
+#define ENVCFG_CBIE			(_UL(0x3) << ENVCFG_CBIE_SHIFT)
+#define ENVCFG_CBIE_ILL			_UL(0x0)
+#define ENVCFG_CBIE_FLUSH		_UL(0x1)
+#define ENVCFG_CBIE_INV			_UL(0x3)
+#define ENVCFG_FIOM			_UL(0x1)
+
+/* ===== User-level CSRs ===== */
+
+/* User Trap Setup (N-extension) */
+#define CSR_USTATUS			0x000
+#define CSR_UIE				0x004
+#define CSR_UTVEC			0x005
+
+/* User Trap Handling (N-extension) */
+#define CSR_USCRATCH			0x040
+#define CSR_UEPC			0x041
+#define CSR_UCAUSE			0x042
+#define CSR_UTVAL			0x043
+#define CSR_UIP				0x044
+
+/* User Floating-point CSRs */
+#define CSR_FFLAGS			0x001
+#define CSR_FRM				0x002
+#define CSR_FCSR			0x003
+
+/* User Counters/Timers */
+#define CSR_CYCLE			0xc00
+#define CSR_TIME			0xc01
+#define CSR_INSTRET			0xc02
+#define CSR_HPMCOUNTER3			0xc03
+#define CSR_HPMCOUNTER4			0xc04
+#define CSR_HPMCOUNTER5			0xc05
+#define CSR_HPMCOUNTER6			0xc06
+#define CSR_HPMCOUNTER7			0xc07
+#define CSR_HPMCOUNTER8			0xc08
+#define CSR_HPMCOUNTER9			0xc09
+#define CSR_HPMCOUNTER10		0xc0a
+#define CSR_HPMCOUNTER11		0xc0b
+#define CSR_HPMCOUNTER12		0xc0c
+#define CSR_HPMCOUNTER13		0xc0d
+#define CSR_HPMCOUNTER14		0xc0e
+#define CSR_HPMCOUNTER15		0xc0f
+#define CSR_HPMCOUNTER16		0xc10
+#define CSR_HPMCOUNTER17		0xc11
+#define CSR_HPMCOUNTER18		0xc12
+#define CSR_HPMCOUNTER19		0xc13
+#define CSR_HPMCOUNTER20		0xc14
+#define CSR_HPMCOUNTER21		0xc15
+#define CSR_HPMCOUNTER22		0xc16
+#define CSR_HPMCOUNTER23		0xc17
+#define CSR_HPMCOUNTER24		0xc18
+#define CSR_HPMCOUNTER25		0xc19
+#define CSR_HPMCOUNTER26		0xc1a
+#define CSR_HPMCOUNTER27		0xc1b
+#define CSR_HPMCOUNTER28		0xc1c
+#define CSR_HPMCOUNTER29		0xc1d
+#define CSR_HPMCOUNTER30		0xc1e
+#define CSR_HPMCOUNTER31		0xc1f
+#define CSR_CYCLEH			0xc80
+#define CSR_TIMEH			0xc81
+#define CSR_INSTRETH			0xc82
+#define CSR_HPMCOUNTER3H		0xc83
+#define CSR_HPMCOUNTER4H		0xc84
+#define CSR_HPMCOUNTER5H		0xc85
+#define CSR_HPMCOUNTER6H		0xc86
+#define CSR_HPMCOUNTER7H		0xc87
+#define CSR_HPMCOUNTER8H		0xc88
+#define CSR_HPMCOUNTER9H		0xc89
+#define CSR_HPMCOUNTER10H		0xc8a
+#define CSR_HPMCOUNTER11H		0xc8b
+#define CSR_HPMCOUNTER12H		0xc8c
+#define CSR_HPMCOUNTER13H		0xc8d
+#define CSR_HPMCOUNTER14H		0xc8e
+#define CSR_HPMCOUNTER15H		0xc8f
+#define CSR_HPMCOUNTER16H		0xc90
+#define CSR_HPMCOUNTER17H		0xc91
+#define CSR_HPMCOUNTER18H		0xc92
+#define CSR_HPMCOUNTER19H		0xc93
+#define CSR_HPMCOUNTER20H		0xc94
+#define CSR_HPMCOUNTER21H		0xc95
+#define CSR_HPMCOUNTER22H		0xc96
+#define CSR_HPMCOUNTER23H		0xc97
+#define CSR_HPMCOUNTER24H		0xc98
+#define CSR_HPMCOUNTER25H		0xc99
+#define CSR_HPMCOUNTER26H		0xc9a
+#define CSR_HPMCOUNTER27H		0xc9b
+#define CSR_HPMCOUNTER28H		0xc9c
+#define CSR_HPMCOUNTER29H		0xc9d
+#define CSR_HPMCOUNTER30H		0xc9e
+#define CSR_HPMCOUNTER31H		0xc9f
+
+/* ===== Supervisor-level CSRs ===== */
+
+/* Supervisor Trap Setup */
+#define CSR_SSTATUS			0x100
+#define CSR_SIE				0x104
+#define CSR_STVEC			0x105
+#define CSR_SCOUNTEREN			0x106
+
+/* Supervisor Configuration */
+#define CSR_SENVCFG			0x10a
+
+/* Supervisor Trap Handling */
+#define CSR_SSCRATCH			0x140
+#define CSR_SEPC			0x141
+#define CSR_SCAUSE			0x142
+#define CSR_STVAL			0x143
+#define CSR_SIP				0x144
+
+/* Sstc extension */
+#define CSR_STIMECMP			0x14D
+#define CSR_STIMECMPH			0x15D
+
+/* Supervisor Protection and Translation */
+#define CSR_SATP			0x180
+
+/* Supervisor-Level Window to Indirectly Accessed Registers (AIA) */
+#define CSR_SISELECT			0x150
+#define CSR_SIREG			0x151
+
+/* Supervisor-Level Interrupts (AIA) */
+#define CSR_STOPEI			0x15c
+#define CSR_STOPI			0xdb0
+
+/* Supervisor-Level High-Half CSRs (AIA) */
+#define CSR_SIEH			0x114
+#define CSR_SIPH			0x154
+
+/* Supervisor stateen CSRs */
+#define CSR_SSTATEEN0			0x10C
+#define CSR_SSTATEEN1			0x10D
+#define CSR_SSTATEEN2			0x10E
+#define CSR_SSTATEEN3			0x10F
+
+/* ===== Hypervisor-level CSRs ===== */
+
+/* Hypervisor Trap Setup (H-extension) */
+#define CSR_HSTATUS			0x600
+#define CSR_HEDELEG			0x602
+#define CSR_HIDELEG			0x603
+#define CSR_HIE				0x604
+#define CSR_HCOUNTEREN			0x606
+#define CSR_HGEIE			0x607
+
+/* Hypervisor Configuration */
+#define CSR_HENVCFG			0x60a
+#define CSR_HENVCFGH			0x61a
+
+/* Hypervisor Trap Handling (H-extension) */
+#define CSR_HTVAL			0x643
+#define CSR_HIP				0x644
+#define CSR_HVIP			0x645
+#define CSR_HTINST			0x64a
+#define CSR_HGEIP			0xe12
+
+/* Hypervisor Protection and Translation (H-extension) */
+#define CSR_HGATP			0x680
+
+/* Hypervisor Counter/Timer Virtualization Registers (H-extension) */
+#define CSR_HTIMEDELTA			0x605
+#define CSR_HTIMEDELTAH			0x615
+
+/* Virtual Supervisor Registers (H-extension) */
+#define CSR_VSSTATUS			0x200
+#define CSR_VSIE			0x204
+#define CSR_VSTVEC			0x205
+#define CSR_VSSCRATCH			0x240
+#define CSR_VSEPC			0x241
+#define CSR_VSCAUSE			0x242
+#define CSR_VSTVAL			0x243
+#define CSR_VSIP			0x244
+#define CSR_VSATP			0x280
+
+/* Virtual Interrupts and Interrupt Priorities (H-extension with AIA) */
+#define CSR_HVIEN			0x608
+#define CSR_HVICTL			0x609
+#define CSR_HVIPRIO1			0x646
+#define CSR_HVIPRIO2			0x647
+
+/* VS-Level Window to Indirectly Accessed Registers (H-extension with AIA) */
+#define CSR_VSISELECT			0x250
+#define CSR_VSIREG			0x251
+
+/* VS-Level Interrupts (H-extension with AIA) */
+#define CSR_VSTOPEI			0x25c
+#define CSR_VSTOPI			0xeb0
+
+/* Hypervisor and VS-Level High-Half CSRs (H-extension with AIA) */
+#define CSR_HIDELEGH			0x613
+#define CSR_HVIENH			0x618
+#define CSR_HVIPH			0x655
+#define CSR_HVIPRIO1H			0x656
+#define CSR_HVIPRIO2H			0x657
+#define CSR_VSIEH			0x214
+#define CSR_VSIPH			0x254
+
+/* Hypervisor stateen CSRs */
+#define CSR_HSTATEEN0			0x60C
+#define CSR_HSTATEEN0H			0x61C
+#define CSR_HSTATEEN1			0x60D
+#define CSR_HSTATEEN1H			0x61D
+#define CSR_HSTATEEN2			0x60E
+#define CSR_HSTATEEN2H			0x61E
+#define CSR_HSTATEEN3			0x60F
+#define CSR_HSTATEEN3H			0x61F
+
+/* ===== Machine-level CSRs ===== */
+
+/* Machine Information Registers */
+#define CSR_MVENDORID			0xf11
+#define CSR_MARCHID			0xf12
+#define CSR_MIMPID			0xf13
+#define CSR_MHARTID			0xf14
+
+/* Machine Trap Setup */
+#define CSR_MSTATUS			0x300
+#define CSR_MISA			0x301
+#define CSR_MEDELEG			0x302
+#define CSR_MIDELEG			0x303
+#define CSR_MIE				0x304
+#define CSR_MTVEC			0x305
+#define CSR_MCOUNTEREN			0x306
+#define CSR_MSTATUSH			0x310
+
+/* Machine Configuration */
+#define CSR_MENVCFG			0x30a
+#define CSR_MENVCFGH			0x31a
+
+/* Machine Trap Handling */
+#define CSR_MSCRATCH			0x340
+#define CSR_MEPC			0x341
+#define CSR_MCAUSE			0x342
+#define CSR_MTVAL			0x343
+#define CSR_MIP				0x344
+#define CSR_MTINST			0x34a
+#define CSR_MTVAL2			0x34b
+
+/* Machine Memory Protection */
+#define CSR_PMPCFG0			0x3a0
+#define CSR_PMPCFG1			0x3a1
+#define CSR_PMPCFG2			0x3a2
+#define CSR_PMPCFG3			0x3a3
+#define CSR_PMPCFG4			0x3a4
+#define CSR_PMPCFG5			0x3a5
+#define CSR_PMPCFG6			0x3a6
+#define CSR_PMPCFG7			0x3a7
+#define CSR_PMPCFG8			0x3a8
+#define CSR_PMPCFG9			0x3a9
+#define CSR_PMPCFG10			0x3aa
+#define CSR_PMPCFG11			0x3ab
+#define CSR_PMPCFG12			0x3ac
+#define CSR_PMPCFG13			0x3ad
+#define CSR_PMPCFG14			0x3ae
+#define CSR_PMPCFG15			0x3af
+#define CSR_PMPADDR0			0x3b0
+#define CSR_PMPADDR1			0x3b1
+#define CSR_PMPADDR2			0x3b2
+#define CSR_PMPADDR3			0x3b3
+#define CSR_PMPADDR4			0x3b4
+#define CSR_PMPADDR5			0x3b5
+#define CSR_PMPADDR6			0x3b6
+#define CSR_PMPADDR7			0x3b7
+#define CSR_PMPADDR8			0x3b8
+#define CSR_PMPADDR9			0x3b9
+#define CSR_PMPADDR10			0x3ba
+#define CSR_PMPADDR11			0x3bb
+#define CSR_PMPADDR12			0x3bc
+#define CSR_PMPADDR13			0x3bd
+#define CSR_PMPADDR14			0x3be
+#define CSR_PMPADDR15			0x3bf
+#define CSR_PMPADDR16			0x3c0
+#define CSR_PMPADDR17			0x3c1
+#define CSR_PMPADDR18			0x3c2
+#define CSR_PMPADDR19			0x3c3
+#define CSR_PMPADDR20			0x3c4
+#define CSR_PMPADDR21			0x3c5
+#define CSR_PMPADDR22			0x3c6
+#define CSR_PMPADDR23			0x3c7
+#define CSR_PMPADDR24			0x3c8
+#define CSR_PMPADDR25			0x3c9
+#define CSR_PMPADDR26			0x3ca
+#define CSR_PMPADDR27			0x3cb
+#define CSR_PMPADDR28			0x3cc
+#define CSR_PMPADDR29			0x3cd
+#define CSR_PMPADDR30			0x3ce
+#define CSR_PMPADDR31			0x3cf
+#define CSR_PMPADDR32			0x3d0
+#define CSR_PMPADDR33			0x3d1
+#define CSR_PMPADDR34			0x3d2
+#define CSR_PMPADDR35			0x3d3
+#define CSR_PMPADDR36			0x3d4
+#define CSR_PMPADDR37			0x3d5
+#define CSR_PMPADDR38			0x3d6
+#define CSR_PMPADDR39			0x3d7
+#define CSR_PMPADDR40			0x3d8
+#define CSR_PMPADDR41			0x3d9
+#define CSR_PMPADDR42			0x3da
+#define CSR_PMPADDR43			0x3db
+#define CSR_PMPADDR44			0x3dc
+#define CSR_PMPADDR45			0x3dd
+#define CSR_PMPADDR46			0x3de
+#define CSR_PMPADDR47			0x3df
+#define CSR_PMPADDR48			0x3e0
+#define CSR_PMPADDR49			0x3e1
+#define CSR_PMPADDR50			0x3e2
+#define CSR_PMPADDR51			0x3e3
+#define CSR_PMPADDR52			0x3e4
+#define CSR_PMPADDR53			0x3e5
+#define CSR_PMPADDR54			0x3e6
+#define CSR_PMPADDR55			0x3e7
+#define CSR_PMPADDR56			0x3e8
+#define CSR_PMPADDR57			0x3e9
+#define CSR_PMPADDR58			0x3ea
+#define CSR_PMPADDR59			0x3eb
+#define CSR_PMPADDR60			0x3ec
+#define CSR_PMPADDR61			0x3ed
+#define CSR_PMPADDR62			0x3ee
+#define CSR_PMPADDR63			0x3ef
+
+/* Machine Counters/Timers */
+#define CSR_MCYCLE			0xb00
+#define CSR_MINSTRET			0xb02
+#define CSR_MHPMCOUNTER3		0xb03
+#define CSR_MHPMCOUNTER4		0xb04
+#define CSR_MHPMCOUNTER5		0xb05
+#define CSR_MHPMCOUNTER6		0xb06
+#define CSR_MHPMCOUNTER7		0xb07
+#define CSR_MHPMCOUNTER8		0xb08
+#define CSR_MHPMCOUNTER9		0xb09
+#define CSR_MHPMCOUNTER10		0xb0a
+#define CSR_MHPMCOUNTER11		0xb0b
+#define CSR_MHPMCOUNTER12		0xb0c
+#define CSR_MHPMCOUNTER13		0xb0d
+#define CSR_MHPMCOUNTER14		0xb0e
+#define CSR_MHPMCOUNTER15		0xb0f
+#define CSR_MHPMCOUNTER16		0xb10
+#define CSR_MHPMCOUNTER17		0xb11
+#define CSR_MHPMCOUNTER18		0xb12
+#define CSR_MHPMCOUNTER19		0xb13
+#define CSR_MHPMCOUNTER20		0xb14
+#define CSR_MHPMCOUNTER21		0xb15
+#define CSR_MHPMCOUNTER22		0xb16
+#define CSR_MHPMCOUNTER23		0xb17
+#define CSR_MHPMCOUNTER24		0xb18
+#define CSR_MHPMCOUNTER25		0xb19
+#define CSR_MHPMCOUNTER26		0xb1a
+#define CSR_MHPMCOUNTER27		0xb1b
+#define CSR_MHPMCOUNTER28		0xb1c
+#define CSR_MHPMCOUNTER29		0xb1d
+#define CSR_MHPMCOUNTER30		0xb1e
+#define CSR_MHPMCOUNTER31		0xb1f
+#define CSR_MCYCLEH			0xb80
+#define CSR_MINSTRETH			0xb82
+#define CSR_MHPMCOUNTER3H		0xb83
+#define CSR_MHPMCOUNTER4H		0xb84
+#define CSR_MHPMCOUNTER5H		0xb85
+#define CSR_MHPMCOUNTER6H		0xb86
+#define CSR_MHPMCOUNTER7H		0xb87
+#define CSR_MHPMCOUNTER8H		0xb88
+#define CSR_MHPMCOUNTER9H		0xb89
+#define CSR_MHPMCOUNTER10H		0xb8a
+#define CSR_MHPMCOUNTER11H		0xb8b
+#define CSR_MHPMCOUNTER12H		0xb8c
+#define CSR_MHPMCOUNTER13H		0xb8d
+#define CSR_MHPMCOUNTER14H		0xb8e
+#define CSR_MHPMCOUNTER15H		0xb8f
+#define CSR_MHPMCOUNTER16H		0xb90
+#define CSR_MHPMCOUNTER17H		0xb91
+#define CSR_MHPMCOUNTER18H		0xb92
+#define CSR_MHPMCOUNTER19H		0xb93
+#define CSR_MHPMCOUNTER20H		0xb94
+#define CSR_MHPMCOUNTER21H		0xb95
+#define CSR_MHPMCOUNTER22H		0xb96
+#define CSR_MHPMCOUNTER23H		0xb97
+#define CSR_MHPMCOUNTER24H		0xb98
+#define CSR_MHPMCOUNTER25H		0xb99
+#define CSR_MHPMCOUNTER26H		0xb9a
+#define CSR_MHPMCOUNTER27H		0xb9b
+#define CSR_MHPMCOUNTER28H		0xb9c
+#define CSR_MHPMCOUNTER29H		0xb9d
+#define CSR_MHPMCOUNTER30H		0xb9e
+#define CSR_MHPMCOUNTER31H		0xb9f
+
+/* Machine Counter Setup */
+#define CSR_MCOUNTINHIBIT		0x320
+#define CSR_MHPMEVENT3			0x323
+#define CSR_MHPMEVENT4			0x324
+#define CSR_MHPMEVENT5			0x325
+#define CSR_MHPMEVENT6			0x326
+#define CSR_MHPMEVENT7			0x327
+#define CSR_MHPMEVENT8			0x328
+#define CSR_MHPMEVENT9			0x329
+#define CSR_MHPMEVENT10			0x32a
+#define CSR_MHPMEVENT11			0x32b
+#define CSR_MHPMEVENT12			0x32c
+#define CSR_MHPMEVENT13			0x32d
+#define CSR_MHPMEVENT14			0x32e
+#define CSR_MHPMEVENT15			0x32f
+#define CSR_MHPMEVENT16			0x330
+#define CSR_MHPMEVENT17			0x331
+#define CSR_MHPMEVENT18			0x332
+#define CSR_MHPMEVENT19			0x333
+#define CSR_MHPMEVENT20			0x334
+#define CSR_MHPMEVENT21			0x335
+#define CSR_MHPMEVENT22			0x336
+#define CSR_MHPMEVENT23			0x337
+#define CSR_MHPMEVENT24			0x338
+#define CSR_MHPMEVENT25			0x339
+#define CSR_MHPMEVENT26			0x33a
+#define CSR_MHPMEVENT27			0x33b
+#define CSR_MHPMEVENT28			0x33c
+#define CSR_MHPMEVENT29			0x33d
+#define CSR_MHPMEVENT30			0x33e
+#define CSR_MHPMEVENT31			0x33f
+
+/* For RV32 */
+#define CSR_MHPMEVENT3H			0x723
+#define CSR_MHPMEVENT4H			0x724
+#define CSR_MHPMEVENT5H			0x725
+#define CSR_MHPMEVENT6H			0x726
+#define CSR_MHPMEVENT7H			0x727
+#define CSR_MHPMEVENT8H			0x728
+#define CSR_MHPMEVENT9H			0x729
+#define CSR_MHPMEVENT10H		0x72a
+#define CSR_MHPMEVENT11H		0x72b
+#define CSR_MHPMEVENT12H		0x72c
+#define CSR_MHPMEVENT13H		0x72d
+#define CSR_MHPMEVENT14H		0x72e
+#define CSR_MHPMEVENT15H		0x72f
+#define CSR_MHPMEVENT16H		0x730
+#define CSR_MHPMEVENT17H		0x731
+#define CSR_MHPMEVENT18H		0x732
+#define CSR_MHPMEVENT19H		0x733
+#define CSR_MHPMEVENT20H		0x734
+#define CSR_MHPMEVENT21H		0x735
+#define CSR_MHPMEVENT22H		0x736
+#define CSR_MHPMEVENT23H		0x737
+#define CSR_MHPMEVENT24H		0x738
+#define CSR_MHPMEVENT25H		0x739
+#define CSR_MHPMEVENT26H		0x73a
+#define CSR_MHPMEVENT27H		0x73b
+#define CSR_MHPMEVENT28H		0x73c
+#define CSR_MHPMEVENT29H		0x73d
+#define CSR_MHPMEVENT30H		0x73e
+#define CSR_MHPMEVENT31H		0x73f
+
+/* Counter Overflow CSR */
+#define CSR_SCOUNTOVF			0xda0
+
+/* Debug/Trace Registers */
+#define CSR_TSELECT			0x7a0
+#define CSR_TDATA1			0x7a1
+#define CSR_TDATA2			0x7a2
+#define CSR_TDATA3			0x7a3
+
+/* Debug Mode Registers */
+#define CSR_DCSR			0x7b0
+#define CSR_DPC				0x7b1
+#define CSR_DSCRATCH0			0x7b2
+#define CSR_DSCRATCH1			0x7b3
+
+/* Machine-Level Window to Indirectly Accessed Registers (AIA) */
+#define CSR_MISELECT			0x350
+#define CSR_MIREG			0x351
+
+/* Machine-Level Interrupts (AIA) */
+#define CSR_MTOPEI			0x35c
+#define CSR_MTOPI			0xfb0
+
+/* Virtual Interrupts for Supervisor Level (AIA) */
+#define CSR_MVIEN			0x308
+#define CSR_MVIP			0x309
+
+/* Smstateen extension registers */
+/* Machine stateen CSRs */
+#define CSR_MSTATEEN0			0x30C
+#define CSR_MSTATEEN0H			0x31C
+#define CSR_MSTATEEN1			0x30D
+#define CSR_MSTATEEN1H			0x31D
+#define CSR_MSTATEEN2			0x30E
+#define CSR_MSTATEEN2H			0x31E
+#define CSR_MSTATEEN3			0x30F
+#define CSR_MSTATEEN3H			0x31F
+
+/* Machine-Level High-Half CSRs (AIA) */
+#define CSR_MIDELEGH			0x313
+#define CSR_MIEH			0x314
+#define CSR_MVIENH			0x318
+#define CSR_MVIPH			0x319
+#define CSR_MIPH			0x354
+
+/* ===== Trap/Exception Causes ===== */
+
+/* Exception cause high bit - is an interrupt if set */
+#define CAUSE_IRQ_FLAG			(_UL(1) << (__riscv_xlen - 1))
+
+#define CAUSE_MISALIGNED_FETCH		0x0
+#define CAUSE_FETCH_ACCESS		0x1
+#define CAUSE_ILLEGAL_INSTRUCTION	0x2
+#define CAUSE_BREAKPOINT		0x3
+#define CAUSE_MISALIGNED_LOAD		0x4
+#define CAUSE_LOAD_ACCESS		0x5
+#define CAUSE_MISALIGNED_STORE		0x6
+#define CAUSE_STORE_ACCESS		0x7
+#define CAUSE_USER_ECALL		0x8
+#define CAUSE_SUPERVISOR_ECALL		0x9
+#define CAUSE_VIRTUAL_SUPERVISOR_ECALL	0xa
+#define CAUSE_MACHINE_ECALL		0xb
+#define CAUSE_FETCH_PAGE_FAULT		0xc
+#define CAUSE_LOAD_PAGE_FAULT		0xd
+#define CAUSE_STORE_PAGE_FAULT		0xf
+#define CAUSE_FETCH_GUEST_PAGE_FAULT	0x14
+#define CAUSE_LOAD_GUEST_PAGE_FAULT	0x15
+#define CAUSE_VIRTUAL_INST_FAULT	0x16
+#define CAUSE_STORE_GUEST_PAGE_FAULT	0x17
+
+/* Common defines for all smstateen */
+#define SMSTATEEN_MAX_COUNT		4
+#define SMSTATEEN0_CS_SHIFT		0
+#define SMSTATEEN0_CS			(_ULL(1) << SMSTATEEN0_CS_SHIFT)
+#define SMSTATEEN0_FCSR_SHIFT		1
+#define SMSTATEEN0_FCSR			(_ULL(1) << SMSTATEEN0_FCSR_SHIFT)
+#define SMSTATEEN0_IMSIC_SHIFT		58
+#define SMSTATEEN0_IMSIC		(_ULL(1) << SMSTATEEN0_IMSIC_SHIFT)
+#define SMSTATEEN0_AIA_SHIFT		59
+#define SMSTATEEN0_AIA			(_ULL(1) << SMSTATEEN0_AIA_SHIFT)
+#define SMSTATEEN0_SVSLCT_SHIFT		60
+#define SMSTATEEN0_SVSLCT		(_ULL(1) << SMSTATEEN0_SVSLCT_SHIFT)
+#define SMSTATEEN0_HSENVCFG_SHIFT	62
+#define SMSTATEEN0_HSENVCFG		(_ULL(1) << SMSTATEEN0_HSENVCFG_SHIFT)
+#define SMSTATEEN_STATEN_SHIFT		63
+#define SMSTATEEN_STATEN		(_ULL(1) << SMSTATEEN_STATEN_SHIFT)
+
+/* ===== Instruction Encodings ===== */
+
+#define INSN_MATCH_LB			0x3
+#define INSN_MASK_LB			0x707f
+#define INSN_MATCH_LH			0x1003
+#define INSN_MASK_LH			0x707f
+#define INSN_MATCH_LW			0x2003
+#define INSN_MASK_LW			0x707f
+#define INSN_MATCH_LD			0x3003
+#define INSN_MASK_LD			0x707f
+#define INSN_MATCH_LBU			0x4003
+#define INSN_MASK_LBU			0x707f
+#define INSN_MATCH_LHU			0x5003
+#define INSN_MASK_LHU			0x707f
+#define INSN_MATCH_LWU			0x6003
+#define INSN_MASK_LWU			0x707f
+#define INSN_MATCH_SB			0x23
+#define INSN_MASK_SB			0x707f
+#define INSN_MATCH_SH			0x1023
+#define INSN_MASK_SH			0x707f
+#define INSN_MATCH_SW			0x2023
+#define INSN_MASK_SW			0x707f
+#define INSN_MATCH_SD			0x3023
+#define INSN_MASK_SD			0x707f
+
+#define INSN_MATCH_FLW			0x2007
+#define INSN_MASK_FLW			0x707f
+#define INSN_MATCH_FLD			0x3007
+#define INSN_MASK_FLD			0x707f
+#define INSN_MATCH_FLQ			0x4007
+#define INSN_MASK_FLQ			0x707f
+#define INSN_MATCH_FSW			0x2027
+#define INSN_MASK_FSW			0x707f
+#define INSN_MATCH_FSD			0x3027
+#define INSN_MASK_FSD			0x707f
+#define INSN_MATCH_FSQ			0x4027
+#define INSN_MASK_FSQ			0x707f
+
+#define INSN_MATCH_C_LD			0x6000
+#define INSN_MASK_C_LD			0xe003
+#define INSN_MATCH_C_SD			0xe000
+#define INSN_MASK_C_SD			0xe003
+#define INSN_MATCH_C_LW			0x4000
+#define INSN_MASK_C_LW			0xe003
+#define INSN_MATCH_C_SW			0xc000
+#define INSN_MASK_C_SW			0xe003
+#define INSN_MATCH_C_LDSP		0x6002
+#define INSN_MASK_C_LDSP		0xe003
+#define INSN_MATCH_C_SDSP		0xe002
+#define INSN_MASK_C_SDSP		0xe003
+#define INSN_MATCH_C_LWSP		0x4002
+#define INSN_MASK_C_LWSP		0xe003
+#define INSN_MATCH_C_SWSP		0xc002
+#define INSN_MASK_C_SWSP		0xe003
+
+#define INSN_MATCH_C_FLD		0x2000
+#define INSN_MASK_C_FLD			0xe003
+#define INSN_MATCH_C_FLW		0x6000
+#define INSN_MASK_C_FLW			0xe003
+#define INSN_MATCH_C_FSD		0xa000
+#define INSN_MASK_C_FSD			0xe003
+#define INSN_MATCH_C_FSW		0xe000
+#define INSN_MASK_C_FSW			0xe003
+#define INSN_MATCH_C_FLDSP		0x2002
+#define INSN_MASK_C_FLDSP		0xe003
+#define INSN_MATCH_C_FSDSP		0xa002
+#define INSN_MASK_C_FSDSP		0xe003
+#define INSN_MATCH_C_FLWSP		0x6002
+#define INSN_MASK_C_FLWSP		0xe003
+#define INSN_MATCH_C_FSWSP		0xe002
+#define INSN_MASK_C_FSWSP		0xe003
+
+#define INSN_MASK_WFI			0xffffff00
+#define INSN_MATCH_WFI			0x10500000
+
+#define INSN_MASK_FENCE_TSO		0xffffffff
+#define INSN_MATCH_FENCE_TSO		0x8330000f
+
+#if __riscv_xlen == 64
+
+/* 64-bit read for VS-stage address translation (RV64) */
+#define INSN_PSEUDO_VS_LOAD		0x00003000
+
+/* 64-bit write for VS-stage address translation (RV64) */
+#define INSN_PSEUDO_VS_STORE	0x00003020
+
+#elif __riscv_xlen == 32
+
+/* 32-bit read for VS-stage address translation (RV32) */
+#define INSN_PSEUDO_VS_LOAD		0x00002000
+
+/* 32-bit write for VS-stage address translation (RV32) */
+#define INSN_PSEUDO_VS_STORE	0x00002020
+
+#else
+#error "Unexpected __riscv_xlen"
+#endif
+
+#define INSN_16BIT_MASK			0x3
+#define INSN_32BIT_MASK			0x1c
+
+#define INSN_IS_16BIT(insn)		\
+	(((insn) & INSN_16BIT_MASK) != INSN_16BIT_MASK)
+#define INSN_IS_32BIT(insn)		\
+	(((insn) & INSN_16BIT_MASK) == INSN_16BIT_MASK && \
+	 ((insn) & INSN_32BIT_MASK) != INSN_32BIT_MASK)
+
+#define INSN_LEN(insn)			(INSN_IS_16BIT(insn) ? 2 : 4)
+
+#if __riscv_xlen == 64
+#define LOG_REGBYTES			3
+#else
+#define LOG_REGBYTES			2
+#endif
+#define REGBYTES			(1 << LOG_REGBYTES)
+
+#define SH_RD				7
+#define SH_RS1				15
+#define SH_RS2				20
+#define SH_RS2C				2
+
+#define RV_X(x, s, n)			(((x) >> (s)) & ((1 << (n)) - 1))
+#define RVC_LW_IMM(x)			((RV_X(x, 6, 1) << 2) | \
+					 (RV_X(x, 10, 3) << 3) | \
+					 (RV_X(x, 5, 1) << 6))
+#define RVC_LD_IMM(x)			((RV_X(x, 10, 3) << 3) | \
+					 (RV_X(x, 5, 2) << 6))
+#define RVC_LWSP_IMM(x)			((RV_X(x, 4, 3) << 2) | \
+					 (RV_X(x, 12, 1) << 5) | \
+					 (RV_X(x, 2, 2) << 6))
+#define RVC_LDSP_IMM(x)			((RV_X(x, 5, 2) << 3) | \
+					 (RV_X(x, 12, 1) << 5) | \
+					 (RV_X(x, 2, 3) << 6))
+#define RVC_SWSP_IMM(x)			((RV_X(x, 9, 4) << 2) | \
+					 (RV_X(x, 7, 2) << 6))
+#define RVC_SDSP_IMM(x)			((RV_X(x, 10, 3) << 3) | \
+					 (RV_X(x, 7, 3) << 6))
+#define RVC_RS1S(insn)			(8 + RV_X(insn, SH_RD, 3))
+#define RVC_RS2S(insn)			(8 + RV_X(insn, SH_RS2C, 3))
+#define RVC_RS2(insn)			RV_X(insn, SH_RS2C, 5)
+
+#define SHIFT_RIGHT(x, y)		\
+	((y) < 0 ? ((x) << -(y)) : ((x) >> (y)))
+
+#define REG_MASK			\
+	((1 << (5 + LOG_REGBYTES)) - (1 << LOG_REGBYTES))
+
+#define REG_OFFSET(insn, pos)		\
+	(SHIFT_RIGHT((insn), (pos) - LOG_REGBYTES) & REG_MASK)
+
+#define REG_PTR(insn, pos, regs)	\
+	(unsigned long *)((unsigned long)(regs) + REG_OFFSET(insn, pos))
+
+#define GET_RM(insn)			(((insn) >> 12) & 7)
+
+#define GET_RS1(insn, regs)		(*REG_PTR(insn, SH_RS1, regs))
+#define GET_RS2(insn, regs)		(*REG_PTR(insn, SH_RS2, regs))
+#define GET_RS1S(insn, regs)		(*REG_PTR(RVC_RS1S(insn), 0, regs))
+#define GET_RS2S(insn, regs)		(*REG_PTR(RVC_RS2S(insn), 0, regs))
+#define GET_RS2C(insn, regs)		(*REG_PTR(insn, SH_RS2C, regs))
+#define GET_SP(regs)			(*REG_PTR(2, 0, regs))
+#define SET_RD(insn, regs, val)		(*REG_PTR(insn, SH_RD, regs) = (val))
+#define IMM_I(insn)			((int32_t)(insn) >> 20)
+#define IMM_S(insn)			(((int32_t)(insn) >> 25 << 5) | \
+					 (int32_t)(((insn) >> 7) & 0x1f))
+#define MASK_FUNCT3			0x7000
+
+/* clang-format on */
+
+#endif
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Feb 10 12:11:24 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 10 Feb 2023 12:11:24 +0000
Received: from list by lists.xenproject.org with outflank-mailman.493361.763259 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pQSFQ-0006N4-1z; Fri, 10 Feb 2023 12:11:24 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 493361.763259; Fri, 10 Feb 2023 12:11:24 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pQSFP-0006My-VO; Fri, 10 Feb 2023 12:11:23 +0000
Received: by outflank-mailman (input) for mailman id 493361;
 Fri, 10 Feb 2023 12: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 1pQSFO-0006Mn-Ni
 for xen-changelog@lists.xenproject.org; Fri, 10 Feb 2023 12:11:22 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pQSFO-0004qX-N5
 for xen-changelog@lists.xenproject.org; Fri, 10 Feb 2023 12:11:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pQSFO-00021K-M8
 for xen-changelog@lists.xenproject.org; Fri, 10 Feb 2023 12:11:22 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=uusdWY0ZULzJ8/w2JiNGAP9J+fUCTT7f7RG9sa6KfbA=; b=VS0ewOFItstqTRUzJIjGC3rJNb
	qB1Z84ATPkcAnC/hMKd7VaawtehyKM37MuDF29DGk1fTF8TlienlCxYaotvCbjFzyxwEX/bbPoROx
	2uBLGWIjgD5rF4xvmFoBzYvT2ylprTwuJrkIvzKyW48sRpAO8lz8YspLC8yJh4sUR1oA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/riscv: introduce empty <asm/string.h>
Message-Id: <E1pQSFO-00021K-M8@xenbits.xenproject.org>
Date: Fri, 10 Feb 2023 12:11:22 +0000

commit a49cf4fb61946d79d997eb83b7695f2c5f29892c
Author:     Oleksii Kurochko <oleksii.kurochko@gmail.com>
AuthorDate: Wed Feb 8 09:20:37 2023 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Feb 8 09:20:37 2023 +0100

    xen/riscv: introduce empty <asm/string.h>
    
    To include <xen/lib.h> <asm/string.h> is required
    
    Signed-off-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
    Acked-by: Alistair Francis <alistair.francis@wdc.com>
---
 xen/arch/riscv/include/asm/string.h | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/xen/arch/riscv/include/asm/string.h b/xen/arch/riscv/include/asm/string.h
new file mode 100644
index 0000000000..a26ba8f5c6
--- /dev/null
+++ b/xen/arch/riscv/include/asm/string.h
@@ -0,0 +1,6 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+
+#ifndef _ASM_RISCV_STRING_H
+#define _ASM_RISCV_STRING_H
+
+#endif /* _ASM_RISCV_STRING_H */
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Feb 10 12:11:34 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 10 Feb 2023 12:11:34 +0000
Received: from list by lists.xenproject.org with outflank-mailman.493362.763263 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pQSFa-0006Q2-3P; Fri, 10 Feb 2023 12:11:34 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 493362.763263; Fri, 10 Feb 2023 12:11:34 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pQSFa-0006Pr-0W; Fri, 10 Feb 2023 12:11:34 +0000
Received: by outflank-mailman (input) for mailman id 493362;
 Fri, 10 Feb 2023 12: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 1pQSFY-0006Pj-Qu
 for xen-changelog@lists.xenproject.org; Fri, 10 Feb 2023 12:11:32 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pQSFY-0004ql-QD
 for xen-changelog@lists.xenproject.org; Fri, 10 Feb 2023 12:11:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pQSFY-00021j-PD
 for xen-changelog@lists.xenproject.org; Fri, 10 Feb 2023 12:11:32 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=BkCB3cbgGSnu6OPSeFXgKz++PAjjk1gWFqpcGVdAaG4=; b=br3SFugVhUIF1c0vp+6KDOz+Af
	mw1q9CVjToKJJG4Rh6eqsY8jiEmHYbjHcMsbkBXekEtgl8XLiogMpIlkRVMBGhC7bukb3fYG92wus
	h6aSOO+K9+6e7v7wC4QESfWWi5Lhpi5M3qVZycvhy+0M+MppWQHWZqvKO/gDPfYNlNLE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/riscv: introduce empty <asm/cache.h>
Message-Id: <E1pQSFY-00021j-PD@xenbits.xenproject.org>
Date: Fri, 10 Feb 2023 12:11:32 +0000

commit 826b270337fe9380519e8dea03442d5430a916b9
Author:     Oleksii Kurochko <oleksii.kurochko@gmail.com>
AuthorDate: Wed Feb 8 09:20:39 2023 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Feb 8 09:20:39 2023 +0100

    xen/riscv: introduce empty <asm/cache.h>
    
    To include <xen/lib.h> <asm/cache.h> is required
    
    Signed-off-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
    Acked-by: Alistair Francis <alistair.francis@wdc.com>
---
 xen/arch/riscv/include/asm/cache.h | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/xen/arch/riscv/include/asm/cache.h b/xen/arch/riscv/include/asm/cache.h
new file mode 100644
index 0000000000..69573eb051
--- /dev/null
+++ b/xen/arch/riscv/include/asm/cache.h
@@ -0,0 +1,6 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+
+#ifndef _ASM_RISCV_CACHE_H
+#define _ASM_RISCV_CACHE_H
+
+#endif /* _ASM_RISCV_CACHE_H */
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Feb 10 12:11:44 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 10 Feb 2023 12:11:44 +0000
Received: from list by lists.xenproject.org with outflank-mailman.493363.763267 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pQSFk-0006Sn-4r; Fri, 10 Feb 2023 12:11:44 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 493363.763267; Fri, 10 Feb 2023 12:11:44 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pQSFk-0006Sf-2E; Fri, 10 Feb 2023 12:11:44 +0000
Received: by outflank-mailman (input) for mailman id 493363;
 Fri, 10 Feb 2023 12: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 1pQSFi-0006SW-U7
 for xen-changelog@lists.xenproject.org; Fri, 10 Feb 2023 12:11:42 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pQSFi-0004qy-TN
 for xen-changelog@lists.xenproject.org; Fri, 10 Feb 2023 12:11:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pQSFi-00022a-SP
 for xen-changelog@lists.xenproject.org; Fri, 10 Feb 2023 12:11:42 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=oF6x/FPxnQV/78MQQy4XK89PshUg//Ae/4gGRiZjXUo=; b=04RxO00h4XxZaMTV47fc4QrWdj
	o8F6m2ka7ZLHRihI4UeBFsZaPr+YhxnowhSrlH7Auj5XX5FMMrRxlGUytpe622+JW6gf62Hmas3tv
	B1ZcfysTQyrawLUt3c83A0L7yJVmAxavNkT+mjebF0dkRHEmQbBS+OdzFOdBTsLn+btU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] libs/light: Rework targets prerequisites
Message-Id: <E1pQSFi-00022a-SP@xenbits.xenproject.org>
Date: Fri, 10 Feb 2023 12:11:42 +0000

commit a2a5d091d0ca78c6a9346c8d4bb8cddc37a07375
Author:     Anthony PERARD <anthony.perard@citrix.com>
AuthorDate: Wed Feb 8 09:21:11 2023 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Feb 8 09:21:11 2023 +0100

    libs/light: Rework targets prerequisites
    
    No need for $(AUTOSRCS), GNU make can generate them as needed when
    trying to build them as needed when trying to build the object. Also,
    those two AUTOSRCS don't need to be a prerequisite of "all". As for
    the "clean" target, those two files are already removed via "_*.c".
    
    We don't need $(AUTOINCS) either:
    - As for both _libxl_save_msgs*.h headers, we are adding more
      selective dependencies so the headers will still be generated as
      needed.
    - "clean" rule already delete the _*.h files, so AUTOINCS aren't needed
      there.
    
    "libxl_internal_json.h" doesn't seems to have ever existed, so the
    dependency is removed.
    
    Rework objects prerequisites, to have them dependents on either
    "libxl.h" or "libxl_internal.h". "libxl.h" is not normally included
    directly in the source code as "libxl_internal.h" is used instead, but
    we have "libxl.h" as prerequisite of "libxl_internal.h", so generated
    headers will still be generated as needed.
    
    Make doesn't need "libxl.h" to generate "testidl.c", "libxl.h" is only
    needed later when building "testidl.o". This avoid the need to
    regenerate "testidl.c" when only "libxl.h" changed. Also use automatic
    variables $< and $@.
    
    Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
    Reviewed-by: Juergen Gross <jgross@suse.com>
---
 tools/libs/light/Makefile | 28 ++++++++++++++++------------
 1 file changed, 16 insertions(+), 12 deletions(-)

diff --git a/tools/libs/light/Makefile b/tools/libs/light/Makefile
index cd3fa855e1..b28447a2ae 100644
--- a/tools/libs/light/Makefile
+++ b/tools/libs/light/Makefile
@@ -148,9 +148,6 @@ LIBXL_TEST_OBJS += $(foreach t, $(LIBXL_TESTS_INSIDE),libxl_test_$t.opic)
 TEST_PROG_OBJS += $(foreach t, $(LIBXL_TESTS_PROGS),test_$t.o) test_common.o
 TEST_PROGS += $(foreach t, $(LIBXL_TESTS_PROGS),test_$t)
 
-AUTOINCS = _libxl_save_msgs_callout.h _libxl_save_msgs_helper.h
-AUTOSRCS = _libxl_save_msgs_callout.c _libxl_save_msgs_helper.c
-
 CLIENTS = testidl libxl-save-helper
 
 SAVE_HELPER_OBJS = libxl_save_helper.o _libxl_save_msgs_helper.o
@@ -178,13 +175,13 @@ libxl_x86_acpi.o libxl_x86_acpi.opic: CFLAGS += -I$(XEN_ROOT)/tools
 $(SAVE_HELPER_OBJS): CFLAGS += $(CFLAGS_libxenctrl) $(CFLAGS_libxenevtchn) $(CFLAGS_libxenguest)
 
 testidl.o: CFLAGS += $(CFLAGS_libxenctrl) $(CFLAGS_libxenlight)
-testidl.c: libxl_types.idl gentest.py $(XEN_INCLUDE)/libxl.h $(AUTOINCS)
-	$(PYTHON) gentest.py libxl_types.idl testidl.c.new
-	mv testidl.c.new testidl.c
+testidl.c: libxl_types.idl gentest.py
+	$(PYTHON) gentest.py $< $@.new
+	mv -f $@.new $@
 
-all: $(CLIENTS) $(TEST_PROGS) $(AUTOSRCS) $(AUTOINCS)
+all: $(CLIENTS) $(TEST_PROGS)
 
-$(OBJS-y) $(PIC_OBJS) $(SAVE_HELPER_OBJS) $(LIBXL_TEST_OBJS) $(TEST_PROG_OBJS): $(AUTOINCS) libxl.api-ok
+$(OBJS-y) $(PIC_OBJS) $(SAVE_HELPER_OBJS) $(LIBXL_TEST_OBJS) $(TEST_PROG_OBJS): libxl.api-ok
 
 $(DSDT_FILES-y): acpi
 
@@ -196,7 +193,7 @@ libxl.api-ok: check-libxl-api-rules _libxl.api-for-check
 	$(PERL) $^
 	touch $@
 
-_libxl.api-for-check: $(XEN_INCLUDE)/libxl.h $(AUTOINCS)
+_libxl.api-for-check: $(XEN_INCLUDE)/libxl.h
 	$(CC) $(CPPFLAGS) $(CFLAGS) -c -E $< $(APPEND_CFLAGS) \
 		-DLIBXL_EXTERNAL_CALLERS_ONLY=LIBXL_EXTERNAL_CALLERS_ONLY \
 		>$@.new
@@ -208,14 +205,22 @@ _libxl_save_msgs_helper.h _libxl_save_msgs_callout.h: \
 	$(PERL) -w $< $@ >$@.new
 	$(call move-if-changed,$@.new,$@)
 
+#
+# headers dependencies on generated headers
+#
 $(XEN_INCLUDE)/libxl.h: $(XEN_INCLUDE)/_libxl_types.h
 $(XEN_INCLUDE)/libxl_json.h: $(XEN_INCLUDE)/_libxl_types_json.h
 libxl_internal.h: $(XEN_INCLUDE)/libxl.h $(XEN_INCLUDE)/libxl_json.h
 libxl_internal.h: _libxl_types_internal.h _libxl_types_private.h _libxl_types_internal_private.h
-libxl_internal_json.h: _libxl_types_internal_json.h
+libxl_internal.h: _libxl_save_msgs_callout.h
 
-$(OBJS-y) $(PIC_OBJS) $(LIBXL_TEST_OBJS) $(TEST_PROG_OBJS) $(SAVE_HELPER_OBJS): $(XEN_INCLUDE)/libxl.h
+#
+# objects dependencies on headers that depends on generated headers
+#
+$(TEST_PROG_OBJS): $(XEN_INCLUDE)/libxl.h
 $(OBJS-y) $(PIC_OBJS) $(LIBXL_TEST_OBJS): libxl_internal.h
+$(SAVE_HELPER_OBJS): $(XEN_INCLUDE)/libxl.h _libxl_save_msgs_helper.h
+testidl.o: $(XEN_INCLUDE)/libxl.h
 
 # This exploits the 'multi-target pattern rule' trick.
 # gentypes.py should be executed only once to make all the targets.
@@ -262,5 +267,4 @@ clean::
 	$(RM) testidl.c.new testidl.c *.api-ok
 	$(RM) $(TEST_PROGS) libxenlight_test.so libxl_test_*.opic
 	$(RM) -r __pycache__
-	$(RM) $(AUTOSRCS) $(AUTOINCS)
 	$(MAKE) -C $(ACPI_PATH) ACPI_BUILD_DIR=$(CURDIR) clean
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Feb 10 12:11:54 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 10 Feb 2023 12:11:54 +0000
Received: from list by lists.xenproject.org with outflank-mailman.493365.763271 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pQSFu-0006V4-6T; Fri, 10 Feb 2023 12:11:54 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 493365.763271; Fri, 10 Feb 2023 12:11:54 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pQSFu-0006Uw-3e; Fri, 10 Feb 2023 12:11:54 +0000
Received: by outflank-mailman (input) for mailman id 493365;
 Fri, 10 Feb 2023 12:11:53 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pQSFt-0006Um-12
 for xen-changelog@lists.xenproject.org; Fri, 10 Feb 2023 12:11:53 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pQSFt-0004rB-0K
 for xen-changelog@lists.xenproject.org; Fri, 10 Feb 2023 12:11:53 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pQSFs-000238-Va
 for xen-changelog@lists.xenproject.org; Fri, 10 Feb 2023 12:11:52 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=yYGfBMpHwMRRWmQPMF+cng4fxSEQkUmFA7NVxsZfSgo=; b=rKAhPccum7crLGkQ/YQ+o7oOjo
	+JftYLtLMXEV242f2ULqijHw1XY7ihQnIItn+HeiIezWGozR/pymAISKNeJWEig9DDd1zlQwA3+VT
	YV42XFvWakn4Ie1Cl1+Uu/7O2dNNsZ6oMtefByehVWfOTwTeQoYlohDeXBKA5b6zd7nU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] libs/light: Makefile cleanup
Message-Id: <E1pQSFs-000238-Va@xenbits.xenproject.org>
Date: Fri, 10 Feb 2023 12:11:52 +0000

commit 78c04e24adff84e3325fbdb04e8ffae559876aba
Author:     Anthony PERARD <anthony.perard@citrix.com>
AuthorDate: Wed Feb 8 09:21:24 2023 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Feb 8 09:21:24 2023 +0100

    libs/light: Makefile cleanup
    
    Rework "libacpi.h" include in "libxl_x86_acpi.c" as to be more
    selective about the include path and only add "tools/libacpi/". Also
    "libxl_dom.c" don't use "libacpi.h" anymore. Use "-iquote" for libacpi
    headers.
    
    Get rid of the weird "$(eval stem =" in the middle of a recipe and use
    a make automatic variable "$(*F)" instead.
    
    Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
    Reviewed-by: Juergen Gross <jgross@suse.com>
---
 tools/libs/light/Makefile         | 16 +++++++---------
 tools/libs/light/libxl_x86_acpi.c |  2 +-
 2 files changed, 8 insertions(+), 10 deletions(-)

diff --git a/tools/libs/light/Makefile b/tools/libs/light/Makefile
index b28447a2ae..96daeabc47 100644
--- a/tools/libs/light/Makefile
+++ b/tools/libs/light/Makefile
@@ -170,8 +170,7 @@ LDLIBS += $(LDLIBS-y)
 $(OBJS-y) $(PIC_OBJS) $(LIBXL_TEST_OBJS): CFLAGS += $(CFLAGS_LIBXL) -include $(XEN_ROOT)/tools/config.h
 $(ACPI_OBJS) $(ACPI_PIC_OBJS): CFLAGS += -I. -DLIBACPI_STDUTILS=\"$(CURDIR)/libxl_x86_acpi.h\"
 $(TEST_PROG_OBJS) _libxl.api-for-check: CFLAGS += $(CFLAGS_libxentoollog) $(CFLAGS_libxentoolcore)
-libxl_dom.o libxl_dom.opic: CFLAGS += -I$(XEN_ROOT)/tools  # include libacpi/x86.h
-libxl_x86_acpi.o libxl_x86_acpi.opic: CFLAGS += -I$(XEN_ROOT)/tools
+libxl_x86_acpi.o libxl_x86_acpi.opic: CFLAGS += -iquote $(ACPI_PATH)
 $(SAVE_HELPER_OBJS): CFLAGS += $(CFLAGS_libxenctrl) $(CFLAGS_libxenevtchn) $(CFLAGS_libxenguest)
 
 testidl.o: CFLAGS += $(CFLAGS_libxenctrl) $(CFLAGS_libxenlight)
@@ -225,13 +224,12 @@ testidl.o: $(XEN_INCLUDE)/libxl.h
 # This exploits the 'multi-target pattern rule' trick.
 # gentypes.py should be executed only once to make all the targets.
 _libxl_type%.h _libxl_type%_json.h _libxl_type%_private.h _libxl_type%.c: libxl_type%.idl gentypes.py idl.py
-	$(eval stem = $(notdir $*))
-	$(PYTHON) gentypes.py libxl_type$(stem).idl __libxl_type$(stem).h __libxl_type$(stem)_private.h \
-		__libxl_type$(stem)_json.h  __libxl_type$(stem).c
-	$(call move-if-changed,__libxl_type$(stem).h,_libxl_type$(stem).h)
-	$(call move-if-changed,__libxl_type$(stem)_private.h,_libxl_type$(stem)_private.h)
-	$(call move-if-changed,__libxl_type$(stem)_json.h,_libxl_type$(stem)_json.h)
-	$(call move-if-changed,__libxl_type$(stem).c,_libxl_type$(stem).c)
+	$(PYTHON) gentypes.py libxl_type$(*F).idl __libxl_type$(*F).h __libxl_type$(*F)_private.h \
+		__libxl_type$(*F)_json.h  __libxl_type$(*F).c
+	$(call move-if-changed,__libxl_type$(*F).h,_libxl_type$(*F).h)
+	$(call move-if-changed,__libxl_type$(*F)_private.h,_libxl_type$(*F)_private.h)
+	$(call move-if-changed,__libxl_type$(*F)_json.h,_libxl_type$(*F)_json.h)
+	$(call move-if-changed,__libxl_type$(*F).c,_libxl_type$(*F).c)
 
 .PRECIOUS: _libxl_type%.h _libxl_type%.c
 
diff --git a/tools/libs/light/libxl_x86_acpi.c b/tools/libs/light/libxl_x86_acpi.c
index 57a6b63790..22eb160659 100644
--- a/tools/libs/light/libxl_x86_acpi.c
+++ b/tools/libs/light/libxl_x86_acpi.c
@@ -16,7 +16,7 @@
 #include "libxl_arch.h"
 #include <xen/hvm/hvm_info_table.h>
 #include <xen/hvm/e820.h>
-#include "libacpi/libacpi.h"
+#include "libacpi.h"
 
  /* Number of pages holding ACPI tables */
 #define NUM_ACPI_PAGES 16
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Feb 10 12:12:04 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 10 Feb 2023 12:12:04 +0000
Received: from list by lists.xenproject.org with outflank-mailman.493366.763275 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pQSG4-0006XZ-8B; Fri, 10 Feb 2023 12:12:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 493366.763275; Fri, 10 Feb 2023 12:12:04 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pQSG4-0006XR-5K; Fri, 10 Feb 2023 12:12:04 +0000
Received: by outflank-mailman (input) for mailman id 493366;
 Fri, 10 Feb 2023 12:12:03 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pQSG3-0006XE-4F
 for xen-changelog@lists.xenproject.org; Fri, 10 Feb 2023 12:12:03 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pQSG3-0004rc-3W
 for xen-changelog@lists.xenproject.org; Fri, 10 Feb 2023 12:12:03 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pQSG3-00023m-2W
 for xen-changelog@lists.xenproject.org; Fri, 10 Feb 2023 12:12:03 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Hjpy8ZxNeBRz/PDXlGXnG7Y+2eB+W1WjUCSPxU0NIo0=; b=egv1DJZKWd6gHv4VSwdyCTzT5R
	nbhDTI6YRDVavaO/XsdDGgVBRK7GPGQMfAQM8RDPFJ8Em7udBqHmXDcnzt57Y9X6G8ISfn2FZk2D3
	LAi93wh5f9OjcXvIZdUvcQt5u7XWwz0sMTVl1gMyYi63Pi/ON5NE3EU3SqdjHk8xgvVc=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/device_tree: add parentheses around macro parameters
Message-Id: <E1pQSG3-00023m-2W@xenbits.xenproject.org>
Date: Fri, 10 Feb 2023 12:12:03 +0000

commit 97266d2ac71e0d966debd9e0b847502b1815e41b
Author:     Xenia Ragiadakou <burzalodowa@gmail.com>
AuthorDate: Fri Feb 3 21:09:07 2023 +0200
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Wed Feb 8 08:32:49 2023 +0000

    xen/device_tree: add parentheses around macro parameters
    
    Add parentheses around macro parameters when the precedence and
    associativity of the performed operators can lead to unintended order of evaluation.
    
    This is fixing some ECLAIR finding for Misra Rule 20.7.
    
    Link: https://lore.kernel.org/xen-devel/20230203190908.211541-2-burzalodowa@gmail.com/
    Signed-off-by: Xenia Ragiadakou <burzalodowa@gmail.com>
    Reviewed-by: Luca Fancellu <luca.fancellu@arm.com>
    [jgrall: Reworded the commit message]
    Acked-by: Julien Grall <jgrall@amazon.com>
---
 xen/include/xen/device_tree.h | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/xen/include/xen/device_tree.h b/xen/include/xen/device_tree.h
index a28937d12a..7839a199e3 100644
--- a/xen/include/xen/device_tree.h
+++ b/xen/include/xen/device_tree.h
@@ -37,11 +37,11 @@ struct dt_device_match {
     const void *data;
 };
 
-#define __DT_MATCH_PATH(p)              .path = p
-#define __DT_MATCH_TYPE(typ)            .type = typ
-#define __DT_MATCH_COMPATIBLE(compat)   .compatible = compat
+#define __DT_MATCH_PATH(p)              .path = (p)
+#define __DT_MATCH_TYPE(typ)            .type = (typ)
+#define __DT_MATCH_COMPATIBLE(compat)   .compatible = (compat)
 #define __DT_MATCH_NOT_AVAILABLE()      .not_available = 1
-#define __DT_MATCH_PROP(p)              .prop = p
+#define __DT_MATCH_PROP(p)              .prop = (p)
 
 #define DT_MATCH_PATH(p)                { __DT_MATCH_PATH(p) }
 #define DT_MATCH_TYPE(typ)              { __DT_MATCH_TYPE(typ) }
@@ -226,13 +226,13 @@ dt_find_interrupt_controller(const struct dt_device_match *matches);
 #define DT_ROOT_NODE_SIZE_CELLS_DEFAULT 1
 
 #define dt_for_each_property_node(dn, pp)                   \
-    for ( pp = dn->properties; pp != NULL; pp = pp->next )
+    for ( pp = (dn)->properties; (pp) != NULL; pp = (pp)->next )
 
 #define dt_for_each_device_node(dt, dn)                     \
-    for ( dn = dt; dn != NULL; dn = dn->allnext )
+    for ( dn = dt; (dn) != NULL; dn = (dn)->allnext )
 
 #define dt_for_each_child_node(dt, dn)                      \
-    for ( dn = dt->child; dn != NULL; dn = dn->sibling )
+    for ( dn = (dt)->child; (dn) != NULL; dn = (dn)->sibling )
 
 /* Helper to read a big number; size is in cells (not bytes) */
 static inline u64 dt_read_number(const __be32 *cell, int size)
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Feb 10 12:12:14 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 10 Feb 2023 12:12:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.493367.763279 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pQSGE-0006ac-9n; Fri, 10 Feb 2023 12:12:14 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 493367.763279; Fri, 10 Feb 2023 12:12:14 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pQSGE-0006aU-6y; Fri, 10 Feb 2023 12:12:14 +0000
Received: by outflank-mailman (input) for mailman id 493367;
 Fri, 10 Feb 2023 12:12:13 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pQSGD-0006aI-79
 for xen-changelog@lists.xenproject.org; Fri, 10 Feb 2023 12:12:13 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pQSGD-0004sD-6L
 for xen-changelog@lists.xenproject.org; Fri, 10 Feb 2023 12:12:13 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pQSGD-00024k-5g
 for xen-changelog@lists.xenproject.org; Fri, 10 Feb 2023 12:12:13 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=1jTSKnMpNAVAHw3anrH1ifOC1yG0Auy1iJw3eF6fPhQ=; b=yPdLK9gONqei+yEiNWbQfH/hSB
	6+YGG2IcSv4EN8Z01IMTAb/blGnYfZ6hkD/Hxq7x4yLrXwvKnw8Yfp/lS1afwfuGh/Nc8wjFu5iYV
	t03Rg1x6bjYv3UZ418U9ARiS/Ow/y1YPHEySYUFreiun0S6OgLkNUBNx1GDDLPbf51js=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/device_tree: remove incorrect and unused dt_irq() and dt_irq_flags() macros
Message-Id: <E1pQSGD-00024k-5g@xenbits.xenproject.org>
Date: Fri, 10 Feb 2023 12:12:13 +0000

commit b9adcb5ab910b61e5332728bd248906e68a45900
Author:     Xenia Ragiadakou <burzalodowa@gmail.com>
AuthorDate: Fri Feb 3 21:09:08 2023 +0200
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Wed Feb 8 08:33:25 2023 +0000

    xen/device_tree: remove incorrect and unused dt_irq() and dt_irq_flags() macros
    
    Macro dt_irq() is broken because the macro parameter has the same name with
    the struct dt_irq member "irq".
    Macro dt_irq_flags() is broken as well because struct dt_irq has no member
    named "flags".
    
    Since no one seems to have ever tried to use them and eventually stumble upon
    the issues above, remove them instead of fixing them.
    
    Fixes: 886f34045bf0 ("xen/arm: Add helpers to retrieve an interrupt description from the device tree")
    Signed-off-by: Xenia Ragiadakou <burzalodowa@gmail.com>
    Reviewed-by: Luca Fancellu <luca.fancellu@arm.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
---
 xen/include/xen/device_tree.h | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/xen/include/xen/device_tree.h b/xen/include/xen/device_tree.h
index 7839a199e3..19a74909ce 100644
--- a/xen/include/xen/device_tree.h
+++ b/xen/include/xen/device_tree.h
@@ -159,9 +159,6 @@ struct dt_raw_irq {
     u32 specifier[DT_MAX_IRQ_SPEC];
 };
 
-#define dt_irq(irq) ((irq)->irq)
-#define dt_irq_flags(irq) ((irq)->flags)
-
 typedef int (*device_tree_node_func)(const void *fdt,
                                      int node, const char *name, int depth,
                                      u32 address_cells, u32 size_cells,
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Feb 10 12:12:24 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 10 Feb 2023 12:12:24 +0000
Received: from list by lists.xenproject.org with outflank-mailman.493368.763283 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pQSGO-0006dp-BC; Fri, 10 Feb 2023 12:12:24 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 493368.763283; Fri, 10 Feb 2023 12:12:24 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pQSGO-0006df-8Q; Fri, 10 Feb 2023 12:12:24 +0000
Received: by outflank-mailman (input) for mailman id 493368;
 Fri, 10 Feb 2023 12:12:23 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pQSGN-0006dK-9x
 for xen-changelog@lists.xenproject.org; Fri, 10 Feb 2023 12:12:23 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pQSGN-0004sP-9F
 for xen-changelog@lists.xenproject.org; Fri, 10 Feb 2023 12:12:23 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pQSGN-00025r-8R
 for xen-changelog@lists.xenproject.org; Fri, 10 Feb 2023 12:12:23 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=JcfLxtbCNerCYA5MzZPjRT09AeEfrl8+HsybgXqx5IA=; b=G4rpokkfME1CO8xPa449Eu7oD2
	mFTuD9iumGgV8iYx20jHvoT9s4qde20ujEL0GtCZkWmCsz16+dGGdkMSWKP64xFDFmcJWGeOfuFE/
	dXS9ek1r3424XPQvUuKwsecOtBIwo/MRKnaBEm+AYdhR00OtqEDd21WC8Z1evwtdhbHc=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/arm: Move kernel_uimage_probe definition after kernel_decompress
Message-Id: <E1pQSGN-00025r-8R@xenbits.xenproject.org>
Date: Fri, 10 Feb 2023 12:12:23 +0000

commit 3da5c20cd9223ae122611270bdf25cb29fd9c42a
Author:     Michal Orzel <michal.orzel@amd.com>
AuthorDate: Thu Feb 2 09:49:04 2023 +0100
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Wed Feb 8 13:56:42 2023 +0000

    xen/arm: Move kernel_uimage_probe definition after kernel_decompress
    
    In a follow-up patch, we will be calling kernel_decompress function from
    within kernel_uimage_probe to support booting compressed images with
    u-boot header. Therefore, move the kernel_uimage_probe definition after
    kernel_decompress so that the latter is visible to the former.
    
    No functional change intended.
    
    Signed-off-by: Michal Orzel <michal.orzel@amd.com>
    Reviewed-by: Ayan Kumar Halder <ayan.kumar.halder@amd.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
---
 xen/arch/arm/kernel.c | 146 +++++++++++++++++++++++++-------------------------
 1 file changed, 73 insertions(+), 73 deletions(-)

diff --git a/xen/arch/arm/kernel.c b/xen/arch/arm/kernel.c
index 36081e73f1..068fbf88e4 100644
--- a/xen/arch/arm/kernel.c
+++ b/xen/arch/arm/kernel.c
@@ -186,6 +186,79 @@ static void __init kernel_zimage_load(struct kernel_info *info)
     iounmap(kernel);
 }
 
+static __init uint32_t output_length(char *image, unsigned long image_len)
+{
+    return *(uint32_t *)&image[image_len - 4];
+}
+
+static __init int kernel_decompress(struct bootmodule *mod)
+{
+    char *output, *input;
+    char magic[2];
+    int rc;
+    unsigned int kernel_order_out;
+    paddr_t output_size;
+    struct page_info *pages;
+    mfn_t mfn;
+    int i;
+    paddr_t addr = mod->start;
+    paddr_t size = mod->size;
+
+    if ( size < 2 )
+        return -EINVAL;
+
+    copy_from_paddr(magic, addr, sizeof(magic));
+
+    /* only gzip is supported */
+    if ( !gzip_check(magic, size) )
+        return -EINVAL;
+
+    input = ioremap_cache(addr, size);
+    if ( input == NULL )
+        return -EFAULT;
+
+    output_size = output_length(input, size);
+    kernel_order_out = get_order_from_bytes(output_size);
+    pages = alloc_domheap_pages(NULL, kernel_order_out, 0);
+    if ( pages == NULL )
+    {
+        iounmap(input);
+        return -ENOMEM;
+    }
+    mfn = page_to_mfn(pages);
+    output = __vmap(&mfn, 1 << kernel_order_out, 1, 1, PAGE_HYPERVISOR, VMAP_DEFAULT);
+
+    rc = perform_gunzip(output, input, size);
+    clean_dcache_va_range(output, output_size);
+    iounmap(input);
+    vunmap(output);
+
+    if ( rc )
+    {
+        free_domheap_pages(pages, kernel_order_out);
+        return rc;
+    }
+
+    mod->start = page_to_maddr(pages);
+    mod->size = output_size;
+
+    /*
+     * Need to free pages after output_size here because they won't be
+     * freed by discard_initial_modules
+     */
+    i = PFN_UP(output_size);
+    for ( ; i < (1 << kernel_order_out); i++ )
+        free_domheap_page(pages + i);
+
+    /*
+     * Free the original kernel, update the pointers to the
+     * decompressed kernel
+     */
+    fw_unreserved_regions(addr, addr + size, init_domheap_pages, 0);
+
+    return 0;
+}
+
 /*
  * Uimage CPU Architecture Codes
  */
@@ -289,79 +362,6 @@ static int __init kernel_uimage_probe(struct kernel_info *info,
     return 0;
 }
 
-static __init uint32_t output_length(char *image, unsigned long image_len)
-{
-    return *(uint32_t *)&image[image_len - 4];
-}
-
-static __init int kernel_decompress(struct bootmodule *mod)
-{
-    char *output, *input;
-    char magic[2];
-    int rc;
-    unsigned int kernel_order_out;
-    paddr_t output_size;
-    struct page_info *pages;
-    mfn_t mfn;
-    int i;
-    paddr_t addr = mod->start;
-    paddr_t size = mod->size;
-
-    if ( size < 2 )
-        return -EINVAL;
-
-    copy_from_paddr(magic, addr, sizeof(magic));
-
-    /* only gzip is supported */
-    if ( !gzip_check(magic, size) )
-        return -EINVAL;
-
-    input = ioremap_cache(addr, size);
-    if ( input == NULL )
-        return -EFAULT;
-
-    output_size = output_length(input, size);
-    kernel_order_out = get_order_from_bytes(output_size);
-    pages = alloc_domheap_pages(NULL, kernel_order_out, 0);
-    if ( pages == NULL )
-    {
-        iounmap(input);
-        return -ENOMEM;
-    }
-    mfn = page_to_mfn(pages);
-    output = __vmap(&mfn, 1 << kernel_order_out, 1, 1, PAGE_HYPERVISOR, VMAP_DEFAULT);
-
-    rc = perform_gunzip(output, input, size);
-    clean_dcache_va_range(output, output_size);
-    iounmap(input);
-    vunmap(output);
-
-    if ( rc )
-    {
-        free_domheap_pages(pages, kernel_order_out);
-        return rc;
-    }
-
-    mod->start = page_to_maddr(pages);
-    mod->size = output_size;
-
-    /*
-     * Need to free pages after output_size here because they won't be
-     * freed by discard_initial_modules
-     */
-    i = PFN_UP(output_size);
-    for ( ; i < (1 << kernel_order_out); i++ )
-        free_domheap_page(pages + i);
-
-    /*
-     * Free the original kernel, update the pointers to the
-     * decompressed kernel
-     */
-    fw_unreserved_regions(addr, addr + size, init_domheap_pages, 0);
-
-    return 0;
-}
-
 #ifdef CONFIG_ARM_64
 /*
  * Check if the image is a 64-bit Image.
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Feb 10 12:12:34 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 10 Feb 2023 12:12:34 +0000
Received: from list by lists.xenproject.org with outflank-mailman.493369.763287 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pQSGY-0006hB-ET; Fri, 10 Feb 2023 12:12:34 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 493369.763287; Fri, 10 Feb 2023 12:12:34 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pQSGY-0006h3-BP; Fri, 10 Feb 2023 12:12:34 +0000
Received: by outflank-mailman (input) for mailman id 493369;
 Fri, 10 Feb 2023 12:12:33 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pQSGX-0006gs-D0
 for xen-changelog@lists.xenproject.org; Fri, 10 Feb 2023 12:12:33 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pQSGX-0004sg-CI
 for xen-changelog@lists.xenproject.org; Fri, 10 Feb 2023 12:12:33 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pQSGX-000278-BO
 for xen-changelog@lists.xenproject.org; Fri, 10 Feb 2023 12:12:33 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=GogbF/VzN8WuEQFOdkRtCu8mOl4V3OQG4jSZwDDUxjU=; b=PC/hvZpnDsrYt8hXnAXDXCuNry
	E3c+WlcI2FHV+4Lx9RqUVIABrOMDJAwfVvBQkK94WULch63t69M4qqI6GsGdqxQQazKlbk+xdkYa3
	G58mttE7oZLyzw0pKeiL3MXLyBeDREhacx2wWQsr044jFobneUzSdMrz63cIA+GS+PU0=;
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 booting gzip compressed uImages
Message-Id: <E1pQSGX-000278-BO@xenbits.xenproject.org>
Date: Fri, 10 Feb 2023 12:12:33 +0000

commit 6d317b10f8e4cbc8092c00ce462d79f13e3ca4f6
Author:     Michal Orzel <michal.orzel@amd.com>
AuthorDate: Thu Feb 2 09:49:05 2023 +0100
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Wed Feb 8 13:57:57 2023 +0000

    xen/arm: Add support for booting gzip compressed uImages
    
    At the moment, Xen does not support booting gzip compressed uImages.
    This is because we are trying to decompress the kernel before probing
    the u-boot header. This leads to a failure as the header always appears
    at the top of the image (and therefore obscuring the gzip header).
    
    Move the call to kernel_uimage_probe before kernel_decompress and make
    the function self-containing by taking the following actions:
     - take a pointer to struct bootmodule as a parameter,
     - check the comp field of a u-boot header to determine compression type,
     - in case of compressed image, call kernel_decompress passing uImage
       header size as an offset to gzip header,
     - set up zimage.{kernel_addr,len} accordingly,
     - return -ENOENT in case of a u-boot header not found to distinguish it
       amongst other return values and make it the only case for falling
       through to try to probe other image types.
    
    Modify kernel_decompress to take an additional parameter being an offset
    to a gzip header from start address. This is needed so that a function
    can first operate on a region containing actually compressed kernel (in case
    of compressed uImage, size of u-boot header is an offset to a gzip header)
    and then at the end pass the entire region (as it was before taking an offset
    into account) to fw_unreserved_regions for freeing.
    
    This approach avoids splitting the uImage probing into 2 stages (executed
    before and after decompression) which otherwise would be necessary to
    properly parse header, update boot module start and size before
    decompression and update zimage.{kernel_addr,len} afterwards.
    
    Remove the limitation from the booting.txt documentation.
    
    Signed-off-by: Michal Orzel <michal.orzel@amd.com>
    Reviewwed-by: Julien Grall <jgrall@amazon.com>
---
 docs/misc/arm/booting.txt |  3 --
 xen/arch/arm/kernel.c     | 83 +++++++++++++++++++++++++++++++++++++++++------
 2 files changed, 73 insertions(+), 13 deletions(-)

diff --git a/docs/misc/arm/booting.txt b/docs/misc/arm/booting.txt
index bd7bfe7f28..02f7bb65ec 100644
--- a/docs/misc/arm/booting.txt
+++ b/docs/misc/arm/booting.txt
@@ -50,9 +50,6 @@ Also, it is to be noted that if user provides the legacy image header on
 top of zImage or Image header, then Xen uses the attributes of legacy
 image header to determine the load address, entry point, etc.
 
-Known limitation: compressed kernels with a uboot headers are not
-working.
-
 
 Firmware/bootloader requirements
 --------------------------------
diff --git a/xen/arch/arm/kernel.c b/xen/arch/arm/kernel.c
index 068fbf88e4..ca5318515e 100644
--- a/xen/arch/arm/kernel.c
+++ b/xen/arch/arm/kernel.c
@@ -191,7 +191,7 @@ static __init uint32_t output_length(char *image, unsigned long image_len)
     return *(uint32_t *)&image[image_len - 4];
 }
 
-static __init int kernel_decompress(struct bootmodule *mod)
+static __init int kernel_decompress(struct bootmodule *mod, uint32_t offset)
 {
     char *output, *input;
     char magic[2];
@@ -204,6 +204,17 @@ static __init int kernel_decompress(struct bootmodule *mod)
     paddr_t addr = mod->start;
     paddr_t size = mod->size;
 
+    if ( size < offset )
+        return -EINVAL;
+
+    /*
+     * It might be that gzip header does not appear at the start address
+     * (e.g. in case of compressed uImage) so take into account offset to
+     * gzip header.
+     */
+    addr += offset;
+    size -= offset;
+
     if ( size < 2 )
         return -EINVAL;
 
@@ -250,6 +261,14 @@ static __init int kernel_decompress(struct bootmodule *mod)
     for ( ; i < (1 << kernel_order_out); i++ )
         free_domheap_page(pages + i);
 
+    /*
+     * 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,
+     * so that the entire region will be freed.
+     */
+    addr -= offset;
+    size += offset;
+
     /*
      * Free the original kernel, update the pointers to the
      * decompressed kernel
@@ -265,11 +284,14 @@ static __init int kernel_decompress(struct bootmodule *mod)
 #define IH_ARCH_ARM             2       /* ARM          */
 #define IH_ARCH_ARM64           22      /* ARM64        */
 
+/* uImage Compression Types */
+#define IH_COMP_GZIP            1
+
 /*
  * Check if the image is a uImage and setup kernel_info
  */
 static int __init kernel_uimage_probe(struct kernel_info *info,
-                                      paddr_t addr, paddr_t size)
+                                      struct bootmodule *mod)
 {
     struct {
         __be32 magic;   /* Image Header Magic Number */
@@ -287,20 +309,30 @@ static int __init kernel_uimage_probe(struct kernel_info *info,
     } uimage;
 
     uint32_t len;
+    paddr_t addr = mod->start;
+    paddr_t size = mod->size;
 
     if ( size < sizeof(uimage) )
-        return -EINVAL;
+        return -ENOENT;
 
     copy_from_paddr(&uimage, addr, sizeof(uimage));
 
     if ( be32_to_cpu(uimage.magic) != UIMAGE_MAGIC )
-        return -EINVAL;
+        return -ENOENT;
 
     len = be32_to_cpu(uimage.size);
 
     if ( len > size - sizeof(uimage) )
         return -EINVAL;
 
+    /* Only gzip compression is supported. */
+    if ( uimage.comp && uimage.comp != IH_COMP_GZIP )
+    {
+        printk(XENLOG_ERR
+               "Unsupported uImage compression type %"PRIu8"\n", uimage.comp);
+        return -EOPNOTSUPP;
+    }
+
     info->zimage.start = be32_to_cpu(uimage.load);
     info->entry = be32_to_cpu(uimage.ep);
 
@@ -330,8 +362,27 @@ static int __init kernel_uimage_probe(struct kernel_info *info,
         return -EINVAL;
     }
 
-    info->zimage.kernel_addr = addr + sizeof(uimage);
-    info->zimage.len = len;
+    if ( uimage.comp )
+    {
+        int rc;
+
+        /*
+         * In case of a compressed uImage, the gzip header is right after
+         * the u-boot header, so pass sizeof(uimage) as an offset to gzip
+         * header.
+         */
+        rc = kernel_decompress(mod, sizeof(uimage));
+        if ( rc )
+            return rc;
+
+        info->zimage.kernel_addr = mod->start;
+        info->zimage.len = mod->size;
+    }
+    else
+    {
+        info->zimage.kernel_addr = addr + sizeof(uimage);
+        info->zimage.len = len;
+    }
 
     info->load = kernel_zimage_load;
 
@@ -561,8 +612,22 @@ int __init kernel_probe(struct kernel_info *info,
         printk("Loading ramdisk from boot module @ %"PRIpaddr"\n",
                info->initrd_bootmodule->start);
 
-    /* if it is a gzip'ed image, 32bit or 64bit, uncompress it */
-    rc = kernel_decompress(mod);
+    /*
+     * uImage header always appears at the top of the image (even compressed),
+     * so it needs to be probed first. Note that in case of compressed uImage,
+     * kernel_decompress is called from kernel_uimage_probe making the function
+     * self-containing (i.e. fall through only in case of a header not found).
+     */
+    rc = kernel_uimage_probe(info, mod);
+    if ( rc != -ENOENT )
+        return rc;
+
+    /*
+     * If it is a gzip'ed image, 32bit or 64bit, uncompress it.
+     * At this point, gzip header appears (if at all) at the top of the image,
+     * so pass 0 as an offset.
+     */
+    rc = kernel_decompress(mod, 0);
     if ( rc && rc != -EINVAL )
         return rc;
 
@@ -570,8 +635,6 @@ int __init kernel_probe(struct kernel_info *info,
     rc = kernel_zimage64_probe(info, mod->start, mod->size);
     if (rc < 0)
 #endif
-        rc = kernel_uimage_probe(info, mod->start, mod->size);
-    if (rc < 0)
         rc = kernel_zimage32_probe(info, mod->start, mod->size);
 
     return rc;
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Feb 10 12:12:44 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 10 Feb 2023 12:12:44 +0000
Received: from list by lists.xenproject.org with outflank-mailman.493370.763291 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pQSGi-0006jz-Fi; Fri, 10 Feb 2023 12:12:44 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 493370.763291; Fri, 10 Feb 2023 12:12:44 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pQSGi-0006jr-D6; Fri, 10 Feb 2023 12:12:44 +0000
Received: by outflank-mailman (input) for mailman id 493370;
 Fri, 10 Feb 2023 12:12:43 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pQSGh-0006jf-Fm
 for xen-changelog@lists.xenproject.org; Fri, 10 Feb 2023 12:12:43 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pQSGh-0004sm-F4
 for xen-changelog@lists.xenproject.org; Fri, 10 Feb 2023 12:12:43 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pQSGh-00027q-EN
 for xen-changelog@lists.xenproject.org; Fri, 10 Feb 2023 12:12:43 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=dBpIF5HASg4Z0T4+Sq6uVF9TpZdoGAdT0bJEOOKw6yU=; b=EZzGKvM+nePnonV/DDxeNgK1vw
	cZzNdi6PMCY9rFPGjhm3h5Anj7bM8kmsGBJ6iS8TV//Lkouaz2kD+1kv4ut4rSt9yr3B56qUefPoh
	e0AUetVGiVGeWyrBFTM0WkCdlqimgCLiKy3YxoJOpR4IYwOWBnAuIny+mEhsk+lqePe0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/riscv: introduce early_printk basic stuff
Message-Id: <E1pQSGh-00027q-EN@xenbits.xenproject.org>
Date: Fri, 10 Feb 2023 12:12:43 +0000

commit 46a78347e2f6706b192eaf5992fec5c3cfe885ae
Author:     Oleksii Kurochko <oleksii.kurochko@gmail.com>
AuthorDate: Thu Feb 9 11:13:50 2023 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Feb 9 11:13:50 2023 +0100

    xen/riscv: introduce early_printk basic stuff
    
    Because printk() relies on a serial driver (like the ns16550 driver)
    and drivers require working virtual memory (ioremap()) there is not
    print functionality early in Xen boot.
    
    The patch introduces the basic stuff of early_printk functionality
    which will be enough to print 'hello from C environment".
    
    Originally early_printk.{c,h} was introduced by Bobby Eshleman
    (https://github.com/glg-rv/xen/commit/a3c9916bbdff7ad6030055bbee7e53d1aab71384)
    but some functionality was changed:
    early_printk() function was changed in comparison with the original as
    common isn't being built now so there is no vscnprintf.
    
    This commit adds early printk implementation built on the putc SBI call.
    
    As sbi_console_putchar() is already being planned for deprecation
    it is used temporarily now and will be removed or reworked after
    real uart will be ready.
    
    Signed-off-by: Bobby Eshleman <bobby.eshleman@gmail.com>
    Signed-off-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
    Reviewed-by: Bobby Eshleman <bobby.eshleman@gmail.com>
    Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
---
 xen/arch/riscv/Kconfig.debug              |  5 ++++
 xen/arch/riscv/Makefile                   |  1 +
 xen/arch/riscv/early_printk.c             | 44 +++++++++++++++++++++++++++++++
 xen/arch/riscv/include/asm/early_printk.h | 12 +++++++++
 xen/arch/riscv/setup.c                    |  4 +++
 5 files changed, 66 insertions(+)

diff --git a/xen/arch/riscv/Kconfig.debug b/xen/arch/riscv/Kconfig.debug
index e69de29bb2..608c9ff832 100644
--- a/xen/arch/riscv/Kconfig.debug
+++ b/xen/arch/riscv/Kconfig.debug
@@ -0,0 +1,5 @@
+config EARLY_PRINTK
+    bool "Enable early printk"
+    default DEBUG
+    help
+      Enables early printk debug messages
diff --git a/xen/arch/riscv/Makefile b/xen/arch/riscv/Makefile
index fd916e1004..1a4f1a6015 100644
--- a/xen/arch/riscv/Makefile
+++ b/xen/arch/riscv/Makefile
@@ -1,3 +1,4 @@
+obj-$(CONFIG_EARLY_PRINTK) += early_printk.o
 obj-$(CONFIG_RISCV_64) += riscv64/
 obj-y += sbi.o
 obj-y += setup.o
diff --git a/xen/arch/riscv/early_printk.c b/xen/arch/riscv/early_printk.c
new file mode 100644
index 0000000000..dfe4ad77e2
--- /dev/null
+++ b/xen/arch/riscv/early_printk.c
@@ -0,0 +1,44 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * RISC-V early printk using SBI
+ *
+ * Copyright (C) 2021 Bobby Eshleman <bobbyeshleman@gmail.com>
+ */
+#include <asm/early_printk.h>
+#include <asm/sbi.h>
+
+/*
+ * When the MMU is off during early boot, any C function called has to
+ * use PC-relative rather than absolute address because the physical address
+ * may not match the virtual address.
+ *
+ * To guarantee PC-relative address cmodel=medany should be used
+ */
+#ifndef __riscv_cmodel_medany
+#error "early_*() can be called from head.S with MMU-off"
+#endif
+
+/*
+ * TODO:
+ *   sbi_console_putchar is already planned for deprecation
+ *   so it should be reworked to use UART directly.
+*/
+void early_puts(const char *s, size_t nr)
+{
+    while ( nr-- > 0 )
+    {
+        if ( *s == '\n' )
+            sbi_console_putchar('\r');
+        sbi_console_putchar(*s);
+        s++;
+    }
+}
+
+void early_printk(const char *str)
+{
+    while ( *str )
+    {
+        early_puts(str, 1);
+        str++;
+    }
+}
diff --git a/xen/arch/riscv/include/asm/early_printk.h b/xen/arch/riscv/include/asm/early_printk.h
new file mode 100644
index 0000000000..05106e160d
--- /dev/null
+++ b/xen/arch/riscv/include/asm/early_printk.h
@@ -0,0 +1,12 @@
+#ifndef __EARLY_PRINTK_H__
+#define __EARLY_PRINTK_H__
+
+#include <xen/early_printk.h>
+
+#ifdef CONFIG_EARLY_PRINTK
+void early_printk(const char *str);
+#else
+static inline void early_printk(const char *s) {};
+#endif
+
+#endif /* __EARLY_PRINTK_H__ */
diff --git a/xen/arch/riscv/setup.c b/xen/arch/riscv/setup.c
index 13e24e2fe1..d09ffe1454 100644
--- a/xen/arch/riscv/setup.c
+++ b/xen/arch/riscv/setup.c
@@ -1,12 +1,16 @@
 #include <xen/compile.h>
 #include <xen/init.h>
 
+#include <asm/early_printk.h>
+
 /* Xen stack for bringing up the first CPU. */
 unsigned char __initdata cpu0_boot_stack[STACK_SIZE]
     __aligned(STACK_SIZE);
 
 void __init noreturn start_xen(void)
 {
+    early_printk("Hello from C env\n");
+
     for ( ;; )
         asm volatile ("wfi");
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Feb 10 12:12:54 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 10 Feb 2023 12:12:54 +0000
Received: from list by lists.xenproject.org with outflank-mailman.493371.763295 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pQSGs-0006ma-Hi; Fri, 10 Feb 2023 12:12:54 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 493371.763295; Fri, 10 Feb 2023 12:12:54 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pQSGs-0006mR-Eh; Fri, 10 Feb 2023 12:12:54 +0000
Received: by outflank-mailman (input) for mailman id 493371;
 Fri, 10 Feb 2023 12:12:53 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pQSGr-0006mH-IL
 for xen-changelog@lists.xenproject.org; Fri, 10 Feb 2023 12:12:53 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pQSGr-0004sx-Hl
 for xen-changelog@lists.xenproject.org; Fri, 10 Feb 2023 12:12:53 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pQSGr-00029v-H8
 for xen-changelog@lists.xenproject.org; Fri, 10 Feb 2023 12:12:53 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=GjJMRn0DD+ueHCWWUI6F667P5GJgbiy/WqKEy9j1Hsg=; b=sv38y4LtgOJfbrzIhSkv/JPD/w
	iilt4oOJdLoGJx19ARF/1vXOH6pR0hVs0I/eIVxfH3Mk16P6EOd50ihWoTOyDHvvBU/Wj6qwymkKc
	xGRRj8fYsc9tLlKc534aKqOHFwlV5r/9ThNSz+tpp+L+yMuP8fVYQIdb0i2qnSIgxGAk=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] automation: add RISC-V smoke test
Message-Id: <E1pQSGr-00029v-H8@xenbits.xenproject.org>
Date: Fri, 10 Feb 2023 12:12:53 +0000

commit 7174971f5f108455c219c999b900ff2056c239c8
Author:     Oleksii Kurochko <oleksii.kurochko@gmail.com>
AuthorDate: Thu Feb 9 11:14:40 2023 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Feb 9 11:14:40 2023 +0100

    automation: add RISC-V smoke test
    
    Add check if there is a message 'Hello from C env' presents
    in log file to be sure that stack is set and C part of early printk
    is working.
    
    Signed-off-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
    Acked-by: Stefano Stabellini <sstabellini@kernel.org>
    Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
---
 automation/gitlab-ci/test.yaml           | 20 ++++++++++++++++++++
 automation/scripts/qemu-smoke-riscv64.sh | 20 ++++++++++++++++++++
 2 files changed, 40 insertions(+)

diff --git a/automation/gitlab-ci/test.yaml b/automation/gitlab-ci/test.yaml
index afd80adfe1..ce543ef5c0 100644
--- a/automation/gitlab-ci/test.yaml
+++ b/automation/gitlab-ci/test.yaml
@@ -54,6 +54,19 @@
   tags:
     - x86_64
 
+.qemu-riscv64:
+  extends: .test-jobs-common
+  variables:
+    CONTAINER: archlinux:current-riscv64
+    LOGFILE: qemu-smoke-riscv64.log
+  artifacts:
+    paths:
+      - smoke.serial
+      - '*.log'
+    when: always
+  tags:
+    - x86_64
+
 .yocto-test:
   extends: .test-jobs-common
   script:
@@ -234,6 +247,13 @@ qemu-smoke-x86-64-clang-pvh:
   needs:
     - debian-unstable-clang-debug
 
+qemu-smoke-riscv64-gcc:
+  extends: .qemu-riscv64
+  script:
+    - ./automation/scripts/qemu-smoke-riscv64.sh 2>&1 | tee ${LOGFILE}
+  needs:
+    - archlinux-current-gcc-riscv64-debug
+
 # Yocto test jobs
 yocto-qemuarm64:
   extends: .yocto-test-arm64
diff --git a/automation/scripts/qemu-smoke-riscv64.sh b/automation/scripts/qemu-smoke-riscv64.sh
new file mode 100755
index 0000000000..e0f06360bc
--- /dev/null
+++ b/automation/scripts/qemu-smoke-riscv64.sh
@@ -0,0 +1,20 @@
+#!/bin/bash
+
+set -ex
+
+# Run the test
+rm -f smoke.serial
+set +e
+
+timeout -k 1 2 \
+qemu-system-riscv64 \
+    -M virt \
+    -smp 1 \
+    -nographic \
+    -m 2g \
+    -kernel binaries/xen \
+    |& tee smoke.serial
+
+set -e
+(grep -q "Hello from C env" smoke.serial) || exit 1
+exit 0
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Feb 10 12:13:05 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 10 Feb 2023 12:13:05 +0000
Received: from list by lists.xenproject.org with outflank-mailman.493372.763299 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pQSH2-0006pK-JK; Fri, 10 Feb 2023 12:13:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 493372.763299; Fri, 10 Feb 2023 12:13:04 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pQSH2-0006pB-GM; Fri, 10 Feb 2023 12:13:04 +0000
Received: by outflank-mailman (input) for mailman id 493372;
 Fri, 10 Feb 2023 12:13:03 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pQSH1-0006oy-M9
 for xen-changelog@lists.xenproject.org; Fri, 10 Feb 2023 12:13:03 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pQSH1-0004tE-Kf
 for xen-changelog@lists.xenproject.org; Fri, 10 Feb 2023 12:13:03 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pQSH1-0002AZ-Jn
 for xen-changelog@lists.xenproject.org; Fri, 10 Feb 2023 12:13:03 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=86HQiFbR9AQ3Aq906Xk+KWWoQ/jeL/gbhTsMRTw/td8=; b=KXsmmeLzu6DIGc2J90zAfh9nuW
	QayYwNToT0KH5O1LqPIST93iSU5KYhjyZhuLSZWDkDgjVtJsmAh2nvPoO8YIk3WKyF4aZGcNc5j7F
	eSpHLTUO+1z72S4AbsMfTCapDCYeB/otOQLvcImTJerFP2HElHbB8QGG/779PoAW4gf4=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/riscv: add <asm/asm.h> header
Message-Id: <E1pQSH1-0002AZ-Jn@xenbits.xenproject.org>
Date: Fri, 10 Feb 2023 12:13:03 +0000

commit 2b385765565bd19cac85edb21ad71aed6ced6cf6
Author:     Oleksii Kurochko <oleksii.kurochko@gmail.com>
AuthorDate: Thu Feb 9 11:14:53 2023 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Feb 9 11:14:53 2023 +0100

    xen/riscv: add <asm/asm.h> header
    
    Signed-off-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
    Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
---
 xen/arch/riscv/include/asm/asm.h | 54 ++++++++++++++++++++++++++++++++++++++++
 1 file changed, 54 insertions(+)

diff --git a/xen/arch/riscv/include/asm/asm.h b/xen/arch/riscv/include/asm/asm.h
new file mode 100644
index 0000000000..6d426ecea7
--- /dev/null
+++ b/xen/arch/riscv/include/asm/asm.h
@@ -0,0 +1,54 @@
+/* SPDX-License-Identifier: (GPL-2.0-only) */
+/*
+ * Copyright (C) 2015 Regents of the University of California
+ */
+
+#ifndef _ASM_RISCV_ASM_H
+#define _ASM_RISCV_ASM_H
+
+#ifdef __ASSEMBLY__
+#define __ASM_STR(x)	x
+#else
+#define __ASM_STR(x)	#x
+#endif
+
+#if __riscv_xlen == 64
+#define __REG_SEL(a, b)	__ASM_STR(a)
+#elif __riscv_xlen == 32
+#define __REG_SEL(a, b)	__ASM_STR(b)
+#else
+#error "Unexpected __riscv_xlen"
+#endif
+
+#define REG_L		__REG_SEL(ld, lw)
+#define REG_S		__REG_SEL(sd, sw)
+
+#if __SIZEOF_POINTER__ == 8
+#ifdef __ASSEMBLY__
+#define RISCV_PTR		.dword
+#else
+#define RISCV_PTR		".dword"
+#endif
+#elif __SIZEOF_POINTER__ == 4
+#ifdef __ASSEMBLY__
+#define RISCV_PTR		.word
+#else
+#define RISCV_PTR		".word"
+#endif
+#else
+#error "Unexpected __SIZEOF_POINTER__"
+#endif
+
+#if (__SIZEOF_INT__ == 4)
+#define RISCV_INT		__ASM_STR(.word)
+#else
+#error "Unexpected __SIZEOF_INT__"
+#endif
+
+#if (__SIZEOF_SHORT__ == 2)
+#define RISCV_SHORT		__ASM_STR(.half)
+#else
+#error "Unexpected __SIZEOF_SHORT__"
+#endif
+
+#endif /* _ASM_RISCV_ASM_H */
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Feb 10 12:13:14 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 10 Feb 2023 12:13:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.493376.763313 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pQSHC-00078O-Tx; Fri, 10 Feb 2023 12:13:14 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 493376.763313; Fri, 10 Feb 2023 12:13:14 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pQSHC-00078E-Qv; Fri, 10 Feb 2023 12:13:14 +0000
Received: by outflank-mailman (input) for mailman id 493376;
 Fri, 10 Feb 2023 12:13:13 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pQSHB-00077g-O8
 for xen-changelog@lists.xenproject.org; Fri, 10 Feb 2023 12:13:13 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pQSHB-0004tl-NY
 for xen-changelog@lists.xenproject.org; Fri, 10 Feb 2023 12:13:13 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pQSHB-0002B3-Mn
 for xen-changelog@lists.xenproject.org; Fri, 10 Feb 2023 12:13:13 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=CylyCZ1yoJjqwWIZRf2/vB/zbMSK/svCyE2lrldJDm4=; b=ShtDKz59XTKgVcDaBm0nsw5KLc
	PSbJDZ5QLQIFB6vMj5iMU0obi/PUpg6vpE5Hf5irtpZwMmWDWTgQJRpfK24rps8f1KH2W8SW3/pdI
	VaRROg4H4hMn8/JGKtrZIwA3/gAcmCAVWDJF0OX/RWXrzEjaIaATzxRTA0r3XfBhskEs=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/riscv: add <asm/csr.h> header
Message-Id: <E1pQSHB-0002B3-Mn@xenbits.xenproject.org>
Date: Fri, 10 Feb 2023 12:13:13 +0000

commit bd960d612840f7204911e592734a87bcd3193166
Author:     Oleksii Kurochko <oleksii.kurochko@gmail.com>
AuthorDate: Thu Feb 9 11:15:08 2023 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Feb 9 11:15:08 2023 +0100

    xen/riscv: add <asm/csr.h> header
    
    The following changes were made in comparison with <asm/csr.h> from
    Linux:
      * remove all defines as they are defined in riscv_encoding.h
      * leave only csr_* macros
    
    Origin: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/ d2d11f342b17
    Signed-off-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
    Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
---
 xen/arch/riscv/include/asm/csr.h | 84 ++++++++++++++++++++++++++++++++++++++++
 1 file changed, 84 insertions(+)

diff --git a/xen/arch/riscv/include/asm/csr.h b/xen/arch/riscv/include/asm/csr.h
new file mode 100644
index 0000000000..8215562343
--- /dev/null
+++ b/xen/arch/riscv/include/asm/csr.h
@@ -0,0 +1,84 @@
+/*
+ * SPDX-License-Identifier: GPL-2.0-only
+ *
+ * Copyright (C) 2015 Regents of the University of California
+ */
+
+#ifndef _ASM_RISCV_CSR_H
+#define _ASM_RISCV_CSR_H
+
+#include <asm/asm.h>
+#include <xen/const.h>
+#include <asm/riscv_encoding.h>
+
+#ifndef __ASSEMBLY__
+
+#define csr_read(csr)                                           \
+({                                                              \
+    register unsigned long __v;                                 \
+    __asm__ __volatile__ ( "csrr %0, " __ASM_STR(csr)           \
+                           : "=r" (__v)                         \
+                           : : "memory" );                      \
+    __v;                                                        \
+})
+
+#define csr_write(csr, val)                                     \
+({                                                              \
+    unsigned long __v = (unsigned long)(val);                   \
+    __asm__ __volatile__ ( "csrw " __ASM_STR(csr) ", %0"        \
+                           : /* no outputs */                   \
+                           : "rK" (__v)                         \
+                           : "memory" );                        \
+})
+
+#define csr_swap(csr, val)                                      \
+({                                                              \
+    unsigned long __v = (unsigned long)(val);                   \
+    __asm__ __volatile__ ( "csrrw %0, " __ASM_STR(csr) ", %1"   \
+                           : "=r" (__v)                         \
+                           : "rK" (__v)                         \
+                           : "memory" );                        \
+    __v;                                                        \
+})
+
+#define csr_read_set(csr, val)                                  \
+({                                                              \
+    unsigned long __v = (unsigned long)(val);                   \
+    __asm__ __volatile__ ( "csrrs %0, " __ASM_STR(csr) ", %1"   \
+                           : "=r" (__v)                         \
+                           : "rK" (__v)                         \
+                           : "memory" );                        \
+    __v;                                                        \
+})
+
+#define csr_set(csr, val)                                       \
+({                                                              \
+    unsigned long __v = (unsigned long)(val);                   \
+    __asm__ __volatile__ ( "csrs " __ASM_STR(csr) ", %0"        \
+                           : /* no outputs */                   \
+                           : "rK" (__v)                         \
+                           : "memory" );                        \
+})
+
+#define csr_read_clear(csr, val)                                \
+({                                                              \
+    unsigned long __v = (unsigned long)(val);                   \
+    __asm__ __volatile__ ( "csrrc %0, " __ASM_STR(csr) ", %1"   \
+                           : "=r" (__v)                         \
+                           : "rK" (__v)                         \
+                           : "memory" );                        \
+    __v;                                                        \
+})
+
+#define csr_clear(csr, val)                                     \
+({                                                              \
+    unsigned long __v = (unsigned long)(val);                   \
+    __asm__ __volatile__ ( "csrc " __ASM_STR(csr) ", %0"        \
+                           : /* no outputs */                   \
+                           : "rK" (__v)                         \
+                           : "memory" );                        \
+})
+
+#endif /* __ASSEMBLY__ */
+
+#endif /* _ASM_RISCV_CSR_H */
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Feb 10 12:13:25 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 10 Feb 2023 12:13:25 +0000
Received: from list by lists.xenproject.org with outflank-mailman.493379.763318 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pQSHN-0007GS-1I; Fri, 10 Feb 2023 12:13:25 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 493379.763318; Fri, 10 Feb 2023 12:13:24 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pQSHM-0007GK-UM; Fri, 10 Feb 2023 12:13:24 +0000
Received: by outflank-mailman (input) for mailman id 493379;
 Fri, 10 Feb 2023 12:13:23 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pQSHL-0007Fn-Rq
 for xen-changelog@lists.xenproject.org; Fri, 10 Feb 2023 12:13:23 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pQSHL-0004tw-R8
 for xen-changelog@lists.xenproject.org; Fri, 10 Feb 2023 12:13:23 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pQSHL-0002Bw-Pf
 for xen-changelog@lists.xenproject.org; Fri, 10 Feb 2023 12:13:23 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=YE7jqlG3n5Mdd107IBxQHgMPe0LxR+ErqamPL5X+Mj4=; b=QprUrwl9Gf1JAqdgwgvWkC7cy2
	LGuzw8AjaGamYNfChe3ckNQ3BXd5MzC5znsuIRaSDvfid3V2dPy3DafbR9kt7TPLipD3YFQMS8BLg
	dl3JAm1Iqp5kn2PD+XiJYX9CLhOMqTKruYPEOh0SkeF7KV43Z0Dq8T1Fp8DQ9wd1ZPz4=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/riscv: introduce exception context
Message-Id: <E1pQSHL-0002Bw-Pf@xenbits.xenproject.org>
Date: Fri, 10 Feb 2023 12:13:23 +0000

commit 35f867133f07dda2bebbf89a95288c8b9fd27aa3
Author:     Oleksii Kurochko <oleksii.kurochko@gmail.com>
AuthorDate: Thu Feb 9 11:15:18 2023 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Feb 9 11:15:18 2023 +0100

    xen/riscv: introduce exception context
    
    The patch introduces a set of registers which should be saved to and
    restored from a stack after an exception occurs and a set of defines
    which will be used during exception context saving/restoring.
    
    Originally <asm/processor.h> header was introduced in the patch series
    from Bobby so partially it was
    re-used and the following changes were done:
      - Move all RISCV_CPU_USER_REGS_* to asm/asm-offsets.c
      - Remove RISCV_CPU_USER_REGS_OFFSET & RISCV_CPU_USER_REGS_SIZE as
        there is no sense in them after RISCV_CPU_USER_REGS_* were moved to
        asm/asm-offsets.c
      - Remove RISCV_PCPUINFO_* as they aren't needed for current status of
        the RISC-V port
      - register_t renamed to unsigned long
      - rename wait_for_interrupt to wfi
    
    Signed-off-by: Bobby Eshleman <bobby.eshleman@gmail.com>
    Signed-off-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
    Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
---
 xen/arch/riscv/include/asm/processor.h | 83 ++++++++++++++++++++++++++++++++++
 xen/arch/riscv/riscv64/asm-offsets.c   | 53 ++++++++++++++++++++++
 2 files changed, 136 insertions(+)

diff --git a/xen/arch/riscv/include/asm/processor.h b/xen/arch/riscv/include/asm/processor.h
new file mode 100644
index 0000000000..a71448e02e
--- /dev/null
+++ b/xen/arch/riscv/include/asm/processor.h
@@ -0,0 +1,83 @@
+/* SPDX-License-Identifier: MIT */
+/******************************************************************************
+ *
+ * Copyright 2019 (C) Alistair Francis <alistair.francis@wdc.com>
+ * Copyright 2021 (C) Bobby Eshleman <bobby.eshleman@gmail.com>
+ * Copyright 2023 (C) Vates
+ *
+ */
+
+#ifndef _ASM_RISCV_PROCESSOR_H
+#define _ASM_RISCV_PROCESSOR_H
+
+#ifndef __ASSEMBLY__
+
+/* On stack VCPU state */
+struct cpu_user_regs
+{
+    unsigned long zero;
+    unsigned long ra;
+    unsigned long sp;
+    unsigned long gp;
+    unsigned long tp;
+    unsigned long t0;
+    unsigned long t1;
+    unsigned long t2;
+    unsigned long s0;
+    unsigned long s1;
+    unsigned long a0;
+    unsigned long a1;
+    unsigned long a2;
+    unsigned long a3;
+    unsigned long a4;
+    unsigned long a5;
+    unsigned long a6;
+    unsigned long a7;
+    unsigned long s2;
+    unsigned long s3;
+    unsigned long s4;
+    unsigned long s5;
+    unsigned long s6;
+    unsigned long s7;
+    unsigned long s8;
+    unsigned long s9;
+    unsigned long s10;
+    unsigned long s11;
+    unsigned long t3;
+    unsigned long t4;
+    unsigned long t5;
+    unsigned long t6;
+    unsigned long sepc;
+    unsigned long sstatus;
+    /* pointer to previous stack_cpu_regs */
+    unsigned long pregs;
+};
+
+static inline void wfi(void)
+{
+    __asm__ __volatile__ ("wfi");
+}
+
+/*
+ * panic() isn't available at the moment so an infinite loop will be
+ * used temporarily.
+ * TODO: change it to panic()
+ */
+static inline void die(void)
+{
+    for ( ;; )
+        wfi();
+}
+
+#endif /* __ASSEMBLY__ */
+
+#endif /* _ASM_RISCV_PROCESSOR_H */
+
+/*
+ * Local variables:
+ * mode: C
+ * c-file-style: "BSD"
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
diff --git a/xen/arch/riscv/riscv64/asm-offsets.c b/xen/arch/riscv/riscv64/asm-offsets.c
index e69de29bb2..d632b75c2a 100644
--- a/xen/arch/riscv/riscv64/asm-offsets.c
+++ b/xen/arch/riscv/riscv64/asm-offsets.c
@@ -0,0 +1,53 @@
+#define COMPILE_OFFSETS
+
+#include <asm/processor.h>
+#include <xen/types.h>
+
+#define DEFINE(_sym, _val)                                                 \
+    asm volatile ("\n.ascii\"==>#define " #_sym " %0 /* " #_val " */<==\"" \
+                  : : "i" (_val) )
+#define BLANK()                                                            \
+    asm volatile ( "\n.ascii\"==><==\"" : : )
+#define OFFSET(_sym, _str, _mem)                                           \
+    DEFINE(_sym, offsetof(_str, _mem));
+
+void asm_offsets(void)
+{
+    BLANK();
+    DEFINE(CPU_USER_REGS_SIZE, sizeof(struct cpu_user_regs));
+    OFFSET(CPU_USER_REGS_ZERO, struct cpu_user_regs, zero);
+    OFFSET(CPU_USER_REGS_RA, struct cpu_user_regs, ra);
+    OFFSET(CPU_USER_REGS_SP, struct cpu_user_regs, sp);
+    OFFSET(CPU_USER_REGS_GP, struct cpu_user_regs, gp);
+    OFFSET(CPU_USER_REGS_TP, struct cpu_user_regs, tp);
+    OFFSET(CPU_USER_REGS_T0, struct cpu_user_regs, t0);
+    OFFSET(CPU_USER_REGS_T1, struct cpu_user_regs, t1);
+    OFFSET(CPU_USER_REGS_T2, struct cpu_user_regs, t2);
+    OFFSET(CPU_USER_REGS_S0, struct cpu_user_regs, s0);
+    OFFSET(CPU_USER_REGS_S1, struct cpu_user_regs, s1);
+    OFFSET(CPU_USER_REGS_A0, struct cpu_user_regs, a0);
+    OFFSET(CPU_USER_REGS_A1, struct cpu_user_regs, a1);
+    OFFSET(CPU_USER_REGS_A2, struct cpu_user_regs, a2);
+    OFFSET(CPU_USER_REGS_A3, struct cpu_user_regs, a3);
+    OFFSET(CPU_USER_REGS_A4, struct cpu_user_regs, a4);
+    OFFSET(CPU_USER_REGS_A5, struct cpu_user_regs, a5);
+    OFFSET(CPU_USER_REGS_A6, struct cpu_user_regs, a6);
+    OFFSET(CPU_USER_REGS_A7, struct cpu_user_regs, a7);
+    OFFSET(CPU_USER_REGS_S2, struct cpu_user_regs, s2);
+    OFFSET(CPU_USER_REGS_S3, struct cpu_user_regs, s3);
+    OFFSET(CPU_USER_REGS_S4, struct cpu_user_regs, s4);
+    OFFSET(CPU_USER_REGS_S5, struct cpu_user_regs, s5);
+    OFFSET(CPU_USER_REGS_S6, struct cpu_user_regs, s6);
+    OFFSET(CPU_USER_REGS_S7, struct cpu_user_regs, s7);
+    OFFSET(CPU_USER_REGS_S8, struct cpu_user_regs, s8);
+    OFFSET(CPU_USER_REGS_S9, struct cpu_user_regs, s9);
+    OFFSET(CPU_USER_REGS_S10, struct cpu_user_regs, s10);
+    OFFSET(CPU_USER_REGS_S11, struct cpu_user_regs, s11);
+    OFFSET(CPU_USER_REGS_T3, struct cpu_user_regs, t3);
+    OFFSET(CPU_USER_REGS_T4, struct cpu_user_regs, t4);
+    OFFSET(CPU_USER_REGS_T5, struct cpu_user_regs, t5);
+    OFFSET(CPU_USER_REGS_T6, struct cpu_user_regs, t6);
+    OFFSET(CPU_USER_REGS_SEPC, struct cpu_user_regs, sepc);
+    OFFSET(CPU_USER_REGS_SSTATUS, struct cpu_user_regs, sstatus);
+    OFFSET(CPU_USER_REGS_PREGS, struct cpu_user_regs, pregs);
+}
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Feb 10 12:13:35 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 10 Feb 2023 12:13:35 +0000
Received: from list by lists.xenproject.org with outflank-mailman.493381.763323 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pQSHX-0007QJ-2m; Fri, 10 Feb 2023 12:13:35 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 493381.763323; Fri, 10 Feb 2023 12:13:35 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pQSHW-0007Q7-Vt; Fri, 10 Feb 2023 12:13:34 +0000
Received: by outflank-mailman (input) for mailman id 493381;
 Fri, 10 Feb 2023 12:13:33 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pQSHV-0007Pj-Ud
 for xen-changelog@lists.xenproject.org; Fri, 10 Feb 2023 12:13:33 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pQSHV-0004u0-U1
 for xen-changelog@lists.xenproject.org; Fri, 10 Feb 2023 12:13:33 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pQSHV-0002CU-TH
 for xen-changelog@lists.xenproject.org; Fri, 10 Feb 2023 12:13:33 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=3CWj0t7E/Wuns+H9YAX6Je8n8ALJN8l4t/ix6HnnEmE=; b=ZGCwP42YrOCjSw4sN3g5NLKeXn
	+iW9tNu0jnHfiTpS028qDzWaSHXrMRbN9SZWTL8hqyCgvDerqJpjFupluyN4z209yuja+f9QY+1+l
	wOHHvBCutUJfNLGOGPtar4wtyAjrrzbN2JaGGOaLpEwLfry+5La68Dr5dorSBe6gLa00=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] ns16550: remove unneeded truncation check in the DT init code
Message-Id: <E1pQSHV-0002CU-TH@xenbits.xenproject.org>
Date: Fri, 10 Feb 2023 12:13:33 +0000

commit e1528c54d3c44e50f0460f1ff721a876c81479b9
Author:     Ayan Kumar Halder <ayan.kumar.halder@amd.com>
AuthorDate: Thu Feb 9 11:15:50 2023 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Feb 9 11:15:50 2023 +0100

    ns16550: remove unneeded truncation check in the DT init code
    
    In an earlier commit (7c1de0038895), "ns16550.io_size" was u32 and
    "io_size" was u64. Thus, the ASSERT() was needed to check if the values
    are the same.
    However, in a later commit (c9f8e0aee507), "ns16550.io_size" was changed
    to u64. Thus, the ASSERT() became redundant.
    
    So, now as "io_size" and "uart->io_size" are both u64, there will be no
    truncation. Thus, one can remove the ASSERT() and extra assignment.
    
    Signed-off-by: Ayan Kumar Halder <ayan.kumar.halder@amd.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/drivers/char/ns16550.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/xen/drivers/char/ns16550.c b/xen/drivers/char/ns16550.c
index 4ce74b3cd3..092f6b9c4b 100644
--- a/xen/drivers/char/ns16550.c
+++ b/xen/drivers/char/ns16550.c
@@ -1747,7 +1747,6 @@ static int __init ns16550_uart_dt_init(struct dt_device_node *dev,
     struct ns16550 *uart;
     int res;
     u32 reg_shift, reg_width;
-    u64 io_size;
 
     uart = &ns16550_com[0];
 
@@ -1758,14 +1757,10 @@ static int __init ns16550_uart_dt_init(struct dt_device_node *dev,
     uart->parity    = UART_PARITY_NONE;
     uart->stop_bits = 1;
 
-    res = dt_device_get_address(dev, 0, &uart->io_base, &io_size);
+    res = dt_device_get_address(dev, 0, &uart->io_base, &uart->io_size);
     if ( res )
         return res;
 
-    uart->io_size = io_size;
-
-    ASSERT(uart->io_size == io_size); /* Detect truncation */
-
     res = dt_property_read_u32(dev, "reg-shift", &reg_shift);
     if ( !res )
         uart->reg_shift = 0;
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Feb 10 12:13:45 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 10 Feb 2023 12:13:45 +0000
Received: from list by lists.xenproject.org with outflank-mailman.493384.763327 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pQSHh-0007X5-4X; Fri, 10 Feb 2023 12:13:45 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 493384.763327; Fri, 10 Feb 2023 12:13:45 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pQSHh-0007Ww-1D; Fri, 10 Feb 2023 12:13:45 +0000
Received: by outflank-mailman (input) for mailman id 493384;
 Fri, 10 Feb 2023 12:13:44 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pQSHg-0007Wd-1N
 for xen-changelog@lists.xenproject.org; Fri, 10 Feb 2023 12:13:44 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pQSHg-0004uI-0l
 for xen-changelog@lists.xenproject.org; Fri, 10 Feb 2023 12:13:44 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pQSHf-0002D5-WA
 for xen-changelog@lists.xenproject.org; Fri, 10 Feb 2023 12:13:43 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=2xXAdf3Rp/zpSRpbyP6zfKNidEE+WSV/huKFlv3aTsg=; b=KDWLddqQb2evFFqlpK3m3lCYvU
	8m9gk+YQsocRcEw/dEIqNXVcF/ousjl3fxD1G+7pwcavPxmRWmoex6TWrAepPd7j24tX7uKJsPwpi
	9lbq1ouzPR/R725kQ4Lq+DyQ3Voer7dpKDKTTpFC6seO8mqgnqtF2VU3G6d+e4db4c2E=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools/helpers: don't log errors when trying to load PVH xenstore-stubdom
Message-Id: <E1pQSHf-0002D5-WA@xenbits.xenproject.org>
Date: Fri, 10 Feb 2023 12:13:43 +0000

commit 26f99e055dfecb8c52bb094bbb5aacb53148ae09
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Fri Jan 27 17:17:39 2023 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Feb 9 11:33:20 2023 +0000

    tools/helpers: don't log errors when trying to load PVH xenstore-stubdom
    
    When loading a Xenstore stubdom the loader doesn't know whether the
    lo be loaded kernel is a PVH or a PV one. So it tries to load it as
    a PVH one first, and if this fails it is loading it as a PV kernel.
    
    This results in errors being logged in case the stubdom is a PV kernel.
    
    Suppress those errors by setting the minimum logging level to
    "critical" while trying to load the kernel as PVH.
    
    In case PVH mode and PV mode loading fails, retry PVH mode loading
    without changing the log level in order to get the error messages
    logged.
    
    Fixes: f89955449c5a ("tools/init-xenstore-domain: support xenstore pvh stubdom")
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 tools/helpers/init-xenstore-domain.c | 28 ++++++++++++++++++++--------
 1 file changed, 20 insertions(+), 8 deletions(-)

diff --git a/tools/helpers/init-xenstore-domain.c b/tools/helpers/init-xenstore-domain.c
index 04e351ca29..85cc9e8381 100644
--- a/tools/helpers/init-xenstore-domain.c
+++ b/tools/helpers/init-xenstore-domain.c
@@ -31,6 +31,8 @@ static int memory;
 static int maxmem;
 static xen_pfn_t console_gfn;
 static xc_evtchn_port_or_error_t console_evtchn;
+static xentoollog_level minmsglevel = XTL_PROGRESS;
+static void *logger;
 
 static struct option options[] = {
     { "kernel", 1, NULL, 'k' },
@@ -141,19 +143,33 @@ static int build(xc_interface *xch)
         goto err;
     }
 
+    /*
+     * This is a bodge.  We can't currently inspect the kernel's ELF notes
+     * ahead of attempting to construct a domain, so try PVH first, suppressing
+     * errors by setting min level to high, and fall back to PV.
+     */
     dom->container_type = XC_DOM_HVM_CONTAINER;
+    xtl_stdiostream_set_minlevel(logger, XTL_CRITICAL);
     rv = xc_dom_parse_image(dom);
+    xtl_stdiostream_set_minlevel(logger, minmsglevel);
     if ( rv )
     {
         dom->container_type = XC_DOM_PV_CONTAINER;
         rv = xc_dom_parse_image(dom);
         if ( rv )
         {
-            fprintf(stderr, "xc_dom_parse_image failed\n");
-            goto err;
+            /* Retry PVH, now with normal logging level. */
+            dom->container_type = XC_DOM_HVM_CONTAINER;
+            rv = xc_dom_parse_image(dom);
+            if ( rv )
+            {
+                fprintf(stderr, "xc_dom_parse_image failed\n");
+                goto err;
+            }
         }
     }
-    else
+
+    if ( dom->container_type == XC_DOM_HVM_CONTAINER )
     {
         config.flags |= XEN_DOMCTL_CDF_hvm | XEN_DOMCTL_CDF_hap;
         config.arch.emulation_flags = XEN_X86_EMU_LAPIC;
@@ -412,8 +428,6 @@ int main(int argc, char** argv)
     char buf[16], be_path[64], fe_path[64];
     int rv, fd;
     char *maxmem_str = NULL;
-    xentoollog_level minmsglevel = XTL_PROGRESS;
-    xentoollog_logger *logger = NULL;
 
     while ( (opt = getopt_long(argc, argv, "v", options, NULL)) != -1 )
     {
@@ -456,9 +470,7 @@ int main(int argc, char** argv)
         return 2;
     }
 
-    logger = (xentoollog_logger *)xtl_createlogger_stdiostream(stderr,
-                                                               minmsglevel, 0);
-
+    logger = xtl_createlogger_stdiostream(stderr, minmsglevel, 0);
     xch = xc_interface_open(logger, logger, 0);
     if ( !xch )
     {
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Feb 10 12:13:55 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 10 Feb 2023 12:13:55 +0000
Received: from list by lists.xenproject.org with outflank-mailman.493385.763330 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pQSHr-0007ab-5m; Fri, 10 Feb 2023 12:13:55 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 493385.763330; Fri, 10 Feb 2023 12:13:55 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pQSHr-0007aQ-2j; Fri, 10 Feb 2023 12:13:55 +0000
Received: by outflank-mailman (input) for mailman id 493385;
 Fri, 10 Feb 2023 12:13:54 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pQSHq-0007a8-4J
 for xen-changelog@lists.xenproject.org; Fri, 10 Feb 2023 12:13:54 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pQSHq-0004uT-3g
 for xen-changelog@lists.xenproject.org; Fri, 10 Feb 2023 12:13:54 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pQSHq-0002DY-2q
 for xen-changelog@lists.xenproject.org; Fri, 10 Feb 2023 12:13:54 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=XL96WNCNGiFZItRC1JmBsgcv9DGIxp4SO5yfVjDzrXM=; b=zPIXhaH9tFNVF7/ucs5CGWKs2m
	9h41U2cEJTYgRPJE8Ho75MdU91djJw1OlKTcuHcECczQ6ppYfGWp6NJ52LPv+nH4UqXMPjZ2/qyDB
	YKIPbGNqRjr0EXXUyFyys+eBxSnHz9NJRUHBzZFw41vMadXKpFkrkyjEGHz6e9RQ6hZE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/paging: return -EINVAL for paging domctls for dying domains
Message-Id: <E1pQSHq-0002DY-2q@xenbits.xenproject.org>
Date: Fri, 10 Feb 2023 12:13:54 +0000

commit 4e0b4ccfc504f26187939068796295340ffd0e2f
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Tue Nov 8 12:38:50 2022 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Feb 9 12:04:11 2023 +0000

    x86/paging: return -EINVAL for paging domctls for dying domains
    
    The current logic returns 0 and leaves the domctl parameter uninitialized for
    any parameter fetching operations (like the GET_ALLOCATION operation), which
    is not helpful from a toolstack point of view, because there's no indication
    that the data hasn't been fetched.
    
    For at least the Ocaml stubs, this ends up passing back stack rubble as if it
    were a correct result.
    
    Inform the caller properly that it hasn't got any data.
    
    Reported-by: Edwin Török <edvin.torok@citrix.com>
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/mm/paging.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/xen/arch/x86/mm/paging.c b/xen/arch/x86/mm/paging.c
index 1c5f54f92a..2991585117 100644
--- a/xen/arch/x86/mm/paging.c
+++ b/xen/arch/x86/mm/paging.c
@@ -695,9 +695,8 @@ int paging_domctl(struct domain *d, struct xen_domctl_shadow_op *sc,
 
     if ( unlikely(d->is_dying) )
     {
-        gdprintk(XENLOG_INFO, "Ignoring paging op on dying domain %u\n",
-                 d->domain_id);
-        return 0;
+        gdprintk(XENLOG_INFO, "Tried to do a paging op on dying %pd\n", d);
+        return -EINVAL;
     }
 
     if ( unlikely(d->vcpu == NULL) || unlikely(d->vcpu[0] == NULL) )
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Feb 10 18:22:09 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 10 Feb 2023 18:22:09 +0000
Received: from list by lists.xenproject.org with outflank-mailman.493505.763433 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pQY27-0006Zx-57; Fri, 10 Feb 2023 18:22:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 493505.763433; Fri, 10 Feb 2023 18: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 1pQY27-0006Zp-21; Fri, 10 Feb 2023 18:22:03 +0000
Received: by outflank-mailman (input) for mailman id 493505;
 Fri, 10 Feb 2023 18: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 1pQY25-0006Zj-Pa
 for xen-changelog@lists.xenproject.org; Fri, 10 Feb 2023 18:22:01 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pQY25-000688-Oh
 for xen-changelog@lists.xenproject.org; Fri, 10 Feb 2023 18:22:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pQY25-0007Dg-Nq
 for xen-changelog@lists.xenproject.org; Fri, 10 Feb 2023 18:22:01 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=8zGdAXwesPqxuXNDZ8jOsCVb+xteu6gapTt3X9fozlM=; b=edm03AS+Jtdbcsl0WppebxlFxQ
	r5UohZK8TISWH49aY0zJLL1ONUCFtqSStlGzr9Qw6chvM1NDg+UqgEFPK37ERtn7+A8K6rxl3qYxJ
	50fen5TjeOBWmpNiUQ9ydXUuEPybGH/T1J87kI+797NUaL+it5rJwm6GZT+2v/9QjffU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.16] tools/ocaml/xenctrl: Make domain_getinfolist tail recursive
Message-Id: <E1pQY25-0007Dg-Nq@xenbits.xenproject.org>
Date: Fri, 10 Feb 2023 18:22:01 +0000

commit c6a3d14df051bae0323af539e34cf5a65fba1112
Author:     Edwin Török <edvin.torok@citrix.com>
AuthorDate: Tue Nov 1 17:59:16 2022 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Feb 9 15:58:51 2023 +0000

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

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


From xen-changelog-bounces@lists.xenproject.org Fri Feb 10 18:22:13 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 10 Feb 2023 18:22:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.493506.763437 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pQY2H-0006bg-6M; Fri, 10 Feb 2023 18:22:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 493506.763437; Fri, 10 Feb 2023 18: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 1pQY2H-0006bZ-3Z; Fri, 10 Feb 2023 18:22:13 +0000
Received: by outflank-mailman (input) for mailman id 493506;
 Fri, 10 Feb 2023 18:22: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 1pQY2F-0006bN-Tr
 for xen-changelog@lists.xenproject.org; Fri, 10 Feb 2023 18:22:11 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pQY2F-00068N-T1
 for xen-changelog@lists.xenproject.org; Fri, 10 Feb 2023 18:22:11 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pQY2F-0007E5-Qz
 for xen-changelog@lists.xenproject.org; Fri, 10 Feb 2023 18: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=lQsPr5Ggl4BhhPLh1DUvqY/+hw11eYtbkLMQ/3BELiA=; b=rpoovtmaQWJvediqbzfG5cJm0Z
	Q4Nx30fj6MVkP7xCqjF3yjAe/DIpEb5cMkfKiERfuOTFccNBNOhX7bCFkULxvsZ36qpPPPd5xfxIV
	XJZ/CcjwAazHrrySBYPFg2RZLN1DpsHT7hR91UOiqVjxraCQExxK7K630hDzzA2M8eNc=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.16] tools/ocaml/xenctrl: Use larger chunksize in domain_getinfolist
Message-Id: <E1pQY2F-0007E5-Qz@xenbits.xenproject.org>
Date: Fri, 10 Feb 2023 18:22:11 +0000

commit 8c66a2d88a9f17e5b5099fcb83231b7a1169ca25
Author:     Edwin Török <edvin.torok@citrix.com>
AuthorDate: Tue Nov 1 17:59:17 2022 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Feb 9 15:58:51 2023 +0000

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

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


From xen-changelog-bounces@lists.xenproject.org Fri Feb 10 18:22:23 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 10 Feb 2023 18:22:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.493507.763441 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pQY2R-0006fA-96; Fri, 10 Feb 2023 18:22:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 493507.763441; Fri, 10 Feb 2023 18: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 1pQY2R-0006f3-6J; Fri, 10 Feb 2023 18:22:23 +0000
Received: by outflank-mailman (input) for mailman id 493507;
 Fri, 10 Feb 2023 18: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 1pQY2Q-0006eq-1G
 for xen-changelog@lists.xenproject.org; Fri, 10 Feb 2023 18:22:22 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pQY2Q-00068z-0U
 for xen-changelog@lists.xenproject.org; Fri, 10 Feb 2023 18:22:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pQY2P-0007EX-V8
 for xen-changelog@lists.xenproject.org; Fri, 10 Feb 2023 18:22:21 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=TOCJTstuVEsMsExsEAmAckVY0byR+Y0AlSvOQ2MTZFE=; b=o3joSgRn7QfV5NGNGuYRugJEKC
	P42y1drRB9jWh1N5FgQ6SvieW27MKfnyxpnuMX4Prh+QY/S4tNlsu8BeUsgOKY5ZqxaWlQLYLHGS8
	/elznxSkxyGeJskikwQrcUfZT/2JWK7vkC0Rp2VDJNyPgyDakY/7Fz579gkjQfuWZB44=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.16] tools/ocaml/xb,mmap: Use Data_abstract_val wrapper
Message-Id: <E1pQY2P-0007EX-V8@xenbits.xenproject.org>
Date: Fri, 10 Feb 2023 18:22:21 +0000

commit 049d16c8ce900dfc8f4b657849aeb82b95ed857c
Author:     Edwin Török <edvin.torok@citrix.com>
AuthorDate: Fri Dec 16 18:25:10 2022 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Feb 9 15:58:51 2023 +0000

    tools/ocaml/xb,mmap: Use Data_abstract_val wrapper
    
    This is not strictly necessary since it is essentially a no-op currently: a
    cast to void * and value *, even in OCaml 5.0.
    
    However it does make it clearer that what we have here is not a regular OCaml
    value, but one allocated with Abstract_tag or Custom_tag, and follows the
    example from the manual more closely:
    https://v2.ocaml.org/manual/intfc.html#ss:c-outside-head
    
    It also makes it clearer that these modules have been reviewed for
    compat with OCaml 5.0.
    
    We cannot use OCaml finalizers here, because we want exact control over when
    to unmap these pages from remote domains.
    
    No functional change.
    
    Signed-off-by: Edwin Török <edvin.torok@citrix.com>
    Acked-by: Christian Lindig <christian.lindig@citrix.com>
    (cherry picked from commit d2ccc637111d6dbcf808aaffeec7a46f0b1e1c81)
---
 tools/ocaml/libs/mmap/mmap_stubs.h    | 4 ++++
 tools/ocaml/libs/mmap/xenmmap_stubs.c | 2 +-
 tools/ocaml/libs/xb/xs_ring_stubs.c   | 2 +-
 3 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/tools/ocaml/libs/mmap/mmap_stubs.h b/tools/ocaml/libs/mmap/mmap_stubs.h
index 65e4239890..f4784e4715 100644
--- a/tools/ocaml/libs/mmap/mmap_stubs.h
+++ b/tools/ocaml/libs/mmap/mmap_stubs.h
@@ -30,4 +30,8 @@ struct mmap_interface
 	int len;
 };
 
+#ifndef Data_abstract_val
+#define Data_abstract_val(x) ((void *)Op_val(x))
+#endif
+
 #endif
diff --git a/tools/ocaml/libs/mmap/xenmmap_stubs.c b/tools/ocaml/libs/mmap/xenmmap_stubs.c
index e2ce088e25..e03951d781 100644
--- a/tools/ocaml/libs/mmap/xenmmap_stubs.c
+++ b/tools/ocaml/libs/mmap/xenmmap_stubs.c
@@ -28,7 +28,7 @@
 #include <caml/fail.h>
 #include <caml/callback.h>
 
-#define Intf_val(a) ((struct mmap_interface *) a)
+#define Intf_val(a) ((struct mmap_interface *)Data_abstract_val(a))
 
 static int mmap_interface_init(struct mmap_interface *intf,
                                int fd, int pflag, int mflag,
diff --git a/tools/ocaml/libs/xb/xs_ring_stubs.c b/tools/ocaml/libs/xb/xs_ring_stubs.c
index 7a91fdee75..1f58524535 100644
--- a/tools/ocaml/libs/xb/xs_ring_stubs.c
+++ b/tools/ocaml/libs/xb/xs_ring_stubs.c
@@ -35,7 +35,7 @@
 #include <sys/mman.h>
 #include "mmap_stubs.h"
 
-#define GET_C_STRUCT(a) ((struct mmap_interface *) a)
+#define GET_C_STRUCT(a) ((struct mmap_interface *)Data_abstract_val(a))
 
 /*
  * Bytes_val has been introduced by Ocaml 4.06.1. So define our own version
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.16


From xen-changelog-bounces@lists.xenproject.org Fri Feb 10 18:22:33 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 10 Feb 2023 18:22:33 +0000
Received: from list by lists.xenproject.org with outflank-mailman.493508.763445 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pQY2b-0006iP-AX; Fri, 10 Feb 2023 18:22:33 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 493508.763445; Fri, 10 Feb 2023 18: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 1pQY2b-0006iH-7z; Fri, 10 Feb 2023 18:22:33 +0000
Received: by outflank-mailman (input) for mailman id 493508;
 Fri, 10 Feb 2023 18: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 1pQY2a-0006hm-47
 for xen-changelog@lists.xenproject.org; Fri, 10 Feb 2023 18:22:32 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pQY2a-00069E-3O
 for xen-changelog@lists.xenproject.org; Fri, 10 Feb 2023 18:22:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pQY2a-0007F6-2c
 for xen-changelog@lists.xenproject.org; Fri, 10 Feb 2023 18:22:32 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=kE9lfSox6Zd/iobAHAFRVYG+YyDaFijundY0dvCbASU=; b=Vpy81FGfP7BzqX8rIuN48vHEHz
	ei8t2//CDaSS/OLYoeXp7GVIj7Yz3/RujNMnXqJQXcKeyOxsDN9rtlur8wUHG3f5SCowEBPOmfOaO
	K6mKCxtUL7lLYQyYRj6uYzepoB3mX7HR+txKyV/lzPUvUXjinNnyoRjMbJQq/6j1WxRQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.16] tools/ocaml/xb: Drop Xs_ring.write
Message-Id: <E1pQY2a-0007F6-2c@xenbits.xenproject.org>
Date: Fri, 10 Feb 2023 18:22:32 +0000

commit f7c4fab9b50af74d0e1170fbf35367ced48d8209
Author:     Edwin Török <edvin.torok@citrix.com>
AuthorDate: Fri Dec 16 18:25:20 2022 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Feb 9 15:58:51 2023 +0000

    tools/ocaml/xb: Drop Xs_ring.write
    
    This function is unusued (only Xs_ring.write_substring is used), and the
    bytes/string conversion here is backwards: the C stub implements the bytes
    version and then we use a Bytes.unsafe_of_string to convert a string into
    bytes.
    
    However the operation here really is read-only: we read from the string and
    write it to the ring, so the C stub should implement the read-only string
    version, and if needed we could use Bytes.unsafe_to_string to be able to send
    'bytes'. However that is not necessary as the 'bytes' version is dropped above.
    
    Signed-off-by: Edwin Török <edvin.torok@citrix.com>
    Acked-by: Christian Lindig <christian.lindig@citrix.com>
    (cherry picked from commit 01f139215e678c2dc7d4bb3f9f2777069bb1b091)
---
 tools/ocaml/libs/xb/xs_ring.ml      | 5 +----
 tools/ocaml/libs/xb/xs_ring_stubs.c | 2 +-
 2 files changed, 2 insertions(+), 5 deletions(-)

diff --git a/tools/ocaml/libs/xb/xs_ring.ml b/tools/ocaml/libs/xb/xs_ring.ml
index db7f86bd27..dd5e014a33 100644
--- a/tools/ocaml/libs/xb/xs_ring.ml
+++ b/tools/ocaml/libs/xb/xs_ring.ml
@@ -25,14 +25,11 @@ module Server_features = Set.Make(struct
 end)
 
 external read: Xenmmap.mmap_interface -> bytes -> int -> int = "ml_interface_read"
-external write: Xenmmap.mmap_interface -> bytes -> int -> int = "ml_interface_write"
+external write_substring: Xenmmap.mmap_interface -> string -> int -> int = "ml_interface_write"
 
 external _internal_set_server_features: Xenmmap.mmap_interface -> int -> unit = "ml_interface_set_server_features" [@@noalloc]
 external _internal_get_server_features: Xenmmap.mmap_interface -> int = "ml_interface_get_server_features" [@@noalloc]
 
-let write_substring mmap buff len =
-	write mmap (Bytes.unsafe_of_string buff) len
-
 let get_server_features mmap =
 	(* NB only one feature currently defined above *)
 	let x = _internal_get_server_features mmap in
diff --git a/tools/ocaml/libs/xb/xs_ring_stubs.c b/tools/ocaml/libs/xb/xs_ring_stubs.c
index 1f58524535..1243c63f03 100644
--- a/tools/ocaml/libs/xb/xs_ring_stubs.c
+++ b/tools/ocaml/libs/xb/xs_ring_stubs.c
@@ -112,7 +112,7 @@ CAMLprim value ml_interface_write(value ml_interface,
 	CAMLlocal1(ml_result);
 
 	struct mmap_interface *interface = GET_C_STRUCT(ml_interface);
-	const unsigned char *buffer = Bytes_val(ml_buffer);
+	const char *buffer = String_val(ml_buffer);
 	int len = Int_val(ml_len);
 	int result;
 
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.16


From xen-changelog-bounces@lists.xenproject.org Fri Feb 10 18:22:43 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 10 Feb 2023 18:22:43 +0000
Received: from list by lists.xenproject.org with outflank-mailman.493509.763449 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pQY2l-0006l8-Cd; Fri, 10 Feb 2023 18:22:43 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 493509.763449; Fri, 10 Feb 2023 18: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 1pQY2l-0006kz-9W; Fri, 10 Feb 2023 18:22:43 +0000
Received: by outflank-mailman (input) for mailman id 493509;
 Fri, 10 Feb 2023 18:22:42 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pQY2k-0006ko-7L
 for xen-changelog@lists.xenproject.org; Fri, 10 Feb 2023 18:22:42 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pQY2k-00069T-6b
 for xen-changelog@lists.xenproject.org; Fri, 10 Feb 2023 18:22:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pQY2k-0007Fc-5i
 for xen-changelog@lists.xenproject.org; Fri, 10 Feb 2023 18:22:42 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=nw5jMfJm3Xa/C4JkUK6xhRP2YnmqdX7/FU3KzE/3bXs=; b=5HhKLBkgLarD19EkzJSISkW55k
	s/aDozJHDORoeEfvgh+njA8xQwjy9iNqjdpK5S+uRmiO1wqmOSy1VwrgR5ogUvYZ/abiQ88HKlYTn
	jdM49wL25jgsKW7CK3Nox9IVtQlpLHu3tzaYM9pMCqR1oZO3MviuKS3U/E4QaxOGkVp0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.16] tools/oxenstored: validate config file before live update
Message-Id: <E1pQY2k-0007Fc-5i@xenbits.xenproject.org>
Date: Fri, 10 Feb 2023 18:22:42 +0000

commit fd1c70442d3aa962be4d041d5f8fce9d2fa72ce1
Author:     Edwin Török <edvin.torok@citrix.com>
AuthorDate: Tue May 11 15:56:50 2021 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Feb 9 15:58:51 2023 +0000

    tools/oxenstored: validate config file before live update
    
    The configuration file can contain typos or various errors that could prevent
    live update from succeeding (e.g. a flag only valid on a different version).
    Unknown entries in the config file would be ignored on startup normally,
    add a strict --config-test that live-update can use to check that the config file
    is valid *for the new binary*.
    
    For compatibility with running old code during live update recognize
    --live --help as an equivalent to --config-test.
    
    Signed-off-by: Edwin Török <edvin.torok@citrix.com>
    Acked-by: Christian Lindig <christian.lindig@citrix.com>
    (cherry picked from commit e6f07052ce4a0f0b7d4dc522d87465efb2d9ee86)
---
 tools/ocaml/xenstored/parse_arg.ml | 26 ++++++++++++++++++++++++++
 tools/ocaml/xenstored/xenstored.ml | 11 +++++++++--
 2 files changed, 35 insertions(+), 2 deletions(-)

diff --git a/tools/ocaml/xenstored/parse_arg.ml b/tools/ocaml/xenstored/parse_arg.ml
index 7c0478e76a..5e4ca6f1f7 100644
--- a/tools/ocaml/xenstored/parse_arg.ml
+++ b/tools/ocaml/xenstored/parse_arg.ml
@@ -26,8 +26,14 @@ type config =
 	restart: bool;
 	live_reload: bool;
 	disable_socket: bool;
+	config_test: bool;
 }
 
+let get_config_filename config_file =
+	match config_file with
+	| Some name -> name
+	| None	    -> Define.default_config_dir ^ "/oxenstored.conf"
+
 let do_argv =
 	let pidfile = ref "" and tracefile = ref "" (* old xenstored compatibility *)
 	and domain_init = ref true
@@ -38,6 +44,8 @@ let do_argv =
 	and restart = ref false
 	and live_reload = ref false
 	and disable_socket = ref false
+	and config_test = ref false
+	and help = ref false
 	in
 
 	let speclist =
@@ -55,10 +63,27 @@ let do_argv =
 		  ("-T", Arg.Set_string tracefile, ""); (* for compatibility *)
 		  ("--restart", Arg.Set restart, "Read database on starting");
 		  ("--live", Arg.Set live_reload, "Read live dump on startup");
+		  ("--config-test", Arg.Set config_test, "Test validity of config file");
 		  ("--disable-socket", Arg.Unit (fun () -> disable_socket := true), "Disable socket");
+		  ("--help", Arg.Set help, "Display this list of options")
 		] in
 	let usage_msg = "usage : xenstored [--config-file <filename>] [--no-domain-init] [--help] [--no-fork] [--reraise-top-level] [--restart] [--disable-socket]" in
 	Arg.parse speclist (fun _ -> ()) usage_msg;
+	let () =
+		if !help then begin
+			if !live_reload then
+				(*
+				 * Transform --live --help into --config-test for backward compat with
+				 * running code during live update.
+				 * Caller will validate config and exit
+				 *)
+				config_test := true
+			else begin
+				Arg.usage_string speclist usage_msg |> print_endline;
+				exit 0
+			end
+		end
+	in
 	{
 		domain_init = !domain_init;
 		activate_access_log = !activate_access_log;
@@ -70,4 +95,5 @@ let do_argv =
 		restart = !restart;
 		live_reload = !live_reload;
 		disable_socket = !disable_socket;
+		config_test = !config_test;
 	}
diff --git a/tools/ocaml/xenstored/xenstored.ml b/tools/ocaml/xenstored/xenstored.ml
index 4d5851c5cb..e2638a5af2 100644
--- a/tools/ocaml/xenstored/xenstored.ml
+++ b/tools/ocaml/xenstored/xenstored.ml
@@ -88,7 +88,7 @@ let default_pidfile = Paths.xen_run_dir ^ "/xenstored.pid"
 
 let ring_scan_interval = ref 20
 
-let parse_config filename =
+let parse_config ?(strict=false) filename =
 	let pidfile = ref default_pidfile in
 	let options = [
 		("merge-activate", Config.Set_bool Transaction.do_coalesce);
@@ -129,11 +129,12 @@ let parse_config filename =
 		("xenstored-port", Config.Set_string Domains.xenstored_port); ] in
 	begin try Config.read filename options (fun _ _ -> raise Not_found)
 	with
-	| Config.Error err -> List.iter (fun (k, e) ->
+	| Config.Error err as e -> List.iter (fun (k, e) ->
 		match e with
 		| "unknown key" -> eprintf "config: unknown key %s\n" k
 		| _             -> eprintf "config: %s: %s\n" k e
 		) err;
+		if strict then raise e
 	| Sys_error m -> eprintf "error: config: %s\n" m;
 	end;
 	!pidfile
@@ -358,6 +359,12 @@ let tweak_gc () =
 let () =
 	Printexc.set_uncaught_exception_handler Logging.fallback_exception_handler;
 	let cf = do_argv in
+	if cf.config_test then begin
+		let path = config_filename cf in
+		let _pidfile:string = parse_config ~strict:true path in
+		Printf.printf "Configuration valid at %s\n%!" path;
+		exit 0
+	end;
 	let pidfile =
 		if Sys.file_exists (config_filename cf) then
 			parse_config (config_filename cf)
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.16


From xen-changelog-bounces@lists.xenproject.org Fri Feb 10 18:22:53 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 10 Feb 2023 18:22:53 +0000
Received: from list by lists.xenproject.org with outflank-mailman.493510.763453 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pQY2v-0006nz-E0; Fri, 10 Feb 2023 18:22:53 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 493510.763453; Fri, 10 Feb 2023 18:22:53 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pQY2v-0006nr-B1; Fri, 10 Feb 2023 18:22:53 +0000
Received: by outflank-mailman (input) for mailman id 493510;
 Fri, 10 Feb 2023 18:22: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 1pQY2u-0006ni-Au
 for xen-changelog@lists.xenproject.org; Fri, 10 Feb 2023 18:22:52 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pQY2u-00069g-9h
 for xen-changelog@lists.xenproject.org; Fri, 10 Feb 2023 18:22:52 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pQY2u-0007Hg-8k
 for xen-changelog@lists.xenproject.org; Fri, 10 Feb 2023 18:22:52 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=ZD8MMahz3fyA7wpQcZkz3r+kMzn68tK+crY+N5Sjh0s=; b=zwRqte4Q9ZR/D62R7OYq7JKJtq
	HKhYdeoBKD4Q958j727BhSLFFqityzptIjAI0/tZnxblP6OygM3ljWguRJ7nwfakjOelxMGyYaCCQ
	88Lc8Hs5HjRTZUDWGyQLCau/DEcczW6SyAWqsWyrwK2pJzJ/1UVY3nserxZ1aHxKGDAk=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.16] tools/ocaml/libs: Don't declare stubs as taking void
Message-Id: <E1pQY2u-0007Hg-8k@xenbits.xenproject.org>
Date: Fri, 10 Feb 2023 18:22:52 +0000

commit 552e5f28d411c1a1a92f2fd3592a76e74f47610b
Author:     Edwin Török <edwin.torok@cloud.com>
AuthorDate: Thu Jan 12 11:28:29 2023 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Feb 9 15:58:51 2023 +0000

    tools/ocaml/libs: Don't declare stubs as taking void
    
    There is no such thing as an Ocaml function (C stub or otherwise) taking no
    parameters.  In the absence of any other parameters, unit is still passed.
    
    This doesn't explode with any ABI we care about, but would malfunction for an
    ABI environment such as stdcall.
    
    Fixes: c3afd398ba7f ("ocaml: Add XS bindings.")
    Fixes: 8b7ce06a2d34 ("ocaml: Add XC bindings.")
    Signed-off-by: Edwin Török <edwin.torok@cloud.com>
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Christian Lindig <christian.lindig@citrix.com>
    (cherry picked from commit ff8b560be80b9211c303d74df7e4b3921d2bb8ca)
---
 tools/ocaml/libs/xb/xenbus_stubs.c  | 5 ++---
 tools/ocaml/libs/xc/xenctrl_stubs.c | 4 ++--
 2 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/tools/ocaml/libs/xb/xenbus_stubs.c b/tools/ocaml/libs/xb/xenbus_stubs.c
index 3065181a55..97116b0782 100644
--- a/tools/ocaml/libs/xb/xenbus_stubs.c
+++ b/tools/ocaml/libs/xb/xenbus_stubs.c
@@ -30,10 +30,9 @@
 #include <xenctrl.h>
 #include <xen/io/xs_wire.h>
 
-CAMLprim value stub_header_size(void)
+CAMLprim value stub_header_size(value unit)
 {
-	CAMLparam0();
-	CAMLreturn(Val_int(sizeof(struct xsd_sockmsg)));
+	return Val_int(sizeof(struct xsd_sockmsg));
 }
 
 CAMLprim value stub_header_of_string(value s)
diff --git a/tools/ocaml/libs/xc/xenctrl_stubs.c b/tools/ocaml/libs/xc/xenctrl_stubs.c
index 5b4fe72c8d..434fc0345b 100644
--- a/tools/ocaml/libs/xc/xenctrl_stubs.c
+++ b/tools/ocaml/libs/xc/xenctrl_stubs.c
@@ -67,9 +67,9 @@ static void Noreturn failwith_xc(xc_interface *xch)
 	caml_raise_with_string(*caml_named_value("xc.error"), error_str);
 }
 
-CAMLprim value stub_xc_interface_open(void)
+CAMLprim value stub_xc_interface_open(value unit)
 {
-	CAMLparam0();
+	CAMLparam1(unit);
         xc_interface *xch;
 
 	/* Don't assert XC_OPENFLAG_NON_REENTRANT because these bindings
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.16


From xen-changelog-bounces@lists.xenproject.org Fri Feb 10 18:23:03 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 10 Feb 2023 18:23:03 +0000
Received: from list by lists.xenproject.org with outflank-mailman.493511.763457 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pQY35-0006qP-Fa; Fri, 10 Feb 2023 18:23:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 493511.763457; Fri, 10 Feb 2023 18:23: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 1pQY35-0006qI-Cg; Fri, 10 Feb 2023 18:23:03 +0000
Received: by outflank-mailman (input) for mailman id 493511;
 Fri, 10 Feb 2023 18:23: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 1pQY34-0006q4-DJ
 for xen-changelog@lists.xenproject.org; Fri, 10 Feb 2023 18:23:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pQY34-0006A9-CV
 for xen-changelog@lists.xenproject.org; Fri, 10 Feb 2023 18:23:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pQY34-0007II-Bv
 for xen-changelog@lists.xenproject.org; Fri, 10 Feb 2023 18: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=FQnew39+9gkwCKPPtA+nclBPV2+z46Qo9mU98MdjzFI=; b=f5GQbx2101YqR7LrqUQzwbWgng
	a0GTPSqFx0y7aSLNOFFpATh7u+Z8H7t2Y+sZZFGDT1kbnQeUFcA5ksk2umEwi1YgCRgI+A7W/hler
	+6mglCK30YyKp7ns39hmwqXDG5NcPmWldq8shL1MCqcSClu8/zIml2nw5/o0VLjdBTiM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.16] tools/ocaml/libs: Allocate the correct amount of memory for Abstract_tag
Message-Id: <E1pQY34-0007II-Bv@xenbits.xenproject.org>
Date: Fri, 10 Feb 2023 18:23:02 +0000

commit 6d66fb984cc768406158353cabf9a55652b0dea7
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Tue Jan 31 10:59:42 2023 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Feb 9 15:58:51 2023 +0000

    tools/ocaml/libs: Allocate the correct amount of memory for Abstract_tag
    
    caml_alloc() takes units of Wsize (word size), not bytes.  As a consequence,
    we're allocating 4 or 8 times too much memory.
    
    Ocaml has a helper, Wsize_bsize(), but it truncates cases which aren't an
    exact multiple.  Use a BUILD_BUG_ON() to cover the potential for truncation,
    as there's no rounding-up form of the helper.
    
    Fixes: 8b7ce06a2d34 ("ocaml: Add XC bindings.")
    Fixes: d3e649277a13 ("ocaml: add mmap bindings implementation.")
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Christian Lindig <christian.lindig@citrix.com>
    (cherry picked from commit 36eb2de31b6ecb8787698fb1a701bd708c8971b2)
---
 tools/ocaml/libs/mmap/Makefile        | 2 ++
 tools/ocaml/libs/mmap/xenmmap_stubs.c | 6 +++++-
 tools/ocaml/libs/xc/xenctrl_stubs.c   | 5 ++++-
 3 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/tools/ocaml/libs/mmap/Makefile b/tools/ocaml/libs/mmap/Makefile
index df45819df5..a3bd75e33a 100644
--- a/tools/ocaml/libs/mmap/Makefile
+++ b/tools/ocaml/libs/mmap/Makefile
@@ -2,6 +2,8 @@ TOPLEVEL=$(CURDIR)/../..
 XEN_ROOT=$(TOPLEVEL)/../..
 include $(TOPLEVEL)/common.make
 
+CFLAGS += $(CFLAGS_xeninclude)
+
 OBJS = xenmmap
 INTF = $(foreach obj, $(OBJS),$(obj).cmi)
 LIBS = xenmmap.cma xenmmap.cmxa
diff --git a/tools/ocaml/libs/mmap/xenmmap_stubs.c b/tools/ocaml/libs/mmap/xenmmap_stubs.c
index e03951d781..d623ad390e 100644
--- a/tools/ocaml/libs/mmap/xenmmap_stubs.c
+++ b/tools/ocaml/libs/mmap/xenmmap_stubs.c
@@ -21,6 +21,8 @@
 #include <errno.h>
 #include "mmap_stubs.h"
 
+#include <xen-tools/libs.h>
+
 #include <caml/mlvalues.h>
 #include <caml/memory.h>
 #include <caml/alloc.h>
@@ -59,7 +61,9 @@ CAMLprim value stub_mmap_init(value fd, value pflag, value mflag,
 	default: caml_invalid_argument("maptype");
 	}
 
-	result = caml_alloc(sizeof(struct mmap_interface), Abstract_tag);
+	BUILD_BUG_ON((sizeof(struct mmap_interface) % sizeof(value)) != 0);
+	result = caml_alloc(Wsize_bsize(sizeof(struct mmap_interface)),
+			    Abstract_tag);
 
 	if (mmap_interface_init(Intf_val(result), Int_val(fd),
 	                        c_pflag, c_mflag,
diff --git a/tools/ocaml/libs/xc/xenctrl_stubs.c b/tools/ocaml/libs/xc/xenctrl_stubs.c
index 434fc0345b..ec64341a9a 100644
--- a/tools/ocaml/libs/xc/xenctrl_stubs.c
+++ b/tools/ocaml/libs/xc/xenctrl_stubs.c
@@ -940,7 +940,10 @@ CAMLprim value stub_map_foreign_range(value xch, value dom,
 	uint32_t c_dom;
 	unsigned long c_mfn;
 
-	result = caml_alloc(sizeof(struct mmap_interface), Abstract_tag);
+	BUILD_BUG_ON((sizeof(struct mmap_interface) % sizeof(value)) != 0);
+	result = caml_alloc(Wsize_bsize(sizeof(struct mmap_interface)),
+			    Abstract_tag);
+
 	intf = (struct mmap_interface *) result;
 
 	intf->len = Int_val(size);
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.16


From xen-changelog-bounces@lists.xenproject.org Fri Feb 10 18:23:13 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 10 Feb 2023 18:23:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.493512.763461 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pQY3F-0006tO-H9; Fri, 10 Feb 2023 18:23:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 493512.763461; Fri, 10 Feb 2023 18:23: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 1pQY3F-0006tG-EJ; Fri, 10 Feb 2023 18:23:13 +0000
Received: by outflank-mailman (input) for mailman id 493512;
 Fri, 10 Feb 2023 18:23: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 1pQY3E-0006sx-GG
 for xen-changelog@lists.xenproject.org; Fri, 10 Feb 2023 18:23:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pQY3E-0006AM-Fe
 for xen-changelog@lists.xenproject.org; Fri, 10 Feb 2023 18:23:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pQY3E-0007In-En
 for xen-changelog@lists.xenproject.org; Fri, 10 Feb 2023 18: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=uN4B2NQ5CDOs80GtZW0dojcVZcw15vjQujNZtUEteYs=; b=Rc9+iZlvt7U+IO3XgeUNlE07h7
	IAgxPa2pM6isbtp+jPYAceWq981zUaivFC+Hf/BDXoUuMOXoDN7wXjM0xvkjwMWGMtGsO8wfhPdIz
	6Tbr0O+5tAwzQATTp8fcOPgmjptbYDUOE+pEkijG6iJ5nQUKkvurvC9BFLnMZ0oPskOc=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.16] tools/ocaml/evtchn: Don't reference Custom objects with the GC lock released
Message-Id: <E1pQY3E-0007In-En@xenbits.xenproject.org>
Date: Fri, 10 Feb 2023 18:23:12 +0000

commit e18faeb91e620624106b94c8821f8c9574eddb17
Author:     Edwin Török <edwin.torok@cloud.com>
AuthorDate: Thu Jan 12 17:48:29 2023 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Feb 9 15:58:51 2023 +0000

    tools/ocaml/evtchn: Don't reference Custom objects with the GC lock released
    
    The modification to the _H() macro for Ocaml 5 support introduced a subtle
    bug.  From the manual:
    
      https://ocaml.org/manual/intfc.html#ss:parallel-execution-long-running-c-code
    
    "After caml_release_runtime_system() was called and until
    caml_acquire_runtime_system() is called, the C code must not access any OCaml
    data, nor call any function of the run-time system, nor call back into OCaml
    code."
    
    Previously, the value was a naked C pointer, so dereferencing it wasn't
    "accessing any Ocaml data", but the fix to avoid naked C pointers added a
    layer of indirection through an Ocaml Custom object, meaning that the common
    pattern of using _H() in a blocking section is unsafe.
    
    In order to fix:
    
     * Drop the _H() macro and replace it with a static inline xce_of_val().
     * Opencode the assignment into Data_custom_val() in the two constructors.
     * Rename "value xce" parameters to "value xce_val" so we can consistently
       have "xenevtchn_handle *xce" on the stack, and obtain the pointer with the
       GC lock still held.
    
    Fixes: 22d5affdf0ce ("tools/ocaml/evtchn: OCaml 5 support, fix potential resource leak")
    Signed-off-by: Edwin Török <edwin.torok@cloud.com>
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Christian Lindig <christian.lindig@citrix.com>
    (cherry picked from commit 2636d8ff7a670c4d2485757dbe966e36c259a960)
---
 tools/ocaml/libs/eventchn/xeneventchn_stubs.c | 60 ++++++++++++++++-----------
 1 file changed, 35 insertions(+), 25 deletions(-)

diff --git a/tools/ocaml/libs/eventchn/xeneventchn_stubs.c b/tools/ocaml/libs/eventchn/xeneventchn_stubs.c
index aa8a69cc1e..d7881ca95f 100644
--- a/tools/ocaml/libs/eventchn/xeneventchn_stubs.c
+++ b/tools/ocaml/libs/eventchn/xeneventchn_stubs.c
@@ -33,11 +33,14 @@
 #include <caml/fail.h>
 #include <caml/signals.h>
 
-#define _H(__h) (*((xenevtchn_handle **)Data_custom_val(__h)))
+static inline xenevtchn_handle *xce_of_val(value v)
+{
+	return *(xenevtchn_handle **)Data_custom_val(v);
+}
 
 static void stub_evtchn_finalize(value v)
 {
-	xenevtchn_close(_H(v));
+	xenevtchn_close(xce_of_val(v));
 }
 
 static struct custom_operations xenevtchn_ops = {
@@ -68,7 +71,7 @@ CAMLprim value stub_eventchn_init(value cloexec)
 		caml_failwith("open failed");
 
 	result = caml_alloc_custom(&xenevtchn_ops, sizeof(xce), 0, 1);
-	_H(result) = xce;
+	*(xenevtchn_handle **)Data_custom_val(result) = xce;
 
 	CAMLreturn(result);
 }
@@ -87,18 +90,19 @@ CAMLprim value stub_eventchn_fdopen(value fdval)
 		caml_failwith("evtchn fdopen failed");
 
 	result = caml_alloc_custom(&xenevtchn_ops, sizeof(xce), 0, 1);
-	_H(result) = xce;
+	*(xenevtchn_handle **)Data_custom_val(result) = xce;
 
 	CAMLreturn(result);
 }
 
-CAMLprim value stub_eventchn_fd(value xce)
+CAMLprim value stub_eventchn_fd(value xce_val)
 {
-	CAMLparam1(xce);
+	CAMLparam1(xce_val);
 	CAMLlocal1(result);
+	xenevtchn_handle *xce = xce_of_val(xce_val);
 	int fd;
 
-	fd = xenevtchn_fd(_H(xce));
+	fd = xenevtchn_fd(xce);
 	if (fd == -1)
 		caml_failwith("evtchn fd failed");
 
@@ -107,13 +111,14 @@ CAMLprim value stub_eventchn_fd(value xce)
 	CAMLreturn(result);
 }
 
-CAMLprim value stub_eventchn_notify(value xce, value port)
+CAMLprim value stub_eventchn_notify(value xce_val, value port)
 {
-	CAMLparam2(xce, port);
+	CAMLparam2(xce_val, port);
+	xenevtchn_handle *xce = xce_of_val(xce_val);
 	int rc;
 
 	caml_enter_blocking_section();
-	rc = xenevtchn_notify(_H(xce), Int_val(port));
+	rc = xenevtchn_notify(xce, Int_val(port));
 	caml_leave_blocking_section();
 
 	if (rc == -1)
@@ -122,15 +127,16 @@ CAMLprim value stub_eventchn_notify(value xce, value port)
 	CAMLreturn(Val_unit);
 }
 
-CAMLprim value stub_eventchn_bind_interdomain(value xce, value domid,
+CAMLprim value stub_eventchn_bind_interdomain(value xce_val, value domid,
                                               value remote_port)
 {
-	CAMLparam3(xce, domid, remote_port);
+	CAMLparam3(xce_val, domid, remote_port);
 	CAMLlocal1(port);
+	xenevtchn_handle *xce = xce_of_val(xce_val);
 	xenevtchn_port_or_error_t rc;
 
 	caml_enter_blocking_section();
-	rc = xenevtchn_bind_interdomain(_H(xce), Int_val(domid), Int_val(remote_port));
+	rc = xenevtchn_bind_interdomain(xce, Int_val(domid), Int_val(remote_port));
 	caml_leave_blocking_section();
 
 	if (rc == -1)
@@ -140,14 +146,15 @@ CAMLprim value stub_eventchn_bind_interdomain(value xce, value domid,
 	CAMLreturn(port);
 }
 
-CAMLprim value stub_eventchn_bind_virq(value xce, value virq_type)
+CAMLprim value stub_eventchn_bind_virq(value xce_val, value virq_type)
 {
-	CAMLparam2(xce, virq_type);
+	CAMLparam2(xce_val, virq_type);
 	CAMLlocal1(port);
+	xenevtchn_handle *xce = xce_of_val(xce_val);
 	xenevtchn_port_or_error_t rc;
 
 	caml_enter_blocking_section();
-	rc = xenevtchn_bind_virq(_H(xce), Int_val(virq_type));
+	rc = xenevtchn_bind_virq(xce, Int_val(virq_type));
 	caml_leave_blocking_section();
 
 	if (rc == -1)
@@ -157,13 +164,14 @@ CAMLprim value stub_eventchn_bind_virq(value xce, value virq_type)
 	CAMLreturn(port);
 }
 
-CAMLprim value stub_eventchn_unbind(value xce, value port)
+CAMLprim value stub_eventchn_unbind(value xce_val, value port)
 {
-	CAMLparam2(xce, port);
+	CAMLparam2(xce_val, port);
+	xenevtchn_handle *xce = xce_of_val(xce_val);
 	int rc;
 
 	caml_enter_blocking_section();
-	rc = xenevtchn_unbind(_H(xce), Int_val(port));
+	rc = xenevtchn_unbind(xce, Int_val(port));
 	caml_leave_blocking_section();
 
 	if (rc == -1)
@@ -172,14 +180,15 @@ CAMLprim value stub_eventchn_unbind(value xce, value port)
 	CAMLreturn(Val_unit);
 }
 
-CAMLprim value stub_eventchn_pending(value xce)
+CAMLprim value stub_eventchn_pending(value xce_val)
 {
-	CAMLparam1(xce);
+	CAMLparam1(xce_val);
 	CAMLlocal1(result);
+	xenevtchn_handle *xce = xce_of_val(xce_val);
 	xenevtchn_port_or_error_t port;
 
 	caml_enter_blocking_section();
-	port = xenevtchn_pending(_H(xce));
+	port = xenevtchn_pending(xce);
 	caml_leave_blocking_section();
 
 	if (port == -1)
@@ -189,16 +198,17 @@ CAMLprim value stub_eventchn_pending(value xce)
 	CAMLreturn(result);
 }
 
-CAMLprim value stub_eventchn_unmask(value xce, value _port)
+CAMLprim value stub_eventchn_unmask(value xce_val, value _port)
 {
-	CAMLparam2(xce, _port);
+	CAMLparam2(xce_val, _port);
+	xenevtchn_handle *xce = xce_of_val(xce_val);
 	evtchn_port_t port;
 	int rc;
 
 	port = Int_val(_port);
 
 	caml_enter_blocking_section();
-	rc = xenevtchn_unmask(_H(xce), port);
+	rc = xenevtchn_unmask(xce, port);
 	caml_leave_blocking_section();
 
 	if (rc)
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.16


From xen-changelog-bounces@lists.xenproject.org Fri Feb 10 18:23:23 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 10 Feb 2023 18:23:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.493513.763465 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pQY3P-0006yD-KP; Fri, 10 Feb 2023 18:23:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 493513.763465; Fri, 10 Feb 2023 18:23: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 1pQY3P-0006y5-Hc; Fri, 10 Feb 2023 18:23:23 +0000
Received: by outflank-mailman (input) for mailman id 493513;
 Fri, 10 Feb 2023 18:23: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 1pQY3O-0006xu-JH
 for xen-changelog@lists.xenproject.org; Fri, 10 Feb 2023 18:23:22 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pQY3O-0006Au-Ie
 for xen-changelog@lists.xenproject.org; Fri, 10 Feb 2023 18:23:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pQY3O-0007JI-Hs
 for xen-changelog@lists.xenproject.org; Fri, 10 Feb 2023 18: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=/KkTcRAfPNdyUlVHjUzIlf4X80fg3yPgiwI6uQr+Il4=; b=vsLXcT3foh0VqRdGo9kw+el8cK
	tzqcfIKUOCF5EGvFm+qHHqDJ8UKHT3x9v5z1DAoLCpSo1g1xHt3cB01wEy5Mjb4DvvpSQ1GunbbaL
	csK1QsC0pcgiOv0ExmZcFMxQQKyMmY05C5KZT1sqAcRZWPKtY+vqjHJDqgWB4fOYyUtI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.16] tools/ocaml/xc: Fix binding for xc_domain_assign_device()
Message-Id: <E1pQY3O-0007JI-Hs@xenbits.xenproject.org>
Date: Fri, 10 Feb 2023 18:23:22 +0000

commit 854013084e2c6267af7787df8b35d85646f79a54
Author:     Edwin Török <edwin.torok@cloud.com>
AuthorDate: Thu Jan 12 11:38:38 2023 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Feb 9 15:58:51 2023 +0000

    tools/ocaml/xc: Fix binding for xc_domain_assign_device()
    
    The patch adding this binding was plain broken, and unreviewed.  It modified
    the C stub to add a 4th parameter without an equivalent adjustment in the
    Ocaml side of the bindings.
    
    In 64bit builds, this causes us to dereference whatever dead value is in %rcx
    when trying to interpret the rflags parameter.
    
    This has gone unnoticed because Xapi doesn't use this binding (it has its
    own), but unbreak the binding by passing RDM_RELAXED unconditionally for
    now (matching the libxl default behaviour).
    
    Fixes: 9b34056cb4 ("tools: extend xc_assign_device() to support rdm reservation policy")
    Signed-off-by: Edwin Török <edwin.torok@cloud.com>
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Christian Lindig <christian.lindig@citrix.com>
    (cherry picked from commit 4250683842104f02996428f93927a035c8e19266)
---
 tools/ocaml/libs/xc/xenctrl_stubs.c | 17 +++++------------
 1 file changed, 5 insertions(+), 12 deletions(-)

diff --git a/tools/ocaml/libs/xc/xenctrl_stubs.c b/tools/ocaml/libs/xc/xenctrl_stubs.c
index ec64341a9a..e2efcbe182 100644
--- a/tools/ocaml/libs/xc/xenctrl_stubs.c
+++ b/tools/ocaml/libs/xc/xenctrl_stubs.c
@@ -1123,17 +1123,12 @@ CAMLprim value stub_xc_domain_test_assign_device(value xch, value domid, value d
 	CAMLreturn(Val_bool(ret == 0));
 }
 
-static int domain_assign_device_rdm_flag_table[] = {
-    XEN_DOMCTL_DEV_RDM_RELAXED,
-};
-
-CAMLprim value stub_xc_domain_assign_device(value xch, value domid, value desc,
-                                            value rflag)
+CAMLprim value stub_xc_domain_assign_device(value xch, value domid, value desc)
 {
-	CAMLparam4(xch, domid, desc, rflag);
+	CAMLparam3(xch, domid, desc);
 	int ret;
 	int domain, bus, dev, func;
-	uint32_t sbdf, flag;
+	uint32_t sbdf;
 
 	domain = Int_val(Field(desc, 0));
 	bus = Int_val(Field(desc, 1));
@@ -1141,10 +1136,8 @@ CAMLprim value stub_xc_domain_assign_device(value xch, value domid, value desc,
 	func = Int_val(Field(desc, 3));
 	sbdf = encode_sbdf(domain, bus, dev, func);
 
-	ret = Int_val(Field(rflag, 0));
-	flag = domain_assign_device_rdm_flag_table[ret];
-
-	ret = xc_assign_device(_H(xch), _D(domid), sbdf, flag);
+	ret = xc_assign_device(_H(xch), _D(domid), sbdf,
+			       XEN_DOMCTL_DEV_RDM_RELAXED);
 
 	if (ret < 0)
 		failwith_xc(_H(xch));
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.16


From xen-changelog-bounces@lists.xenproject.org Fri Feb 10 18:23:33 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 10 Feb 2023 18:23:33 +0000
Received: from list by lists.xenproject.org with outflank-mailman.493514.763469 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pQY3Z-000719-Lz; Fri, 10 Feb 2023 18:23:33 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 493514.763469; Fri, 10 Feb 2023 18:23: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 1pQY3Z-000711-J9; Fri, 10 Feb 2023 18:23:33 +0000
Received: by outflank-mailman (input) for mailman id 493514;
 Fri, 10 Feb 2023 18:23: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 1pQY3Y-00070p-MG
 for xen-changelog@lists.xenproject.org; Fri, 10 Feb 2023 18:23:32 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pQY3Y-0006B9-La
 for xen-changelog@lists.xenproject.org; Fri, 10 Feb 2023 18:23:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pQY3Y-0007K1-Kl
 for xen-changelog@lists.xenproject.org; Fri, 10 Feb 2023 18: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=ofx9Jvmmo1ciKGsa4NZS1VWa6iBswwmhJ3goM6cWrPQ=; b=h0fSNtkO8bHk7LwZAk3439fuHf
	lX4wGP/Rwd4aQUhRbzmtzmQXG7CpAdEirUlIeyAaD7djyVRi9IYHeRX0y3VenmIxSgN16zlskXqWl
	YgTPj752DJBllmg+pOrFvFt0GozX4SMymxD6pyBTea0FroCv3F17HLaHy3Hq8Cmof44k=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.16] tools/ocaml/xc: Don't reference Abstract_Tag objects with the GC lock released
Message-Id: <E1pQY3Y-0007K1-Kl@xenbits.xenproject.org>
Date: Fri, 10 Feb 2023 18:23:32 +0000

commit 1fdff77e26290ae1ed40e8253959d12a0c4b3d3f
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Tue Jan 31 17:19:30 2023 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Feb 9 15:58:51 2023 +0000

    tools/ocaml/xc: Don't reference Abstract_Tag objects with the GC lock released
    
    The intf->{addr,len} references in the xc_map_foreign_range() call are unsafe.
    From the manual:
    
      https://ocaml.org/manual/intfc.html#ss:parallel-execution-long-running-c-code
    
    "After caml_release_runtime_system() was called and until
    caml_acquire_runtime_system() is called, the C code must not access any OCaml
    data, nor call any function of the run-time system, nor call back into OCaml
    code."
    
    More than what the manual says, the intf pointer is (potentially) invalidated
    by caml_enter_blocking_section() if another thread happens to perform garbage
    collection at just the right (wrong) moment.
    
    Rewrite the logic.  There's no need to stash data in the Ocaml object until
    the success path at the very end.
    
    Fixes: 8b7ce06a2d34 ("ocaml: Add XC bindings.")
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Christian Lindig <christian.lindig@citrix.com>
    (cherry picked from commit 9e7c74e6f9fd2e44df1212643b80af9032b45b07)
---
 tools/ocaml/libs/xc/xenctrl_stubs.c | 23 +++++++++++------------
 1 file changed, 11 insertions(+), 12 deletions(-)

diff --git a/tools/ocaml/libs/xc/xenctrl_stubs.c b/tools/ocaml/libs/xc/xenctrl_stubs.c
index e2efcbe182..0a0fe45c54 100644
--- a/tools/ocaml/libs/xc/xenctrl_stubs.c
+++ b/tools/ocaml/libs/xc/xenctrl_stubs.c
@@ -937,26 +937,25 @@ CAMLprim value stub_map_foreign_range(value xch, value dom,
 	CAMLparam4(xch, dom, size, mfn);
 	CAMLlocal1(result);
 	struct mmap_interface *intf;
-	uint32_t c_dom;
-	unsigned long c_mfn;
+	unsigned long c_mfn = Nativeint_val(mfn);
+	int len = Int_val(size);
+	void *ptr;
 
 	BUILD_BUG_ON((sizeof(struct mmap_interface) % sizeof(value)) != 0);
 	result = caml_alloc(Wsize_bsize(sizeof(struct mmap_interface)),
 			    Abstract_tag);
 
-	intf = (struct mmap_interface *) result;
-
-	intf->len = Int_val(size);
-
-	c_dom = _D(dom);
-	c_mfn = Nativeint_val(mfn);
 	caml_enter_blocking_section();
-	intf->addr = xc_map_foreign_range(_H(xch), c_dom,
-	                                  intf->len, PROT_READ|PROT_WRITE,
-	                                  c_mfn);
+	ptr = xc_map_foreign_range(_H(xch), _D(dom), len,
+				   PROT_READ|PROT_WRITE, c_mfn);
 	caml_leave_blocking_section();
-	if (!intf->addr)
+
+	if (!ptr)
 		caml_failwith("xc_map_foreign_range error");
+
+	intf = Data_abstract_val(result);
+	*intf = (struct mmap_interface){ ptr, len };
+
 	CAMLreturn(result);
 }
 
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.16


From xen-changelog-bounces@lists.xenproject.org Fri Feb 10 18:23:44 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 10 Feb 2023 18:23:44 +0000
Received: from list by lists.xenproject.org with outflank-mailman.493515.763472 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pQY3k-00073x-NN; Fri, 10 Feb 2023 18:23:44 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 493515.763472; Fri, 10 Feb 2023 18: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 1pQY3k-00073p-Kp; Fri, 10 Feb 2023 18:23:44 +0000
Received: by outflank-mailman (input) for mailman id 493515;
 Fri, 10 Feb 2023 18:23: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 1pQY3i-00073T-P0
 for xen-changelog@lists.xenproject.org; Fri, 10 Feb 2023 18:23:42 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pQY3i-0006BK-OO
 for xen-changelog@lists.xenproject.org; Fri, 10 Feb 2023 18:23:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pQY3i-0007Ke-Ne
 for xen-changelog@lists.xenproject.org; Fri, 10 Feb 2023 18: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=uj6ofOkyMSSXc5LRUKYu+6D6s64KKpkUhQzV2NGdjM4=; b=543oyl8BU8qJXa+S34d8Wij1Ir
	OgCxtDCf4T2dDtnbiJ8Mx+g18J7ABzV8F9xTwY2xQsJvw2sQ7rZLZkgpuYj2ruhyF/vED8CfRhFHz
	mI4FbU2ls/atppHBVqfrM9PfWUB7NYUufuKv1+IRpIe/10EHomWoA+xyjK7Jn26IA2tk=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.16] tools/ocaml/libs: Fix memory/resource leaks with caml_alloc_custom()
Message-Id: <E1pQY3i-0007Ke-Ne@xenbits.xenproject.org>
Date: Fri, 10 Feb 2023 18:23:42 +0000

commit 1b6acdeeb2323c53d841356da50440e274e7bf9a
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Wed Feb 1 11:27:42 2023 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Feb 9 15:58:51 2023 +0000

    tools/ocaml/libs: Fix memory/resource leaks with caml_alloc_custom()
    
    All caml_alloc_*() functions can throw exceptions, and longjump out of
    context.  If this happens, we leak the xch/xce handle.
    
    Reorder the logic to allocate the the Ocaml object first.
    
    Fixes: 8b3c06a3e545 ("tools/ocaml/xenctrl: OCaml 5 support, fix use-after-free")
    Fixes: 22d5affdf0ce ("tools/ocaml/evtchn: OCaml 5 support, fix potential resource leak")
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Christian Lindig <christian.lindig@citrix.com>
    (cherry picked from commit d69ccf52ad467ccc22029172a8e61dc621187889)
---
 tools/ocaml/libs/eventchn/xeneventchn_stubs.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/tools/ocaml/libs/eventchn/xeneventchn_stubs.c b/tools/ocaml/libs/eventchn/xeneventchn_stubs.c
index d7881ca95f..de2fc29292 100644
--- a/tools/ocaml/libs/eventchn/xeneventchn_stubs.c
+++ b/tools/ocaml/libs/eventchn/xeneventchn_stubs.c
@@ -63,6 +63,8 @@ CAMLprim value stub_eventchn_init(value cloexec)
 	if ( !Bool_val(cloexec) )
 		flags |= XENEVTCHN_NO_CLOEXEC;
 
+	result = caml_alloc_custom(&xenevtchn_ops, sizeof(xce), 0, 1);
+
 	caml_enter_blocking_section();
 	xce = xenevtchn_open(NULL, flags);
 	caml_leave_blocking_section();
@@ -70,7 +72,6 @@ CAMLprim value stub_eventchn_init(value cloexec)
 	if (xce == NULL)
 		caml_failwith("open failed");
 
-	result = caml_alloc_custom(&xenevtchn_ops, sizeof(xce), 0, 1);
 	*(xenevtchn_handle **)Data_custom_val(result) = xce;
 
 	CAMLreturn(result);
@@ -82,6 +83,8 @@ CAMLprim value stub_eventchn_fdopen(value fdval)
 	CAMLlocal1(result);
 	xenevtchn_handle *xce;
 
+	result = caml_alloc_custom(&xenevtchn_ops, sizeof(xce), 0, 1);
+
 	caml_enter_blocking_section();
 	xce = xenevtchn_fdopen(NULL, Int_val(fdval), 0);
 	caml_leave_blocking_section();
@@ -89,7 +92,6 @@ CAMLprim value stub_eventchn_fdopen(value fdval)
 	if (xce == NULL)
 		caml_failwith("evtchn fdopen failed");
 
-	result = caml_alloc_custom(&xenevtchn_ops, sizeof(xce), 0, 1);
 	*(xenevtchn_handle **)Data_custom_val(result) = xce;
 
 	CAMLreturn(result);
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.16


From xen-changelog-bounces@lists.xenproject.org Sun Feb 12 07:55:08 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 12 Feb 2023 07:55:08 +0000
Received: from list by lists.xenproject.org with outflank-mailman.494005.763982 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pR7CR-0004l5-59; Sun, 12 Feb 2023 07:55:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 494005.763982; Sun, 12 Feb 2023 07:55:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pR7CR-0004kx-2M; Sun, 12 Feb 2023 07:55:03 +0000
Received: by outflank-mailman (input) for mailman id 494005;
 Sun, 12 Feb 2023 07: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 1pR7CP-0004kn-Vi
 for xen-changelog@lists.xenproject.org; Sun, 12 Feb 2023 07:55:01 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pR7CP-0000xD-Uv
 for xen-changelog@lists.xenproject.org; Sun, 12 Feb 2023 07:55:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pR7CP-0004cw-U2
 for xen-changelog@lists.xenproject.org; Sun, 12 Feb 2023 07:55:01 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=MXbnEpmmnh0Hgdungp+nRsrKo28gvf+obuID5i8Ccxk=; b=KpLdzGN41k/eobb1XM/fcKI9SH
	x7t/YK8rfKoL4IxsDklPrDXlY6t2Z5AkUyjGjbiaNgDy5nUpZNctN/yX3Bx+2mzC2GHBxaeYJcfIZ
	c9R9/5VqQnq+Pnplln+5I/mzgGuHLHW9B4a9NZIDBFVJVxnEAL0MEZ+8p4MEzLuttWN0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] docs/process: branching-checklist: Use consistent indentation
Message-Id: <E1pR7CP-0004cw-U2@xenbits.xenproject.org>
Date: Sun, 12 Feb 2023 07:55:01 +0000

commit 5dbe775c2b622a9473ddb9492db63cc320d562c4
Author:     Julien Grall <jgrall@amazon.com>
AuthorDate: Thu Feb 9 17:04:30 2023 +0000
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Thu Feb 9 17:04:30 2023 +0000

    docs/process: branching-checklist: Use consistent indentation
    
    At the moment, branch-checklist.txt is using a mix of soft and hard
    tab. They are both meant to be represented using 8 characters.
    
    In Xen we tend to use 4-space softtab represented with 4 characters. So
    to avoid  having to use a different editor configuration, switch all
    the indentation to 4-space softtab.
    
    Signed-off-by: Julien Grall <jgrall@amazon.com>
    Acked-by: George Dunlap <george.dunlap@cloud.com>
    Reviewed-by: Henry Wang <Henry.Wang@arm.com>
---
 docs/process/branching-checklist.txt | 102 +++++++++++++++++------------------
 1 file changed, 51 insertions(+), 51 deletions(-)

diff --git a/docs/process/branching-checklist.txt b/docs/process/branching-checklist.txt
index 0e83272caa..9aac474734 100644
--- a/docs/process/branching-checklist.txt
+++ b/docs/process/branching-checklist.txt
@@ -2,78 +2,78 @@ v=4.1
 ov=4.0
 
 * make branch in qemu-iwj.git
-        git-branch $v-testing master
+    git-branch $v-testing master
 
 # make branches in xenbits.xen.org qemus
-        ssh xen@xenbits.xen.org
-	cd ~/git/qemu-xen.git
-	git branch staging-$v staging
-	git branch stable-$v master
-	cd ~/git/qemu-xen-traditional.git
-	git branch stable-$v master
+    ssh xen@xenbits.xen.org
+    cd ~/git/qemu-xen.git
+    git branch staging-$v staging
+    git branch stable-$v master
+    cd ~/git/qemu-xen-traditional.git
+    git branch stable-$v master
 
 # make branch in libvirt
-        ssh xen@xenbits.xen.org
-        cd ~/git/libvirt.git/
-	git branch osstest/frozen/xen-$v-testing   xen-tested-master
+    ssh xen@xenbits.xen.org
+    cd ~/git/libvirt.git/
+    git branch osstest/frozen/xen-$v-testing   xen-tested-master
 
 # make branches in xenbits.xen.org xen.git
-        ssh xen@xenbits.xen.org
-        cd ~/git/xen.git
-	git branch staging-$v staging
-	git branch stable-$v master
+    ssh xen@xenbits.xen.org
+    cd ~/git/xen.git
+    git branch staging-$v staging
+    git branch stable-$v master
 
 # update xendocs@xenbits docs generator to generate new stable branch
 #  docs too. commit to git.
 * make 13:37 <ijc> https://xenbits.xen.org/docs/4.2-testing/ is now live true
 #14:17 <ijc> HOWTO: login to xenbits. become "xendocs" . cd cronjobs . edit
 #            xenbits-docs-all.sh in the obvious way. git commit
-	ssh root@xenbits.xen.org
-	su - xendocs
-	cd cronjobs
-	ed xenbits-docs-all.sh
-	/for branch
-	s/$/ 4.6-testing
-	# ^ OR SIMILAR
-	w
-	q
-        git add -p
-	git commit -m "Branch for $v"
+    ssh root@xenbits.xen.org
+    su - xendocs
+    cd cronjobs
+    ed xenbits-docs-all.sh
+    /for branch
+    s/$/ 4.6-testing
+    # ^ OR SIMILAR
+    w
+    q
+    git add -p
+    git commit -m "Branch for $v"
 
 * make branches etc. in osstest
-        ssh osstest@osstest.test-lab
-	cd testing.git
-	OSSTEST_CONFIG=production-config ./mg-branch-setup xen-$v-testing bisect
-	OSSTEST_CONFIG=production-config ./mg-branch-setup qemu-upstream-$v-testing bisect
+    ssh osstest@osstest.test-lab
+    cd testing.git
+    OSSTEST_CONFIG=production-config ./mg-branch-setup xen-$v-testing bisect
+    OSSTEST_CONFIG=production-config ./mg-branch-setup qemu-upstream-$v-testing bisect
 
 # make branches etc. in Cambridge osstest
-        ssh osstest@osstest.xs.citrite.net
-	cd testing.git
-	OSSTEST_CONFIG=production-config-cambridge ./mg-branch-setup xen-$v-testing bisect
-	OSSTEST_CONFIG=production-config-cambridge ./mg-branch-setup qemu-upstream-$v-testing bisect
+    ssh osstest@osstest.xs.citrite.net
+    cd testing.git
+    OSSTEST_CONFIG=production-config-cambridge ./mg-branch-setup xen-$v-testing bisect
+    OSSTEST_CONFIG=production-config-cambridge ./mg-branch-setup qemu-upstream-$v-testing bisect
 
 * add branch to osstest
-        ie add both eg qemu-upstream-4.2-testing and xen-4.2-testing to BRANCHES in cr-for-branches
+    ie add both eg qemu-upstream-4.2-testing and xen-4.2-testing to BRANCHES in cr-for-branches
 
 * add to patchbot
-        on xenbits
-        cd ~/HG/patchbot/
+    on xenbits
+    cd ~/HG/patchbot/
 
-	cp xen--master.patchbot-reported-heads xen--stable-$v.patchbot-reported-heads
-	cp xen--staging.patchbot-reported-heads xen--staging-$v.patchbot-reported-heads
-        cp qemu-xen--master.patchbot-reported-heads  qemu-xen--stable-$v.patchbot-reported-heads
-        cp qemu-xen--staging.patchbot-reported-heads  qemu-xen--staging-$v.patchbot-reported-heads
-        cp qemu-xen-traditional--master.patchbot-reported-heads qemu-xen-traditional--stable-$v.patchbot-reported-heads
+    cp xen--master.patchbot-reported-heads xen--stable-$v.patchbot-reported-heads
+    cp xen--staging.patchbot-reported-heads xen--staging-$v.patchbot-reported-heads
+    cp qemu-xen--master.patchbot-reported-heads  qemu-xen--stable-$v.patchbot-reported-heads
+    cp qemu-xen--staging.patchbot-reported-heads  qemu-xen--staging-$v.patchbot-reported-heads
+    cp qemu-xen-traditional--master.patchbot-reported-heads qemu-xen-traditional--stable-$v.patchbot-reported-heads
 
-        #emacs versions
-	perl -i~ -pe 'next unless m/\b\Q'$ov'\E\b/; $x=$_; $x=~ s/\b\Q'$ov'\E\b/'$v'/g; print $x;' versions
-        git diff
-	git add versions
-	git commit -m "Branch for $v"
+    #emacs versions
+    perl -i~ -pe 'next unless m/\b\Q'$ov'\E\b/; $x=$_; $x=~ s/\b\Q'$ov'\E\b/'$v'/g; print $x;' versions
+    git diff
+    git add versions
+    git commit -m "Branch for $v"
 
 Ensure references to qemu trees in xen.git's Config.mk are updated.
 Check this with
-        grep unstable Config.mk 
+    grep unstable Config.mk
 which should produce no output.  Replace as necessary.
 (There may well be none.)
 
@@ -86,9 +86,9 @@ including turning off debug.
 
 Set off a manual osstest run, since the osstest cr-for-branches change
 will take a while to take effect:
-  ssh osstest@osstest.test-lab
-  cd testing.git
-  screen -S $v
-  BRANCHES=xen-$v-testing ./cr-for-branches branches -w "./cr-daily-branch --real"
+    ssh osstest@osstest.test-lab
+    cd testing.git
+    screen -S $v
+    BRANCHES=xen-$v-testing ./cr-for-branches branches -w "./cr-daily-branch --real"
 
 Send message to committers and RM.  Use previous mail as a template.
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sun Feb 12 07:55:13 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 12 Feb 2023 07:55:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.494006.763986 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pR7Cb-0004nQ-6O; Sun, 12 Feb 2023 07:55:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 494006.763986; Sun, 12 Feb 2023 07:55:13 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pR7Cb-0004nI-3l; Sun, 12 Feb 2023 07:55:13 +0000
Received: by outflank-mailman (input) for mailman id 494006;
 Sun, 12 Feb 2023 07: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 1pR7Ca-0004n8-2I
 for xen-changelog@lists.xenproject.org; Sun, 12 Feb 2023 07:55:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pR7Ca-0000xL-1b
 for xen-changelog@lists.xenproject.org; Sun, 12 Feb 2023 07:55:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pR7Ca-0004dO-0n
 for xen-changelog@lists.xenproject.org; Sun, 12 Feb 2023 07:55:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=JqZMnPqUt2jRlVweZ/60/a7OWokV6akBoCKmca/q1Kk=; b=qLuEJh+KUmQvAUS96qnixHG33y
	hVJZaj9ZCMWeU7DjHT7x+r8wkAa3SWna84xgZht47a0adqr3MqcEAc51d5iTowA+5VivnxTanxXXh
	+g7XKGnXpEH2ROIkCDkP+9FS2tYQQwKvgJ5cVk9e65NP5Uz4hWkWWWvS7OZQyoHeCZG0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] docs/process: branching-checklist: Remove reference to qemu-ijw.git
Message-Id: <E1pR7Ca-0004dO-0n@xenbits.xenproject.org>
Date: Sun, 12 Feb 2023 07:55:12 +0000

commit f87a15f5cce5c76c3d8028b7129f3a1abf1d6b7d
Author:     Julien Grall <jgrall@amazon.com>
AuthorDate: Thu Feb 9 17:04:41 2023 +0000
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Thu Feb 9 17:04:41 2023 +0000

    docs/process: branching-checklist: Remove reference to qemu-ijw.git
    
    Per [1], qemu-iwj.git was a clone of QEMU traditional on Ian's computer
    for tagging QEMU trad.
    
    The next section will provide tag for the official tree. So remove
    the section about qemu-ijw.git.
    
    [1] 25482.10006.140155.984629@chiark.greenend.org.uk
    
    Signed-off-by: Julien Grall <jgrall@amazon.com>
    Acked-by: George Dunlap <george.dunlap@cloud.com>
    Acked-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
    Reviewed-by: Henry Wang <Henry.Wang@arm.com>
---
 docs/process/branching-checklist.txt | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/docs/process/branching-checklist.txt b/docs/process/branching-checklist.txt
index 9aac474734..b8101dd0e3 100644
--- a/docs/process/branching-checklist.txt
+++ b/docs/process/branching-checklist.txt
@@ -1,9 +1,6 @@
 v=4.1
 ov=4.0
 
-* make branch in qemu-iwj.git
-    git-branch $v-testing master
-
 # make branches in xenbits.xen.org qemus
     ssh xen@xenbits.xen.org
     cd ~/git/qemu-xen.git
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sun Feb 12 07:55:23 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 12 Feb 2023 07:55:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.494007.763991 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pR7Cl-0004r2-81; Sun, 12 Feb 2023 07:55:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 494007.763991; Sun, 12 Feb 2023 07:55:23 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pR7Cl-0004qu-5E; Sun, 12 Feb 2023 07:55:23 +0000
Received: by outflank-mailman (input) for mailman id 494007;
 Sun, 12 Feb 2023 07: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 1pR7Ck-0004qh-5U
 for xen-changelog@lists.xenproject.org; Sun, 12 Feb 2023 07:55:22 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pR7Ck-0000zF-4j
 for xen-changelog@lists.xenproject.org; Sun, 12 Feb 2023 07:55:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pR7Ck-0004dp-3i
 for xen-changelog@lists.xenproject.org; Sun, 12 Feb 2023 07:55:22 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=jTSohR1qEYUyb+jXWLG64Dh8HH2a6DFKAkTzrhBe7k8=; b=iOFXH8+jAcASxnTZtpliLzfhlD
	SC53PLqN47lmrW7KaGTbACmNByqVXLtAgE4vRZ2kCGxzItfiRvYw3a/eieIJ64RoV+jSRVG4x1e0c
	romJlV3yeEt3BVS2h6WzgTdoWlaroGOstYiX3vMRMxIUuFixDUfbDsftIumzbu3Lgr14=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] docs/process: branching-checklist: Remove reference to root
Message-Id: <E1pR7Ck-0004dp-3i@xenbits.xenproject.org>
Date: Sun, 12 Feb 2023 07:55:22 +0000

commit 6a6ae4ac349ee31030d4fb3952f2c3b48e60d09f
Author:     Julien Grall <jgrall@amazon.com>
AuthorDate: Thu Feb 9 17:07:13 2023 +0000
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Thu Feb 9 17:07:13 2023 +0000

    docs/process: branching-checklist: Remove reference to root
    
    The steps to generate the documentation for the new branch requires
    to ssh as root and then su to run with the user xendocs.
    
    The release technician may not (and should not) have access to root.
    So update the step to directly ssh as xendocs.
    
    Signed-off-by: Julien Grall <jgrall@amazon.com>
    Acked-by: George Dunlap <george.dunlap@cloud.com>
    Reviewed-by: Henry Wang <Henry.Wang@arm.com>
---
 docs/process/branching-checklist.txt | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/docs/process/branching-checklist.txt b/docs/process/branching-checklist.txt
index b8101dd0e3..a98f6559ab 100644
--- a/docs/process/branching-checklist.txt
+++ b/docs/process/branching-checklist.txt
@@ -25,8 +25,7 @@ ov=4.0
 * make 13:37 <ijc> https://xenbits.xen.org/docs/4.2-testing/ is now live true
 #14:17 <ijc> HOWTO: login to xenbits. become "xendocs" . cd cronjobs . edit
 #            xenbits-docs-all.sh in the obvious way. git commit
-    ssh root@xenbits.xen.org
-    su - xendocs
+    ssh xendocs@xenbits.xen.org
     cd cronjobs
     ed xenbits-docs-all.sh
     /for branch
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sun Feb 12 07:55:33 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 12 Feb 2023 07:55:33 +0000
Received: from list by lists.xenproject.org with outflank-mailman.494008.763995 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pR7Cv-0004tV-9S; Sun, 12 Feb 2023 07:55:33 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 494008.763995; Sun, 12 Feb 2023 07:55:33 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pR7Cv-0004tO-6o; Sun, 12 Feb 2023 07:55:33 +0000
Received: by outflank-mailman (input) for mailman id 494008;
 Sun, 12 Feb 2023 07: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 1pR7Cu-0004tG-8r
 for xen-changelog@lists.xenproject.org; Sun, 12 Feb 2023 07:55:32 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pR7Cu-0000zd-87
 for xen-changelog@lists.xenproject.org; Sun, 12 Feb 2023 07:55:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pR7Cu-0004eF-6t
 for xen-changelog@lists.xenproject.org; Sun, 12 Feb 2023 07:55:32 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=FXO0Det7/imSt9zXd+MNS39Qt328bRWjpLpYU2vzRCA=; b=v8K6NbYBHYGeqT8IJcoTGrCo1h
	w94PCQ2KMMdicQvljT1uFWviWQ4wRuwJS2utkPO+Mq91wqAbBtLQqVjFfOZ0WRSKAARs6rzPkuzQd
	W9OCJvZQw4bhAXKqiCmWn6BECCSoXLSalEJNuX8euE8444Cz6P8DZnhIDRZh1Bqhuhgc=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] docs/process: branching-checklist: Clarify steps to add the branch in osstest
Message-Id: <E1pR7Cu-0004eF-6t@xenbits.xenproject.org>
Date: Sun, 12 Feb 2023 07:55:32 +0000

commit 4e0e7a29d2fe318e4e60e77a56773b4d020ebc6a
Author:     Julien Grall <jgrall@amazon.com>
AuthorDate: Thu Feb 9 17:07:28 2023 +0000
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Thu Feb 9 17:07:28 2023 +0000

    docs/process: branching-checklist: Clarify steps to add the branch in osstest
    
    The steps to add the new branch in osstest doesn't mention the change
    should be committed.
    
    Update the steps to clarify that. Take the opportunity to switch to
    use $v instead hardcoded version.
    
    Signed-off-by: Julien Grall <jgrall@amazon.com>
    Reviewed-by: Henry Wang <Henry.Wang@arm.com>
---
 docs/process/branching-checklist.txt | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/docs/process/branching-checklist.txt b/docs/process/branching-checklist.txt
index a98f6559ab..d1550385c9 100644
--- a/docs/process/branching-checklist.txt
+++ b/docs/process/branching-checklist.txt
@@ -49,7 +49,9 @@ ov=4.0
     OSSTEST_CONFIG=production-config-cambridge ./mg-branch-setup qemu-upstream-$v-testing bisect
 
 * add branch to osstest
-    ie add both eg qemu-upstream-4.2-testing and xen-4.2-testing to BRANCHES in cr-for-branches
+    Add both qemu-upstream-$v-testing and xen-$v-testing to BRANCHES in cr-for-branches
+    git add -p
+    git commit -m "cr-for-branches: Add Xen and QEMU $v branch"
 
 * add to patchbot
     on xenbits
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sun Feb 12 07:55:43 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 12 Feb 2023 07:55:43 +0000
Received: from list by lists.xenproject.org with outflank-mailman.494010.763999 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pR7D5-00054y-Ax; Sun, 12 Feb 2023 07:55:43 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 494010.763999; Sun, 12 Feb 2023 07: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 1pR7D5-00054q-8J; Sun, 12 Feb 2023 07:55:43 +0000
Received: by outflank-mailman (input) for mailman id 494010;
 Sun, 12 Feb 2023 07: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 1pR7D4-00054e-Dh
 for xen-changelog@lists.xenproject.org; Sun, 12 Feb 2023 07:55:42 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pR7D4-00010E-D4
 for xen-changelog@lists.xenproject.org; Sun, 12 Feb 2023 07:55:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pR7D4-0004el-AT
 for xen-changelog@lists.xenproject.org; Sun, 12 Feb 2023 07:55:42 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=G0uZDLAcVTxnBu1NVCucv4qAZKWY8GhQBrrv8h0aLbs=; b=gefFCXaIQOb5Y37UCMFVaGKiaS
	Z6IOF7gbl3VduMVJ7Y12J2w4k2DHdIvFOgPqMPAhSYPSajhV+mxuArQIKtop0SAQ6kEME5BSCAQog
	ncH6D2kFQdjiqDg8AnUfpGNwAIPiXodArxrH8YtryW4AFgJrtV1QLBR8VSCuB6wGEwOQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools/xenstored: hashtable: Constify the parameters of hashfn/eqfn
Message-Id: <E1pR7D4-0004el-AT@xenbits.xenproject.org>
Date: Sun, 12 Feb 2023 07:55:42 +0000

commit 5b46dd85d051ceecc2c00a0de27f03e571bff379
Author:     Julien Grall <jgrall@amazon.com>
AuthorDate: Fri Jan 27 18:55:46 2023 +0000
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Thu Feb 9 17:29:51 2023 +0000

    tools/xenstored: hashtable: Constify the parameters of hashfn/eqfn
    
    The parameters of hashfn/eqfn should never be modified. So constify
    them and propagate the const to the users.
    
    Take the opportunity to solve some coding style issues around the
    code modified.
    
    Signed-off-by: Julien Grall <jgrall@amazon.com>
    Reviewed-by: Henry Wang <Henry.Wang@arm.com>
    Tested-by: Henry Wang <Henry.Wang@arm.com>
    Reviewed-by: Juergen Gross <jgross@suse.com>
---
 tools/xenstore/hashtable.c        | 16 ++++++++--------
 tools/xenstore/hashtable.h        | 10 +++++-----
 tools/xenstore/xenstored_core.c   |  8 ++++----
 tools/xenstore/xenstored_domain.c |  8 ++++----
 4 files changed, 21 insertions(+), 21 deletions(-)

diff --git a/tools/xenstore/hashtable.c b/tools/xenstore/hashtable.c
index 30eb9f21d2..3d4466b597 100644
--- a/tools/xenstore/hashtable.c
+++ b/tools/xenstore/hashtable.c
@@ -23,8 +23,8 @@ struct hashtable {
     unsigned int entrycount;
     unsigned int loadlimit;
     unsigned int primeindex;
-    unsigned int (*hashfn) (void *k);
-    int (*eqfn) (void *k1, void *k2);
+    unsigned int (*hashfn) (const void *k);
+    int (*eqfn) (const void *k1, const void *k2);
 };
 
 /*
@@ -53,8 +53,8 @@ indexFor(unsigned int tablelength, unsigned int hashvalue) {
 /*****************************************************************************/
 struct hashtable *
 create_hashtable(const void *ctx, unsigned int minsize,
-                 unsigned int (*hashf) (void*),
-                 int (*eqf) (void*,void*),
+                 unsigned int (*hashf) (const void *),
+                 int (*eqf) (const void *, const void *),
                  unsigned int flags)
 {
     struct hashtable *h;
@@ -92,7 +92,7 @@ err0:
 
 /*****************************************************************************/
 unsigned int
-hash(struct hashtable *h, void *k)
+hash(const struct hashtable *h, const void *k)
 {
     /* Aim to protect against poor hash functions by adding logic here
      * - logic taken from java 1.4 hashtable source */
@@ -151,7 +151,7 @@ hashtable_expand(struct hashtable *h)
 
 /*****************************************************************************/
 unsigned int
-hashtable_count(struct hashtable *h)
+hashtable_count(const struct hashtable *h)
 {
     return h->entrycount;
 }
@@ -188,7 +188,7 @@ hashtable_insert(struct hashtable *h, void *k, void *v)
 
 /*****************************************************************************/
 void * /* returns value associated with key */
-hashtable_search(struct hashtable *h, void *k)
+hashtable_search(const struct hashtable *h, const void *k)
 {
     struct entry *e;
     unsigned int hashvalue, index;
@@ -206,7 +206,7 @@ hashtable_search(struct hashtable *h, void *k)
 
 /*****************************************************************************/
 void
-hashtable_remove(struct hashtable *h, void *k)
+hashtable_remove(struct hashtable *h, const void *k)
 {
     /* TODO: consider compacting the table when the load factor drops enough,
      *       or provide a 'compact' method. */
diff --git a/tools/xenstore/hashtable.h b/tools/xenstore/hashtable.h
index 4e2823134e..cc0090f133 100644
--- a/tools/xenstore/hashtable.h
+++ b/tools/xenstore/hashtable.h
@@ -24,8 +24,8 @@ struct hashtable;
 
 struct hashtable *
 create_hashtable(const void *ctx, unsigned int minsize,
-                 unsigned int (*hashfunction) (void*),
-                 int (*key_eq_fn) (void*,void*),
+                 unsigned int (*hashfunction) (const void *),
+                 int (*key_eq_fn) (const void *, const void *),
                  unsigned int flags
 );
 
@@ -61,7 +61,7 @@ hashtable_insert(struct hashtable *h, void *k, void *v);
  */
 
 void *
-hashtable_search(struct hashtable *h, void *k);
+hashtable_search(const struct hashtable *h, const void *k);
 
 /*****************************************************************************
  * hashtable_remove
@@ -72,7 +72,7 @@ hashtable_search(struct hashtable *h, void *k);
  */
 
 void
-hashtable_remove(struct hashtable *h, void *k);
+hashtable_remove(struct hashtable *h, const void *k);
 
 /*****************************************************************************
  * hashtable_count
@@ -82,7 +82,7 @@ hashtable_remove(struct hashtable *h, void *k);
  * @return      the number of items stored in the hashtable
  */
 unsigned int
-hashtable_count(struct hashtable *h);
+hashtable_count(const struct hashtable *h);
 
 /*****************************************************************************
  * hashtable_iterate
diff --git a/tools/xenstore/xenstored_core.c b/tools/xenstore/xenstored_core.c
index 4f00e0cdc0..7348f935bc 100644
--- a/tools/xenstore/xenstored_core.c
+++ b/tools/xenstore/xenstored_core.c
@@ -2386,9 +2386,9 @@ void setup_structure(bool live_update)
 	}
 }
 
-static unsigned int hash_from_key_fn(void *k)
+static unsigned int hash_from_key_fn(const void *k)
 {
-	char *str = k;
+	const char *str = k;
 	unsigned int hash = 5381;
 	char c;
 
@@ -2399,9 +2399,9 @@ static unsigned int hash_from_key_fn(void *k)
 }
 
 
-static int keys_equal_fn(void *key1, void *key2)
+static int keys_equal_fn(const void *key1, const void *key2)
 {
-	return 0 == strcmp((char *)key1, (char *)key2);
+	return 0 == strcmp(key1, key2);
 }
 
 int remember_string(struct hashtable *hash, const char *str)
diff --git a/tools/xenstore/xenstored_domain.c b/tools/xenstore/xenstored_domain.c
index 9ef41ede03..d7fc2fafc7 100644
--- a/tools/xenstore/xenstored_domain.c
+++ b/tools/xenstore/xenstored_domain.c
@@ -916,14 +916,14 @@ void dom0_init(void)
 	xenevtchn_notify(xce_handle, dom0->port);
 }
 
-static unsigned int domhash_fn(void *k)
+static unsigned int domhash_fn(const void *k)
 {
-	return *(unsigned int *)k;
+	return *(const unsigned int *)k;
 }
 
-static int domeq_fn(void *key1, void *key2)
+static int domeq_fn(const void *key1, const void *key2)
 {
-	return *(unsigned int *)key1 == *(unsigned int *)key2;
+	return *(const unsigned int *)key1 == *(const unsigned int *)key2;
 }
 
 void domain_init(int evtfd)
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sun Feb 12 07:55:53 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 12 Feb 2023 07:55:53 +0000
Received: from list by lists.xenproject.org with outflank-mailman.494011.764003 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pR7DF-00057R-Ch; Sun, 12 Feb 2023 07:55:53 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 494011.764003; Sun, 12 Feb 2023 07: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 1pR7DF-00057J-9r; Sun, 12 Feb 2023 07:55:53 +0000
Received: by outflank-mailman (input) for mailman id 494011;
 Sun, 12 Feb 2023 07:55:52 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pR7DE-00057B-HI
 for xen-changelog@lists.xenproject.org; Sun, 12 Feb 2023 07:55:52 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pR7DE-00010X-G1
 for xen-changelog@lists.xenproject.org; Sun, 12 Feb 2023 07:55:52 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pR7DE-0004fL-FH
 for xen-changelog@lists.xenproject.org; Sun, 12 Feb 2023 07:55:52 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=RUfcHzJ5PY+AsFaX0hNEzGPY4h966w/bfz0ajE8Fs9g=; b=LdvSPSai+wfEjKRUiyvkgBUlap
	VPhyycGN0s7nQagbh53/6+Ffk2ahblZujAB/GNPLgUtHiMYP9/uxz8WWxSl+uI+z75pUuhh+ZJ7W6
	Vznb3Rkdf05PLyUgsBxwk59oMNaFkUdBRVa4HN4VXwwZuz1Hpstdf6LwsYXwpiYjYrD4=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] libs/util: Remove unused headers in libxlu_pci.c
Message-Id: <E1pR7DE-0004fL-FH@xenbits.xenproject.org>
Date: Sun, 12 Feb 2023 07:55:52 +0000

commit 52493ec3e32a6e631b3ae3571db7ed41f10d9b06
Author:     Anthony PERARD <anthony.perard@citrix.com>
AuthorDate: Thu Feb 9 12:11:40 2023 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Feb 9 18:26:17 2023 +0000

    libs/util: Remove unused headers in libxlu_pci.c
    
    libxlu_pci.c doesn't use any "xlu__cfg*()" functions and doesn't use
    any of the disk parsing functions "xlu__disk*()", so all those headers
    can be removed.
    
    Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 tools/libs/util/libxlu_pci.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/tools/libs/util/libxlu_pci.c b/tools/libs/util/libxlu_pci.c
index 551d8e3aed..294482c6d7 100644
--- a/tools/libs/util/libxlu_pci.c
+++ b/tools/libs/util/libxlu_pci.c
@@ -3,9 +3,6 @@
 #include <ctype.h>
 
 #include "libxlu_internal.h"
-#include "libxlu_disk_l.h"
-#include "libxlu_disk_i.h"
-#include "libxlu_cfg_i.h"
 
 
 #define XLU__PCI_ERR(_c, _x, _a...) \
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sun Feb 12 07:56:03 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 12 Feb 2023 07:56:03 +0000
Received: from list by lists.xenproject.org with outflank-mailman.494012.764008 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pR7DP-0005Ar-IS; Sun, 12 Feb 2023 07:56:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 494012.764008; Sun, 12 Feb 2023 07: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 1pR7DP-0005Aj-EA; Sun, 12 Feb 2023 07:56:03 +0000
Received: by outflank-mailman (input) for mailman id 494012;
 Sun, 12 Feb 2023 07:56:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pR7DO-0005AU-Jl
 for xen-changelog@lists.xenproject.org; Sun, 12 Feb 2023 07:56:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pR7DO-00010x-Iz
 for xen-changelog@lists.xenproject.org; Sun, 12 Feb 2023 07:56:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pR7DO-0004fz-IA
 for xen-changelog@lists.xenproject.org; Sun, 12 Feb 2023 07:56:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=j7eVuJudJkfWgTw/VMSyh1mj+wIqBm+8JwhpvvWYy84=; b=J/1ku0zMhRBgT+taSAJZ5GeNKR
	uN1P7zRDGzQ3jYKb/N3RfSCktXbZs0Z2DNakJXqdY0CwsVspDZ9QjbSuliFokYaLpE+B51kVM4v3A
	uCmSh+ZraMqEgH47sD6xeRm6SOHxQGovLB96s+Hwg1BNAPvi7pMoLL78K3+yEiP22wrQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] libs/util: Fix parallel build between flex/bison and CC rules
Message-Id: <E1pR7DO-0004fz-IA@xenbits.xenproject.org>
Date: Sun, 12 Feb 2023 07:56:02 +0000

commit bf652a50fb3bb3b1b3d93db6fb79bc28f978fe75
Author:     Anthony PERARD <anthony.perard@citrix.com>
AuthorDate: Thu Feb 9 16:14:48 2023 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Feb 9 18:26:17 2023 +0000

    libs/util: Fix parallel build between flex/bison and CC rules
    
    flex/bison generate two targets, and when those targets are
    prerequisite of other rules they are considered independently by make.
    
    We can have a situation where the .c file is out-of-date but not the
    .h, git checkout for example. In this case, if a rule only have the .h
    file as prerequiste, make will procced and start to build the object.
    In parallel, another target can have the .c file as prerequisite and
    make will find out it need re-generating and do so, changing the .h at
    the same time. This parallel task breaks the first one.
    
    To avoid this scenario, we put both the header and the source as
    prerequisite for all object even if they only need the header.
    
    Reported-by: Andrew Cooper <Andrew.Cooper3@citrix.com>
    Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 tools/libs/util/Makefile | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/tools/libs/util/Makefile b/tools/libs/util/Makefile
index e016baf888..c3b21875dc 100644
--- a/tools/libs/util/Makefile
+++ b/tools/libs/util/Makefile
@@ -40,6 +40,14 @@ include $(XEN_ROOT)/tools/libs/libs.mk
 
 $(OBJS-y) $(PIC_OBJS): $(AUTOINCS)
 
+# Adding the .c conterparts of the headers generated by flex/bison as
+# prerequisite of all objects.
+# This is to tell make that if only the .c file is out-of-date but not the
+# header, it should still wait for the .c file to be rebuilt.
+# Otherwise, make doesn't considered "%.c %.h" as grouped targets, and will run
+# the flex/bison rules in parallel of CC rules which only need the header.
+$(OBJS-y) $(PIC_OBJS): libxlu_cfg_l.c libxlu_cfg_y.c libxlu_disk_l.c
+
 %.c %.h:: %.y
 	@rm -f $*.[ch]
 	$(BISON) --output=$*.c $<
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sun Feb 12 07:56:13 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 12 Feb 2023 07:56:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.494013.764011 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pR7DZ-0005Dh-J3; Sun, 12 Feb 2023 07:56:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 494013.764011; Sun, 12 Feb 2023 07: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 1pR7DZ-0005Da-G1; Sun, 12 Feb 2023 07:56:13 +0000
Received: by outflank-mailman (input) for mailman id 494013;
 Sun, 12 Feb 2023 07:56:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pR7DY-0005DL-Mt
 for xen-changelog@lists.xenproject.org; Sun, 12 Feb 2023 07:56:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pR7DY-00011F-M1
 for xen-changelog@lists.xenproject.org; Sun, 12 Feb 2023 07:56:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pR7DY-0004gU-LJ
 for xen-changelog@lists.xenproject.org; Sun, 12 Feb 2023 07:56:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=xiNLCm1ZI47mbWzRF29zCDXn1Tdz25TxvU0qYeeRw6s=; b=ovjo1NMANdEdwzgqK6QjmPuPdi
	60dSMOnOsra6gSjIse1SWc1b4qpxSF/JRmG5TgU7ttCCPQsMIzGlNbBMHssHP8MO9wb2bEK5DeCWW
	k8R6tTQqTQLI8zmqrNp2uiznXLIFOPPxf9a9sjIDQyt+bSH1HH8ijdnUBM+/3BhRTxd8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools/ocaml: Drop libxl and xentoollog bindings
Message-Id: <E1pR7DY-0004gU-LJ@xenbits.xenproject.org>
Date: Sun, 12 Feb 2023 07:56:12 +0000

commit e51d31f79edc10f8d622e7f5bf4b935af6d4618f
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu Feb 9 15:25:10 2023 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Feb 9 18:26:17 2023 +0000

    tools/ocaml: Drop libxl and xentoollog bindings
    
    There are significant issues with these bindings (they segfault for starters)
    and their companion half in Xapi was deleted in 2018
    
      https://github.com/xapi-project/xen-api/commit/203292ebe0c487d7ae4adb961a6d080f4fbe933d
    
    owing to there having been no development of these bindings since 2014.
    
    In the unlikely event that we'd want to reinstate them, they'd need reworking
    basically from scratch anyway.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Christian Lindig <christian.lindig@citrix.com>
---
 tools/ocaml/Makefile                           |    4 -
 tools/ocaml/libs/Makefile                      |    3 +-
 tools/ocaml/libs/xentoollog/META.in            |    4 -
 tools/ocaml/libs/xentoollog/Makefile           |   65 -
 tools/ocaml/libs/xentoollog/caml_xentoollog.h  |   24 -
 tools/ocaml/libs/xentoollog/genlevels.py       |  130 --
 tools/ocaml/libs/xentoollog/xentoollog.ml.in   |   48 -
 tools/ocaml/libs/xentoollog/xentoollog.mli.in  |   43 -
 tools/ocaml/libs/xentoollog/xentoollog_stubs.c |  205 ---
 tools/ocaml/libs/xl/META.in                    |    5 -
 tools/ocaml/libs/xl/Makefile                   |   71 -
 tools/ocaml/libs/xl/genwrap.py                 |  582 ---------
 tools/ocaml/libs/xl/xenlight.ml.in             |   94 --
 tools/ocaml/libs/xl/xenlight.mli.in            |   93 --
 tools/ocaml/libs/xl/xenlight_stubs.c           | 1663 ------------------------
 tools/ocaml/test/Makefile                      |   55 -
 tools/ocaml/test/dmesg.ml                      |   17 -
 tools/ocaml/test/list_domains.ml               |   26 -
 tools/ocaml/test/raise_exception.ml            |    9 -
 tools/ocaml/test/send_debug_keys.ml            |   13 -
 tools/ocaml/test/xtl.ml                        |   39 -
 21 files changed, 1 insertion(+), 3192 deletions(-)

diff --git a/tools/ocaml/Makefile b/tools/ocaml/Makefile
index 85bfd087c9..1557fd6c3c 100644
--- a/tools/ocaml/Makefile
+++ b/tools/ocaml/Makefile
@@ -4,10 +4,6 @@ include $(XEN_ROOT)/tools/Rules.mk
 SUBDIRS := libs
 SUBDIRS += xenstored
 
-ifeq ($(CONFIG_TESTS),y)
-SUBDIRS += test
-endif
-
 .NOTPARALLEL:
 # targets here must be run in order, otherwise we can try
 # to build programs before the libraries are done
diff --git a/tools/ocaml/libs/Makefile b/tools/ocaml/libs/Makefile
index 5146c52484..89350aa12f 100644
--- a/tools/ocaml/libs/Makefile
+++ b/tools/ocaml/libs/Makefile
@@ -3,9 +3,8 @@ include $(XEN_ROOT)/tools/Rules.mk
 
 SUBDIRS= \
 	mmap \
-	xentoollog \
 	eventchn xc \
-	xb xs xl
+	xb xs
 
 .PHONY: all
 all: subdirs-all
diff --git a/tools/ocaml/libs/xentoollog/META.in b/tools/ocaml/libs/xentoollog/META.in
deleted file mode 100644
index 7b066830ed..0000000000
--- a/tools/ocaml/libs/xentoollog/META.in
+++ /dev/null
@@ -1,4 +0,0 @@
-version = "@VERSION@"
-description = "Xen Tools Logger Interface"
-archive(byte) = "xentoollog.cma"
-archive(native) = "xentoollog.cmxa"
diff --git a/tools/ocaml/libs/xentoollog/Makefile b/tools/ocaml/libs/xentoollog/Makefile
deleted file mode 100644
index 1645b40faf..0000000000
--- a/tools/ocaml/libs/xentoollog/Makefile
+++ /dev/null
@@ -1,65 +0,0 @@
-OCAML_TOPLEVEL=$(CURDIR)/../..
-XEN_ROOT=$(OCAML_TOPLEVEL)/../..
-include $(OCAML_TOPLEVEL)/common.make
-
-# allow mixed declarations and code
-CFLAGS += -Wno-declaration-after-statement
-
-CFLAGS += $(CFLAGS_libxentoollog)
-CFLAGS += $(APPEND_CFLAGS)
-OCAMLINCLUDE +=
-
-OBJS = xentoollog
-INTF = xentoollog.cmi
-LIBS = xentoollog.cma xentoollog.cmxa
-
-LIBS_xentoollog = $(call xenlibs-ldflags-ldlibs,toollog)
-
-xentoollog_OBJS = $(OBJS)
-xentoollog_C_OBJS = xentoollog_stubs
-
-OCAML_LIBRARY = xentoollog
-
-GENERATED_FILES += xentoollog.ml xentoollog.ml.tmp xentoollog.mli xentoollog.mli.tmp
-GENERATED_FILES += _xtl_levels.mli.in _xtl_levels.ml.in _xtl_levels.inc META
-
-all: $(INTF) $(LIBS)
-
-xentoollog.ml: xentoollog.ml.in _xtl_levels.ml.in
-	$(Q)sed -e '1i\
-(*\
- * AUTO-GENERATED FILE DO NOT EDIT\
- * Generated from xentoollog.ml.in and _xtl_levels.ml.in\
- *)\
-' \
-	    -e '/^(\* @@XTL_LEVELS@@ \*)$$/r_xtl_levels.ml.in' \
-	  < xentoollog.ml.in > xentoollog.ml.tmp
-	$(Q)mv xentoollog.ml.tmp xentoollog.ml
-
-xentoollog.mli: xentoollog.mli.in _xtl_levels.mli.in
-	$(Q)sed -e '1i\
-(*\
- * AUTO-GENERATED FILE DO NOT EDIT\
- * Generated from xentoollog.mli.in and _xtl_levels.mli.in\
- *)\
-' \
-	    -e '/^(\* @@XTL_LEVELS@@ \*)$$/r_xtl_levels.mli.in' \
-	  < xentoollog.mli.in > xentoollog.mli.tmp
-	$(Q)mv xentoollog.mli.tmp xentoollog.mli
-
-libs: $(LIBS)
-
-_xtl_levels.ml.in _xtl_levels.mli.in _xtl_levels.inc: genlevels.py $(XEN_INCLUDE)/xentoollog.h
-	$(PYTHON) genlevels.py _xtl_levels.mli.in _xtl_levels.ml.in _xtl_levels.inc
-
-.PHONY: install
-install: $(LIBS) META
-	mkdir -p $(OCAMLDESTDIR)
-	ocamlfind remove -destdir $(OCAMLDESTDIR) xentoollog
-	ocamlfind install -destdir $(OCAMLDESTDIR) -ldconf ignore xentoollog META $(INTF) $(LIBS) *.a *.so *.cmx
-
-.PHONY: uninstall
-uninstall:
-	ocamlfind remove -destdir $(OCAMLDESTDIR) xentoollog
-
-include $(OCAML_TOPLEVEL)/Makefile.rules
diff --git a/tools/ocaml/libs/xentoollog/caml_xentoollog.h b/tools/ocaml/libs/xentoollog/caml_xentoollog.h
deleted file mode 100644
index 0eb7618512..0000000000
--- a/tools/ocaml/libs/xentoollog/caml_xentoollog.h
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * Copyright (C) 2013      Citrix Ltd.
- * Author Ian Campbell <ian.campbell@citrix.com>
- * Author Rob Hoes <rob.hoes@citrix.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published
- * by the Free Software Foundation; version 2.1 only. with the special
- * exception on linking described in file LICENSE.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU Lesser General Public License for more details.
- */
-
-struct caml_xtl {
-	xentoollog_logger vtable;
-	char *vmessage_cb;
-	char *progress_cb;
-};
-
-#define Xtl_val(x)(*((struct caml_xtl **) Data_custom_val(x)))
-
diff --git a/tools/ocaml/libs/xentoollog/genlevels.py b/tools/ocaml/libs/xentoollog/genlevels.py
deleted file mode 100755
index 11a623e459..0000000000
--- a/tools/ocaml/libs/xentoollog/genlevels.py
+++ /dev/null
@@ -1,130 +0,0 @@
-#!/usr/bin/python
-
-from __future__ import print_function
-
-import sys
-from functools import reduce
-
-def read_levels():
-	f = open('../../../include/xentoollog.h', 'r')
-
-	levels = []
-	record = False
-	for l in f.readlines():
-		if 'XTL_NUM_LEVELS' in l:
-			break
-		if record == True:
-			levels.append(l.split(',')[0].strip())
-		if 'XTL_NONE' in l:
-			record = True
-
-	f.close()
-
-	olevels = [level[4:].capitalize() for level in levels]
-
-	return levels, olevels
-
-# .ml
-
-def gen_ml(olevels):
-	s = ""
-
-	s += "type level = \n"
-	for level in olevels:
-		s += '\t| %s\n' % level
-
-	s += "\nlet level_to_string level =\n"
-	s +=  "\tmatch level with\n"
-	for level in olevels:
-		s += '\t| %s -> "%s"\n' % (level, level)
-
-	s += "\nlet level_to_prio level =\n"
-	s += "\tmatch level with\n"
-	for index,level in enumerate(olevels):
-		s += '\t| %s -> %d\n' % (level, index)
-
-	return s
-
-# .mli
-
-def gen_mli(olevels):
-	s = ""
-
-	s += "type level = \n"
-	for level in olevels:
-		s += '\t| %s\n' % level
-
-	return s
-
-# .c
-
-def gen_c(level):
-	s = ""
-
-	s += "static value Val_level(xentoollog_level c_level)\n"
-	s += "{\n"
-	s += "\tswitch (c_level) {\n"
-	s += "\tcase XTL_NONE: /* Not a real value */\n"
-	s += '\t\tcaml_raise_sys_error(caml_copy_string("Val_level XTL_NONE"));\n'
-	s += "\t\tbreak;\n"
-
-	for index,level in enumerate(levels):
-		s += "\tcase %s:\n\t\treturn Val_int(%d);\n" % (level, index)
-
-	s += """\tcase XTL_NUM_LEVELS: /* Not a real value! */
-	\t\tcaml_raise_sys_error(
-	\t\t\tcaml_copy_string("Val_level XTL_NUM_LEVELS"));
-	#if 0 /* Let the compiler catch this */
-	\tdefault:
-	\t\tcaml_raise_sys_error(caml_copy_string("Val_level Unknown"));
-	\t\tbreak;
-	#endif
-	\t}
-	\tabort();
-	}
-	"""
-
-	return s
-
-def autogen_header(open_comment, close_comment):
-    s = open_comment + " AUTO-GENERATED FILE DO NOT EDIT " + close_comment + "\n"
-    s += open_comment + " autogenerated by \n"
-    s += reduce(lambda x,y: x + " ", range(len(open_comment + " ")), "")
-    s += "%s" % " ".join(sys.argv)
-    s += "\n " + close_comment + "\n\n"
-    return s
-
-if __name__ == '__main__':
-	if len(sys.argv) < 3:
-		print("Usage: genlevels.py <mli> <ml> <c-inc>", file=sys.stderr)
-		sys.exit(1)
-
-	levels, olevels = read_levels()
-
-	_mli = sys.argv[1]
-	mli = open(_mli, 'w')
-	mli.write(autogen_header("(*", "*)"))
-
-	_ml = sys.argv[2]
-	ml = open(_ml, 'w')
-	ml.write(autogen_header("(*", "*)"))
-
-	_cinc = sys.argv[3]
-	cinc = open(_cinc, 'w')
-	cinc.write(autogen_header("/*", "*/"))
-
-	mli.write(gen_mli(olevels))
-	mli.write("\n")
-
-	ml.write(gen_ml(olevels))
-	ml.write("\n")
-
-	cinc.write(gen_c(levels))
-	cinc.write("\n")
-
-	ml.write("(* END OF AUTO-GENERATED CODE *)\n")
-	ml.close()
-	mli.write("(* END OF AUTO-GENERATED CODE *)\n")
-	mli.close()
-	cinc.close()
-
diff --git a/tools/ocaml/libs/xentoollog/xentoollog.ml.in b/tools/ocaml/libs/xentoollog/xentoollog.ml.in
deleted file mode 100644
index ce9ea1db77..0000000000
--- a/tools/ocaml/libs/xentoollog/xentoollog.ml.in
+++ /dev/null
@@ -1,48 +0,0 @@
-(*
- * Copyright (C) 2012      Citrix Ltd.
- * Author Ian Campbell <ian.campbell@citrix.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published
- * by the Free Software Foundation; version 2.1 only. with the special
- * exception on linking described in file LICENSE.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU Lesser General Public License for more details.
- *)
-
-open Printf
-open Random
-open Callback
-
-(* @@XTL_LEVELS@@ *)
-
-let compare_level x y =
-	compare (level_to_prio x) (level_to_prio y)
-
-type handle
-
-type logger_cbs = {
-	vmessage : level -> int option -> string option -> string -> unit;
-	progress : string option -> string -> int -> int64 -> int64 -> unit;
-	(*destroy : unit -> unit*)
-}
-
-external _create_logger: (string * string) -> handle = "stub_xtl_create_logger"
-external test: handle -> unit = "stub_xtl_test"
-
-let counter = ref 0L
-
-let create name cbs : handle =
-	(* Callback names are supposed to be unique *)
-	let suffix = Int64.to_string !counter in
-	counter := Int64.succ !counter;
-	let vmessage_name = sprintf "%s_vmessage_%s" name suffix in
-	let progress_name = sprintf "%s_progress_%s" name suffix in
-	(*let destroy_name = sprintf "%s_destroy" name in*)
-	Callback.register vmessage_name cbs.vmessage;
-	Callback.register progress_name cbs.progress;
-	_create_logger (vmessage_name, progress_name)
-
diff --git a/tools/ocaml/libs/xentoollog/xentoollog.mli.in b/tools/ocaml/libs/xentoollog/xentoollog.mli.in
deleted file mode 100644
index 05c098ae49..0000000000
--- a/tools/ocaml/libs/xentoollog/xentoollog.mli.in
+++ /dev/null
@@ -1,43 +0,0 @@
-(*
- * Copyright (C) 2012      Citrix Ltd.
- * Author Ian Campbell <ian.campbell@citrix.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published
- * by the Free Software Foundation; version 2.1 only. with the special
- * exception on linking described in file LICENSE.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU Lesser General Public License for more details.
- *)
-
-(* @@XTL_LEVELS@@ *)
-
-val level_to_string : level -> string
-val compare_level : level -> level -> int
-
-type handle
-
-(** call back arguments. See xentoollog.h for more info.
-    vmessage:
-      level: level as above
-      errno: Some <errno> or None
-      context: Some <string> or None
-      message: The log message (already formatted)
-    progress:
-      context: Some <string> or None
-      doing_what: string
-      percent, done, total.
-*)
-type logger_cbs = {
-	vmessage : level -> int option -> string option -> string -> unit;
-	progress : string option -> string -> int -> int64 -> int64 -> unit;
-	(*destroy : handle -> unit*)
-}
-
-external test: handle -> unit = "stub_xtl_test"
-
-val create : string -> logger_cbs -> handle
-
diff --git a/tools/ocaml/libs/xentoollog/xentoollog_stubs.c b/tools/ocaml/libs/xentoollog/xentoollog_stubs.c
deleted file mode 100644
index e4306a0c2f..0000000000
--- a/tools/ocaml/libs/xentoollog/xentoollog_stubs.c
+++ /dev/null
@@ -1,205 +0,0 @@
-/*
- * Copyright (C) 2012      Citrix Ltd.
- * Author Ian Campbell <ian.campbell@citrix.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published
- * by the Free Software Foundation; version 2.1 only. with the special
- * exception on linking described in file LICENSE.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU Lesser General Public License for more details.
- */
-
-#define _GNU_SOURCE
-#include <stdio.h>
-#include <string.h>
-#include <unistd.h>
-#include <errno.h>
-
-#define CAML_NAME_SPACE
-#include <caml/alloc.h>
-#include <caml/memory.h>
-#include <caml/signals.h>
-#include <caml/fail.h>
-#include <caml/callback.h>
-#include <caml/custom.h>
-
-#include <xentoollog.h>
-
-#include "caml_xentoollog.h"
-
-/* The following is equal to the CAMLreturn macro, but without the return */
-#define CAMLdone do{ \
-caml_local_roots = caml__frame; \
-}while (0)
-
-#define XTL ((xentoollog_logger *) Xtl_val(handle))
-
-static char * dup_String_val(value s)
-{
-	int len;
-	char *c;
-	len = caml_string_length(s);
-	c = calloc(len + 1, sizeof(char));
-	if (!c)
-		caml_raise_out_of_memory();
-	memcpy(c, String_val(s), len);
-	return c;
-}
-
-#include "_xtl_levels.inc"
-
-/* Option type support as per http://www.linux-nantes.org/~fmonnier/ocaml/ocaml-wrapping-c.php */
-#ifndef Val_none
-#define Val_none Val_int(0)
-#endif
-#ifndef Some_val
-#define Some_val(v) Field(v,0)
-#endif
-
-static value Val_some(value v)
-{
-	CAMLparam1(v);
-	CAMLlocal1(some);
-	some = caml_alloc(1, 0);
-	Store_field(some, 0, v);
-	CAMLreturn(some);
-}
-
-static value Val_errno(int errnoval)
-{
-	if (errnoval == -1)
-		return Val_none;
-	return Val_some(Val_int(errnoval));
-}
-
-static value Val_context(const char *context)
-{
-	if (context == NULL)
-		return Val_none;
-	return Val_some(caml_copy_string(context));
-}
-
-static void stub_xtl_ocaml_vmessage(struct xentoollog_logger *logger,
-	xentoollog_level level,
-	int errnoval,
-	const char *context,
-	const char *format,
-	va_list al)
-{
-	caml_leave_blocking_section();
-	CAMLparam0();
-	CAMLlocalN(args, 4);
-	struct caml_xtl *xtl = (struct caml_xtl*)logger;
-	const value *func = caml_named_value(xtl->vmessage_cb);
-	char *msg;
-
-	if (func == NULL)
-		caml_raise_sys_error(caml_copy_string("Unable to find callback"));
-	if (vasprintf(&msg, format, al) < 0)
-		caml_raise_out_of_memory();
-
-	/* vmessage : level -> int option -> string option -> string -> unit; */
-	args[0] = Val_level(level);
-	args[1] = Val_errno(errnoval);
-	args[2] = Val_context(context);
-	args[3] = caml_copy_string(msg);
-
-	free(msg);
-
-	caml_callbackN(*func, 4, args);
-	CAMLdone;
-	caml_enter_blocking_section();
-}
-
-static void stub_xtl_ocaml_progress(struct xentoollog_logger *logger,
-	const char *context,
-	const char *doing_what /* no \r,\n */,
-	int percent, unsigned long done, unsigned long total)
-{
-	caml_leave_blocking_section();
-	CAMLparam0();
-	CAMLlocalN(args, 5);
-	struct caml_xtl *xtl = (struct caml_xtl*)logger;
-	const value *func = caml_named_value(xtl->progress_cb);
-
-	if (func == NULL)
-		caml_raise_sys_error(caml_copy_string("Unable to find callback"));
-
-	/* progress : string option -> string -> int -> int64 -> int64 -> unit; */
-	args[0] = Val_context(context);
-	args[1] = caml_copy_string(doing_what);
-	args[2] = Val_int(percent);
-	args[3] = caml_copy_int64(done);
-	args[4] = caml_copy_int64(total);
-
-	caml_callbackN(*func, 5, args);
-	CAMLdone;
-	caml_enter_blocking_section();
-}
-
-static void xtl_destroy(struct xentoollog_logger *logger)
-{
-	struct caml_xtl *xtl = (struct caml_xtl*)logger;
-	free(xtl->vmessage_cb);
-	free(xtl->progress_cb);
-	free(xtl);
-}
-
-void xtl_finalize(value handle)
-{
-	xtl_destroy(XTL);
-}
-
-static struct custom_operations xentoollogger_custom_operations = {
-	"xentoollogger_custom_operations",
-	xtl_finalize /* custom_finalize_default */,
-	custom_compare_default,
-	custom_hash_default,
-	custom_serialize_default,
-	custom_deserialize_default
-};
-
-/* external _create_logger: (string * string) -> handle = "stub_xtl_create_logger" */
-CAMLprim value stub_xtl_create_logger(value cbs)
-{
-	CAMLparam1(cbs);
-	CAMLlocal1(handle);
-	struct caml_xtl *xtl = malloc(sizeof(*xtl));
-	if (xtl == NULL)
-		caml_raise_out_of_memory();
-
-	memset(xtl, 0, sizeof(*xtl));
-
-	xtl->vtable.vmessage = &stub_xtl_ocaml_vmessage;
-	xtl->vtable.progress = &stub_xtl_ocaml_progress;
-	xtl->vtable.destroy = &xtl_destroy;
-
-	xtl->vmessage_cb = dup_String_val(Field(cbs, 0));
-	xtl->progress_cb = dup_String_val(Field(cbs, 1));
-
-	handle = caml_alloc_custom(&xentoollogger_custom_operations, sizeof(xtl), 0, 1);
-	Xtl_val(handle) = xtl;
-
-	CAMLreturn(handle);
-}
-
-/* external test: handle -> unit = "stub_xtl_test" */
-CAMLprim value stub_xtl_test(value handle)
-{
-	unsigned long l;
-	CAMLparam1(handle);
-	xtl_log(XTL, XTL_DEBUG, -1, "debug", "%s -- debug", __func__);
-	xtl_log(XTL, XTL_INFO, -1, "test", "%s -- test 1", __func__);
-	xtl_log(XTL, XTL_INFO, ENOSYS, "test errno", "%s -- test 2", __func__);
-	xtl_log(XTL, XTL_CRITICAL, -1, "critical", "%s -- critical", __func__);
-	for (l = 0UL; l<=100UL; l += 10UL) {
-		xtl_progress(XTL, "progress", "testing", l, 100UL);
-		usleep(10000);
-	}
-	CAMLreturn(Val_unit);
-}
-
diff --git a/tools/ocaml/libs/xl/META.in b/tools/ocaml/libs/xl/META.in
deleted file mode 100644
index 3f0c5526cb..0000000000
--- a/tools/ocaml/libs/xl/META.in
+++ /dev/null
@@ -1,5 +0,0 @@
-version = "@VERSION@"
-description = "Xen Toolstack Library"
-requires = "xentoollog"
-archive(byte) = "xenlight.cma"
-archive(native) = "xenlight.cmxa"
diff --git a/tools/ocaml/libs/xl/Makefile b/tools/ocaml/libs/xl/Makefile
deleted file mode 100644
index 22d6c93aae..0000000000
--- a/tools/ocaml/libs/xl/Makefile
+++ /dev/null
@@ -1,71 +0,0 @@
-OCAML_TOPLEVEL=$(CURDIR)/../..
-XEN_ROOT=$(OCAML_TOPLEVEL)/../..
-include $(OCAML_TOPLEVEL)/common.make
-
-# ignore unused generated functions and allow mixed declarations and code
-CFLAGS += -Wno-unused -Wno-declaration-after-statement
-
-CFLAGS += $(CFLAGS_libxenlight)
-CFLAGS += -I ../xentoollog
-CFLAGS += $(APPEND_CFLAGS)
-
-OBJS = xenlight
-INTF = xenlight.cmi
-LIBS = xenlight.cma xenlight.cmxa
-
-OCAMLINCLUDE += -I ../xentoollog
-
-LIBS_xenlight = $(call xenlibs-ldflags-ldlibs,light)
-
-xenlight_OBJS = $(OBJS)
-xenlight_C_OBJS = xenlight_stubs
-
-OCAML_LIBRARY = xenlight
-
-GENERATED_FILES += xenlight.ml xenlight.ml.tmp xenlight.mli xenlight.mli.tmp
-GENERATED_FILES += _libxl_types.ml.in _libxl_types.mli.in
-GENERATED_FILES += _libxl_types.inc META
-
-all: $(INTF) $(LIBS)
-
-xenlight.ml: xenlight.ml.in _libxl_types.ml.in
-	$(Q)sed -e '1i\
-(*\
- * AUTO-GENERATED FILE DO NOT EDIT\
- * Generated from xenlight.ml.in and _libxl_types.ml.in\
- *)\
-' \
-	    -e '/^(\* @@LIBXL_TYPES@@ \*)$$/r_libxl_types.ml.in' \
-	  < xenlight.ml.in > xenlight.ml.tmp
-	$(Q)mv xenlight.ml.tmp xenlight.ml
-
-xenlight.mli: xenlight.mli.in _libxl_types.mli.in
-	$(Q)sed -e '1i\
-(*\
- * AUTO-GENERATED FILE DO NOT EDIT\
- * Generated from xenlight.mli.in and _libxl_types.mli.in\
- *)\
-' \
-	    -e '/^(\* @@LIBXL_TYPES@@ \*)$$/r_libxl_types.mli.in' \
-	  < xenlight.mli.in > xenlight.mli.tmp
-	$(Q)mv xenlight.mli.tmp xenlight.mli
-
-_libxl_types.ml.in _libxl_types.mli.in _libxl_types.inc: genwrap.py $(XEN_ROOT)/tools/libs/light/libxl_types.idl \
-                $(XEN_ROOT)/tools/libs/light/idl.py
-	PYTHONPATH=$(XEN_ROOT)/tools/libs/light $(PYTHON) genwrap.py \
-		$(XEN_ROOT)/tools/libs/light/libxl_types.idl \
-		_libxl_types.mli.in _libxl_types.ml.in _libxl_types.inc
-
-libs: $(LIBS)
-
-.PHONY: install
-install: $(LIBS) META
-	mkdir -p $(OCAMLDESTDIR)
-	$(OCAMLFIND) remove -destdir $(OCAMLDESTDIR) xenlight
-	$(OCAMLFIND) install -destdir $(OCAMLDESTDIR) -ldconf ignore xenlight META $(INTF) $(LIBS) *.a *.so *.cmx
-
-.PHONY: uninstall
-uninstall:
-	$(OCAMLFIND) remove -destdir $(OCAMLDESTDIR) xenlight
-
-include $(OCAML_TOPLEVEL)/Makefile.rules
diff --git a/tools/ocaml/libs/xl/genwrap.py b/tools/ocaml/libs/xl/genwrap.py
deleted file mode 100644
index 7bf26bdcd8..0000000000
--- a/tools/ocaml/libs/xl/genwrap.py
+++ /dev/null
@@ -1,582 +0,0 @@
-#!/usr/bin/python
-
-from __future__ import print_function
-
-import sys,os
-from functools import reduce
-
-import idl
-
-# typename -> ( ocaml_type, c_from_ocaml, ocaml_from_c )
-builtins = {
-    "bool":                 ("bool",                   "%(c)s = Bool_val(%(o)s)",           "Val_bool(%(c)s)" ),
-    "int":                  ("int",                    "%(c)s = Int_val(%(o)s)",            "Val_int(%(c)s)"  ),
-    "char *":               ("string option",          "%(c)s = String_option_val(%(o)s)",  "Val_string_option(%(c)s)"),
-    "libxl_domid":          ("domid",                  "%(c)s = Int_val(%(o)s)",            "Val_int(%(c)s)"  ),
-    "libxl_devid":          ("devid",                  "%(c)s = Int_val(%(o)s)",            "Val_int(%(c)s)"  ),
-    "libxl_defbool":        ("bool option",            "%(c)s = Defbool_val(%(o)s)",        "Val_defbool(%(c)s)" ),
-    "libxl_uuid":           ("int array",              "Uuid_val(&%(c)s, %(o)s)",   "Val_uuid(&%(c)s)"),
-    "libxl_bitmap":         ("bool array",             "Bitmap_val(ctx, &%(c)s, %(o)s)",   "Val_bitmap(&%(c)s)"),
-    "libxl_key_value_list": ("(string * string) list", "libxl_key_value_list_val(&%(c)s, %(o)s)", "Val_key_value_list(&%(c)s)"),
-    "libxl_string_list":    ("string list",            "libxl_string_list_val(&%(c)s, %(o)s)", "Val_string_list(&%(c)s)"),
-    "libxl_mac":            ("int array",              "Mac_val(&%(c)s, %(o)s)",    "Val_mac(&%(c)s)"),
-    "libxl_hwcap":          ("int32 array",            None,                                "Val_hwcap(&%(c)s)"),
-    "libxl_ms_vm_genid":    ("int array",              "Ms_vm_genid_val(&%(c)s, %(o)s)",    "Val_ms_vm_genid(&%(c)s)"),
-    # The following needs to be sorted out later
-    "libxl_cpuid_policy_list": ("unit",                "%(c)s = 0",                         "Val_unit"),
-    }
-
-DEVICE_FUNCTIONS = [ ("add",            ["ctx", "t", "domid", "?async:'a", "unit", "unit"]),
-                     ("remove",         ["ctx", "t", "domid", "?async:'a", "unit", "unit"]),
-                     ("destroy",        ["ctx", "t", "domid", "?async:'a", "unit", "unit"]),
-                   ]
-DEVICE_LIST =      [ ("list",           ["ctx", "domid", "t list"]),
-                   ]
-
-functions = { # ( name , [type1,type2,....] )
-    "device_vfb":     DEVICE_FUNCTIONS,
-    "device_vkb":     DEVICE_FUNCTIONS,
-    "device_disk":    DEVICE_FUNCTIONS + DEVICE_LIST +
-                      [ ("insert",         ["ctx", "t", "domid", "?async:'a", "unit", "unit"]),
-                        ("of_vdev",        ["ctx", "domid", "string", "t"]),
-                      ],
-    "device_nic":     DEVICE_FUNCTIONS + DEVICE_LIST +
-                      [ ("of_devid",       ["ctx", "domid", "int", "t"]),
-                      ],
-    "device_pci":     DEVICE_FUNCTIONS + DEVICE_LIST +
-                      [ ("assignable_add",    ["ctx", "t", "bool", "unit"]),
-                        ("assignable_remove", ["ctx", "t", "bool", "unit"]),
-                        ("assignable_list",   ["ctx", "t list"]),
-                      ],
-    "dominfo":        [ ("list",           ["ctx", "t list"]),
-                        ("get",            ["ctx", "domid", "t"]),
-                      ],
-    "physinfo":       [ ("get",            ["ctx", "t"]),
-                      ],
-    "cputopology":    [ ("get",            ["ctx", "t array"]),
-                      ],
-    "domain_sched_params":
-                      [ ("get",            ["ctx", "domid", "t"]),
-                        ("set",            ["ctx", "domid", "t", "unit"]),
-                      ],
-}
-def stub_fn_name(ty, name):
-    return "stub_xl_%s_%s" % (ty.rawname,name)
-
-def ocaml_type_of(ty):
-    if ty.rawname in ["domid","devid"]:
-        return ty.rawname
-    elif isinstance(ty,idl.UInt):
-        if ty.width in [8, 16]:
-            # handle as ints
-            width = None
-        elif ty.width in [32, 64]:
-            width = ty.width
-        else:
-            raise NotImplementedError("Cannot handle %d-bit int" % ty.width)
-        if width:
-            return "int%d" % ty.width
-        else:
-            return "int"
-    elif isinstance(ty,idl.Array):
-        return "%s array" % ocaml_type_of(ty.elem_type)
-    elif isinstance(ty,idl.Builtin):
-        if ty.typename not in builtins:
-            raise NotImplementedError("Unknown Builtin %s (%s)" % (ty.typename, type(ty)))
-        typename,_,_ = builtins[ty.typename]
-        if not typename:
-            raise NotImplementedError("No typename for Builtin %s (%s)" % (ty.typename, type(ty)))
-        return typename
-    elif isinstance(ty,idl.KeyedUnion):
-        return ty.union_name
-    elif isinstance(ty,idl.Aggregate):
-        if ty.rawname is None:
-            return ty.anon_struct
-        else:
-            return ty.rawname.capitalize() + ".t"
-    else:
-        return ty.rawname
-
-ocaml_keywords = ['and', 'as', 'assert', 'begin', 'end', 'class', 'constraint',
-    'do', 'done', 'downto', 'else', 'if', 'end', 'exception', 'external', 'false',
-    'for', 'fun', 'function', 'functor', 'if', 'in', 'include', 'inherit',
-    'initializer', 'lazy', 'let', 'match', 'method', 'module', 'mutable', 'new',
-    'object', 'of', 'open', 'or', 'private', 'rec', 'sig', 'struct', 'then', 'to',
-    'true', 'try', 'type', 'val', 'virtual', 'when', 'while', 'with']
-
-def munge_name(name):
-    if name in ocaml_keywords:
-        return "xl_" + name
-    else:
-        return name
-
-def ocaml_instance_of_field(f):
-    if isinstance(f.type, idl.KeyedUnion):
-        name = f.type.keyvar.name
-    else:
-        name = f.name
-    return "%s : %s" % (munge_name(name), ocaml_type_of(f.type))
-
-def gen_struct(ty, indent):
-    s = ""
-    for f in ty.fields:
-        if f.type.private:
-            continue
-        x = ocaml_instance_of_field(f)
-        x = x.replace("\n", "\n"+indent)
-        s += indent + x + ";\n"
-    return s
-
-def gen_ocaml_keyedunions(ty, interface, indent, parent = None):
-    s = ""
-    union_type = ""
-
-    if ty.rawname is not None:
-        # Non-anonymous types need no special handling
-        pass
-    elif isinstance(ty, idl.KeyedUnion):
-        if parent is None:
-            nparent = ty.keyvar.name
-        else:
-            nparent = parent + "_" + ty.keyvar.name
-
-        for f in ty.fields:
-            if f.type is None: continue
-            if f.type.rawname is not None: continue
-            if isinstance(f.type, idl.Struct) and not f.type.has_fields(): continue
-            s += "\ntype %s_%s =\n" % (nparent,f.name)
-            s += "{\n"
-            s += gen_struct(f.type, indent + "\t")
-            s += "}\n"
-
-        name = "%s__union" % ty.keyvar.name
-        s += "\n"
-        s += "type %s = " % name
-        u = []
-        for f in ty.fields:
-            if f.type is None:
-                u.append("%s" % (f.name.capitalize()))
-            elif isinstance(f.type, idl.Struct):
-                if f.type.rawname is not None:
-                    u.append("%s of %s.t" % (f.name.capitalize(), f.type.rawname.capitalize()))
-                elif f.type.has_fields():
-                    u.append("%s of %s_%s" % (f.name.capitalize(), nparent, f.name))
-                else:
-                    u.append("%s" % (f.name.capitalize()))
-            else:
-                raise NotImplementedError("Cannot handle KeyedUnion fields which are not Structs")
-
-        s += " | ".join(u) + "\n"
-        ty.union_name = name
-
-        union_type = "?%s:%s" % (munge_name(nparent), ty.keyvar.type.rawname)
-
-    if s == "":
-        return None, None
-    return s.replace("\n", "\n%s" % indent), union_type
-
-def gen_ocaml_anonstruct(ty, interface, indent, parent = None):
-    s= ""
-
-    if ty.rawname is not None:
-        # Non-anonymous types need no special handling
-        pass
-    elif isinstance(ty, idl.Struct):
-        name = "%s__anon" % parent
-        s += "type %s = {\n" % name
-        s += gen_struct(ty, indent)
-        s += "}\n"
-        ty.anon_struct = name
-    if s == "":
-        return None
-    s = indent + s
-    return s.replace("\n", "\n%s" % indent)
-
-def gen_ocaml_ml(ty, interface, indent=""):
-
-    if interface:
-        s = ("""(* %s interface *)\n""" % ty.typename)
-    else:
-        s = ("""(* %s implementation *)\n""" % ty.typename)
-
-    if isinstance(ty, idl.Enumeration):
-        s += "type %s = \n" % ty.rawname
-        for v in ty.values:
-            s += "\t | %s\n" % v.rawname
-
-        if interface:
-            s += "\nval string_of_%s : %s -> string\n" % (ty.rawname, ty.rawname)
-        else:
-            s += "\nlet string_of_%s = function\n" % ty.rawname
-            for v in ty.values:
-                s += '\t| %s -> "%s"\n' % (v.rawname, v.valuename)
-
-    elif isinstance(ty, idl.Aggregate):
-        s += ""
-
-        if ty.typename is None:
-            raise NotImplementedError("%s has no typename" % type(ty))
-        else:
-
-            module_name = ty.rawname[0].upper() + ty.rawname[1:]
-
-            if interface:
-                s += "module %s : sig\n" % module_name
-            else:
-                s += "module %s = struct\n" % module_name
-
-        # Handle KeyedUnions...
-        union_types = []
-        for f in ty.fields:
-            ku, union_type = gen_ocaml_keyedunions(f.type, interface, "\t")
-            if ku is not None:
-                s += ku
-                s += "\n"
-            if union_type is not None:
-                union_types.append(union_type)
-
-        # Handle anonymous structs...
-        for f in ty.fields:
-            anon = gen_ocaml_anonstruct(f.type, interface, "\t", f.name)
-            if anon is not None:
-                s += anon
-                s += "\n"
-
-        s += "\ttype t =\n"
-        s += "\t{\n"
-        s += gen_struct(ty, "\t\t")
-        s += "\t}\n"
-
-        if ty.init_fn is not None:
-            union_args = "".join([u + " -> " for u in union_types])
-            if interface:
-                s += "\tval default : ctx -> %sunit -> t\n" % union_args
-            else:
-                s += "\texternal default : ctx -> %sunit -> t = \"stub_libxl_%s_init\"\n" % (union_args, ty.rawname)
-
-        if ty.rawname in functions:
-            for name,args in functions[ty.rawname]:
-                s += "\texternal %s : " % name
-                s += " -> ".join(args)
-                s += " = \"%s\"\n" % stub_fn_name(ty,name)
-
-        s += "end\n"
-
-    else:
-        raise NotImplementedError("%s" % type(ty))
-    return s.replace("\n", "\n%s" % indent)
-
-def c_val(ty, c, o, indent="", parent = None):
-    s = indent
-    if isinstance(ty,idl.UInt):
-        if ty.width in [8, 16]:
-            # handle as ints
-            width = None
-        elif ty.width in [32, 64]:
-            width = ty.width
-        else:
-            raise NotImplementedError("Cannot handle %d-bit int" % ty.width)
-        if width:
-            s += "%s = Int%d_val(%s);" % (c, width, o)
-        else:
-            s += "%s = Int_val(%s);" % (c, o)
-    elif isinstance(ty,idl.Builtin):
-        if ty.typename not in builtins:
-            raise NotImplementedError("Unknown Builtin %s (%s)" % (ty.typename, type(ty)))
-        _,fn,_ = builtins[ty.typename]
-        if not fn:
-            raise NotImplementedError("No c_val fn for Builtin %s (%s)" % (ty.typename, type(ty)))
-        s += "%s;" % (fn % { "o": o, "c": c })
-    elif isinstance (ty,idl.Array):
-        s += "{\n"
-        s += "\tint i;\n"
-        s += "\t%s = Wosize_val(%s);\n" % (parent + ty.lenvar.name, o)
-        s += "\t%s = (%s) calloc(%s, sizeof(*%s));\n" % (c, ty.typename, parent + ty.lenvar.name, c)
-        s += "\tfor(i=0; i<%s; i++) {\n" % (parent + ty.lenvar.name)
-        s += c_val(ty.elem_type, c+"[i]", "Field(%s, i)" % o, indent="\t\t", parent=parent) + "\n"
-        s += "\t}\n"
-        s += "}\n"
-    elif isinstance(ty,idl.Enumeration) and (parent is None):
-        n = 0
-        s += "switch(Int_val(%s)) {\n" % o
-        for e in ty.values:
-            s += "    case %d: *%s = %s; break;\n" % (n, c, e.name)
-            n += 1
-        s += "    default: failwith_xl(ERROR_FAIL, \"cannot convert value to %s\"); break;\n" % ty.typename
-        s += "}"
-    elif isinstance(ty, idl.KeyedUnion):
-        s += "{\n"
-        s += "\tif(Is_long(%s)) {\n" % o
-        n = 0
-        s += "\t\tswitch(Int_val(%s)) {\n" % o
-        for f in ty.fields:
-            if f.type is None or not f.type.has_fields():
-                s += "\t\t    case %d: %s = %s; break;\n" % (n,
-                                                    parent + ty.keyvar.name,
-                                                    f.enumname)
-                n += 1
-        s += "\t\t    default: failwith_xl(ERROR_FAIL, \"variant handling bug %s%s (long)\"); break;\n" % (parent, ty.keyvar.name)
-        s += "\t\t}\n"
-        s += "\t} else {\n"
-        s += "\t\t/* Is block... */\n"
-        s += "\t\tswitch(Tag_val(%s)) {\n" % o
-        n = 0
-        for f in ty.fields:
-            if f.type is not None and f.type.has_fields():
-                if f.type.private:
-                    continue
-                s += "\t\t    case %d:\n" % (n)
-                s += "\t\t        %s = %s;\n" % (parent + ty.keyvar.name, f.enumname)
-                (nparent,fexpr) = ty.member(c, f, False)
-                s += "%s" % c_val(f.type, fexpr, "Field(%s, 0)" % o, parent=nparent, indent=indent+"\t\t        ")
-                s += "break;\n"
-                n += 1
-        s += "\t\t    default: failwith_xl(ERROR_FAIL, \"variant handling bug %s%s (block)\"); break;\n" % (parent, ty.keyvar.name)
-        s += "\t\t}\n"
-        s += "\t}\n"
-        s += "}"
-    elif isinstance(ty, idl.Aggregate) and (parent is None or ty.rawname is None):
-        n = 0
-        for f in ty.fields:
-            if f.type.private:
-                continue
-            (nparent,fexpr) = ty.member(c, f, ty.rawname is not None)
-            s += "%s\n" % c_val(f.type, fexpr, "Field(%s, %d)" % (o,n), parent=nparent)
-            n = n + 1
-    else:
-        s += "%s_val(ctx, %s, %s);" % (ty.rawname, ty.pass_arg(c, parent is None, passby=idl.PASS_BY_REFERENCE), o)
-
-    return s.replace("\n", "\n%s" % indent)
-
-def gen_c_val(ty, indent=""):
-    s = "/* Convert caml value to %s */\n" % ty.rawname
-
-    s += "static int %s_val (libxl_ctx *ctx, %s, value v)\n" % (ty.rawname, ty.make_arg("c_val", passby=idl.PASS_BY_REFERENCE))
-    s += "{\n"
-    s += "\tCAMLparam1(v);\n"
-    s += "\n"
-
-    s += c_val(ty, "c_val", "v", indent="\t") + "\n"
-
-    s += "\tCAMLreturn(0);\n"
-    s += "}\n"
-
-    return s.replace("\n", "\n%s" % indent)
-
-def ocaml_Val(ty, o, c, indent="", parent = None):
-    s = indent
-    if isinstance(ty,idl.UInt):
-        if ty.width in [8, 16]:
-            # handle as ints
-            width = None
-        elif ty.width in [32, 64]:
-            width = ty.width
-        else:
-            raise NotImplementedError("Cannot handle %d-bit int" % ty.width)
-        if width:
-            s += "%s = caml_copy_int%d(%s);" % (o, width, c)
-        else:
-            s += "%s = Val_int(%s);" % (o, c)
-    elif isinstance(ty,idl.Builtin):
-        if ty.typename not in builtins:
-            raise NotImplementedError("Unknown Builtin %s (%s)" % (ty.typename, type(ty)))
-        _,_,fn = builtins[ty.typename]
-        if not fn:
-            raise NotImplementedError("No ocaml Val fn for Builtin %s (%s)" % (ty.typename, type(ty)))
-        s += "%s = %s;" % (o, fn % { "c": c })
-    elif isinstance(ty, idl.Array):
-        s += "{\n"
-        s += "\t    int i;\n"
-        s += "\t    CAMLlocal1(array_elem);\n"
-        s += "\t    %s = caml_alloc(%s,0);\n" % (o, parent + ty.lenvar.name)
-        s += "\t    for(i=0; i<%s; i++) {\n" % (parent + ty.lenvar.name)
-        s += "\t        %s\n" % ocaml_Val(ty.elem_type, "array_elem", c + "[i]", "", parent=parent)
-        s += "\t        Store_field(%s, i, array_elem);\n" % o
-        s += "\t    }\n"
-        s += "\t}"
-    elif isinstance(ty,idl.Enumeration) and (parent is None):
-        n = 0
-        s += "switch(%s) {\n" % c
-        for e in ty.values:
-            s += "    case %s: %s = Val_int(%d); break;\n" % (e.name, o, n)
-            n += 1
-        s += "    default: failwith_xl(ERROR_FAIL, \"cannot convert value from %s\"); break;\n" % ty.typename
-        s += "}"
-    elif isinstance(ty, idl.KeyedUnion):
-        n = 0
-        m = 0
-        s += "switch(%s) {\n" % (parent + ty.keyvar.name)
-        for f in ty.fields:
-            s += "\t    case %s:\n" % f.enumname
-            if f.type is None:
-                s += "\t        /* %d: None */\n" % n
-                s += "\t        %s = Val_long(%d);\n" % (o,n)
-                n += 1
-            elif not f.type.has_fields():
-                s += "\t        /* %d: Long */\n" % n
-                s += "\t        %s = Val_long(%d);\n" % (o,n)
-                n += 1
-            else:
-                s += "\t        /* %d: Block */\n" % m
-                (nparent,fexpr) = ty.member(c, f, parent is None)
-                s += "\t        {\n"
-                s += "\t\t        CAMLlocal1(tmp);\n"
-                s += "\t\t        %s = caml_alloc(%d,%d);\n" % (o, 1, m)
-                s += ocaml_Val(f.type, 'tmp', fexpr, indent="\t\t        ", parent=nparent)
-                s += "\n"
-                s += "\t\t        Store_field(%s, 0, tmp);\n" % o
-                s += "\t        }\n"
-                m += 1
-                #s += "\t        %s = caml_alloc(%d,%d);\n" % (o,len(f.type.fields),n)
-            s += "\t        break;\n"
-        s += "\t    default: failwith_xl(ERROR_FAIL, \"cannot convert value from %s\"); break;\n" % ty.typename
-        s += "\t}"
-    elif isinstance(ty,idl.Aggregate) and (parent is None or ty.rawname is None):
-        s += "{\n"
-        if ty.rawname is None:
-            fn = "anon_field"
-        else:
-            fn = "%s_field" % ty.rawname
-        s += "\tCAMLlocal1(%s);\n" % fn
-        s += "\n"
-        s += "\t%s = caml_alloc_tuple(%d);\n" % (o, len(ty.fields))
-
-        n = 0
-        for f in ty.fields:
-            if f.type.private:
-                continue
-
-            (nparent,fexpr) = ty.member(c, f, parent is None)
-
-            s += "\n"
-            s += "\t%s\n" % ocaml_Val(f.type, fn, ty.pass_arg(fexpr, c), parent=nparent)
-            s += "\tStore_field(%s, %d, %s);\n" % (o, n, fn)
-            n = n + 1
-        s += "}"
-    else:
-        s += "%s = Val_%s(%s);" % (o, ty.rawname, ty.pass_arg(c, parent is None))
-
-    return s.replace("\n", "\n%s" % indent).rstrip(indent)
-
-def gen_Val_ocaml(ty, indent=""):
-    s = "/* Convert %s to a caml value */\n" % ty.rawname
-
-    s += "static value Val_%s (%s)\n" % (ty.rawname, ty.make_arg(ty.rawname+"_c"))
-    s += "{\n"
-    s += "\tCAMLparam0();\n"
-    s += "\tCAMLlocal1(%s_ocaml);\n" % ty.rawname
-
-    s += ocaml_Val(ty, "%s_ocaml" % ty.rawname, "%s_c" % ty.rawname, indent="\t") + "\n"
-
-    s += "\tCAMLreturn(%s_ocaml);\n" % ty.rawname
-    s += "}\n"
-    return s.replace("\n", "\n%s" % indent)
-
-def gen_c_stub_prototype(ty, fns):
-    s = "/* Stubs for %s */\n" % ty.rawname
-    for name,args in fns:
-        # For N args we return one value and take N-1 values as parameters
-        s += "value %s(" % stub_fn_name(ty, name)
-        s += ", ".join(["value v%d" % v for v in range(1,len(args))])
-        s += ");\n"
-    return s
-
-def gen_c_default(ty):
-    s = "/* Get the defaults for %s */\n" % ty.rawname
-    # Handle KeyedUnions...
-    union_types = []
-    for f in ty.fields:
-        if isinstance(f.type, idl.KeyedUnion):
-            union_types.append(f.type.keyvar)
-
-    s += "value stub_libxl_%s_init(value ctx, %svalue unit)\n" % (ty.rawname,
-        "".join(["value " + u.name + ", " for u in union_types]))
-    s += "{\n"
-    s += "\tCAMLparam%d(ctx, %sunit);\n" % (len(union_types) + 2, "".join([u.name + ", " for u in union_types]))
-    s += "\tCAMLlocal1(val);\n"
-    s += "\tlibxl_%s c_val;\n" % ty.rawname
-    s += "\tlibxl_%s_init(&c_val);\n" % ty.rawname
-    for u in union_types:
-        s += "\tif (%s != Val_none) {\n" % u.name
-        s += "\t\t%s c = 0;\n" % u.type.typename
-        s += "\t\t%s_val(CTX, &c, Some_val(%s));\n" % (u.type.rawname, u.name)
-        s += "\t\tlibxl_%s_init_%s(&c_val, c);\n" % (ty.rawname, u.name)
-        s += "\t}\n"
-    s += "\tval = Val_%s(&c_val);\n" % ty.rawname
-    if ty.dispose_fn:
-        s += "\tlibxl_%s_dispose(&c_val);\n" % ty.rawname
-    s += "\tCAMLreturn(val);\n"
-    s += "}\n"
-    return s
-
-def gen_c_defaults(ty):
-    s = gen_c_default(ty)
-    return s
-
-def autogen_header(open_comment, close_comment):
-    s = open_comment + " AUTO-GENERATED FILE DO NOT EDIT " + close_comment + "\n"
-    s += open_comment + " autogenerated by \n"
-    s += reduce(lambda x,y: x + " ", range(len(open_comment + " ")), "")
-    s += "%s" % " ".join(sys.argv)
-    s += "\n " + close_comment + "\n\n"
-    return s
-
-if __name__ == '__main__':
-    if len(sys.argv) < 4:
-        print("Usage: genwrap.py <idl> <mli> <ml> <c-inc>", file=sys.stderr)
-        sys.exit(1)
-
-    (_,types) = idl.parse(sys.argv[1])
-
-    # Do not generate these yet.
-    blacklist = [
-        "cpupoolinfo",
-        "vcpuinfo",
-        ]
-
-    for t in blacklist:
-        if t not in [ty.rawname for ty in types]:
-            print("unknown type %s in blacklist" % t)
-
-    types = [ty for ty in types if not ty.rawname in blacklist]
-
-    _ml = sys.argv[3]
-    ml = open(_ml, 'w')
-    ml.write(autogen_header("(*", "*)"))
-
-    _mli = sys.argv[2]
-    mli = open(_mli, 'w')
-    mli.write(autogen_header("(*", "*)"))
-
-    _cinc = sys.argv[4]
-    cinc = open(_cinc, 'w')
-    cinc.write(autogen_header("/*", "*/"))
-
-    for ty in types:
-        if ty.private:
-            continue
-        #sys.stdout.write(" TYPE    %-20s " % ty.rawname)
-        ml.write(gen_ocaml_ml(ty, False))
-        ml.write("\n")
-
-        mli.write(gen_ocaml_ml(ty, True))
-        mli.write("\n")
-
-        if ty.marshal_in():
-            cinc.write(gen_c_val(ty))
-            cinc.write("\n")
-        cinc.write(gen_Val_ocaml(ty))
-        cinc.write("\n")
-        if ty.rawname in functions:
-            cinc.write(gen_c_stub_prototype(ty, functions[ty.rawname]))
-            cinc.write("\n")
-        if ty.init_fn is not None:
-            cinc.write(gen_c_defaults(ty))
-            cinc.write("\n")
-        #sys.stdout.write("\n")
-
-    ml.write("(* END OF AUTO-GENERATED CODE *)\n")
-    ml.close()
-    mli.write("(* END OF AUTO-GENERATED CODE *)\n")
-    mli.close()
-    cinc.close()
diff --git a/tools/ocaml/libs/xl/xenlight.ml.in b/tools/ocaml/libs/xl/xenlight.ml.in
deleted file mode 100644
index 6989bb6638..0000000000
--- a/tools/ocaml/libs/xl/xenlight.ml.in
+++ /dev/null
@@ -1,94 +0,0 @@
-(*
- * Copyright (C) 2009-2011 Citrix Ltd.
- * Author Vincent Hanquez <vincent.hanquez@eu.citrix.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published
- * by the Free Software Foundation; version 2.1 only. with the special
- * exception on linking described in file LICENSE.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU Lesser General Public License for more details.
- *)
-
-type ctx
-type domid = int
-type devid = int
-
-(* @@LIBXL_TYPES@@ *)
-
-exception Error of (error * string)
-
-external ctx_alloc: Xentoollog.handle -> ctx = "stub_libxl_ctx_alloc"
-
-external test_raise_exception: unit -> unit = "stub_raise_exception"
-
-type event =
-	| POLLIN (* There is data to read *)
-	| POLLPRI (* There is urgent data to read *)
-	| POLLOUT (* Writing now will not block *)
-	| POLLERR (* Error condition (revents only) *)
-	| POLLHUP (* Device has been disconnected (revents only) *)
-	| POLLNVAL (* Invalid request: fd not open (revents only). *)
-
-module Domain = struct
-	external create_new : ctx -> Domain_config.t -> ?async:'a -> unit -> domid = "stub_libxl_domain_create_new"
-	external create_restore : ctx -> Domain_config.t -> (Unix.file_descr * Domain_restore_params.t) ->
-		?async:'a -> unit -> domid = "stub_libxl_domain_create_restore"
-	external shutdown : ctx -> domid -> ?async:'a -> unit -> unit = "stub_libxl_domain_shutdown"
-	external reboot : ctx -> domid -> ?async:'a -> unit -> unit = "stub_libxl_domain_reboot"
-	external destroy : ctx -> domid -> ?async:'a -> unit -> unit = "stub_libxl_domain_destroy"
-	external suspend : ctx -> domid -> Unix.file_descr -> ?async:'a -> unit -> unit = "stub_libxl_domain_suspend"
-	external pause : ctx -> domid -> ?async:'a -> unit = "stub_libxl_domain_pause"
-	external unpause : ctx -> domid -> ?async:'a -> unit = "stub_libxl_domain_unpause"
-
-	external send_trigger : ctx -> domid -> trigger -> int -> ?async:'a -> unit = "stub_xl_send_trigger"
-	external send_sysrq : ctx -> domid -> char -> unit = "stub_xl_send_sysrq"
-end
-
-module Host = struct
-	type console_reader
-	exception End_of_file
-
-	external xen_console_read_start : ctx -> int -> console_reader  = "stub_libxl_xen_console_read_start"
-	external xen_console_read_line : ctx -> console_reader -> string = "stub_libxl_xen_console_read_line"
-	external xen_console_read_finish : ctx -> console_reader -> unit = "stub_libxl_xen_console_read_finish"
-
-	external send_debug_keys : ctx -> string -> unit = "stub_xl_send_debug_keys"
-end
-
-module Async = struct
-	type for_libxl
-	type event_hooks
-	type osevent_hooks
-
-	external osevent_register_hooks' : ctx -> 'a -> osevent_hooks = "stub_libxl_osevent_register_hooks"
-	external osevent_occurred_fd : ctx -> for_libxl -> Unix.file_descr -> event list -> event list -> unit = "stub_libxl_osevent_occurred_fd"
-	external osevent_occurred_timeout : ctx -> for_libxl -> unit = "stub_libxl_osevent_occurred_timeout"
-
-	let osevent_register_hooks ctx ~user ~fd_register ~fd_modify ~fd_deregister ~timeout_register ~timeout_fire_now =
-		Callback.register "libxl_fd_register" fd_register;
-		Callback.register "libxl_fd_modify" fd_modify;
-		Callback.register "libxl_fd_deregister" fd_deregister;
-		Callback.register "libxl_timeout_register" timeout_register;
-		Callback.register "libxl_timeout_fire_now" timeout_fire_now;
-		osevent_register_hooks' ctx user
-
-	let async_register_callback ~async_callback =
-		Callback.register "libxl_async_callback" async_callback
-
-	external evenable_domain_death : ctx -> domid -> int -> unit = "stub_libxl_evenable_domain_death"
-	external event_register_callbacks' : ctx -> 'a -> event_hooks = "stub_libxl_event_register_callbacks"
-
-	let event_register_callbacks ctx ~user ~event_occurs_callback ~event_disaster_callback =
-		Callback.register "libxl_event_occurs_callback" event_occurs_callback;
-		Callback.register "libxl_event_disaster_callback" event_disaster_callback;
-		event_register_callbacks' ctx user
-end
-
-let register_exceptions () =
-	Callback.register_exception "Xenlight.Error" (Error(ERROR_FAIL, ""));
-	Callback.register_exception "Xenlight.Host.End_of_file" (Host.End_of_file)
-
diff --git a/tools/ocaml/libs/xl/xenlight.mli.in b/tools/ocaml/libs/xl/xenlight.mli.in
deleted file mode 100644
index b98a3db7e7..0000000000
--- a/tools/ocaml/libs/xl/xenlight.mli.in
+++ /dev/null
@@ -1,93 +0,0 @@
-(*
- * Copyright (C) 2009-2011 Citrix Ltd.
- * Author Vincent Hanquez <vincent.hanquez@eu.citrix.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published
- * by the Free Software Foundation; version 2.1 only. with the special
- * exception on linking described in file LICENSE.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU Lesser General Public License for more details.
- *)
-
-type ctx
-type domid = int
-type devid = int
-
-(* @@LIBXL_TYPES@@ *)
-
-exception Error of (error * string)
-
-val register_exceptions: unit -> unit
-
-external ctx_alloc: Xentoollog.handle -> ctx = "stub_libxl_ctx_alloc"
-
-external test_raise_exception: unit -> unit = "stub_raise_exception"
-
-type event =
-	| POLLIN (* There is data to read *)
-	| POLLPRI (* There is urgent data to read *)
-	| POLLOUT (* Writing now will not block *)
-	| POLLERR (* Error condition (revents only) *)
-	| POLLHUP (* Device has been disconnected (revents only) *)
-	| POLLNVAL (* Invalid request: fd not open (revents only). *)
-
-module Domain : sig
-	external create_new : ctx -> Domain_config.t -> ?async:'a -> unit -> domid = "stub_libxl_domain_create_new"
-	external create_restore : ctx -> Domain_config.t -> (Unix.file_descr * Domain_restore_params.t) ->
-		?async:'a -> unit -> domid = "stub_libxl_domain_create_restore"
-	external shutdown : ctx -> domid -> ?async:'a -> unit -> unit = "stub_libxl_domain_shutdown"
-	external reboot : ctx -> domid -> ?async:'a -> unit -> unit = "stub_libxl_domain_reboot"
-	external destroy : ctx -> domid -> ?async:'a -> unit -> unit = "stub_libxl_domain_destroy"
-	external suspend : ctx -> domid -> Unix.file_descr -> ?async:'a -> unit -> unit = "stub_libxl_domain_suspend"
-	external pause : ctx -> domid -> ?async:'a -> unit = "stub_libxl_domain_pause"
-	external unpause : ctx -> domid -> ?async:'a -> unit = "stub_libxl_domain_unpause"
-
-	external send_trigger : ctx -> domid -> trigger -> int -> ?async:'a -> unit = "stub_xl_send_trigger"
-	external send_sysrq : ctx -> domid -> char -> unit = "stub_xl_send_sysrq"
-end
-
-module Host : sig
-	type console_reader
-	exception End_of_file
-
-	external xen_console_read_start : ctx -> int -> console_reader  = "stub_libxl_xen_console_read_start"
-	external xen_console_read_line : ctx -> console_reader -> string = "stub_libxl_xen_console_read_line"
-	external xen_console_read_finish : ctx -> console_reader -> unit = "stub_libxl_xen_console_read_finish"
-
-	external send_debug_keys : ctx -> string -> unit = "stub_xl_send_debug_keys"
-end
-
-module Async : sig
-	type for_libxl
-	type event_hooks
-	type osevent_hooks
-
-	val osevent_register_hooks : ctx ->
-		user:'a ->
-		fd_register:('a -> Unix.file_descr -> event list -> for_libxl -> 'b) ->
-		fd_modify:('a -> Unix.file_descr -> 'b -> event list -> 'b) ->
-		fd_deregister:('a -> Unix.file_descr -> 'b -> unit) ->
-		timeout_register:('a -> int64 -> int64 -> for_libxl -> 'c) ->
-		timeout_fire_now:('a -> 'c -> 'c) ->
-		osevent_hooks
-
-	external osevent_occurred_fd : ctx -> for_libxl -> Unix.file_descr -> event list -> event list -> unit = "stub_libxl_osevent_occurred_fd"
-	external osevent_occurred_timeout : ctx -> for_libxl -> unit = "stub_libxl_osevent_occurred_timeout"
-
-	val async_register_callback :
-		async_callback:(result:error option -> user:'a -> unit) ->
-		unit
-
-	external evenable_domain_death : ctx -> domid -> int -> unit = "stub_libxl_evenable_domain_death"
-
-	val event_register_callbacks : ctx ->
-		user:'a ->
-		event_occurs_callback:('a -> Event.t -> unit) ->
-		event_disaster_callback:('a -> event_type -> string -> int -> unit) ->
-		event_hooks
-end
-
diff --git a/tools/ocaml/libs/xl/xenlight_stubs.c b/tools/ocaml/libs/xl/xenlight_stubs.c
deleted file mode 100644
index 45b8af61c7..0000000000
--- a/tools/ocaml/libs/xl/xenlight_stubs.c
+++ /dev/null
@@ -1,1663 +0,0 @@
-/*
- * Copyright (C) 2009-2011 Citrix Ltd.
- * Author Vincent Hanquez <vincent.hanquez@eu.citrix.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published
- * by the Free Software Foundation; version 2.1 only. with the special
- * exception on linking described in file LICENSE.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU Lesser General Public License for more details.
- */
-
-#include <stdlib.h>
-
-#define CAML_NAME_SPACE
-#include <caml/alloc.h>
-#include <caml/memory.h>
-#include <caml/signals.h>
-#include <caml/fail.h>
-#include <caml/callback.h>
-#include <caml/custom.h>
-
-#include <sys/mman.h>
-#include <stdint.h>
-#include <string.h>
-
-#include <libxl.h>
-#include <libxl_utils.h>
-
-#include <unistd.h>
-#include <assert.h>
-
-#include "caml_xentoollog.h"
-
-/*
- * Starting with ocaml-3.09.3, CAMLreturn can only be used for ``value''
- * types. CAMLreturnT was only added in 3.09.4, so we define our own
- * version here if needed.
- */
-#ifndef CAMLreturnT
-#define CAMLreturnT(type, result) do { \
-    type caml__temp_result = (result); \
-    caml_local_roots = caml__frame; \
-    return (caml__temp_result); \
-} while (0)
-#endif
-
-/* The following is equal to the CAMLreturn macro, but without the return */
-#define CAMLdone do{ \
-caml_local_roots = caml__frame; \
-}while (0)
-
-#define Ctx_val(x)(*((libxl_ctx **) Data_custom_val(x)))
-#define CTX ((libxl_ctx *) Ctx_val(ctx))
-
-static char * dup_String_val(value s)
-{
-	int len;
-	char *c;
-	len = caml_string_length(s);
-	c = calloc(len + 1, sizeof(char));
-	if (!c)
-		caml_raise_out_of_memory();
-	memcpy(c, String_val(s), len);
-	return c;
-}
-
-/* Forward reference: this is defined in the auto-generated include file below. */
-static value Val_error (libxl_error error_c);
-
-static void failwith_xl(int error, char *fname)
-{
-	CAMLparam0();
-	CAMLlocal1(arg);
-	static const value *exc = NULL;
-
-	/* First time around, lookup by name */
-	if (!exc)
-		exc = caml_named_value("Xenlight.Error");
-
-	if (!exc)
-		caml_invalid_argument("Exception Xenlight.Error not initialized, please link xenlight.cma");
-
-	arg = caml_alloc(2, 0);
-
-	Store_field(arg, 0, Val_error(error));
-	Store_field(arg, 1, caml_copy_string(fname));
-
-	caml_raise_with_arg(*exc, arg);
-	CAMLreturn0;
-}
-
-CAMLprim value stub_raise_exception(value unit)
-{
-	CAMLparam1(unit);
-	failwith_xl(ERROR_FAIL, "test exception");
-	CAMLreturn(Val_unit);
-}
-
-void ctx_finalize(value ctx)
-{
-	libxl_ctx_free(CTX);
-}
-
-static struct custom_operations libxl_ctx_custom_operations = {
-	"libxl_ctx_custom_operations",
-	ctx_finalize /* custom_finalize_default */,
-	custom_compare_default,
-	custom_hash_default,
-	custom_serialize_default,
-	custom_deserialize_default
-};
-
-CAMLprim value stub_libxl_ctx_alloc(value logger)
-{
-	CAMLparam1(logger);
-	CAMLlocal1(handle);
-	libxl_ctx *ctx;
-	int ret;
-
-	ret = libxl_ctx_alloc(&ctx, LIBXL_VERSION, 0, (xentoollog_logger *) Xtl_val(logger));
-	if (ret != 0) \
-		failwith_xl(ERROR_FAIL, "cannot init context");
-
-	handle = caml_alloc_custom(&libxl_ctx_custom_operations, sizeof(ctx), 0, 1);
-	Ctx_val(handle) = ctx;
-
-	CAMLreturn(handle);
-}
-
-static int list_len(value v)
-{
-	int len = 0;
-	while ( v != Val_emptylist ) {
-		len++;
-		v = Field(v, 1);
-	}
-	return len;
-}
-
-static int libxl_key_value_list_val(libxl_key_value_list *c_val,
-	value v)
-{
-	CAMLparam1(v);
-	CAMLlocal1(elem);
-	int nr, i;
-	libxl_key_value_list array;
-
-	nr = list_len(v);
-
-	array = calloc((nr + 1) * 2, sizeof(char *));
-	if (!array)
-		caml_raise_out_of_memory();
-
-	for (i=0; v != Val_emptylist; i++, v = Field(v, 1) ) {
-		elem = Field(v, 0);
-
-		array[i * 2] = dup_String_val(Field(elem, 0));
-		array[i * 2 + 1] = dup_String_val(Field(elem, 1));
-	}
-
-	*c_val = array;
-	CAMLreturn(0);
-}
-
-static value Val_key_value_list(libxl_key_value_list *c_val)
-{
-	CAMLparam0();
-	CAMLlocal5(list, cons, key, val, kv);
-	int i;
-
-	list = Val_emptylist;
-	for (i = libxl_string_list_length((libxl_string_list *) c_val) - 1; i >= 0; i -= 2) {
-		val = caml_copy_string((*c_val)[i]);
-		key = caml_copy_string((*c_val)[i - 1]);
-		kv = caml_alloc_tuple(2);
-		Store_field(kv, 0, key);
-		Store_field(kv, 1, val);
-
-		cons = caml_alloc(2, 0);
-		Store_field(cons, 0, kv);   // head
-		Store_field(cons, 1, list);   // tail
-		list = cons;
-	}
-
-	CAMLreturn(list);
-}
-
-static int libxl_string_list_val(libxl_string_list *c_val, value v)
-{
-	CAMLparam1(v);
-	int nr, i;
-	libxl_string_list array;
-
-	nr = list_len(v);
-
-	array = calloc(nr + 1, sizeof(char *));
-	if (!array)
-		caml_raise_out_of_memory();
-
-	for (i=0; v != Val_emptylist; i++, v = Field(v, 1) )
-		array[i] = dup_String_val(Field(v, 0));
-
-	*c_val = array;
-	CAMLreturn(0);
-}
-
-static value Val_string_list(libxl_string_list *c_val)
-{
-	CAMLparam0();
-	CAMLlocal3(list, cons, string);
-	int i;
-
-	list = Val_emptylist;
-	for (i = libxl_string_list_length(c_val) - 1; i >= 0; i--) {
-		string = caml_copy_string((*c_val)[i]);
-		cons = caml_alloc(2, 0);
-		Store_field(cons, 0, string);   // head
-		Store_field(cons, 1, list);     // tail
-		list = cons;
-	}
-
-	CAMLreturn(list);
-}
-
-/* Option type support as per http://www.linux-nantes.org/~fmonnier/ocaml/ocaml-wrapping-c.php */
-#ifndef Val_none
-#define Val_none Val_int(0)
-#endif
-#ifndef Some_val
-#define Some_val(v) Field(v,0)
-#endif
-
-static value Val_some(value v)
-{
-	CAMLparam1(v);
-	CAMLlocal1(some);
-	some = caml_alloc(1, 0);
-	Store_field(some, 0, v);
-	CAMLreturn(some);
-}
-
-static value Val_mac (libxl_mac *c_val)
-{
-	CAMLparam0();
-	CAMLlocal1(v);
-	int i;
-
-	v = caml_alloc_tuple(6);
-
-	for(i=0; i<6; i++)
-		Store_field(v, i, Val_int((*c_val)[i]));
-
-	CAMLreturn(v);
-}
-
-static int Mac_val(libxl_mac *c_val, value v)
-{
-	CAMLparam1(v);
-	int i;
-
-	for(i=0; i<6; i++)
-		(*c_val)[i] = Int_val(Field(v, i));
-
-	CAMLreturn(0);
-}
-
-static value Val_bitmap (libxl_bitmap *c_val)
-{
-	CAMLparam0();
-	CAMLlocal1(v);
-	int i;
-
-	if (c_val->size == 0)
-		v = Atom(0);
-	else {
-	    v = caml_alloc(8 * (c_val->size), 0);
-	    libxl_for_each_bit(i, *c_val) {
-		    if (libxl_bitmap_test(c_val, i))
-			    Store_field(v, i, Val_true);
-		    else
-			    Store_field(v, i, Val_false);
-	    }
-	}
-	CAMLreturn(v);
-}
-
-static int Bitmap_val(libxl_ctx *ctx, libxl_bitmap *c_val, value v)
-{
-	CAMLparam1(v);
-	int i, len = Wosize_val(v);
-
-	c_val->size = 0;
-	if (len > 0 && libxl_bitmap_alloc(ctx, c_val, len))
-		failwith_xl(ERROR_NOMEM, "cannot allocate bitmap");
-	for (i=0; i<len; i++) {
-		if (Int_val(Field(v, i)))
-			libxl_bitmap_set(c_val, i);
-		else
-			libxl_bitmap_reset(c_val, i);
-	}
-	CAMLreturn(0);
-}
-
-static value Val_uuid (libxl_uuid *c_val)
-{
-	CAMLparam0();
-	CAMLlocal1(v);
-	uint8_t *uuid = libxl_uuid_bytearray(c_val);
-	int i;
-
-	v = caml_alloc_tuple(16);
-
-	for(i=0; i<16; i++)
-		Store_field(v, i, Val_int(uuid[i]));
-
-	CAMLreturn(v);
-}
-
-static int Uuid_val(libxl_uuid *c_val, value v)
-{
-	CAMLparam1(v);
-	int i;
-	uint8_t *uuid = libxl_uuid_bytearray(c_val);
-
-	for(i=0; i<16; i++)
-		uuid[i] = Int_val(Field(v, i));
-
-	CAMLreturn(0);
-}
-
-static value Val_defbool(libxl_defbool c_val)
-{
-	CAMLparam0();
-	CAMLlocal2(v1, v2);
-	bool b;
-
-	if (libxl_defbool_is_default(c_val))
-		v2 = Val_none;
-	else {
-		b = libxl_defbool_val(c_val);
-		v1 = b ? Val_bool(true) : Val_bool(false);
-		v2 = Val_some(v1);
-	}
-	CAMLreturn(v2);
-}
-
-static libxl_defbool Defbool_val(value v)
-{
-	CAMLparam1(v);
-	libxl_defbool db;
-	if (v == Val_none)
-		libxl_defbool_unset(&db);
-	else {
-		bool b = Bool_val(Some_val(v));
-		libxl_defbool_set(&db, b);
-	}
-	CAMLreturnT(libxl_defbool, db);
-}
-
-static value Val_hwcap(libxl_hwcap *c_val)
-{
-	CAMLparam0();
-	CAMLlocal1(hwcap);
-	int i;
-
-	hwcap = caml_alloc_tuple(8);
-	for (i = 0; i < 8; i++)
-		Store_field(hwcap, i, caml_copy_int32((*c_val)[i]));
-
-	CAMLreturn(hwcap);
-}
-
-static value Val_ms_vm_genid (libxl_ms_vm_genid *c_val)
-{
-	CAMLparam0();
-	CAMLlocal1(v);
-	int i;
-
-	v = caml_alloc_tuple(LIBXL_MS_VM_GENID_LEN);
-
-	for(i=0; i<LIBXL_MS_VM_GENID_LEN; i++)
-		Store_field(v, i, Val_int(c_val->bytes[i]));
-
-	CAMLreturn(v);
-}
-
-static int Ms_vm_genid_val(libxl_ms_vm_genid *c_val, value v)
-{
-	CAMLparam1(v);
-	int i;
-
-	for(i=0; i<LIBXL_MS_VM_GENID_LEN; i++)
-		c_val->bytes[i] = Int_val(Field(v, i));
-
-	CAMLreturn(0);
-}
-
-static value Val_string_option(const char *c_val)
-{
-	CAMLparam0();
-	CAMLlocal2(tmp1, tmp2);
-	if (c_val) {
-		tmp1 = caml_copy_string(c_val);
-		tmp2 = Val_some(tmp1);
-		CAMLreturn(tmp2);
-	}
-	else
-		CAMLreturn(Val_none);
-}
-
-static char *String_option_val(value v)
-{
-	CAMLparam1(v);
-	char *s = NULL;
-	if (v != Val_none)
-		s = dup_String_val(Some_val(v));
-	CAMLreturnT(char *, s);
-}
-
-#include "_libxl_types.inc"
-
-void async_callback(libxl_ctx *ctx, int rc, void *for_callback)
-{
-	caml_leave_blocking_section();
-	CAMLparam0();
-	CAMLlocal2(error, tmp);
-	static const value *func = NULL;
-	value *p = (value *) for_callback;
-
-	if (func == NULL) {
-		/* First time around, lookup by name */
-		func = caml_named_value("libxl_async_callback");
-	}
-
-	if (rc == 0)
-		error = Val_none;
-	else {
-		tmp = Val_error(rc);
-		error = Val_some(tmp);
-	}
-
-	/* for_callback is a pointer to a "value" that was malloc'ed and
-	 * registered with the OCaml GC. The value is handed back to OCaml
-	 * in the following callback, after which the pointer is unregistered
-	 * and freed. */
-	caml_callback2(*func, error, *p);
-
-	caml_remove_global_root(p);
-	free(p);
-
-	CAMLdone;
-	caml_enter_blocking_section();
-}
-
-static libxl_asyncop_how *aohow_val(value async)
-{
-	CAMLparam1(async);
-	libxl_asyncop_how *ao_how = NULL;
-	value *p;
-
-	if (async != Val_none) {
-		/* for_callback must be a pointer to a "value" that is malloc'ed and
-		 * registered with the OCaml GC. This ensures that the GC does not remove
-		 * the corresponding OCaml heap blocks, and allows the GC to update the value
-		 * when blocks are moved around, while libxl is free to copy the pointer if
-		 * it needs to.
-		 * The for_callback pointer must always be non-NULL. */
-		p = malloc(sizeof(value));
-		if (!p)
-			failwith_xl(ERROR_NOMEM, "cannot allocate value");
-		*p = Some_val(async);
-		caml_register_global_root(p);
-		ao_how = malloc(sizeof(*ao_how));
-		ao_how->callback = async_callback;
-		ao_how->u.for_callback = (void *) p;
-	}
-
-	CAMLreturnT(libxl_asyncop_how *, ao_how);
-}
-
-value stub_libxl_domain_create_new(value ctx, value domain_config, value async, value unit)
-{
-	CAMLparam4(ctx, async, domain_config, unit);
-	int ret;
-	libxl_domain_config c_dconfig;
-	uint32_t c_domid;
-	libxl_asyncop_how *ao_how;
-
-	libxl_domain_config_init(&c_dconfig);
-	ret = domain_config_val(CTX, &c_dconfig, domain_config);
-	if (ret != 0) {
-		libxl_domain_config_dispose(&c_dconfig);
-		failwith_xl(ret, "domain_create_new");
-	}
-
-	ao_how = aohow_val(async);
-
-	caml_enter_blocking_section();
-	ret = libxl_domain_create_new(CTX, &c_dconfig, &c_domid, ao_how, NULL);
-	caml_leave_blocking_section();
-
-	free(ao_how);
-	libxl_domain_config_dispose(&c_dconfig);
-
-	if (ret != 0)
-		failwith_xl(ret, "domain_create_new");
-
-	CAMLreturn(Val_int(c_domid));
-}
-
-value stub_libxl_domain_create_restore(value ctx, value domain_config, value params,
-	value async, value unit)
-{
-	CAMLparam5(ctx, domain_config, params, async, unit);
-	int ret;
-	libxl_domain_config c_dconfig;
-	libxl_domain_restore_params c_params;
-	uint32_t c_domid;
-	libxl_asyncop_how *ao_how;
-	int restore_fd;
-
-	libxl_domain_config_init(&c_dconfig);
-	ret = domain_config_val(CTX, &c_dconfig, domain_config);
-	if (ret != 0) {
-		libxl_domain_config_dispose(&c_dconfig);
-		failwith_xl(ret, "domain_create_restore");
-	}
-
-	libxl_domain_restore_params_init(&c_params);
-	ret = domain_restore_params_val(CTX, &c_params, Field(params, 1));
-	if (ret != 0) {
-		libxl_domain_restore_params_dispose(&c_params);
-		failwith_xl(ret, "domain_create_restore");
-	}
-
-	ao_how = aohow_val(async);
-	restore_fd = Int_val(Field(params, 0));
-
-	caml_enter_blocking_section();
-	ret = libxl_domain_create_restore(CTX, &c_dconfig, &c_domid, restore_fd,
-		-1, &c_params, ao_how, NULL);
-	caml_leave_blocking_section();
-
-	free(ao_how);
-	libxl_domain_config_dispose(&c_dconfig);
-	libxl_domain_restore_params_dispose(&c_params);
-
-	if (ret != 0)
-		failwith_xl(ret, "domain_create_restore");
-
-	CAMLreturn(Val_int(c_domid));
-}
-
-value stub_libxl_domain_shutdown(value ctx, value domid, value async, value unit)
-{
-	CAMLparam4(ctx, domid, async, unit);
-	int ret;
-	uint32_t c_domid = Int_val(domid);
-	libxl_asyncop_how *ao_how = aohow_val(async);
-
-	caml_enter_blocking_section();
-	ret = libxl_domain_shutdown(CTX, c_domid, ao_how);
-	caml_leave_blocking_section();
-
-	free(ao_how);
-
-	if (ret != 0)
-		failwith_xl(ret, "domain_shutdown");
-
-	CAMLreturn(Val_unit);
-}
-
-value stub_libxl_domain_reboot(value ctx, value domid, value async, value unit)
-{
-	CAMLparam4(ctx, domid, async, unit);
-	int ret;
-	uint32_t c_domid = Int_val(domid);
-	libxl_asyncop_how *ao_how = aohow_val(async);
-
-	caml_enter_blocking_section();
-	ret = libxl_domain_reboot(CTX, c_domid, ao_how);
-	caml_leave_blocking_section();
-
-	free(ao_how);
-
-	if (ret != 0)
-		failwith_xl(ret, "domain_reboot");
-
-	CAMLreturn(Val_unit);
-}
-
-value stub_libxl_domain_destroy(value ctx, value domid, value async, value unit)
-{
-	CAMLparam4(ctx, domid, async, unit);
-	int ret;
-	uint32_t c_domid = Int_val(domid);
-	libxl_asyncop_how *ao_how = aohow_val(async);
-
-	caml_enter_blocking_section();
-	ret = libxl_domain_destroy(CTX, c_domid, ao_how);
-	caml_leave_blocking_section();
-
-	free(ao_how);
-
-	if (ret != 0)
-		failwith_xl(ret, "domain_destroy");
-
-	CAMLreturn(Val_unit);
-}
-
-value stub_libxl_domain_suspend(value ctx, value domid, value fd, value async, value unit)
-{
-	CAMLparam5(ctx, domid, fd, async, unit);
-	int ret;
-	uint32_t c_domid = Int_val(domid);
-	int c_fd = Int_val(fd);
-	libxl_asyncop_how *ao_how = aohow_val(async);
-
-	caml_enter_blocking_section();
-	ret = libxl_domain_suspend(CTX, c_domid, c_fd, 0, ao_how);
-	caml_leave_blocking_section();
-
-	free(ao_how);
-
-	if (ret != 0)
-		failwith_xl(ret, "domain_suspend");
-
-	CAMLreturn(Val_unit);
-}
-
-value stub_libxl_domain_pause(value ctx, value domid, value async)
-{
-	CAMLparam3(ctx, domid, async);
-	int ret;
-	uint32_t c_domid = Int_val(domid);
-	libxl_asyncop_how *ao_how = aohow_val(async);
-
-	caml_enter_blocking_section();
-	ret = libxl_domain_pause(CTX, c_domid, ao_how);
-	caml_leave_blocking_section();
-
-	free(ao_how);
-
-	if (ret != 0)
-		failwith_xl(ret, "domain_pause");
-
-	CAMLreturn(Val_unit);
-}
-
-value stub_libxl_domain_unpause(value ctx, value domid, value async)
-{
-	CAMLparam3(ctx, domid, async);
-	int ret;
-	uint32_t c_domid = Int_val(domid);
-	libxl_asyncop_how *ao_how = aohow_val(async);
-
-	caml_enter_blocking_section();
-	ret = libxl_domain_unpause(CTX, c_domid, ao_how);
-	caml_leave_blocking_section();
-
-	free(ao_how);
-
-	if (ret != 0)
-		failwith_xl(ret, "domain_unpause");
-
-	CAMLreturn(Val_unit);
-}
-
-#define _STRINGIFY(x) #x
-#define STRINGIFY(x) _STRINGIFY(x)
-
-#define _DEVICE_ADDREMOVE(type,fn,op)					\
-value stub_xl_device_##type##_##op(value ctx, value info, value domid,	\
-	value async, value unit)					\
-{									\
-	CAMLparam5(ctx, info, domid, async, unit);			\
-	libxl_device_##type c_info;					\
-	int ret, marker_var;						\
-	uint32_t c_domid = Int_val(domid);				\
-	libxl_asyncop_how *ao_how = aohow_val(async);			\
-									\
-	device_##type##_val(CTX, &c_info, info);			\
-									\
-	caml_enter_blocking_section();					\
-	ret = libxl_##fn##_##op(CTX, c_domid, &c_info, ao_how);		\
-	caml_leave_blocking_section();					\
-									\
-	free(ao_how);							\
-	libxl_device_##type##_dispose(&c_info);				\
-									\
-	if (ret != 0)							\
-		failwith_xl(ret, STRINGIFY(type) "_" STRINGIFY(op));	\
-									\
-	CAMLreturn(Val_unit);						\
-}
-
-#define DEVICE_ADDREMOVE(type) \
-	_DEVICE_ADDREMOVE(type, device_##type, add) \
-	_DEVICE_ADDREMOVE(type, device_##type, remove) \
-	_DEVICE_ADDREMOVE(type, device_##type, destroy)
-
-DEVICE_ADDREMOVE(disk)
-DEVICE_ADDREMOVE(nic)
-DEVICE_ADDREMOVE(vfb)
-DEVICE_ADDREMOVE(vkb)
-DEVICE_ADDREMOVE(pci)
-_DEVICE_ADDREMOVE(disk, cdrom, insert)
-
-value stub_xl_device_nic_of_devid(value ctx, value domid, value devid)
-{
-	CAMLparam3(ctx, domid, devid);
-	CAMLlocal1(nic);
-	libxl_device_nic c_nic;
-	uint32_t c_domid = Int_val(domid);
-	int c_devid = Int_val(devid);
-
-	caml_enter_blocking_section();
-	libxl_devid_to_device_nic(CTX, c_domid, c_devid, &c_nic);
-	caml_leave_blocking_section();
-
-	nic = Val_device_nic(&c_nic);
-	libxl_device_nic_dispose(&c_nic);
-
-	CAMLreturn(nic);
-}
-
-value stub_xl_device_nic_list(value ctx, value domid)
-{
-	CAMLparam2(ctx, domid);
-	CAMLlocal2(list, temp);
-	libxl_device_nic *c_list;
-	int i, nb;
-	uint32_t c_domid = Int_val(domid);
-
-	caml_enter_blocking_section();
-	c_list = libxl_device_nic_list(CTX, c_domid, &nb);
-	caml_leave_blocking_section();
-
-	if (!c_list)
-		failwith_xl(ERROR_FAIL, "nic_list");
-
-	list = temp = Val_emptylist;
-	for (i = 0; i < nb; i++) {
-		list = caml_alloc_small(2, Tag_cons);
-		Field(list, 0) = Val_int(0);
-		Field(list, 1) = temp;
-		temp = list;
-		Store_field(list, 0, Val_device_nic(&c_list[i]));
-	}
-	libxl_device_nic_list_free(c_list, nb);
-
-	CAMLreturn(list);
-}
-
-value stub_xl_device_disk_list(value ctx, value domid)
-{
-	CAMLparam2(ctx, domid);
-	CAMLlocal2(list, temp);
-	libxl_device_disk *c_list;
-	int i, nb;
-	uint32_t c_domid = Int_val(domid);
-
-	caml_enter_blocking_section();
-	c_list = libxl_device_disk_list(CTX, c_domid, &nb);
-	caml_leave_blocking_section();
-
-	if (!c_list)
-		failwith_xl(ERROR_FAIL, "disk_list");
-
-	list = temp = Val_emptylist;
-	for (i = 0; i < nb; i++) {
-		list = caml_alloc_small(2, Tag_cons);
-		Field(list, 0) = Val_int(0);
-		Field(list, 1) = temp;
-		temp = list;
-		Store_field(list, 0, Val_device_disk(&c_list[i]));
-	}
-	libxl_device_disk_list_free(c_list, nb);
-
-	CAMLreturn(list);
-}
-
-value stub_xl_device_disk_of_vdev(value ctx, value domid, value vdev)
-{
-	CAMLparam3(ctx, domid, vdev);
-	CAMLlocal1(disk);
-	libxl_device_disk c_disk;
-	char *c_vdev;
-	uint32_t c_domid = Int_val(domid);
-
-	c_vdev = strdup(String_val(vdev));
-
-	caml_enter_blocking_section();
-	libxl_vdev_to_device_disk(CTX, c_domid, c_vdev, &c_disk);
-	caml_leave_blocking_section();
-
-	disk = Val_device_disk(&c_disk);
-	libxl_device_disk_dispose(&c_disk);
-	free(c_vdev);
-
-	CAMLreturn(disk);
-}
-
-value stub_xl_device_pci_list(value ctx, value domid)
-{
-	CAMLparam2(ctx, domid);
-	CAMLlocal2(list, temp);
-	libxl_device_pci *c_list;
-	int i, nb;
-	uint32_t c_domid = Int_val(domid);
-
-	caml_enter_blocking_section();
-	c_list = libxl_device_pci_list(CTX, c_domid, &nb);
-	caml_leave_blocking_section();
-
-	if (!c_list)
-		failwith_xl(ERROR_FAIL, "pci_list");
-
-	list = temp = Val_emptylist;
-	for (i = 0; i < nb; i++) {
-		list = caml_alloc_small(2, Tag_cons);
-		Field(list, 0) = Val_int(0);
-		Field(list, 1) = temp;
-		temp = list;
-		Store_field(list, 0, Val_device_pci(&c_list[i]));
-		libxl_device_pci_dispose(&c_list[i]);
-	}
-	free(c_list);
-
-	CAMLreturn(list);
-}
-
-value stub_xl_device_pci_assignable_add(value ctx, value info, value rebind)
-{
-	CAMLparam3(ctx, info, rebind);
-	libxl_device_pci c_info;
-	int ret, marker_var;
-	int c_rebind = (int) Bool_val(rebind);
-
-	device_pci_val(CTX, &c_info, info);
-
-	caml_enter_blocking_section();
-	ret = libxl_device_pci_assignable_add(CTX, &c_info, c_rebind);
-	caml_leave_blocking_section();
-
-	libxl_device_pci_dispose(&c_info);
-
-	if (ret != 0)
-		failwith_xl(ret, "pci_assignable_add");
-
-	CAMLreturn(Val_unit);
-}
-
-value stub_xl_device_pci_assignable_remove(value ctx, value info, value rebind)
-{
-	CAMLparam3(ctx, info, rebind);
-	libxl_device_pci c_info;
-	int ret, marker_var;
-	int c_rebind = (int) Bool_val(rebind);
-
-	device_pci_val(CTX, &c_info, info);
-
-	caml_enter_blocking_section();
-	ret = libxl_device_pci_assignable_remove(CTX, &c_info, c_rebind);
-	caml_leave_blocking_section();
-
-	libxl_device_pci_dispose(&c_info);
-
-	if (ret != 0)
-		failwith_xl(ret, "pci_assignable_remove");
-
-	CAMLreturn(Val_unit);
-}
-
-value stub_xl_device_pci_assignable_list(value ctx)
-{
-	CAMLparam1(ctx);
-	CAMLlocal2(list, temp);
-	libxl_device_pci *c_list;
-	int i, nb;
-	uint32_t c_domid;
-
-	caml_enter_blocking_section();
-	c_list = libxl_device_pci_assignable_list(CTX, &nb);
-	caml_leave_blocking_section();
-
-	if (!c_list)
-		failwith_xl(ERROR_FAIL, "pci_assignable_list");
-
-	list = temp = Val_emptylist;
-	for (i = 0; i < nb; i++) {
-		list = caml_alloc_small(2, Tag_cons);
-		Field(list, 0) = Val_int(0);
-		Field(list, 1) = temp;
-		temp = list;
-		Store_field(list, 0, Val_device_pci(&c_list[i]));
-	}
-	libxl_device_pci_assignable_list_free(c_list, nb);
-
-	CAMLreturn(list);
-}
-
-value stub_xl_physinfo_get(value ctx)
-{
-	CAMLparam1(ctx);
-	CAMLlocal1(physinfo);
-	libxl_physinfo c_physinfo;
-	int ret;
-
-	caml_enter_blocking_section();
-	ret = libxl_get_physinfo(CTX, &c_physinfo);
-	caml_leave_blocking_section();
-
-	if (ret != 0)
-		failwith_xl(ret, "get_physinfo");
-
-	physinfo = Val_physinfo(&c_physinfo);
-
-	libxl_physinfo_dispose(&c_physinfo);
-
-	CAMLreturn(physinfo);
-}
-
-value stub_xl_cputopology_get(value ctx)
-{
-	CAMLparam1(ctx);
-	CAMLlocal3(topology, v, v0);
-	libxl_cputopology *c_topology;
-	int i, nr;
-
-	caml_enter_blocking_section();
-	c_topology = libxl_get_cpu_topology(CTX, &nr);
-	caml_leave_blocking_section();
-
-	if (!c_topology)
-		failwith_xl(ERROR_FAIL, "get_cpu_topologyinfo");
-
-	topology = caml_alloc_tuple(nr);
-	for (i = 0; i < nr; i++) {
-		if (c_topology[i].core != LIBXL_CPUTOPOLOGY_INVALID_ENTRY) {
-			v0 = Val_cputopology(&c_topology[i]);
-			v = Val_some(v0);
-		}
-		else
-			v = Val_none;
-		Store_field(topology, i, v);
-	}
-
-	libxl_cputopology_list_free(c_topology, nr);
-
-	CAMLreturn(topology);
-}
-
-value stub_xl_dominfo_list(value ctx)
-{
-	CAMLparam1(ctx);
-	CAMLlocal2(domlist, temp);
-	libxl_dominfo *c_domlist;
-	int i, nb;
-
-	caml_enter_blocking_section();
-	c_domlist = libxl_list_domain(CTX, &nb);
-	caml_leave_blocking_section();
-
-	if (!c_domlist)
-		failwith_xl(ERROR_FAIL, "dominfo_list");
-
-	domlist = temp = Val_emptylist;
-	for (i = nb - 1; i >= 0; i--) {
-		domlist = caml_alloc_small(2, Tag_cons);
-		Field(domlist, 0) = Val_int(0);
-		Field(domlist, 1) = temp;
-		temp = domlist;
-
-		Store_field(domlist, 0, Val_dominfo(&c_domlist[i]));
-	}
-
-	libxl_dominfo_list_free(c_domlist, nb);
-
-	CAMLreturn(domlist);
-}
-
-value stub_xl_dominfo_get(value ctx, value domid)
-{
-	CAMLparam2(ctx, domid);
-	CAMLlocal1(dominfo);
-	libxl_dominfo c_dominfo;
-	int ret;
-	uint32_t c_domid = Int_val(domid);
-
-	caml_enter_blocking_section();
-	ret = libxl_domain_info(CTX, &c_dominfo, c_domid);
-	caml_leave_blocking_section();
-
-	if (ret != 0)
-		failwith_xl(ERROR_FAIL, "domain_info");
-	dominfo = Val_dominfo(&c_dominfo);
-
-	CAMLreturn(dominfo);
-}
-
-value stub_xl_domain_sched_params_get(value ctx, value domid)
-{
-	CAMLparam2(ctx, domid);
-	CAMLlocal1(scinfo);
-	libxl_domain_sched_params c_scinfo;
-	int ret;
-	uint32_t c_domid = Int_val(domid);
-
-	caml_enter_blocking_section();
-	ret = libxl_domain_sched_params_get(CTX, c_domid, &c_scinfo);
-	caml_leave_blocking_section();
-
-	if (ret != 0)
-		failwith_xl(ret, "domain_sched_params_get");
-
-	scinfo = Val_domain_sched_params(&c_scinfo);
-
-	libxl_domain_sched_params_dispose(&c_scinfo);
-
-	CAMLreturn(scinfo);
-}
-
-value stub_xl_domain_sched_params_set(value ctx, value domid, value scinfo)
-{
-	CAMLparam3(ctx, domid, scinfo);
-	libxl_domain_sched_params c_scinfo;
-	int ret;
-	uint32_t c_domid = Int_val(domid);
-
-	domain_sched_params_val(CTX, &c_scinfo, scinfo);
-
-	caml_enter_blocking_section();
-	ret = libxl_domain_sched_params_set(CTX, c_domid, &c_scinfo);
-	caml_leave_blocking_section();
-
-	libxl_domain_sched_params_dispose(&c_scinfo);
-
-	if (ret != 0)
-		failwith_xl(ret, "domain_sched_params_set");
-
-	CAMLreturn(Val_unit);
-}
-
-value stub_xl_send_trigger(value ctx, value domid, value trigger, value vcpuid, value async)
-{
-	CAMLparam5(ctx, domid, trigger, vcpuid, async);
-	int ret;
-	uint32_t c_domid = Int_val(domid);
-	libxl_trigger c_trigger = LIBXL_TRIGGER_UNKNOWN;
-	int c_vcpuid = Int_val(vcpuid);
-	libxl_asyncop_how *ao_how = aohow_val(async);
-
-	trigger_val(CTX, &c_trigger, trigger);
-
-	caml_enter_blocking_section();
-	ret = libxl_send_trigger(CTX, c_domid, c_trigger, c_vcpuid, ao_how);
-	caml_leave_blocking_section();
-
-	free(ao_how);
-
-	if (ret != 0)
-		failwith_xl(ret, "send_trigger");
-
-	CAMLreturn(Val_unit);
-}
-
-value stub_xl_send_sysrq(value ctx, value domid, value sysrq)
-{
-	CAMLparam3(ctx, domid, sysrq);
-	int ret;
-	uint32_t c_domid = Int_val(domid);
-	int c_sysrq = Int_val(sysrq);
-
-	caml_enter_blocking_section();
-	ret = libxl_send_sysrq(CTX, c_domid, c_sysrq);
-	caml_leave_blocking_section();
-
-	if (ret != 0)
-		failwith_xl(ret, "send_sysrq");
-
-	CAMLreturn(Val_unit);
-}
-
-value stub_xl_send_debug_keys(value ctx, value keys)
-{
-	CAMLparam2(ctx, keys);
-	int ret;
-	char *c_keys;
-
-	c_keys = dup_String_val(keys);
-
-	caml_enter_blocking_section();
-	ret = libxl_send_debug_keys(CTX, c_keys);
-	caml_leave_blocking_section();
-
-	free(c_keys);
-
-	if (ret != 0)
-		failwith_xl(ret, "send_debug_keys");
-
-	CAMLreturn(Val_unit);
-}
-
-static struct custom_operations libxl_console_reader_custom_operations = {
-	"libxl_console_reader_custom_operations",
-	custom_finalize_default,
-	custom_compare_default,
-	custom_hash_default,
-	custom_serialize_default,
-	custom_deserialize_default
-};
-
-#define Console_reader_val(x)(*((libxl_xen_console_reader **) Data_custom_val(x)))
-
-value stub_libxl_xen_console_read_start(value ctx, value clear)
-{
-	CAMLparam2(ctx, clear);
-	CAMLlocal1(handle);
-	int c_clear = Int_val(clear);
-	libxl_xen_console_reader *cr;
-
-	caml_enter_blocking_section();
-	cr = libxl_xen_console_read_start(CTX, c_clear);
-	caml_leave_blocking_section();
-
-	handle = caml_alloc_custom(&libxl_console_reader_custom_operations, sizeof(cr), 0, 1);
-	Console_reader_val(handle) = cr;
-
-	CAMLreturn(handle);
-}
-
-static void raise_eof(void)
-{
-	static const value *exc = NULL;
-
-	/* First time around, lookup by name */
-	if (!exc)
-		exc = caml_named_value("Xenlight.Host.End_of_file");
-
-	if (!exc)
-		caml_invalid_argument("Exception Xenlight.Host.End_of_file not initialized, please link xenlight.cma");
-
-	caml_raise_constant(*exc);
-}
-
-value stub_libxl_xen_console_read_line(value ctx, value reader)
-{
-	CAMLparam2(ctx, reader);
-	CAMLlocal1(line);
-	int ret;
-	char *c_line;
-	libxl_xen_console_reader *cr = (libxl_xen_console_reader *) Console_reader_val(reader);
-
-	caml_enter_blocking_section();
-	ret = libxl_xen_console_read_line(CTX, cr, &c_line);
-	caml_leave_blocking_section();
-
-	if (ret < 0)
-		failwith_xl(ret, "xen_console_read_line");
-	if (ret == 0)
-		raise_eof();
-
-	line = caml_copy_string(c_line);
-
-	CAMLreturn(line);
-}
-
-value stub_libxl_xen_console_read_finish(value ctx, value reader)
-{
-	CAMLparam2(ctx, reader);
-	libxl_xen_console_reader *cr = (libxl_xen_console_reader *) Console_reader_val(reader);
-
-	caml_enter_blocking_section();
-	libxl_xen_console_read_finish(CTX, cr);
-	caml_leave_blocking_section();
-
-	CAMLreturn(Val_unit);
-}
-
-/* Event handling */
-
-short Poll_val(value event)
-{
-	CAMLparam1(event);
-	short res = -1;
-
-	switch (Int_val(event)) {
-		case 0: res = POLLIN; break;
-		case 1: res = POLLPRI; break;
-		case 2: res = POLLOUT; break;
-		case 3: res = POLLERR; break;
-		case 4: res = POLLHUP; break;
-		case 5: res = POLLNVAL; break;
-	}
-
-	CAMLreturn(res);
-}
-
-short Poll_events_val(value event_list)
-{
-	CAMLparam1(event_list);
-	short events = 0;
-
-	while (event_list != Val_emptylist) {
-		events |= Poll_val(Field(event_list, 0));
-		event_list = Field(event_list, 1);
-	}
-
-	CAMLreturn(events);
-}
-
-value Val_poll(short event)
-{
-	CAMLparam0();
-	CAMLlocal1(res);
-
-	switch (event) {
-		case POLLIN: res = Val_int(0); break;
-		case POLLPRI: res = Val_int(1); break;
-		case POLLOUT: res = Val_int(2); break;
-		case POLLERR: res = Val_int(3); break;
-		case POLLHUP: res = Val_int(4); break;
-		case POLLNVAL: res = Val_int(5); break;
-		default: failwith_xl(ERROR_FAIL, "cannot convert poll event value"); break;
-	}
-
-	CAMLreturn(res);
-}
-
-value add_event(value event_list, short event)
-{
-	CAMLparam1(event_list);
-	CAMLlocal1(new_list);
-
-	new_list = caml_alloc(2, 0);
-	Store_field(new_list, 0, Val_poll(event));
-	Store_field(new_list, 1, event_list);
-
-	CAMLreturn(new_list);
-}
-
-value Val_poll_events(short events)
-{
-	CAMLparam0();
-	CAMLlocal1(event_list);
-
-	event_list = Val_emptylist;
-	if (events & POLLIN)
-		event_list = add_event(event_list, POLLIN);
-	if (events & POLLPRI)
-		event_list = add_event(event_list, POLLPRI);
-	if (events & POLLOUT)
-		event_list = add_event(event_list, POLLOUT);
-	if (events & POLLERR)
-		event_list = add_event(event_list, POLLERR);
-	if (events & POLLHUP)
-		event_list = add_event(event_list, POLLHUP);
-	if (events & POLLNVAL)
-		event_list = add_event(event_list, POLLNVAL);
-
-	CAMLreturn(event_list);
-}
-
-/* The process for dealing with the for_app_registration_  values in the
- * callbacks below (GC registrations etc) is similar to the way for_callback is
- * handled in the asynchronous operations above. */
-
-int fd_register(void *user, int fd, void **for_app_registration_out,
-                     short events, void *for_libxl)
-{
-	caml_leave_blocking_section();
-	CAMLparam0();
-	CAMLlocalN(args, 4);
-	int ret = 0;
-	static const value *func = NULL;
-	value *p = (value *) user;
-	value *for_app;
-
-	if (func == NULL) {
-		/* First time around, lookup by name */
-		func = caml_named_value("libxl_fd_register");
-	}
-
-	args[0] = *p;
-	args[1] = Val_int(fd);
-	args[2] = Val_poll_events(events);
-	args[3] = (value) for_libxl;
-
-	for_app = malloc(sizeof(value));
-	if (!for_app) {
-		ret = ERROR_OSEVENT_REG_FAIL;
-		goto err;
-	}
-
-	*for_app = caml_callbackN_exn(*func, 4, args);
-	if (Is_exception_result(*for_app)) {
-		ret = ERROR_OSEVENT_REG_FAIL;
-		free(for_app);
-		goto err;
-	}
-
-	caml_register_global_root(for_app);
-	*for_app_registration_out = for_app;
-
-err:
-	CAMLdone;
-	caml_enter_blocking_section();
-	return ret;
-}
-
-int fd_modify(void *user, int fd, void **for_app_registration_update,
-                   short events)
-{
-	caml_leave_blocking_section();
-	CAMLparam0();
-	CAMLlocalN(args, 4);
-	int ret = 0;
-	static const value *func = NULL;
-	value *p = (value *) user;
-	value *for_app = *for_app_registration_update;
-
-	/* If for_app == NULL, then something is very wrong */
-	assert(for_app);
-
-	if (func == NULL) {
-		/* First time around, lookup by name */
-		func = caml_named_value("libxl_fd_modify");
-	}
-
-	args[0] = *p;
-	args[1] = Val_int(fd);
-	args[2] = *for_app;
-	args[3] = Val_poll_events(events);
-
-	*for_app = caml_callbackN_exn(*func, 4, args);
-	if (Is_exception_result(*for_app)) {
-		/* If an exception is caught, *for_app_registration_update is not
-		 * changed. It remains a valid pointer to a value that is registered
-		 * with the GC. */
-		ret = ERROR_OSEVENT_REG_FAIL;
-		goto err;
-	}
-
-	*for_app_registration_update = for_app;
-
-err:
-	CAMLdone;
-	caml_enter_blocking_section();
-	return ret;
-}
-
-void fd_deregister(void *user, int fd, void *for_app_registration)
-{
-	caml_leave_blocking_section();
-	CAMLparam0();
-	CAMLlocalN(args, 3);
-	static const value *func = NULL;
-	value *p = (value *) user;
-	value *for_app = for_app_registration;
-
-	/* If for_app == NULL, then something is very wrong */
-	assert(for_app);
-
-	if (func == NULL) {
-		/* First time around, lookup by name */
-		func = caml_named_value("libxl_fd_deregister");
-	}
-
-	args[0] = *p;
-	args[1] = Val_int(fd);
-	args[2] = *for_app;
-
-	caml_callbackN_exn(*func, 3, args);
-	/* This hook does not return error codes, so the best thing we can do
-	 * to avoid trouble, if we catch an exception from the app, is abort. */
-	if (Is_exception_result(*for_app))
-		abort();
-
-	caml_remove_global_root(for_app);
-	free(for_app);
-
-	CAMLdone;
-	caml_enter_blocking_section();
-}
-
-struct timeout_handles {
-	void *for_libxl;
-	value for_app;
-};
-
-int timeout_register(void *user, void **for_app_registration_out,
-                          struct timeval abs, void *for_libxl)
-{
-	caml_leave_blocking_section();
-	CAMLparam0();
-	CAMLlocal2(sec, usec);
-	CAMLlocalN(args, 4);
-	int ret = 0;
-	static const value *func = NULL;
-	value *p = (value *) user;
-	struct timeout_handles *handles;
-
-	if (func == NULL) {
-		/* First time around, lookup by name */
-		func = caml_named_value("libxl_timeout_register");
-	}
-
-	sec = caml_copy_int64(abs.tv_sec);
-	usec = caml_copy_int64(abs.tv_usec);
-
-	/* This struct of "handles" will contain "for_libxl" as well as "for_app".
-	 * We'll give a pointer to the struct to the app, and get it back in
-	 * occurred_timeout, where we can clean it all up. */
-	handles = malloc(sizeof(*handles));
-	if (!handles) {
-		ret = ERROR_OSEVENT_REG_FAIL;
-		goto err;
-	}
-
-	handles->for_libxl = for_libxl;
-
-	args[0] = *p;
-	args[1] = sec;
-	args[2] = usec;
-	args[3] = (value) handles;
-
-	handles->for_app = caml_callbackN_exn(*func, 4, args);
-	if (Is_exception_result(handles->for_app)) {
-		ret = ERROR_OSEVENT_REG_FAIL;
-		free(handles);
-		goto err;
-	}
-
-	caml_register_global_root(&handles->for_app);
-	*for_app_registration_out = handles;
-
-err:
-	CAMLdone;
-	caml_enter_blocking_section();
-	return ret;
-}
-
-int timeout_modify(void *user, void **for_app_registration_update,
-                         struct timeval abs)
-{
-	caml_leave_blocking_section();
-	CAMLparam0();
-	CAMLlocal1(for_app_update);
-	CAMLlocalN(args, 2);
-	int ret = 0;
-	static const value *func = NULL;
-	value *p = (value *) user;
-	struct timeout_handles *handles = *for_app_registration_update;
-
-	/* If for_app == NULL, then something is very wrong */
-	assert(handles->for_app);
-
-	/* Libxl currently promises that timeout_modify is only ever called with
-	 * abs={0,0}, meaning "right away". We cannot deal with other values. */
-	assert(abs.tv_sec == 0 && abs.tv_usec == 0);
-
-	if (func == NULL) {
-		/* First time around, lookup by name */
-		func = caml_named_value("libxl_timeout_fire_now");
-	}
-
-	args[0] = *p;
-	args[1] = handles->for_app;
-
-	for_app_update = caml_callbackN_exn(*func, 2, args);
-	if (Is_exception_result(for_app_update)) {
-		/* If an exception is caught, *for_app_registration_update is not
-		 * changed. It remains a valid pointer to a value that is registered
-		 * with the GC. */


From xen-changelog-bounces@lists.xenproject.org Sun Feb 12 07:56:23 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 12 Feb 2023 07:56:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.494014.764015 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pR7Dj-0005HL-ND; Sun, 12 Feb 2023 07:56:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 494014.764015; Sun, 12 Feb 2023 07: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 1pR7Dj-0005HD-Kc; Sun, 12 Feb 2023 07:56:23 +0000
Received: by outflank-mailman (input) for mailman id 494014;
 Sun, 12 Feb 2023 07:56:22 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pR7Di-0005H1-QB
 for xen-changelog@lists.xenproject.org; Sun, 12 Feb 2023 07:56:22 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pR7Di-00011Q-PW
 for xen-changelog@lists.xenproject.org; Sun, 12 Feb 2023 07:56:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pR7Di-0004h8-OV
 for xen-changelog@lists.xenproject.org; Sun, 12 Feb 2023 07:56:22 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=CmBeGLbgoxNhCEHGwri9PtegS2kEQmCn90PkraMFC8M=; b=wt77/QlCwrsw1d3fmB3vJSgKwj
	lv9GxfMXhUATHJf/uFI6zcsE4O0+muLtLw6arUyBBv2GmdfCHd86JlXeED7/PatpYJBKgCP245KYr
	/MXQ0qOjbdABWEqVfid6sL91pfD245QmYa1zyxMW9Gjf8gQPMcdezUqJsCHjOM6CHfJI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] SUPPORT.md: update version to 4.18-unstable
Message-Id: <E1pR7Di-0004h8-OV@xenbits.xenproject.org>
Date: Sun, 12 Feb 2023 07:56:22 +0000

commit d184b26db2b29b5f610b61c43580becd7a4057b1
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Thu Feb 9 15:23:57 2023 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Feb 9 18:26:17 2023 +0000

    SUPPORT.md: update version to 4.18-unstable
    
    The current version is no longer 4.17-rc. Update it to "4.18-unstable".
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 SUPPORT.md | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/SUPPORT.md b/SUPPORT.md
index 295369998e..aa1940e55f 100644
--- a/SUPPORT.md
+++ b/SUPPORT.md
@@ -9,7 +9,7 @@ for the definitions of the support status levels etc.
 
 # Release Support
 
-    Xen-Version: 4.17-rc
+    Xen-Version: 4.18-unstable
     Initial-Release: n/a
     Supported-Until: TBD
     Security-Support-Until: Unreleased - not yet security-supported
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sun Feb 12 07:56:33 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 12 Feb 2023 07:56:33 +0000
Received: from list by lists.xenproject.org with outflank-mailman.494015.764018 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pR7Dt-0005KL-Or; Sun, 12 Feb 2023 07:56:33 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 494015.764018; Sun, 12 Feb 2023 07:56:33 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pR7Dt-0005KD-M7; Sun, 12 Feb 2023 07:56:33 +0000
Received: by outflank-mailman (input) for mailman id 494015;
 Sun, 12 Feb 2023 07:56:33 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pR7Ds-0005K6-V9
 for xen-changelog@lists.xenproject.org; Sun, 12 Feb 2023 07:56:32 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pR7Ds-00011a-U4
 for xen-changelog@lists.xenproject.org; Sun, 12 Feb 2023 07:56:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pR7Ds-0004hX-Rf
 for xen-changelog@lists.xenproject.org; Sun, 12 Feb 2023 07:56:32 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=xfeyl0fHoDAtXro41F+UxK0hrPr0dsCKUruYXMaaE2M=; b=HfnVFr8PfxvwHQui4hGC8LZvvg
	QSHk4dlI3VDx+WpcwAq9w7bcTVjuIwssnPavfBVzYHf2gCKuLEcwFn9GCO8JhRB34GS1tLqYJ08/5
	zjQFUhjGEdy3nW/xRK9e0xZAERyj6XVRjhC78D1b4yOwRay4jioNOk7QIEXvmWGcgSdc=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] docs: clarify xenstore permission documentation
Message-Id: <E1pR7Ds-0004hX-Rf@xenbits.xenproject.org>
Date: Sun, 12 Feb 2023 07:56:32 +0000

commit 789ed08abb8f5e411cf06f6acb61c2d261f625da
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Thu Feb 9 15:41:48 2023 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Feb 9 18:26:17 2023 +0000

    docs: clarify xenstore permission documentation
    
    In docs/misc/xenstore.txt the description of the Xenstore node access
    permissions is missing one important aspect, which can be found only
    in the code or in the wiki [1]:
    
    The first permission entry is defining the owner of the node via the
    domid, and the access rights for all domains NOT having a dedicated
    permission entry.
    
    Make that aspect clear in the official documentation.
    
    [1]: https://wiki.xenproject.org/wiki/XenBus#Permissions
    
    Reported-by: Edwin Török <edwin.torok@cloud.com>
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Julien Grall <jgrall@amazon.com>
---
 docs/misc/xenstore.txt | 17 ++++++++++-------
 1 file changed, 10 insertions(+), 7 deletions(-)

diff --git a/docs/misc/xenstore.txt b/docs/misc/xenstore.txt
index 8887e7df88..d807ef0709 100644
--- a/docs/misc/xenstore.txt
+++ b/docs/misc/xenstore.txt
@@ -45,13 +45,16 @@ them to within 2048 bytes.  (See XENSTORE_*_PATH_MAX in xs_wire.h.)
 
 Each node has one or multiple permission entries.  Permissions are
 granted by domain-id, the first permission entry of each node specifies
-the owner of the node.  Permissions of a node can be changed by the
-owner of the node, the owner can only be modified by the control
-domain (usually domain id 0).  The owner always has the right to read
-and write the node, while other permissions can be setup to allow
-read and/or write access.  When a domain is being removed from Xenstore
-nodes owned by that domain will be removed together with all of those
-nodes' children.
+the owner of the node, who always has full access to the node (read and
+write permission).  The access rights of the first entry specify the
+allowed access for all domains not having a dedicated permission entry
+(the default is "n", removing access for all domains not explicitly
+added via additional permission entries).  Permissions of a node can be
+changed by the owner of the node, the owner can only be modified by the
+control domain (usually domain id 0).  Other permissions can be setup to
+allow read and/or write access for other domains.  When a domain is
+being removed from Xenstore nodes owned by that domain will be removed
+together with all of those nodes' children.
 
 
 Communication with xenstore is via either sockets, or event channel
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sun Feb 12 07:56:44 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 12 Feb 2023 07:56:44 +0000
Received: from list by lists.xenproject.org with outflank-mailman.494016.764023 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pR7E4-0005N4-Qf; Sun, 12 Feb 2023 07:56:44 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 494016.764023; Sun, 12 Feb 2023 07:56:44 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pR7E4-0005Mu-Nj; Sun, 12 Feb 2023 07:56:44 +0000
Received: by outflank-mailman (input) for mailman id 494016;
 Sun, 12 Feb 2023 07:56:43 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pR7E3-0005Mm-2r
 for xen-changelog@lists.xenproject.org; Sun, 12 Feb 2023 07:56:43 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pR7E3-000124-1r
 for xen-changelog@lists.xenproject.org; Sun, 12 Feb 2023 07:56:43 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pR7E3-0004i1-0D
 for xen-changelog@lists.xenproject.org; Sun, 12 Feb 2023 07:56:43 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Msx1UWFOJV8toG/xowZhKQi0oSHM/vWqrXIN0lbERTI=; b=kwiY3GGYO8kJXnH8vtzj7DCqcd
	pBY5zhUZ7vJXWMU+jVkK6PnO5hDwiNs3D/IS8bYQ8iYg+ag//i0d6yEEoMfez9GziruXwSfJtpqJL
	mItcYR8hXtnbV3hXcuB8sg4ZE6O/lPhcMsFGKhK+Ou1/EFQZ33v9k+KzpUc57E33/f20=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/cpuid: Infrastructure for leaves 7:1{ecx,edx}
Message-Id: <E1pR7E3-0004i1-0D@xenbits.xenproject.org>
Date: Sun, 12 Feb 2023 07:56:43 +0000

commit b4a23bf6293aadecfd03bf9e83974443e2eac9cb
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Fri Oct 28 11:40:00 2022 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Feb 9 18:26:17 2023 +0000

    x86/cpuid: Infrastructure for leaves 7:1{ecx,edx}
    
    We don't actually need ecx yet, but adding it in now will reduce the amount to
    which leaf 7 is out of order in a featureset.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 tools/misc/xen-cpuid.c                      | 10 ++++++++++
 xen/arch/x86/cpu/common.c                   |  3 ++-
 xen/include/public/arch-x86/cpufeatureset.h |  4 ++++
 xen/include/xen/lib/x86/cpuid.h             | 15 ++++++++++++++-
 4 files changed, 30 insertions(+), 2 deletions(-)

diff --git a/tools/misc/xen-cpuid.c b/tools/misc/xen-cpuid.c
index 08831af46c..ba749fcb70 100644
--- a/tools/misc/xen-cpuid.c
+++ b/tools/misc/xen-cpuid.c
@@ -204,6 +204,14 @@ static const char *const str_7b1[32] =
     [ 0] = "ppin",
 };
 
+static const char *const str_7c1[32] =
+{
+};
+
+static const char *const str_7d1[32] =
+{
+};
+
 static const char *const str_7d2[32] =
 {
     [ 0] = "intel-psfd",
@@ -231,6 +239,8 @@ static const struct {
     { "0x80000021.eax",  "e21a", str_e21a },
     { "0x00000007:1.ebx", "7b1", str_7b1 },
     { "0x00000007:2.edx", "7d2", str_7d2 },
+    { "0x00000007:1.ecx", "7c1", str_7c1 },
+    { "0x00000007:1.edx", "7d1", str_7d1 },
 };
 
 #define COL_ALIGN "18"
diff --git a/xen/arch/x86/cpu/common.c b/xen/arch/x86/cpu/common.c
index f44c907e8a..860f2dea5c 100644
--- a/xen/arch/x86/cpu/common.c
+++ b/xen/arch/x86/cpu/common.c
@@ -453,7 +453,8 @@ static void generic_identify(struct cpuinfo_x86 *c)
 			cpuid_count(7, 1,
 				    &c->x86_capability[FEATURESET_7a1],
 				    &c->x86_capability[FEATURESET_7b1],
-				    &tmp, &tmp);
+				    &c->x86_capability[FEATURESET_7c1],
+				    &c->x86_capability[FEATURESET_7d1]);
 		if (max_subleaf >= 2)
 			cpuid_count(7, 2,
 				    &tmp, &tmp, &tmp,
diff --git a/xen/include/public/arch-x86/cpufeatureset.h b/xen/include/public/arch-x86/cpufeatureset.h
index 3b85bcca15..9fb19b7057 100644
--- a/xen/include/public/arch-x86/cpufeatureset.h
+++ b/xen/include/public/arch-x86/cpufeatureset.h
@@ -297,6 +297,10 @@ XEN_CPUFEATURE(RRSBA_CTRL,         13*32+ 2) /*   MSR_SPEC_CTRL.RRSBA_DIS_* */
 XEN_CPUFEATURE(BHI_CTRL,           13*32+ 4) /*   MSR_SPEC_CTRL.BHI_DIS_S */
 XEN_CPUFEATURE(MCDT_NO,            13*32+ 5) /*A  MCDT_NO */
 
+/* Intel-defined CPU features, CPUID level 0x00000007:1.ecx, word 14 */
+
+/* Intel-defined CPU features, CPUID level 0x00000007:1.edx, word 15 */
+
 #endif /* XEN_CPUFEATURE */
 
 /* Clean up from a default include.  Close the enum (for C). */
diff --git a/xen/include/xen/lib/x86/cpuid.h b/xen/include/xen/lib/x86/cpuid.h
index 73a5c33036..fa98b371ee 100644
--- a/xen/include/xen/lib/x86/cpuid.h
+++ b/xen/include/xen/lib/x86/cpuid.h
@@ -18,6 +18,8 @@
 #define FEATURESET_e21a  11 /* 0x80000021.eax      */
 #define FEATURESET_7b1   12 /* 0x00000007:1.ebx    */
 #define FEATURESET_7d2   13 /* 0x00000007:2.edx    */
+#define FEATURESET_7c1   14 /* 0x00000007:1.ecx    */
+#define FEATURESET_7d1   15 /* 0x00000007:1.edx    */
 
 struct cpuid_leaf
 {
@@ -194,7 +196,14 @@ struct cpuid_policy
                 uint32_t _7b1;
                 struct { DECL_BITFIELD(7b1); };
             };
-            uint32_t /* c */:32, /* d */:32;
+            union {
+                uint32_t _7c1;
+                struct { DECL_BITFIELD(7c1); };
+            };
+            union {
+                uint32_t _7d1;
+                struct { DECL_BITFIELD(7d1); };
+            };
 
             /* Subleaf 2. */
             uint32_t /* a */:32, /* b */:32, /* c */:32;
@@ -343,6 +352,8 @@ static inline void cpuid_policy_to_featureset(
     fs[FEATURESET_e21a] = p->extd.e21a;
     fs[FEATURESET_7b1] = p->feat._7b1;
     fs[FEATURESET_7d2] = p->feat._7d2;
+    fs[FEATURESET_7c1] = p->feat._7c1;
+    fs[FEATURESET_7d1] = p->feat._7d1;
 }
 
 /* Fill in a CPUID policy from a featureset bitmap. */
@@ -363,6 +374,8 @@ static inline void cpuid_featureset_to_policy(
     p->extd.e21a  = fs[FEATURESET_e21a];
     p->feat._7b1  = fs[FEATURESET_7b1];
     p->feat._7d2  = fs[FEATURESET_7d2];
+    p->feat._7c1  = fs[FEATURESET_7c1];
+    p->feat._7d1  = fs[FEATURESET_7d1];
 }
 
 static inline uint64_t cpuid_policy_xcr0_max(const struct cpuid_policy *p)
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sun Feb 12 07:56:55 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 12 Feb 2023 07:56:55 +0000
Received: from list by lists.xenproject.org with outflank-mailman.494017.764027 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pR7EE-0005Pu-S6; Sun, 12 Feb 2023 07:56:54 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 494017.764027; Sun, 12 Feb 2023 07:56:54 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pR7EE-0005Pm-PJ; Sun, 12 Feb 2023 07:56:54 +0000
Received: by outflank-mailman (input) for mailman id 494017;
 Sun, 12 Feb 2023 07:56:53 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pR7ED-0005Pa-6D
 for xen-changelog@lists.xenproject.org; Sun, 12 Feb 2023 07:56:53 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pR7ED-00012C-5U
 for xen-changelog@lists.xenproject.org; Sun, 12 Feb 2023 07:56:53 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pR7ED-0004iU-4q
 for xen-changelog@lists.xenproject.org; Sun, 12 Feb 2023 07:56:53 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=kLPQMYAg/BvsGDZh3XNA5OaVZJcSmyqbqhay1Vn21LU=; b=a7boVxhxBzakfnqAHMgZqPcef3
	oCn5GfPB6cJZ3JypoZ6JWVNHoGiqlkyRZRVgmE0fwnO3+MPoAk75jp4holBIrSFnaqCZ8ffzDcpjk
	OyO1AFGVuJFduIGbAYKpsqrHBXF+mII2hhhDdjqsejtnCC+1q6Y1Gev4AkioWh77+tYk=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/shskt: Disable CET-SS on parts susceptible to fractured updates
Message-Id: <E1pR7ED-0004iU-4q@xenbits.xenproject.org>
Date: Sun, 12 Feb 2023 07:56:53 +0000

commit 01e7477d1b081cff4288ff9f51ec59ee94c03ee0
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Fri Oct 28 11:40:00 2022 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Feb 9 18:26:17 2023 +0000

    x86/shskt: Disable CET-SS on parts susceptible to fractured updates
    
    Refer to Intel SDM Rev 70 (Dec 2022), Vol3 17.2.3 "Supervisor Shadow Stack
    Token".
    
    Architecturally, an event delivery which starts in CPL<3 and switches shadow
    stack will first validate the Supervisor Shadow Stack Token (setting the busy
    bit), then pushes CS/LIP/SSP.  One example of this is an NMI interrupting Xen.
    
    Some CPUs suffer from an issue called fracturing, whereby a fault/vmexit/etc
    between setting the busy bit and completing the event injection renders the
    action non-restartable, because when it comes time to restart, the busy bit is
    found to be already set.
    
    This is far more easily encountered under virt, yet it is not the fault of the
    hypervisor, nor the fault of the guest kernel.  The fault lies somewhere
    between the architectural specification, and the uarch behaviour.
    
    Intel have allocated CPUID.7[1].ecx[18] CET_SSS to enumerate that supervisor
    shadow stacks are safe to use.  Because of how Xen lays out its shadow stacks,
    fracturing is not expected to be a problem on native.
    
    Detect this case on boot and default to not using shstk if virtualised.
    Specifying `cet=shstk` on the command line will override this heuristic and
    enable shadow stacks irrespective.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 docs/misc/xen-command-line.pandoc           |  7 ++++-
 tools/libs/light/libxl_cpuid.c              |  2 ++
 tools/misc/xen-cpuid.c                      |  1 +
 xen/arch/x86/cpu/common.c                   | 11 +++++--
 xen/arch/x86/setup.c                        | 46 ++++++++++++++++++++++++-----
 xen/include/public/arch-x86/cpufeatureset.h |  1 +
 6 files changed, 57 insertions(+), 11 deletions(-)

diff --git a/docs/misc/xen-command-line.pandoc b/docs/misc/xen-command-line.pandoc
index 923910f553..19d4d815bd 100644
--- a/docs/misc/xen-command-line.pandoc
+++ b/docs/misc/xen-command-line.pandoc
@@ -287,10 +287,15 @@ can be maintained with the pv-shim mechanism.
     protection.
 
     The option is available when `CONFIG_XEN_SHSTK` is compiled in, and
-    defaults to `true` on hardware supporting CET-SS.  Specifying
+    generally defaults to `true` on hardware supporting CET-SS.  Specifying
     `cet=no-shstk` will cause Xen not to use Shadow Stacks even when support
     is available in hardware.
 
+    Some hardware suffers from an issue known as Supervisor Shadow Stack
+    Fracturing.  On such hardware, Xen will default to not using Shadow Stacks
+    when virtualised.  Specifying `cet=shstk` will override this heuristic and
+    enable Shadow Stacks unilaterally.
+
 *   The `ibt=` boolean controls whether Xen uses Indirect Branch Tracking for
     its own protection.
 
diff --git a/tools/libs/light/libxl_cpuid.c b/tools/libs/light/libxl_cpuid.c
index 8da78773a8..06b1227a2f 100644
--- a/tools/libs/light/libxl_cpuid.c
+++ b/tools/libs/light/libxl_cpuid.c
@@ -237,6 +237,8 @@ int libxl_cpuid_parse_config(libxl_cpuid_policy_list *cpuid, const char* str)
         {"fsrcs",        0x00000007,  1, CPUID_REG_EAX, 12,  1},
         {"wrmsrns",      0x00000007,  1, CPUID_REG_EAX, 19,  1},
 
+        {"cet-sss",      0x00000007,  1, CPUID_REG_EDX, 18,  1},
+
         {"intel-psfd",   0x00000007,  2, CPUID_REG_EDX,  0,  1},
         {"mcdt-no",      0x00000007,  2, CPUID_REG_EDX,  5,  1},
 
diff --git a/tools/misc/xen-cpuid.c b/tools/misc/xen-cpuid.c
index ba749fcb70..3ab820571d 100644
--- a/tools/misc/xen-cpuid.c
+++ b/tools/misc/xen-cpuid.c
@@ -210,6 +210,7 @@ static const char *const str_7c1[32] =
 
 static const char *const str_7d1[32] =
 {
+    [18] = "cet-sss",
 };
 
 static const char *const str_7d2[32] =
diff --git a/xen/arch/x86/cpu/common.c b/xen/arch/x86/cpu/common.c
index 860f2dea5c..5ad347534a 100644
--- a/xen/arch/x86/cpu/common.c
+++ b/xen/arch/x86/cpu/common.c
@@ -349,11 +349,18 @@ void __init early_cpu_init(void)
 	       x86_cpuid_vendor_to_str(c->x86_vendor), c->x86, c->x86,
 	       c->x86_model, c->x86_model, c->x86_mask, eax);
 
-	if (c->cpuid_level >= 7)
-		cpuid_count(7, 0, &eax, &ebx,
+	if (c->cpuid_level >= 7) {
+		uint32_t max_subleaf;
+
+		cpuid_count(7, 0, &max_subleaf, &ebx,
 			    &c->x86_capability[FEATURESET_7c0],
 			    &c->x86_capability[FEATURESET_7d0]);
 
+		if (max_subleaf >= 1)
+			cpuid_count(7, 1, &eax, &ebx, &ecx,
+				    &c->x86_capability[FEATURESET_7d1]);
+	}
+
 	eax = cpuid_eax(0x80000000);
 	if ((eax >> 16) == 0x8000 && eax >= 0x80000008) {
 		ebx = eax >= 0x8000001f ? cpuid_ebx(0x8000001f) : 0;
diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c
index 567a0a42ac..23b1834e94 100644
--- a/xen/arch/x86/setup.c
+++ b/xen/arch/x86/setup.c
@@ -96,11 +96,7 @@ unsigned long __initdata highmem_start;
 size_param("highmem-start", highmem_start);
 #endif
 
-#ifdef CONFIG_XEN_SHSTK
-static bool __initdata opt_xen_shstk = true;
-#else
-#define opt_xen_shstk false
-#endif
+static int8_t __initdata opt_xen_shstk = -IS_ENABLED(CONFIG_XEN_SHSTK);
 
 #ifdef CONFIG_XEN_IBT
 static bool __initdata opt_xen_ibt = true;
@@ -1100,11 +1096,45 @@ void __init noreturn __start_xen(unsigned long mbi_p)
     early_cpu_init();
 
     /* Choose shadow stack early, to set infrastructure up appropriately. */
-    if ( opt_xen_shstk && boot_cpu_has(X86_FEATURE_CET_SS) )
+    if ( !boot_cpu_has(X86_FEATURE_CET_SS) )
+        opt_xen_shstk = 0;
+
+    if ( opt_xen_shstk )
     {
-        printk("Enabling Supervisor Shadow Stacks\n");
+        /*
+         * Some CPUs suffer from Shadow Stack Fracturing, an issue whereby a
+         * fault/VMExit/etc between setting a Supervisor Busy bit and the
+         * event delivery completing renders the operation non-restartable.
+         * On restart, event delivery will find the Busy bit already set.
+         *
+         * This is a problem on bare metal, but outside of synthetic cases or
+         * a very badly timed #MC, it's not believed to be a problem.  It is a
+         * much bigger problem under virt, because we can VMExit for a number
+         * of legitimate reasons and tickle this bug.
+         *
+         * CPUs with this addressed enumerate CET-SSS to indicate that
+         * supervisor shadow stacks are now safe to use.
+         */
+        bool cpu_has_bug_shstk_fracture =
+            boot_cpu_data.x86_vendor == X86_VENDOR_INTEL &&
+            !boot_cpu_has(X86_FEATURE_CET_SSS);
 
-        setup_force_cpu_cap(X86_FEATURE_XEN_SHSTK);
+        /*
+         * On bare metal, assume that Xen won't be impacted by shstk
+         * fracturing problems.  Under virt, be more conservative and disable
+         * shstk by default.
+         */
+        if ( opt_xen_shstk == -1 )
+            opt_xen_shstk =
+                cpu_has_hypervisor ? !cpu_has_bug_shstk_fracture
+                                   : true;
+
+        if ( opt_xen_shstk )
+        {
+            printk("Enabling Supervisor Shadow Stacks\n");
+
+            setup_force_cpu_cap(X86_FEATURE_XEN_SHSTK);
+        }
     }
 
     if ( opt_xen_ibt && boot_cpu_has(X86_FEATURE_CET_IBT) )
diff --git a/xen/include/public/arch-x86/cpufeatureset.h b/xen/include/public/arch-x86/cpufeatureset.h
index 9fb19b7057..336744b471 100644
--- a/xen/include/public/arch-x86/cpufeatureset.h
+++ b/xen/include/public/arch-x86/cpufeatureset.h
@@ -300,6 +300,7 @@ XEN_CPUFEATURE(MCDT_NO,            13*32+ 5) /*A  MCDT_NO */
 /* Intel-defined CPU features, CPUID level 0x00000007:1.ecx, word 14 */
 
 /* Intel-defined CPU features, CPUID level 0x00000007:1.edx, word 15 */
+XEN_CPUFEATURE(CET_SSS,            15*32+18) /*   CET Supervisor Shadow Stacks safe to use */
 
 #endif /* XEN_CPUFEATURE */
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Feb 14 01:11:09 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 14 Feb 2023 01:11:09 +0000
Received: from list by lists.xenproject.org with outflank-mailman.494917.765105 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pRjqZ-0004HD-Nr; Tue, 14 Feb 2023 01:11:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 494917.765105; Tue, 14 Feb 2023 01:11:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pRjqZ-0004H4-Kq; Tue, 14 Feb 2023 01:11:03 +0000
Received: by outflank-mailman (input) for mailman id 494917;
 Tue, 14 Feb 2023 01: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 1pRjqY-0004Gy-7k
 for xen-changelog@lists.xenproject.org; Tue, 14 Feb 2023 01:11:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pRjqY-0006Mm-5L
 for xen-changelog@lists.xenproject.org; Tue, 14 Feb 2023 01:11:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pRjqY-0007bV-4J
 for xen-changelog@lists.xenproject.org; Tue, 14 Feb 2023 01:11:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=d7ztiLaN3NY1dV8rvv66F6dMsPOXgl1ul0NpovdcyXA=; b=pb7M+trCYZOkMsZZHh7r/0Oi75
	uTfQjgulVfUluv5d87Y8PxtK+8erXAEaIfmIH6/CywtuGlNkf11xcgmHtg/PCt/g7tYKcaW9CMesK
	SqUiaCap7IbCk4IF+RKeTqlYYpxGHj4kB6GOSSdeLuL8s50CHNIHJ5KlJAzl8DUBlxSQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] riscv: add temporary riscv64_defconfig alias
Message-Id: <E1pRjqY-0007bV-4J@xenbits.xenproject.org>
Date: Tue, 14 Feb 2023 01:11:02 +0000

commit acb37235fb53e3b4ee6ec5a6fe20dbd23b61cdd0
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Feb 9 10:52:39 2023 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Feb 13 10:04:16 2023 +0100

    riscv: add temporary riscv64_defconfig alias
    
    This is to allow building of Xen without going through a separate
    tiny64_defconfig build step, just like is possible for all other
    architectures. Eventually the symlink will want replacing by,
    presumably, an empty file just like other arches have.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Alistair Francis <alistair.francis@wdc.com>
---
 xen/arch/riscv/configs/riscv64_defconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/xen/arch/riscv/configs/riscv64_defconfig b/xen/arch/riscv/configs/riscv64_defconfig
new file mode 120000
index 0000000000..c3c97b4d10
--- /dev/null
+++ b/xen/arch/riscv/configs/riscv64_defconfig
@@ -0,0 +1 @@
+tiny64_defconfig
\ No newline at end of file
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Feb 14 01:11:13 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 14 Feb 2023 01:11:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.494918.765109 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pRjqj-0004Io-P6; Tue, 14 Feb 2023 01:11:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 494918.765109; Tue, 14 Feb 2023 01:11:13 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pRjqj-0004Ih-MT; Tue, 14 Feb 2023 01:11:13 +0000
Received: by outflank-mailman (input) for mailman id 494918;
 Tue, 14 Feb 2023 01: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 1pRjqi-0004Ib-An
 for xen-changelog@lists.xenproject.org; Tue, 14 Feb 2023 01:11:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pRjqi-0006Mq-9a
 for xen-changelog@lists.xenproject.org; Tue, 14 Feb 2023 01:11:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pRjqi-0007cJ-7Y
 for xen-changelog@lists.xenproject.org; Tue, 14 Feb 2023 01:11:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=mZ1xFkFB6aI3xWoN4EnGhfwLYzyZZ51D3/NTcWiThgQ=; b=QmfvWPi+CZyLfEs7YAhuYbZlsY
	49HhXN8h8Ck4sfTNwqoHbPcOp0ozity08Z6CYASizrKP2xnageRRP9NSQLWzK69JKCVbVciQmTveI
	TaJFKTuz2+Rd0nsnbA3wGfi/Jaj3XgwxG5Da+7G2yQM2JEn0VEvLQhxpDYiDFsJnzh+U=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/riscv: introduce exception handlers implementation
Message-Id: <E1pRjqi-0007cJ-7Y@xenbits.xenproject.org>
Date: Tue, 14 Feb 2023 01:11:12 +0000

commit 72c9ea1f88dc115a28b20abc8929cfb93a9a79f8
Author:     Oleksii Kurochko <oleksii.kurochko@gmail.com>
AuthorDate: Mon Feb 13 10:04:48 2023 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Feb 13 10:04:48 2023 +0100

    xen/riscv: introduce exception handlers implementation
    
    The patch introduces an implementation of basic exception handlers:
    - to save/restore context
    - to handle an exception itself. The handler calls wait_for_interrupt
      now, nothing more.
    
    Signed-off-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
    Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
---
 xen/arch/riscv/Makefile            |  2 +
 xen/arch/riscv/entry.S             | 94 ++++++++++++++++++++++++++++++++++++++
 xen/arch/riscv/include/asm/traps.h | 13 ++++++
 xen/arch/riscv/traps.c             | 13 ++++++
 4 files changed, 122 insertions(+)

diff --git a/xen/arch/riscv/Makefile b/xen/arch/riscv/Makefile
index 1a4f1a6015..443f6bf15f 100644
--- a/xen/arch/riscv/Makefile
+++ b/xen/arch/riscv/Makefile
@@ -1,7 +1,9 @@
 obj-$(CONFIG_EARLY_PRINTK) += early_printk.o
+obj-y += entry.o
 obj-$(CONFIG_RISCV_64) += riscv64/
 obj-y += sbi.o
 obj-y += setup.o
+obj-y += traps.o
 
 $(TARGET): $(TARGET)-syms
 	$(OBJCOPY) -O binary -S $< $@
diff --git a/xen/arch/riscv/entry.S b/xen/arch/riscv/entry.S
new file mode 100644
index 0000000000..0be543f8e0
--- /dev/null
+++ b/xen/arch/riscv/entry.S
@@ -0,0 +1,94 @@
+#include <asm/asm.h>
+#include <asm/asm-offsets.h>
+#include <asm/processor.h>
+#include <asm/riscv_encoding.h>
+#include <asm/traps.h>
+
+/* WIP: only works while interrupting Xen context */
+ENTRY(handle_trap)
+
+    /* Exceptions from xen */
+save_to_stack:
+        /* Save context to stack */
+        REG_S   sp, (CPU_USER_REGS_SP - CPU_USER_REGS_SIZE) (sp)
+        addi    sp, sp, -CPU_USER_REGS_SIZE
+        REG_S   t0, CPU_USER_REGS_T0(sp)
+
+        /* Save registers */
+        REG_S   ra, CPU_USER_REGS_RA(sp)
+        REG_S   gp, CPU_USER_REGS_GP(sp)
+        REG_S   t1, CPU_USER_REGS_T1(sp)
+        REG_S   t2, CPU_USER_REGS_T2(sp)
+        REG_S   s0, CPU_USER_REGS_S0(sp)
+        REG_S   s1, CPU_USER_REGS_S1(sp)
+        REG_S   a0, CPU_USER_REGS_A0(sp)
+        REG_S   a1, CPU_USER_REGS_A1(sp)
+        REG_S   a2, CPU_USER_REGS_A2(sp)
+        REG_S   a3, CPU_USER_REGS_A3(sp)
+        REG_S   a4, CPU_USER_REGS_A4(sp)
+        REG_S   a5, CPU_USER_REGS_A5(sp)
+        REG_S   a6, CPU_USER_REGS_A6(sp)
+        REG_S   a7, CPU_USER_REGS_A7(sp)
+        REG_S   s2, CPU_USER_REGS_S2(sp)
+        REG_S   s3, CPU_USER_REGS_S3(sp)
+        REG_S   s4, CPU_USER_REGS_S4(sp)
+        REG_S   s5, CPU_USER_REGS_S5(sp)
+        REG_S   s6, CPU_USER_REGS_S6(sp)
+        REG_S   s7, CPU_USER_REGS_S7(sp)
+        REG_S   s8, CPU_USER_REGS_S8(sp)
+        REG_S   s9, CPU_USER_REGS_S9(sp)
+        REG_S   s10,CPU_USER_REGS_S10(sp)
+        REG_S   s11,CPU_USER_REGS_S11(sp)
+        REG_S   t3, CPU_USER_REGS_T3(sp)
+        REG_S   t4, CPU_USER_REGS_T4(sp)
+        REG_S   t5, CPU_USER_REGS_T5(sp)
+        REG_S   t6, CPU_USER_REGS_T6(sp)
+        csrr    t0, CSR_SEPC
+        REG_S   t0, CPU_USER_REGS_SEPC(sp)
+        csrr    t0, CSR_SSTATUS
+        REG_S   t0, CPU_USER_REGS_SSTATUS(sp)
+
+        mv      a0, sp
+        jal     do_trap
+
+restore_registers:
+        /* Restore stack_cpu_regs */
+        REG_L   t0, CPU_USER_REGS_SEPC(sp)
+        csrw    CSR_SEPC, t0
+        REG_L   t0, CPU_USER_REGS_SSTATUS(sp)
+        csrw    CSR_SSTATUS, t0
+
+        REG_L   ra, CPU_USER_REGS_RA(sp)
+        REG_L   gp, CPU_USER_REGS_GP(sp)
+        REG_L   t0, CPU_USER_REGS_T0(sp)
+        REG_L   t1, CPU_USER_REGS_T1(sp)
+        REG_L   t2, CPU_USER_REGS_T2(sp)
+        REG_L   s0, CPU_USER_REGS_S0(sp)
+        REG_L   s1, CPU_USER_REGS_S1(sp)
+        REG_L   a0, CPU_USER_REGS_A0(sp)
+        REG_L   a1, CPU_USER_REGS_A1(sp)
+        REG_L   a2, CPU_USER_REGS_A2(sp)
+        REG_L   a3, CPU_USER_REGS_A3(sp)
+        REG_L   a4, CPU_USER_REGS_A4(sp)
+        REG_L   a5, CPU_USER_REGS_A5(sp)
+        REG_L   a6, CPU_USER_REGS_A6(sp)
+        REG_L   a7, CPU_USER_REGS_A7(sp)
+        REG_L   s2, CPU_USER_REGS_S2(sp)
+        REG_L   s3, CPU_USER_REGS_S3(sp)
+        REG_L   s4, CPU_USER_REGS_S4(sp)
+        REG_L   s5, CPU_USER_REGS_S5(sp)
+        REG_L   s6, CPU_USER_REGS_S6(sp)
+        REG_L   s7, CPU_USER_REGS_S7(sp)
+        REG_L   s8, CPU_USER_REGS_S8(sp)
+        REG_L   s9, CPU_USER_REGS_S9(sp)
+        REG_L   s10, CPU_USER_REGS_S10(sp)
+        REG_L   s11, CPU_USER_REGS_S11(sp)
+        REG_L   t3, CPU_USER_REGS_T3(sp)
+        REG_L   t4, CPU_USER_REGS_T4(sp)
+        REG_L   t5, CPU_USER_REGS_T5(sp)
+        REG_L   t6, CPU_USER_REGS_T6(sp)
+
+        /* Restore sp */
+        REG_L   sp, CPU_USER_REGS_SP(sp)
+
+        sret
diff --git a/xen/arch/riscv/include/asm/traps.h b/xen/arch/riscv/include/asm/traps.h
new file mode 100644
index 0000000000..f3fb6b25d1
--- /dev/null
+++ b/xen/arch/riscv/include/asm/traps.h
@@ -0,0 +1,13 @@
+#ifndef __ASM_TRAPS_H__
+#define __ASM_TRAPS_H__
+
+#include <asm/processor.h>
+
+#ifndef __ASSEMBLY__
+
+void do_trap(struct cpu_user_regs *cpu_regs);
+void handle_trap(void);
+
+#endif /* __ASSEMBLY__ */
+
+#endif /* __ASM_TRAPS_H__ */
diff --git a/xen/arch/riscv/traps.c b/xen/arch/riscv/traps.c
new file mode 100644
index 0000000000..ccd3593f5a
--- /dev/null
+++ b/xen/arch/riscv/traps.c
@@ -0,0 +1,13 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
+/*
+ * Copyright (C) 2023 Vates
+ *
+ * RISC-V Trap handlers
+ */
+#include <asm/processor.h>
+#include <asm/traps.h>
+
+void do_trap(struct cpu_user_regs *cpu_regs)
+{
+    die();
+}
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Feb 14 01:11:23 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 14 Feb 2023 01:11:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.494919.765113 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pRjqt-0004LT-Qs; Tue, 14 Feb 2023 01:11:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 494919.765113; Tue, 14 Feb 2023 01:11:23 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pRjqt-0004LL-Nw; Tue, 14 Feb 2023 01:11:23 +0000
Received: by outflank-mailman (input) for mailman id 494919;
 Tue, 14 Feb 2023 01: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 1pRjqs-0004L4-DV
 for xen-changelog@lists.xenproject.org; Tue, 14 Feb 2023 01:11:22 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pRjqs-0006ND-Cj
 for xen-changelog@lists.xenproject.org; Tue, 14 Feb 2023 01:11:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pRjqs-0007cs-Bj
 for xen-changelog@lists.xenproject.org; Tue, 14 Feb 2023 01:11:22 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=sLYbCG650CREsPjMqQoPnuM23hgWm8YZt+OoQuPr/Z4=; b=YHHRpH2rG6TKk1tTxAdIlSeVd5
	1MXa6NCSvXoqxDBMj6NuLfroZUfbtJRuPtA9rgKHHWHkh/6xdffkKz635b4HvlyXuK+Nigu7b14bJ
	wh5y4EeVzPLcct/kpKHZDpEOpWAxa0sZAxyQ8uL5g+zEgMuu2snkA6cP5Gu0OYa92ddY=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/riscv: mask all interrupts
Message-Id: <E1pRjqs-0007cs-Bj@xenbits.xenproject.org>
Date: Tue, 14 Feb 2023 01:11:22 +0000

commit e16f103d699d679cc9600995e762bb77fa9a585f
Author:     Oleksii Kurochko <oleksii.kurochko@gmail.com>
AuthorDate: Mon Feb 13 10:05:39 2023 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Feb 13 10:05:39 2023 +0100

    xen/riscv: mask all interrupts
    
    Signed-off-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
    Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
---
 xen/arch/riscv/riscv64/head.S | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/xen/arch/riscv/riscv64/head.S b/xen/arch/riscv/riscv64/head.S
index d444dd8aad..ffd95f9f89 100644
--- a/xen/arch/riscv/riscv64/head.S
+++ b/xen/arch/riscv/riscv64/head.S
@@ -1,6 +1,11 @@
+#include <asm/riscv_encoding.h>
+
         .section .text.header, "ax", %progbits
 
 ENTRY(start)
+        /* Mask all interrupts */
+        csrw    CSR_SIE, zero
+
         la      sp, cpu0_boot_stack
         li      t0, STACK_SIZE
         add     sp, sp, t0
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Feb 14 01:11:33 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 14 Feb 2023 01:11:33 +0000
Received: from list by lists.xenproject.org with outflank-mailman.494920.765117 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pRjr3-0004OL-Sh; Tue, 14 Feb 2023 01:11:33 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 494920.765117; Tue, 14 Feb 2023 01:11:33 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pRjr3-0004OD-Pu; Tue, 14 Feb 2023 01:11:33 +0000
Received: by outflank-mailman (input) for mailman id 494920;
 Tue, 14 Feb 2023 01: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 1pRjr2-0004O2-Gm
 for xen-changelog@lists.xenproject.org; Tue, 14 Feb 2023 01:11:32 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pRjr2-0006Ni-Fw
 for xen-changelog@lists.xenproject.org; Tue, 14 Feb 2023 01:11:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pRjr2-0007dH-FH
 for xen-changelog@lists.xenproject.org; Tue, 14 Feb 2023 01:11:32 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Z8iUvgQF8HFFyMk0iYrQY4lV5/Tm57pYJYYTi2n5QRs=; b=toT+XNWiZaIU7J5qfK26CQZFqH
	bj1Hl6QqQwTcQdmSGoq2ic9/jdoNoSuMHIgz30HkvATaU8dQ6yjjQn3lN7m5vodIsO5msHdt31l7U
	Pmh3GCLYnrc/ARvFcsBvGb0+GLMDE2lPMWw1kZgGX49Kj0/ANNNWhuhAFfbOlyA9SaVQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/shadow: replace sh_reset_l3_up_pointers()
Message-Id: <E1pRjr2-0007dH-FH@xenbits.xenproject.org>
Date: Tue, 14 Feb 2023 01:11:32 +0000

commit d04a6ee164f55f99a638998c60c16c12701d840f
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Mon Feb 13 10:07:03 2023 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Feb 13 10:07:03 2023 +0100

    x86/shadow: replace sh_reset_l3_up_pointers()
    
    Rather than doing a separate hash walk (and then even using the vCPU
    variant, which is to go away), do the up-pointer-clearing right in
    sh_unpin(), as an alternative to the (now further limited) enlisting on
    a "free floating" list fragment. This utilizes the fact that such list
    fragments are traversed only for multi-page shadows (in shadow_free()
    and sh_next_page()). Furthermore sh_terminate_list() is a safe guard
    only anyway, which isn't in use in the common case (it actually does
    something only for BIGMEM configurations).
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/mm/shadow/common.c  | 23 -----------------------
 xen/arch/x86/mm/shadow/multi.c   |  1 -
 xen/arch/x86/mm/shadow/private.h | 26 +++++++++++++++-----------
 3 files changed, 15 insertions(+), 35 deletions(-)

diff --git a/xen/arch/x86/mm/shadow/common.c b/xen/arch/x86/mm/shadow/common.c
index a74b15e3e7..18a23c28e5 100644
--- a/xen/arch/x86/mm/shadow/common.c
+++ b/xen/arch/x86/mm/shadow/common.c
@@ -2369,29 +2369,6 @@ static void sh_detach_old_tables(struct vcpu *v)
     }
 }
 
-/**************************************************************************/
-
-/* Reset the up-pointers of every L3 shadow to 0.
- * This is called when l3 shadows stop being pinnable, to clear out all
- * the list-head bits so the up-pointer field is properly inititalised. */
-static int cf_check sh_clear_up_pointer(
-    struct vcpu *v, mfn_t smfn, mfn_t unused)
-{
-    mfn_to_page(smfn)->up = 0;
-    return 0;
-}
-
-void sh_reset_l3_up_pointers(struct vcpu *v)
-{
-    static const hash_vcpu_callback_t callbacks[SH_type_unused] = {
-        [SH_type_l3_64_shadow] = sh_clear_up_pointer,
-    };
-
-    HASH_CALLBACKS_CHECK(SHF_L3_64);
-    hash_vcpu_foreach(v, SHF_L3_64, callbacks, INVALID_MFN);
-}
-
-
 /**************************************************************************/
 
 static void sh_update_paging_modes(struct vcpu *v)
diff --git a/xen/arch/x86/mm/shadow/multi.c b/xen/arch/x86/mm/shadow/multi.c
index 3b06cfaf9a..b6e844df95 100644
--- a/xen/arch/x86/mm/shadow/multi.c
+++ b/xen/arch/x86/mm/shadow/multi.c
@@ -971,7 +971,6 @@ sh_make_shadow(struct vcpu *v, mfn_t gmfn, u32 shadow_type)
                     sh_unpin(d, page_to_mfn(sp));
             }
             d->arch.paging.shadow.opt_flags &= ~SHOPT_LINUX_L3_TOPLEVEL;
-            sh_reset_l3_up_pointers(v);
         }
     }
 #endif
diff --git a/xen/arch/x86/mm/shadow/private.h b/xen/arch/x86/mm/shadow/private.h
index 79d82364fc..8cd2d60d13 100644
--- a/xen/arch/x86/mm/shadow/private.h
+++ b/xen/arch/x86/mm/shadow/private.h
@@ -505,11 +505,6 @@ void shadow_blow_tables(struct domain *d);
  */
 int sh_remove_all_mappings(struct domain *d, mfn_t gmfn, gfn_t gfn);
 
-/* Reset the up-pointers of every L3 shadow to 0.
- * This is called when l3 shadows stop being pinnable, to clear out all
- * the list-head bits so the up-pointer field is properly inititalised. */
-void sh_reset_l3_up_pointers(struct vcpu *v);
-
 /******************************************************************************
  * Flags used in the return value of the shadow_set_lXe() functions...
  */
@@ -729,7 +724,7 @@ static inline void sh_unpin(struct domain *d, mfn_t smfn)
 {
     struct page_list_head tmp_list, *pin_list;
     struct page_info *sp, *next;
-    unsigned int i, head_type;
+    unsigned int i, head_type, sz;
 
     ASSERT(mfn_valid(smfn));
     sp = mfn_to_page(smfn);
@@ -741,20 +736,29 @@ static inline void sh_unpin(struct domain *d, mfn_t smfn)
         return;
     sp->u.sh.pinned = 0;
 
-    /* Cut the sub-list out of the list of pinned shadows,
-     * stitching it back into a list fragment of its own. */
+    sz = shadow_size(head_type);
+
+    /*
+     * Cut the sub-list out of the list of pinned shadows, stitching
+     * multi-page shadows back into a list fragment of their own.
+     */
     pin_list = &d->arch.paging.shadow.pinned_shadows;
     INIT_PAGE_LIST_HEAD(&tmp_list);
-    for ( i = 0; i < shadow_size(head_type); i++ )
+    for ( i = 0; i < sz; i++ )
     {
         ASSERT(sp->u.sh.type == head_type);
         ASSERT(!i || !sp->u.sh.head);
         next = page_list_next(sp, pin_list);
         page_list_del(sp, pin_list);
-        page_list_add_tail(sp, &tmp_list);
+        if ( sz > 1 )
+            page_list_add_tail(sp, &tmp_list);
+        else if ( head_type == SH_type_l3_64_shadow )
+            sp->up = 0;
         sp = next;
     }
-    sh_terminate_list(&tmp_list);
+
+    if ( sz > 1 )
+        sh_terminate_list(&tmp_list);
 
     sh_put_ref(d, smfn, 0);
 }
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Feb 14 01:11:44 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 14 Feb 2023 01:11:44 +0000
Received: from list by lists.xenproject.org with outflank-mailman.494923.765133 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pRjrE-0004gj-Ck; Tue, 14 Feb 2023 01:11:44 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 494923.765133; Tue, 14 Feb 2023 01:11:44 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pRjrE-0004gc-7h; Tue, 14 Feb 2023 01:11:44 +0000
Received: by outflank-mailman (input) for mailman id 494923;
 Tue, 14 Feb 2023 01: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 1pRjrC-0004Qx-K4
 for xen-changelog@lists.xenproject.org; Tue, 14 Feb 2023 01:11:42 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pRjrC-0006Ny-JK
 for xen-changelog@lists.xenproject.org; Tue, 14 Feb 2023 01:11:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pRjrC-0007dg-IP
 for xen-changelog@lists.xenproject.org; Tue, 14 Feb 2023 01:11:42 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=tGNrTSOjdkdRXXcjBTENJRdMG2yGw53H53UDiOHghOY=; b=5ZjTGBovpBUAOFh71mBKvHA4p8
	hYucXclyh7SbYxtVsj8QuARSRi60PklWLpnwJoRvzrHT1V9oxGVof0CG1qSs7k4z/c5gcyVDLdUB9
	zWUXXSPw9z3ZEJoBvK6YmQmR86WdCq/VPUo4BQ4et0VyvolVuFEnwUTTeohp1fs/FnUY=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/shadow: drop hash_vcpu_foreach()
Message-Id: <E1pRjrC-0007dg-IP@xenbits.xenproject.org>
Date: Tue, 14 Feb 2023 01:11:42 +0000

commit 39bd52c91ebff3888a352bf9366cbcc492c5ab4e
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Mon Feb 13 10:08:07 2023 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Feb 13 10:08:07 2023 +0100

    x86/shadow: drop hash_vcpu_foreach()
    
    The domain based variant is easily usable by shadow_audit_tables(); all
    that's needed is conversion of the callback functions.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/mm/shadow/common.c | 52 ++---------------------------------------
 xen/arch/x86/mm/shadow/multi.c  | 26 +++++++++------------
 xen/arch/x86/mm/shadow/multi.h  | 10 ++++----
 3 files changed, 18 insertions(+), 70 deletions(-)

diff --git a/xen/arch/x86/mm/shadow/common.c b/xen/arch/x86/mm/shadow/common.c
index 18a23c28e5..e150c53afd 100644
--- a/xen/arch/x86/mm/shadow/common.c
+++ b/xen/arch/x86/mm/shadow/common.c
@@ -1680,59 +1680,11 @@ bool shadow_hash_delete(struct domain *d, unsigned long n, unsigned int t,
     return true;
 }
 
-typedef int (*hash_vcpu_callback_t)(struct vcpu *v, mfn_t smfn, mfn_t other_mfn);
 typedef int (*hash_domain_callback_t)(struct domain *d, mfn_t smfn, mfn_t other_mfn);
 
 #define HASH_CALLBACKS_CHECK(mask) \
     BUILD_BUG_ON((mask) > (1U << ARRAY_SIZE(callbacks)) - 1)
 
-static void hash_vcpu_foreach(struct vcpu *v, unsigned int callback_mask,
-                              const hash_vcpu_callback_t callbacks[],
-                              mfn_t callback_mfn)
-/* Walk the hash table looking at the types of the entries and
- * calling the appropriate callback function for each entry.
- * The mask determines which shadow types we call back for, and the array
- * of callbacks tells us which function to call.
- * Any callback may return non-zero to let us skip the rest of the scan.
- *
- * WARNING: Callbacks MUST NOT add or remove hash entries unless they
- * then return non-zero to terminate the scan. */
-{
-    int i, done = 0;
-    struct domain *d = v->domain;
-    struct page_info *x;
-
-    ASSERT(paging_locked_by_me(d));
-
-    /* Can be called via p2m code &c after shadow teardown. */
-    if ( unlikely(!d->arch.paging.shadow.hash_table) )
-        return;
-
-    /* Say we're here, to stop hash-lookups reordering the chains */
-    ASSERT(d->arch.paging.shadow.hash_walking == 0);
-    d->arch.paging.shadow.hash_walking = 1;
-
-    for ( i = 0; i < SHADOW_HASH_BUCKETS; i++ )
-    {
-        /* WARNING: This is not safe against changes to the hash table.
-         * The callback *must* return non-zero if it has inserted or
-         * deleted anything from the hash (lookups are OK, though). */
-        for ( x = d->arch.paging.shadow.hash_table[i]; x; x = next_shadow(x) )
-        {
-            if ( callback_mask & (1 << x->u.sh.type) )
-            {
-                ASSERT(x->u.sh.type <= SH_type_max_shadow);
-                ASSERT(callbacks[x->u.sh.type] != NULL);
-                done = callbacks[x->u.sh.type](v, page_to_mfn(x),
-                                               callback_mfn);
-                if ( done ) break;
-            }
-        }
-        if ( done ) break;
-    }
-    d->arch.paging.shadow.hash_walking = 0;
-}
-
 static void hash_domain_foreach(struct domain *d,
                                 unsigned int callback_mask,
                                 const hash_domain_callback_t callbacks[],
@@ -3280,7 +3232,7 @@ int shadow_domctl(struct domain *d,
 void shadow_audit_tables(struct vcpu *v)
 {
     /* Dispatch table for getting per-type functions */
-    static const hash_vcpu_callback_t callbacks[SH_type_unused] = {
+    static const hash_domain_callback_t callbacks[SH_type_unused] = {
 #if SHADOW_AUDIT & (SHADOW_AUDIT_ENTRIES | SHADOW_AUDIT_ENTRIES_FULL)
 # ifdef CONFIG_HVM
         [SH_type_l1_32_shadow] = SHADOW_INTERNAL_NAME(sh_audit_l1_table, 2),
@@ -3329,7 +3281,7 @@ void shadow_audit_tables(struct vcpu *v)
     HASH_CALLBACKS_CHECK(SHADOW_AUDIT & (SHADOW_AUDIT_ENTRIES |
                                          SHADOW_AUDIT_ENTRIES_FULL)
                          ? SHF_page_type_mask : 0);
-    hash_vcpu_foreach(v, mask, callbacks, INVALID_MFN);
+    hash_domain_foreach(v->domain, mask, callbacks, INVALID_MFN);
 }
 
 #ifdef CONFIG_PV
diff --git a/xen/arch/x86/mm/shadow/multi.c b/xen/arch/x86/mm/shadow/multi.c
index b6e844df95..1642c0e167 100644
--- a/xen/arch/x86/mm/shadow/multi.c
+++ b/xen/arch/x86/mm/shadow/multi.c
@@ -333,32 +333,32 @@ static void sh_audit_gw(struct vcpu *v, const walk_t *gw)
     if ( mfn_valid(gw->l4mfn)
          && mfn_valid((smfn = get_shadow_status(d, gw->l4mfn,
                                                 SH_type_l4_shadow))) )
-        (void) sh_audit_l4_table(v, smfn, INVALID_MFN);
+        sh_audit_l4_table(d, smfn, INVALID_MFN);
     if ( mfn_valid(gw->l3mfn)
          && mfn_valid((smfn = get_shadow_status(d, gw->l3mfn,
                                                 SH_type_l3_shadow))) )
-        (void) sh_audit_l3_table(v, smfn, INVALID_MFN);
+        sh_audit_l3_table(d, smfn, INVALID_MFN);
 #endif /* PAE or 64... */
     if ( mfn_valid(gw->l2mfn) )
     {
         if ( mfn_valid((smfn = get_shadow_status(d, gw->l2mfn,
                                                  SH_type_l2_shadow))) )
-            (void) sh_audit_l2_table(v, smfn, INVALID_MFN);
+            sh_audit_l2_table(d, smfn, INVALID_MFN);
 #if GUEST_PAGING_LEVELS >= 4 && defined(CONFIG_PV32)
         if ( mfn_valid((smfn = get_shadow_status(d, gw->l2mfn,
                                                  SH_type_l2h_shadow))) )
-            (void) sh_audit_l2_table(v, smfn, INVALID_MFN);
+            sh_audit_l2_table(d, smfn, INVALID_MFN);
 #endif
     }
     if ( mfn_valid(gw->l1mfn)
          && mfn_valid((smfn = get_shadow_status(d, gw->l1mfn,
                                                 SH_type_l1_shadow))) )
-        (void) sh_audit_l1_table(v, smfn, INVALID_MFN);
+        sh_audit_l1_table(d, smfn, INVALID_MFN);
     else if ( (guest_l2e_get_flags(gw->l2e) & _PAGE_PRESENT)
               && (guest_l2e_get_flags(gw->l2e) & _PAGE_PSE)
               && mfn_valid(
               (smfn = get_fl1_shadow_status(d, guest_l2e_get_gfn(gw->l2e)))) )
-        (void) sh_audit_fl1_table(v, smfn, INVALID_MFN);
+        sh_audit_fl1_table(d, smfn, INVALID_MFN);
 #endif /* SHADOW_AUDIT & SHADOW_AUDIT_ENTRIES */
 }
 
@@ -3920,9 +3920,8 @@ static const char *sh_audit_flags(const struct domain *d, int level,
     return NULL;
 }
 
-int cf_check sh_audit_l1_table(struct vcpu *v, mfn_t sl1mfn, mfn_t x)
+int cf_check sh_audit_l1_table(struct domain *d, mfn_t sl1mfn, mfn_t x)
 {
-    struct domain *d = v->domain;
     guest_l1e_t *gl1e, *gp;
     shadow_l1e_t *sl1e;
     mfn_t mfn, gmfn, gl1mfn;
@@ -3989,7 +3988,7 @@ int cf_check sh_audit_l1_table(struct vcpu *v, mfn_t sl1mfn, mfn_t x)
     return done;
 }
 
-int cf_check sh_audit_fl1_table(struct vcpu *v, mfn_t sl1mfn, mfn_t x)
+int cf_check sh_audit_fl1_table(struct domain *d, mfn_t sl1mfn, mfn_t x)
 {
     guest_l1e_t *gl1e, e;
     shadow_l1e_t *sl1e;
@@ -4015,9 +4014,8 @@ int cf_check sh_audit_fl1_table(struct vcpu *v, mfn_t sl1mfn, mfn_t x)
     return 0;
 }
 
-int cf_check sh_audit_l2_table(struct vcpu *v, mfn_t sl2mfn, mfn_t x)
+int cf_check sh_audit_l2_table(struct domain *d, mfn_t sl2mfn, mfn_t x)
 {
-    struct domain *d = v->domain;
     guest_l2e_t *gl2e, *gp;
     shadow_l2e_t *sl2e;
     mfn_t mfn, gmfn, gl2mfn;
@@ -4067,9 +4065,8 @@ int cf_check sh_audit_l2_table(struct vcpu *v, mfn_t sl2mfn, mfn_t x)
 }
 
 #if GUEST_PAGING_LEVELS >= 4
-int cf_check sh_audit_l3_table(struct vcpu *v, mfn_t sl3mfn, mfn_t x)
+int cf_check sh_audit_l3_table(struct domain *d, mfn_t sl3mfn, mfn_t x)
 {
-    struct domain *d = v->domain;
     guest_l3e_t *gl3e, *gp;
     shadow_l3e_t *sl3e;
     mfn_t mfn, gmfn, gl3mfn;
@@ -4117,9 +4114,8 @@ int cf_check sh_audit_l3_table(struct vcpu *v, mfn_t sl3mfn, mfn_t x)
     return 0;
 }
 
-int cf_check sh_audit_l4_table(struct vcpu *v, mfn_t sl4mfn, mfn_t x)
+int cf_check sh_audit_l4_table(struct domain *d, mfn_t sl4mfn, mfn_t x)
 {
-    struct domain *d = v->domain;
     guest_l4e_t *gl4e, *gp;
     shadow_l4e_t *sl4e;
     mfn_t mfn, gmfn, gl4mfn;
diff --git a/xen/arch/x86/mm/shadow/multi.h b/xen/arch/x86/mm/shadow/multi.h
index 5bcd6ae1a8..0918df753c 100644
--- a/xen/arch/x86/mm/shadow/multi.h
+++ b/xen/arch/x86/mm/shadow/multi.h
@@ -83,19 +83,19 @@ SHADOW_INTERNAL_NAME(sh_remove_l3_shadow, GUEST_LEVELS)
 #if SHADOW_AUDIT & SHADOW_AUDIT_ENTRIES
 int cf_check
 SHADOW_INTERNAL_NAME(sh_audit_l1_table, GUEST_LEVELS)
-    (struct vcpu *v, mfn_t sl1mfn, mfn_t x);
+    (struct domain *d, mfn_t sl1mfn, mfn_t x);
 int cf_check
 SHADOW_INTERNAL_NAME(sh_audit_fl1_table, GUEST_LEVELS)
-    (struct vcpu *v, mfn_t sl1mfn, mfn_t x);
+    (struct domain *d, mfn_t sl1mfn, mfn_t x);
 int cf_check
 SHADOW_INTERNAL_NAME(sh_audit_l2_table, GUEST_LEVELS)
-    (struct vcpu *v, mfn_t sl2mfn, mfn_t x);
+    (struct domain *d, mfn_t sl2mfn, mfn_t x);
 int cf_check
 SHADOW_INTERNAL_NAME(sh_audit_l3_table, GUEST_LEVELS)
-    (struct vcpu *v, mfn_t sl3mfn, mfn_t x);
+    (struct domain *d, mfn_t sl3mfn, mfn_t x);
 int cf_check
 SHADOW_INTERNAL_NAME(sh_audit_l4_table, GUEST_LEVELS)
-    (struct vcpu *v, mfn_t sl4mfn, mfn_t x);
+    (struct domain *d, mfn_t sl4mfn, mfn_t x);
 #endif
 
 extern const struct paging_mode
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Feb 14 01:11:54 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 14 Feb 2023 01:11:54 +0000
Received: from list by lists.xenproject.org with outflank-mailman.494925.765136 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pRjrO-0004nn-Eu; Tue, 14 Feb 2023 01:11:54 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 494925.765136; Tue, 14 Feb 2023 01:11:54 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pRjrO-0004nf-CH; Tue, 14 Feb 2023 01:11:54 +0000
Received: by outflank-mailman (input) for mailman id 494925;
 Tue, 14 Feb 2023 01: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 1pRjrM-0004mu-NA
 for xen-changelog@lists.xenproject.org; Tue, 14 Feb 2023 01:11:52 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pRjrM-0006OC-MM
 for xen-changelog@lists.xenproject.org; Tue, 14 Feb 2023 01:11:52 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pRjrM-0007eC-LZ
 for xen-changelog@lists.xenproject.org; Tue, 14 Feb 2023 01:11:52 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=yFIBg/H6JTCEuLCBDhVwuZHUjNJl5fUuy3fX4wMcSkU=; b=KsF8G5ZQxP3qR+CxiCsCCKkVHG
	f0o5AqEHRr72zqXaib6nLHljNN4pyQrmJ8eAzEH5gUS/nEtFJSqFOnd7vIXpr1kmlNt/fen2UK7+D
	PrRQ+lBEJcxaifZqFXxYQiXgRGjKW11+lTfIKYFAcpfpuMFnpcSW7tH9PhWUeIoH9HAI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/shadow: rename hash_domain_foreach()
Message-Id: <E1pRjrM-0007eC-LZ@xenbits.xenproject.org>
Date: Tue, 14 Feb 2023 01:11:52 +0000

commit 888aaa2d696ff3a58cd64c7b0cf35544363f12f1
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Mon Feb 13 10:08:44 2023 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Feb 13 10:08:44 2023 +0100

    x86/shadow: rename hash_domain_foreach()
    
    The "domain" in there has become meaningless; drop it.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/mm/shadow/common.c | 32 ++++++++++++++++----------------
 1 file changed, 16 insertions(+), 16 deletions(-)

diff --git a/xen/arch/x86/mm/shadow/common.c b/xen/arch/x86/mm/shadow/common.c
index e150c53afd..7c829c1a1d 100644
--- a/xen/arch/x86/mm/shadow/common.c
+++ b/xen/arch/x86/mm/shadow/common.c
@@ -1680,15 +1680,15 @@ bool shadow_hash_delete(struct domain *d, unsigned long n, unsigned int t,
     return true;
 }
 
-typedef int (*hash_domain_callback_t)(struct domain *d, mfn_t smfn, mfn_t other_mfn);
+typedef int (*hash_callback_t)(struct domain *d, mfn_t smfn, mfn_t other_mfn);
 
 #define HASH_CALLBACKS_CHECK(mask) \
     BUILD_BUG_ON((mask) > (1U << ARRAY_SIZE(callbacks)) - 1)
 
-static void hash_domain_foreach(struct domain *d,
-                                unsigned int callback_mask,
-                                const hash_domain_callback_t callbacks[],
-                                mfn_t callback_mfn)
+static void hash_foreach(struct domain *d,
+                         unsigned int callback_mask,
+                         const hash_callback_t callbacks[],
+                         mfn_t callback_mfn)
 /* Walk the hash table looking at the types of the entries and
  * calling the appropriate callback function for each entry.
  * The mask determines which shadow types we call back for, and the array
@@ -1826,7 +1826,7 @@ int sh_remove_write_access(struct domain *d, mfn_t gmfn,
                            unsigned long fault_addr)
 {
     /* Dispatch table for getting per-type functions */
-    static const hash_domain_callback_t callbacks[SH_type_unused] = {
+    static const hash_callback_t callbacks[SH_type_unused] = {
 #ifdef CONFIG_HVM
         [SH_type_l1_32_shadow] = SHADOW_INTERNAL_NAME(sh_rm_write_access_from_l1, 2),
         [SH_type_fl1_32_shadow] = SHADOW_INTERNAL_NAME(sh_rm_write_access_from_l1, 2),
@@ -2011,7 +2011,7 @@ int sh_remove_write_access(struct domain *d, mfn_t gmfn,
     else
         perfc_incr(shadow_writeable_bf);
     HASH_CALLBACKS_CHECK(SHF_L1_ANY | SHF_FL1_ANY);
-    hash_domain_foreach(d, SHF_L1_ANY | SHF_FL1_ANY, callbacks, gmfn);
+    hash_foreach(d, SHF_L1_ANY | SHF_FL1_ANY, callbacks, gmfn);
 
     /* If that didn't catch the mapping, then there's some non-pagetable
      * mapping -- ioreq page, grant mapping, &c. */
@@ -2039,7 +2039,7 @@ int sh_remove_all_mappings(struct domain *d, mfn_t gmfn, gfn_t gfn)
     struct page_info *page = mfn_to_page(gmfn);
 
     /* Dispatch table for getting per-type functions */
-    static const hash_domain_callback_t callbacks[SH_type_unused] = {
+    static const hash_callback_t callbacks[SH_type_unused] = {
         [SH_type_l1_32_shadow] = SHADOW_INTERNAL_NAME(sh_rm_mappings_from_l1, 2),
         [SH_type_fl1_32_shadow] = SHADOW_INTERNAL_NAME(sh_rm_mappings_from_l1, 2),
         [SH_type_l1_pae_shadow] = SHADOW_INTERNAL_NAME(sh_rm_mappings_from_l1, 3),
@@ -2063,7 +2063,7 @@ int sh_remove_all_mappings(struct domain *d, mfn_t gmfn, gfn_t gfn)
     /* Brute-force search of all the shadows, by walking the hash */
     perfc_incr(shadow_mappings_bf);
     HASH_CALLBACKS_CHECK(SHF_L1_ANY | SHF_FL1_ANY);
-    hash_domain_foreach(d, SHF_L1_ANY | SHF_FL1_ANY, callbacks, gmfn);
+    hash_foreach(d, SHF_L1_ANY | SHF_FL1_ANY, callbacks, gmfn);
 
     /* If that didn't catch the mapping, something is very wrong */
     if ( !sh_check_page_has_no_refs(page) )
@@ -2172,7 +2172,7 @@ void sh_remove_shadows(struct domain *d, mfn_t gmfn, int fast, int all)
 
     /* Dispatch table for getting per-type functions: each level must
      * be called with the function to remove a lower-level shadow. */
-    static const hash_domain_callback_t callbacks[SH_type_unused] = {
+    static const hash_callback_t callbacks[SH_type_unused] = {
 #ifdef CONFIG_HVM
         [SH_type_l2_32_shadow] = SHADOW_INTERNAL_NAME(sh_remove_l1_shadow, 2),
         [SH_type_l2_pae_shadow] = SHADOW_INTERNAL_NAME(sh_remove_l1_shadow, 3),
@@ -2221,9 +2221,9 @@ void sh_remove_shadows(struct domain *d, mfn_t gmfn, int fast, int all)
 
     /*
      * Lower-level shadows need to be excised from upper-level shadows. This
-     * call to hash_domain_foreach() looks dangerous but is in fact OK: each
-     * call will remove at most one shadow, and terminate immediately when
-     * it does remove it, so we never walk the hash after doing a deletion.
+     * call to hash_foreach() looks dangerous but is in fact OK: each call
+     * will remove at most one shadow, and terminate immediately when it does
+     * remove it, so we never walk the hash after doing a deletion.
      */
 #define DO_UNSHADOW(_type) do {                                         \
     t = (_type);                                                        \
@@ -2247,7 +2247,7 @@ void sh_remove_shadows(struct domain *d, mfn_t gmfn, int fast, int all)
          (pg->shadow_flags & (1 << t)) )                                \
     {                                                                   \
         HASH_CALLBACKS_CHECK(SHF_page_type_mask);                       \
-        hash_domain_foreach(d, masks[t], callbacks, smfn);              \
+        hash_foreach(d, masks[t], callbacks, smfn);                     \
     }                                                                   \
 } while (0)
 
@@ -3232,7 +3232,7 @@ int shadow_domctl(struct domain *d,
 void shadow_audit_tables(struct vcpu *v)
 {
     /* Dispatch table for getting per-type functions */
-    static const hash_domain_callback_t callbacks[SH_type_unused] = {
+    static const hash_callback_t callbacks[SH_type_unused] = {
 #if SHADOW_AUDIT & (SHADOW_AUDIT_ENTRIES | SHADOW_AUDIT_ENTRIES_FULL)
 # ifdef CONFIG_HVM
         [SH_type_l1_32_shadow] = SHADOW_INTERNAL_NAME(sh_audit_l1_table, 2),
@@ -3281,7 +3281,7 @@ void shadow_audit_tables(struct vcpu *v)
     HASH_CALLBACKS_CHECK(SHADOW_AUDIT & (SHADOW_AUDIT_ENTRIES |
                                          SHADOW_AUDIT_ENTRIES_FULL)
                          ? SHF_page_type_mask : 0);
-    hash_domain_foreach(v->domain, mask, callbacks, INVALID_MFN);
+    hash_foreach(v->domain, mask, callbacks, INVALID_MFN);
 }
 
 #ifdef CONFIG_PV
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Feb 14 01:12:04 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 14 Feb 2023 01:12:04 +0000
Received: from list by lists.xenproject.org with outflank-mailman.494929.765140 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pRjrY-0004z7-Gd; Tue, 14 Feb 2023 01:12:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 494929.765140; Tue, 14 Feb 2023 01:12:04 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pRjrY-0004yx-Dn; Tue, 14 Feb 2023 01:12:04 +0000
Received: by outflank-mailman (input) for mailman id 494929;
 Tue, 14 Feb 2023 01:12: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 1pRjrW-0004xF-QR
 for xen-changelog@lists.xenproject.org; Tue, 14 Feb 2023 01:12:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pRjrW-0006Ob-Pj
 for xen-changelog@lists.xenproject.org; Tue, 14 Feb 2023 01:12:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pRjrW-0007gV-On
 for xen-changelog@lists.xenproject.org; Tue, 14 Feb 2023 01:12:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Wyg732+UBQb7npTIY39Oe1DWD5epmtwGKMxBrj5NC3Q=; b=WfenVMYoy0H9kh0pxx8/p4J5zf
	7buF/SkiQ37h1jYF/Z4kdxB7roLaxd5n9AdMpUYfbO5fDlxF9TtetzuC/u0Yq2RxBRn/QZohZbPqp
	xxMVeLqnvkIrPfT9vukz8oTsjIVTDlMaP0Cfte8Ch+HZ+RSK1CJoXAZ/TTghuQe62u04=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/shadow: re-work 4-level SHADOW_FOREACH_L2E()
Message-Id: <E1pRjrW-0007gV-On@xenbits.xenproject.org>
Date: Tue, 14 Feb 2023 01:12:02 +0000

commit 5a703566eb5dd59da718a46b5047b454a0d93cb4
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Mon Feb 13 10:09:15 2023 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Feb 13 10:09:15 2023 +0100

    x86/shadow: re-work 4-level SHADOW_FOREACH_L2E()
    
    First of all move the almost loop-invariant condition out of the loop;
    transform it into an altered loop boundary, noting that the updating of
    _gl2p is relevant only at one use site, and then also only inside the
    _code blob it provides. Then drop the shadow_mode_external() part of the
    condition as being redundant with the is_pv_32bit_domain() check.
    Further, since the new local variable wants to be "unsigned int",
    convert the loop induction variable accordingly. Finally also adjust
    formatting as most code needs touching anyway.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/mm/shadow/multi.c | 23 +++++++++++------------
 1 file changed, 11 insertions(+), 12 deletions(-)

diff --git a/xen/arch/x86/mm/shadow/multi.c b/xen/arch/x86/mm/shadow/multi.c
index 1642c0e167..cded39ef09 100644
--- a/xen/arch/x86/mm/shadow/multi.c
+++ b/xen/arch/x86/mm/shadow/multi.c
@@ -861,23 +861,22 @@ do {                                                                       \
 /* 64-bit l2: touch all entries except for PAE compat guests. */
 #define SHADOW_FOREACH_L2E(_sl2mfn, _sl2e, _gl2p, _done, _dom, _code)       \
 do {                                                                        \
-    int _i;                                                                 \
-    int _xen = !shadow_mode_external(_dom);                                 \
+    unsigned int _i, _end = SHADOW_L2_PAGETABLE_ENTRIES;                    \
     shadow_l2e_t *_sp = map_domain_page((_sl2mfn));                         \
     ASSERT_VALID_L2(mfn_to_page(_sl2mfn)->u.sh.type);                       \
-    for ( _i = 0; _i < SHADOW_L2_PAGETABLE_ENTRIES; _i++ )                  \
+    if ( is_pv_32bit_domain(_dom) /* implies !shadow_mode_external */ &&    \
+         mfn_to_page(_sl2mfn)->u.sh.type != SH_type_l2_64_shadow )          \
+        _end = COMPAT_L2_PAGETABLE_FIRST_XEN_SLOT(_dom);                    \
+    for ( _i = 0; _i < _end; ++_i )                                         \
     {                                                                       \
-        if ( (!(_xen))                                                      \
-             || !is_pv_32bit_domain(_dom)                                   \
-             || mfn_to_page(_sl2mfn)->u.sh.type == SH_type_l2_64_shadow     \
-             || (_i < COMPAT_L2_PAGETABLE_FIRST_XEN_SLOT(_dom)) )           \
+        (_sl2e) = _sp + _i;                                                 \
+        if ( shadow_l2e_get_flags(*(_sl2e)) & _PAGE_PRESENT )               \
         {                                                                   \
-            (_sl2e) = _sp + _i;                                             \
-            if ( shadow_l2e_get_flags(*(_sl2e)) & _PAGE_PRESENT )           \
-                {_code}                                                     \
-            if ( _done ) break;                                             \
-            increment_ptr_to_guest_entry(_gl2p);                            \
+            _code;                                                          \
         }                                                                   \
+        if ( _done )                                                        \
+            break;                                                          \
+        increment_ptr_to_guest_entry(_gl2p);                                \
     }                                                                       \
     unmap_domain_page(_sp);                                                 \
 } while (0)
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Feb 14 01:12:14 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 14 Feb 2023 01:12:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.494931.765144 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pRjri-00056D-IS; Tue, 14 Feb 2023 01:12:14 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 494931.765144; Tue, 14 Feb 2023 01:12:14 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pRjri-000565-FT; Tue, 14 Feb 2023 01:12:14 +0000
Received: by outflank-mailman (input) for mailman id 494931;
 Tue, 14 Feb 2023 01:12: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 1pRjrg-00055l-Tb
 for xen-changelog@lists.xenproject.org; Tue, 14 Feb 2023 01:12:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pRjrg-0006Om-Sk
 for xen-changelog@lists.xenproject.org; Tue, 14 Feb 2023 01:12:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pRjrg-0007hC-Rt
 for xen-changelog@lists.xenproject.org; Tue, 14 Feb 2023 01:12:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=zuEVKpaZs+0Ekq9UNV6zPESMywwuqDVjctffBN/BDi0=; b=yoLtaQclLzCNwBsrrtk7cPHYnp
	SelBkl9zjTsuZ3F3fq/CmUbATMmXgN4lzQ8qSpUiFUNdmHNzXs6SHo7GwqGkSHE25IV9+Xx0udsBW
	IvAcN5snBHG4jnp1za9RSSgFUkEQyH5Jt8rVQJgWxc9fSc0CqTvRNnMjAdC+rR/fRmyA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/public: fix 9pfs Xenstore entry documentation
Message-Id: <E1pRjrg-0007hC-Rt@xenbits.xenproject.org>
Date: Tue, 14 Feb 2023 01:12:12 +0000

commit 80653bd6548810a123bc425c08e0424204c5275b
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Mon Feb 13 10:10:06 2023 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Feb 13 10:10:06 2023 +0100

    xen/public: fix 9pfs Xenstore entry documentation
    
    In xen/include/public/io/9pfs.h the documentation regarding the
    Xenstore entries isn't reflecting reality: the "tag" Xenstore entry
    is on the frontend side, not on the backend one.
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
---
 xen/include/public/io/9pfs.h | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/xen/include/public/io/9pfs.h b/xen/include/public/io/9pfs.h
index 5dad0db869..617ad9afd7 100644
--- a/xen/include/public/io/9pfs.h
+++ b/xen/include/public/io/9pfs.h
@@ -64,12 +64,6 @@
  *
  *         Host filesystem path to share.
  *
- *    tag
- *         Values:         <string>
- *
- *         Alphanumeric tag that identifies the 9pfs share. The client needs
- *         to know the tag to be able to mount it.
- *
  *    security-model
  *         Values:         "none"
  *
@@ -106,6 +100,12 @@
  *         map a page with information to setup a share ring. One for each
  *         ring.
  *
+ *    tag
+ *         Values:         <string>
+ *
+ *         Alphanumeric tag that identifies the 9pfs share. The client needs
+ *         to know the tag to be able to mount it.
+ *
  ******************************************************************************
  *                              State Machine
  ******************************************************************************
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Feb 14 01:12:23 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 14 Feb 2023 01:12:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.494933.765148 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pRjrr-0005Aw-Jm; Tue, 14 Feb 2023 01:12:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 494933.765148; Tue, 14 Feb 2023 01:12:23 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pRjrr-0005Ao-Gt; Tue, 14 Feb 2023 01:12:23 +0000
Received: by outflank-mailman (input) for mailman id 494933;
 Tue, 14 Feb 2023 01:12:23 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pRjrr-0005Ac-0A
 for xen-changelog@lists.xenproject.org; Tue, 14 Feb 2023 01:12:23 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pRjrq-0006Oz-Vg
 for xen-changelog@lists.xenproject.org; Tue, 14 Feb 2023 01:12:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pRjrq-0007hp-Up
 for xen-changelog@lists.xenproject.org; Tue, 14 Feb 2023 01:12:22 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=78bqITgnECe2BYUglV01AxlH67AHTvotmKeG+ZhVkb0=; b=hQoHJMi1GEkvxhYO72zJefr+GN
	q26oLyyG8YsUmXY5hZe3KeqM5gUEMRHdP4Lu0j3jP8fqLdq7BP41UErlwemO5gSRsrfBRLaAeg3SJ
	+SKqr3cD8mj1QtDCd9pOYGSd6+yl3QhihW9mItfHwF7xGrGwLz5bdSJ2/rq5T3SXnKsc=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/public: fix 9pfs documentation of connection sequence
Message-Id: <E1pRjrq-0007hp-Up@xenbits.xenproject.org>
Date: Tue, 14 Feb 2023 01:12:22 +0000

commit 9f8b53bf1670e6e748d4220020cf87891458f112
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Mon Feb 13 10:10:24 2023 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Feb 13 10:10:24 2023 +0100

    xen/public: fix 9pfs documentation of connection sequence
    
    The documented connection sequence in xen/include/public/io/9pfs.h has
    a bug: the frontend needs to wait for the backend to have published its
    features before being able to allocate its rings and event-channels.
    
    While correcting that, make it clear that there might be multiple
    rings and event-channels by adding "(s)".
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
---
 xen/include/public/io/9pfs.h | 32 ++++++++++++++++++++++----------
 1 file changed, 22 insertions(+), 10 deletions(-)

diff --git a/xen/include/public/io/9pfs.h b/xen/include/public/io/9pfs.h
index 617ad9afd7..a0ce82d0a8 100644
--- a/xen/include/public/io/9pfs.h
+++ b/xen/include/public/io/9pfs.h
@@ -114,14 +114,26 @@
  *
  *    *Front*                               *Back*
  *    XenbusStateInitialising               XenbusStateInitialising
- *    - Query virtual device                - Query backend device
- *      properties.                           identification data.
- *    - Setup OS device instance.           - Publish backend features
- *    - Allocate and initialize the           and transport parameters
- *      request ring.                                      |
- *    - Publish transport parameters                       |
- *      that will be in effect during                      V
- *      this connection.                            XenbusStateInitWait
+ *                                          - Query backend device
+ *                                            identification data.
+ *                                          - Publish backend features
+ *                                            and transport parameters.
+ *                                                         |
+ *                                                         |
+ *                                                         V
+ *                                                  XenbusStateInitWait
+ *
+ *    - Query virtual device
+ *      properties.
+ *    - Query backend features and
+ *      transport parameters.
+ *    - Setup OS device instance.
+ *    - Allocate and initialize the
+ *      request ring(s) and
+ *      event-channel(s).
+ *    - Publish transport parameters
+ *      that will be in effect during
+ *      this connection.
  *                 |
  *                 |
  *                 V
@@ -129,8 +141,8 @@
  *
  *                                          - Query frontend transport
  *                                            parameters.
- *                                          - Connect to the request ring and
- *                                            event channel.
+ *                                          - Connect to the request ring(s)
+ *                                            and event channel(s).
  *                                                         |
  *                                                         |
  *                                                         V
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Feb 14 01:12:33 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 14 Feb 2023 01:12:33 +0000
Received: from list by lists.xenproject.org with outflank-mailman.494934.765152 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pRjs1-0005E4-LD; Tue, 14 Feb 2023 01:12:33 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 494934.765152; Tue, 14 Feb 2023 01:12:33 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pRjs1-0005Dw-IT; Tue, 14 Feb 2023 01:12:33 +0000
Received: by outflank-mailman (input) for mailman id 494934;
 Tue, 14 Feb 2023 01:12:33 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pRjs1-0005Do-35
 for xen-changelog@lists.xenproject.org; Tue, 14 Feb 2023 01:12:33 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pRjs1-0006PS-2L
 for xen-changelog@lists.xenproject.org; Tue, 14 Feb 2023 01:12:33 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pRjs1-0007iP-1Y
 for xen-changelog@lists.xenproject.org; Tue, 14 Feb 2023 01:12:33 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=OBj4NWinISZsNfOnhdgvyZIXI1njYXMRwHDRwH7Rev0=; b=E91oofhlYoUYWBMeQ5i8Cpkk/z
	oSGVqwD4u54ZmY2Kl0skSL/Pa1WleISO4Xt8GUW+MCfxGmbJcHF8mCTzZTmPlVZ3S4c+ypxuyKHgb
	rsT51/MEQgZ0xlc35/A9Hu6PQkKgTXplom8RUGDMXIqLVuOZft1jxR7dQ9y7Z5qTOs1U=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] build: move double-$ into as-option-add
Message-Id: <E1pRjs1-0007iP-1Y@xenbits.xenproject.org>
Date: Tue, 14 Feb 2023 01:12:33 +0000

commit f4f498d08d50259b9f25c274fd7b1e8ccf5693af
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Mon Feb 13 10:13:47 2023 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Feb 13 10:13:47 2023 +0100

    build: move double-$ into as-option-add
    
    It's imo helping readability as well as uses a little if properly
    arranging for sufficiently late macro expansion is part of the macro
    itself, rather than all (applicable) instances of its users.
    
    No functional change intended.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Anthony PERARD <anthony.perard@citrix.com>
---
 xen/arch/x86/arch.mk       | 14 +++++++-------
 xen/scripts/Kbuild.include |  2 +-
 2 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/xen/arch/x86/arch.mk b/xen/arch/x86/arch.mk
index 227d439a45..7b5be9fe46 100644
--- a/xen/arch/x86/arch.mk
+++ b/xen/arch/x86/arch.mk
@@ -13,18 +13,18 @@ CFLAGS += -msoft-float
 $(call cc-options-add,CFLAGS,CC,$(EMBEDDED_EXTRA_CFLAGS))
 $(call cc-option-add,CFLAGS,CC,-Wnested-externs)
 $(call as-option-add,CFLAGS,CC,"vmcall",-DHAVE_AS_VMX)
-$(call as-option-add,CFLAGS,CC,"crc32 %eax$$(comma)%eax",-DHAVE_AS_SSE4_2)
-$(call as-option-add,CFLAGS,CC,"invept (%rax)$$(comma)%rax",-DHAVE_AS_EPT)
+$(call as-option-add,CFLAGS,CC,"crc32 %eax$(comma)%eax",-DHAVE_AS_SSE4_2)
+$(call as-option-add,CFLAGS,CC,"invept (%rax)$(comma)%rax",-DHAVE_AS_EPT)
 $(call as-option-add,CFLAGS,CC,"rdrand %eax",-DHAVE_AS_RDRAND)
 $(call as-option-add,CFLAGS,CC,"rdfsbase %rax",-DHAVE_AS_FSGSBASE)
 $(call as-option-add,CFLAGS,CC,"xsaveopt (%rax)",-DHAVE_AS_XSAVEOPT)
 $(call as-option-add,CFLAGS,CC,"rdseed %eax",-DHAVE_AS_RDSEED)
 $(call as-option-add,CFLAGS,CC,"clac",-DHAVE_AS_CLAC_STAC)
 $(call as-option-add,CFLAGS,CC,"clwb (%rax)",-DHAVE_AS_CLWB)
-$(call as-option-add,CFLAGS,CC,".equ \"x\"$$(comma)1",-DHAVE_AS_QUOTED_SYM)
-$(call as-option-add,CFLAGS,CC,"invpcid (%rax)$$(comma)%rax",-DHAVE_AS_INVPCID)
-$(call as-option-add,CFLAGS,CC,"movdiri %rax$$(comma)(%rax)",-DHAVE_AS_MOVDIR)
-$(call as-option-add,CFLAGS,CC,"enqcmd (%rax)$$(comma)%rax",-DHAVE_AS_ENQCMD)
+$(call as-option-add,CFLAGS,CC,".equ \"x\"$(comma)1",-DHAVE_AS_QUOTED_SYM)
+$(call as-option-add,CFLAGS,CC,"invpcid (%rax)$(comma)%rax",-DHAVE_AS_INVPCID)
+$(call as-option-add,CFLAGS,CC,"movdiri %rax$(comma)(%rax)",-DHAVE_AS_MOVDIR)
+$(call as-option-add,CFLAGS,CC,"enqcmd (%rax)$(comma)%rax",-DHAVE_AS_ENQCMD)
 
 # GAS's idea of true is -1.  Clang's idea is 1
 $(call as-option-add,CFLAGS,CC,\
@@ -32,7 +32,7 @@ $(call as-option-add,CFLAGS,CC,\
 
 # Check to see whether the assmbler supports the .nop directive.
 $(call as-option-add,CFLAGS,CC,\
-    ".L1: .L2: .nops (.L2 - .L1)$$(comma)9",-DHAVE_AS_NOPS_DIRECTIVE)
+    ".L1: .L2: .nops (.L2 - .L1)$(comma)9",-DHAVE_AS_NOPS_DIRECTIVE)
 
 CFLAGS += -mno-red-zone -fpic
 
diff --git a/xen/scripts/Kbuild.include b/xen/scripts/Kbuild.include
index 6e7a403b35..785a32c32e 100644
--- a/xen/scripts/Kbuild.include
+++ b/xen/scripts/Kbuild.include
@@ -66,7 +66,7 @@ as-insn = $(if $(shell echo 'void _(void) { asm volatile ( $(2) ); }' \
 # Usage: $(call as-option-add,CFLAGS,CC,"insn",option-yes,option-no)
 as-option-add = $(eval $(call as-option-add-closure,$(1),$(2),$(3),$(4),$(5)))
 define as-option-add-closure
-    ifeq ($$(call as-insn,$$($(2)) $$($(1)),$(3),y,n),y)
+    ifeq ($$(call as-insn,$$($(2)) $$($(1)),$$(3),y,n),y)
         $(1) += $(4)
     else
         $(1) += $(5)
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Feb 14 11:22:07 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 14 Feb 2023 11:22:07 +0000
Received: from list by lists.xenproject.org with outflank-mailman.495140.765393 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pRtNr-0002mZ-61; Tue, 14 Feb 2023 11:22:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 495140.765393; Tue, 14 Feb 2023 11: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 1pRtNr-0002mR-2u; Tue, 14 Feb 2023 11:22:03 +0000
Received: by outflank-mailman (input) for mailman id 495140;
 Tue, 14 Feb 2023 11: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 1pRtNq-0002mL-DW
 for xen-changelog@lists.xenproject.org; Tue, 14 Feb 2023 11:22:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pRtNq-00058l-AE
 for xen-changelog@lists.xenproject.org; Tue, 14 Feb 2023 11:22:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pRtNq-0001Ri-99
 for xen-changelog@lists.xenproject.org; Tue, 14 Feb 2023 11:22:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=UirZ0nfrsn1OmnCSmL9qCr7I5sB66WkBSMG29oLMDRo=; b=ig1z4DbrJ3FYi+Pp+92APMON8E
	Ss/qWFaPzgx7mNDYrb91dka7iFLQkcqGSET1cI4Hr8ntQQrWDJdhTz1hl6SMoLdHnJaAovfUqz3y9
	kebbo4xBvxRy7GYvhIhcRgeVOAS1JdPdDGoEXrzILABEDdJcryIn4jHavhnPLVvn9C80=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/shadow: make iommu_snoop usage consistent with HAP's
Message-Id: <E1pRtNq-0001Ri-99@xenbits.xenproject.org>
Date: Tue, 14 Feb 2023 11:22:02 +0000

commit c609108b2190d1ef43582c2b17b1b2e0beae0fb0
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Mon Feb 13 16:26:03 2023 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Feb 13 16:26:03 2023 +0100

    x86/shadow: make iommu_snoop usage consistent with HAP's
    
    First of all the variable is meaningful only when an IOMMU is in use for
    a guest. Qualify the check accordingly, like done elsewhere. Furthermore
    the controlling command line option is supposed to take effect on VT-d
    only. Since command line parsing happens before we know whether we're
    going to use VT-d, force the variable back to set when instead running
    with AMD IOMMU(s).
    
    Since it may end up misleading, also remove the clearing of the flag in
    iommu_setup() and vtd_setup()'s error path. The variable simply is
    meaningless with IOMMU(s) disabled, so there's no point touching it
    there.
    
    Finally also correct a relevant nearby comment.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Xenia Ragiadakou <burzalodowa@gmail.com>
    Reviewed-by: Kevin Tian <kevin.tian@intel.com>
---
 xen/arch/x86/mm/shadow/multi.c      |  6 +++---
 xen/drivers/passthrough/iommu.c     |  3 ---
 xen/drivers/passthrough/vtd/iommu.c |  3 ---
 xen/drivers/passthrough/x86/iommu.c | 11 +++++++++++
 4 files changed, 14 insertions(+), 9 deletions(-)

diff --git a/xen/arch/x86/mm/shadow/multi.c b/xen/arch/x86/mm/shadow/multi.c
index cded39ef09..5f3e175bbe 100644
--- a/xen/arch/x86/mm/shadow/multi.c
+++ b/xen/arch/x86/mm/shadow/multi.c
@@ -556,8 +556,8 @@ _sh_propagate(struct vcpu *v,
 
         ASSERT(!(sflags & PAGE_CACHE_ATTRS));
 
-        /* compute the PAT index for shadow page entry when VT-d is enabled
-         * and device assigned.
+        /*
+         * Compute the PAT index for shadow page entry when IOMMU is enabled.
          * 1) direct MMIO: compute the PAT index with gMTRR=UC and gPAT.
          * 2) if enables snoop control, compute the PAT index as WB.
          * 3) if disables snoop control, compute the PAT index with
@@ -577,7 +577,7 @@ _sh_propagate(struct vcpu *v,
                             gfn_to_paddr(target_gfn),
                             mfn_to_maddr(target_mfn),
                             X86_MT_UC);
-                else if ( iommu_snoop )
+                else if ( is_iommu_enabled(d) && iommu_snoop )
                     sflags |= pat_type_2_pte_flags(X86_MT_WB);
                 else
                     sflags |= get_pat_flags(v,
diff --git a/xen/drivers/passthrough/iommu.c b/xen/drivers/passthrough/iommu.c
index b4dfa95dfd..921b71e819 100644
--- a/xen/drivers/passthrough/iommu.c
+++ b/xen/drivers/passthrough/iommu.c
@@ -587,9 +587,6 @@ int __init iommu_setup(void)
     printk("I/O virtualisation %sabled\n", iommu_enabled ? "en" : "dis");
     if ( !iommu_enabled )
     {
-#ifndef iommu_snoop
-        iommu_snoop = false;
-#endif
         iommu_hwdom_passthrough = false;
         iommu_hwdom_strict = false;
     }
diff --git a/xen/drivers/passthrough/vtd/iommu.c b/xen/drivers/passthrough/vtd/iommu.c
index 62e143125d..a9f4f28ad6 100644
--- a/xen/drivers/passthrough/vtd/iommu.c
+++ b/xen/drivers/passthrough/vtd/iommu.c
@@ -2746,9 +2746,6 @@ static int __init cf_check vtd_setup(void)
 
  error:
     iommu_enabled = 0;
-#ifndef iommu_snoop
-    iommu_snoop = false;
-#endif
     iommu_hwdom_passthrough = false;
     iommu_qinval = 0;
     iommu_intremap = iommu_intremap_off;
diff --git a/xen/drivers/passthrough/x86/iommu.c b/xen/drivers/passthrough/x86/iommu.c
index f671b0f2bb..5a8b28a4ca 100644
--- a/xen/drivers/passthrough/x86/iommu.c
+++ b/xen/drivers/passthrough/x86/iommu.c
@@ -56,6 +56,17 @@ void __init acpi_iommu_init(void)
     if ( !acpi_disabled )
     {
         ret = acpi_dmar_init();
+
+#ifndef iommu_snoop
+        /*
+         * As long as there's no per-domain snoop control, and as long as on
+         * AMD we uniformly force coherent accesses, a possible command line
+         * override should affect VT-d only.
+         */
+        if ( ret )
+            iommu_snoop = true;
+#endif
+
         if ( ret == -ENODEV )
             ret = acpi_ivrs_init();
     }
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Feb 14 11:22:13 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 14 Feb 2023 11:22:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.495141.765399 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pRtO1-0002pH-9M; Tue, 14 Feb 2023 11:22:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 495141.765399; Tue, 14 Feb 2023 11: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 1pRtO1-0002p5-66; Tue, 14 Feb 2023 11:22:13 +0000
Received: by outflank-mailman (input) for mailman id 495141;
 Tue, 14 Feb 2023 11: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 1pRtO0-0002oz-FP
 for xen-changelog@lists.xenproject.org; Tue, 14 Feb 2023 11:22:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pRtO0-00058p-EC
 for xen-changelog@lists.xenproject.org; Tue, 14 Feb 2023 11:22:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pRtO0-0001SD-CX
 for xen-changelog@lists.xenproject.org; Tue, 14 Feb 2023 11:22:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Dm3OLfzDzIxysDGAFeaIU9XnC8dvLVCtI/wv2bkb/cQ=; b=eOyySyJpqPemrafagjm7BVliop
	QPGL9QPLsFmkyuJ04ClqWrm1jwTopRDP6gumQz7CmrPLxJOo2S4wVjGiv8AQ5ZL5HnGeA69dg8sX5
	fLH6U/Rml+jJPvVBSzT0EVE9TOcMFZd5TX1p1XGRjrdIYg7Sjxi5T8Iixq1LXlQfXdqo=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/iommu: snoop control is allowed only by Intel VT-d
Message-Id: <E1pRtO0-0001SD-CX@xenbits.xenproject.org>
Date: Tue, 14 Feb 2023 11:22:12 +0000

commit 80b83a3c94e55a23f647dd3c92b522d77959bdc0
Author:     Xenia Ragiadakou <burzalodowa@gmail.com>
AuthorDate: Mon Feb 13 16:26:43 2023 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Feb 13 16:26:43 2023 +0100

    x86/iommu: snoop control is allowed only by Intel VT-d
    
    The AMD-Vi driver forces coherent accesses by hardwiring the FC bit to 1.
    Therefore, given that iommu_snoop is used only when the iommu is enabled,
    when Xen is configured with only the AMD iommu enabled, iommu_snoop can be
    reduced to a #define to true.
    
    No functional change intended.
    
    Signed-off-by: Xenia Ragiadakou <burzalodowa@gmail.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/include/xen/iommu.h | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/xen/include/xen/iommu.h b/xen/include/xen/iommu.h
index 4f22fc1bed..626731941b 100644
--- a/xen/include/xen/iommu.h
+++ b/xen/include/xen/iommu.h
@@ -74,7 +74,12 @@ extern enum __packed iommu_intremap {
    iommu_intremap_restricted,
    iommu_intremap_full,
 } iommu_intremap;
-extern bool iommu_igfx, iommu_qinval, iommu_snoop;
+extern bool iommu_igfx, iommu_qinval;
+#ifdef CONFIG_INTEL_IOMMU
+extern bool iommu_snoop;
+#else
+# define iommu_snoop true
+#endif /* CONFIG_INTEL_IOMMU */
 #else
 # define iommu_intremap false
 # define iommu_snoop false
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Feb 14 11:22:23 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 14 Feb 2023 11:22:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.495142.765402 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pRtOB-0002sW-Ay; Tue, 14 Feb 2023 11:22:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 495142.765402; Tue, 14 Feb 2023 11: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 1pRtOB-0002sM-7Y; Tue, 14 Feb 2023 11:22:23 +0000
Received: by outflank-mailman (input) for mailman id 495142;
 Tue, 14 Feb 2023 11: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 1pRtOA-0002sC-IY
 for xen-changelog@lists.xenproject.org; Tue, 14 Feb 2023 11:22:22 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pRtOA-00059D-Hr
 for xen-changelog@lists.xenproject.org; Tue, 14 Feb 2023 11:22:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pRtOA-0001St-GQ
 for xen-changelog@lists.xenproject.org; Tue, 14 Feb 2023 11:22:22 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=8SLlKadALmUyX1Z0PmfbcWyFX+zbcmj6XAMyc6Ynul4=; b=u2N+0yO4xiG9kxRnfRiexLMxN6
	MXwBw4CFNI+nhPmIqjUz1B1p17P5JPTCdqngxz4FOWaPcXlhHWmDb2iBwqxkauanuNXYWauvjjTZn
	G6erQZc9GIy++WkuJYQib1e1lhLWQSxAkt3OxHV9P7n8Xg3eW46p0C4PQdTNMlMg6VqQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/iommu: make code addressing CVE-2011-1898 no VT-d specific
Message-Id: <E1pRtOA-0001St-GQ@xenbits.xenproject.org>
Date: Tue, 14 Feb 2023 11:22:22 +0000

commit 9cf1318a32bca00d024fc4ff64f7c317bda56b5d
Author:     Xenia Ragiadakou <burzalodowa@gmail.com>
AuthorDate: Mon Feb 13 16:27:39 2023 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Feb 13 16:27:39 2023 +0100

    x86/iommu: make code addressing CVE-2011-1898 no VT-d specific
    
    The variable untrusted_msi indicates whether the system is vulnerable to
    CVE-2011-1898 due to the absence of interrupt remapping support.
    Although AMD iommus with interrupt remapping disabled are also affected,
    this case is not handled yet. Given that the issue is not VT-d specific,
    and to accommodate future use of the flag for covering also the AMD iommu
    case, move the definition of the flag out of the VT-d specific code to the
    common x86 iommu code.
    
    Also, since the current implementation assumes that only PV guests are prone
    to this attack, take the opportunity to define untrusted_msi only when PV is
    enabled.
    
    No functional change intended.
    
    Signed-off-by: Xenia Ragiadakou <burzalodowa@gmail.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Kevin Tian <kevin.tian@intel.com>
---
 xen/drivers/passthrough/vtd/iommu.c | 5 ++---
 xen/drivers/passthrough/x86/iommu.c | 5 +++++
 2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/xen/drivers/passthrough/vtd/iommu.c b/xen/drivers/passthrough/vtd/iommu.c
index a9f4f28ad6..130a159cde 100644
--- a/xen/drivers/passthrough/vtd/iommu.c
+++ b/xen/drivers/passthrough/vtd/iommu.c
@@ -54,9 +54,6 @@
                                  ? dom_iommu(d)->arch.vtd.pgd_maddr \
                                  : (pdev)->arch.vtd.pgd_maddr)
 
-/* Possible unfiltered LAPIC/MSI messages from untrusted sources? */
-bool __read_mostly untrusted_msi;
-
 bool __read_mostly iommu_igfx = true;
 bool __read_mostly iommu_qinval = true;
 #ifndef iommu_snoop
@@ -2767,6 +2764,7 @@ static int cf_check reassign_device_ownership(
         if ( !has_arch_pdevs(target) )
             vmx_pi_hooks_assign(target);
 
+#ifdef CONFIG_PV
         /*
          * Devices assigned to untrusted domains (here assumed to be any domU)
          * can attempt to send arbitrary LAPIC/MSI messages. We are unprotected
@@ -2775,6 +2773,7 @@ static int cf_check reassign_device_ownership(
         if ( !iommu_intremap && !is_hardware_domain(target) &&
              !is_system_domain(target) )
             untrusted_msi = true;
+#endif
 
         ret = domain_context_mapping(target, devfn, pdev);
 
diff --git a/xen/drivers/passthrough/x86/iommu.c b/xen/drivers/passthrough/x86/iommu.c
index 5a8b28a4ca..9c868db63b 100644
--- a/xen/drivers/passthrough/x86/iommu.c
+++ b/xen/drivers/passthrough/x86/iommu.c
@@ -36,6 +36,11 @@ bool __initdata iommu_superpages = true;
 
 enum iommu_intremap __read_mostly iommu_intremap = iommu_intremap_full;
 
+#ifdef CONFIG_PV
+/* Possible unfiltered LAPIC/MSI messages from untrusted sources? */
+bool __read_mostly untrusted_msi;
+#endif
+
 #ifndef iommu_intpost
 /*
  * In the current implementation of VT-d posted interrupts, in some extreme
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Feb 14 11:22:33 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 14 Feb 2023 11:22:33 +0000
Received: from list by lists.xenproject.org with outflank-mailman.495143.765405 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pRtOL-0002vD-Bq; Tue, 14 Feb 2023 11:22:33 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 495143.765405; Tue, 14 Feb 2023 11: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 1pRtOL-0002v5-99; Tue, 14 Feb 2023 11:22:33 +0000
Received: by outflank-mailman (input) for mailman id 495143;
 Tue, 14 Feb 2023 11: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 1pRtOK-0002ux-M9
 for xen-changelog@lists.xenproject.org; Tue, 14 Feb 2023 11:22:32 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pRtOK-00059a-LQ
 for xen-changelog@lists.xenproject.org; Tue, 14 Feb 2023 11:22:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pRtOK-0001TO-KQ
 for xen-changelog@lists.xenproject.org; Tue, 14 Feb 2023 11:22:32 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=0a/ZQcpByToZMaf+DvJdF1ijfzpl0PefK9wfMen+4NU=; b=qIPnU+VTAWwLkRjMS21qOZXAt9
	qhxULKHeieCylDj9lGC3tYEDGhHd9J55AxuzOgxdSQmWgwKdqqr6FyS8prYqfb59zIlDytvQC40fM
	kAcO0HCsN/KTQ4SobMsmhRNtEcV1qRgD3WTK7cD9VMMAdpg2as76DsxvpuKsyxGtv4+M=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/iommu: call pi_update_irte through an hvm_function callback
Message-Id: <E1pRtOK-0001TO-KQ@xenbits.xenproject.org>
Date: Tue, 14 Feb 2023 11:22:32 +0000

commit 0d57bba8ad0ef3d1ae5dd1ad3677ec34351ef530
Author:     Xenia Ragiadakou <burzalodowa@gmail.com>
AuthorDate: Mon Feb 13 16:28:32 2023 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Feb 13 16:28:32 2023 +0100

    x86/iommu: call pi_update_irte through an hvm_function callback
    
    Posted interrupt support in Xen is currently implemented only for the
    Intel platforms. Instead of calling directly pi_update_irte() from the
    common hvm code, add a pi_update_irte callback to the hvm_function_table.
    Then, create a wrapper function hvm_pi_update_irte() to be used by the
    common hvm code.
    
    In the pi_update_irte callback prototype, pass the vcpu as first parameter
    instead of the posted-interrupt descriptor that is platform specific, and
    remove the const qualifier from the parameter gvec since it is not needed
    and because it does not compile with the alternative code patching in use.
    
    Since the posted interrupt descriptor is Intel VT-x specific while
    msi_msg_write_remap_rte is iommu specific, open code pi_update_irte() inside
    vmx_pi_update_irte() but replace msi_msg_write_remap_rte() with generic
    iommu_update_ire_from_msi(). That way vmx_pi_update_irte() is not bound to
    Intel VT-d anymore.
    
    Remove the now unused pi_update_irte() implementation.
    
    No functional change intended.
    
    Signed-off-by: Xenia Ragiadakou <burzalodowa@gmail.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Kevin Tian <kevin.tian@intel.com>
---
 xen/arch/x86/hvm/vmx/vmx.c             | 41 ++++++++++++++++++++++++++++++++++
 xen/arch/x86/include/asm/hvm/hvm.h     | 10 +++++++++
 xen/arch/x86/include/asm/iommu.h       |  4 ----
 xen/drivers/passthrough/vtd/intremap.c | 36 -----------------------------
 xen/drivers/passthrough/x86/hvm.c      |  5 ++---
 5 files changed, 53 insertions(+), 43 deletions(-)

diff --git a/xen/arch/x86/hvm/vmx/vmx.c b/xen/arch/x86/hvm/vmx/vmx.c
index ade2a25ce7..270bc98195 100644
--- a/xen/arch/x86/hvm/vmx/vmx.c
+++ b/xen/arch/x86/hvm/vmx/vmx.c
@@ -397,6 +397,43 @@ void vmx_pi_hooks_deassign(struct domain *d)
     domain_unpause(d);
 }
 
+/*
+ * This function is used to update the IRTE for posted-interrupt
+ * when guest changes MSI/MSI-X information.
+ */
+static int cf_check vmx_pi_update_irte(const struct vcpu *v,
+                                       const struct pirq *pirq, uint8_t gvec)
+{
+    const struct pi_desc *pi_desc = v ? &v->arch.hvm.vmx.pi_desc : NULL;
+    struct irq_desc *desc;
+    struct msi_desc *msi_desc;
+    int rc;
+
+    desc = pirq_spin_lock_irq_desc(pirq, NULL);
+    if ( !desc )
+        return -EINVAL;
+
+    msi_desc = desc->msi_desc;
+    if ( !msi_desc )
+    {
+        rc = -ENODEV;
+        goto unlock_out;
+    }
+    msi_desc->pi_desc = pi_desc;
+    msi_desc->gvec = gvec;
+
+    spin_unlock_irq(&desc->lock);
+
+    ASSERT(pcidevs_locked());
+
+    return iommu_update_ire_from_msi(msi_desc, &msi_desc->msg);
+
+ unlock_out:
+    spin_unlock_irq(&desc->lock);
+
+    return rc;
+}
+
 static const struct lbr_info {
     u32 base, count;
 } p4_lbr[] = {
@@ -2986,8 +3023,12 @@ const struct hvm_function_table * __init start_vmx(void)
     {
         alloc_direct_apic_vector(&posted_intr_vector, pi_notification_interrupt);
         if ( iommu_intpost )
+        {
             alloc_direct_apic_vector(&pi_wakeup_vector, pi_wakeup_interrupt);
 
+            vmx_function_table.pi_update_irte = vmx_pi_update_irte;
+        }
+
         vmx_function_table.deliver_posted_intr = vmx_deliver_posted_intr;
         vmx_function_table.sync_pir_to_irr     = vmx_sync_pir_to_irr;
         vmx_function_table.test_pir            = vmx_test_pir;
diff --git a/xen/arch/x86/include/asm/hvm/hvm.h b/xen/arch/x86/include/asm/hvm/hvm.h
index 65768c797e..80e4565bd2 100644
--- a/xen/arch/x86/include/asm/hvm/hvm.h
+++ b/xen/arch/x86/include/asm/hvm/hvm.h
@@ -28,6 +28,8 @@
 #include <asm/x86_emulate.h>
 #include <asm/hvm/asid.h>
 
+struct pirq; /* needed by pi_update_irte */
+
 #ifdef CONFIG_HVM_FEP
 /* Permit use of the Forced Emulation Prefix in HVM guests */
 extern bool_t opt_hvm_fep;
@@ -213,6 +215,8 @@ struct hvm_function_table {
     void (*sync_pir_to_irr)(struct vcpu *v);
     bool (*test_pir)(const struct vcpu *v, uint8_t vector);
     void (*handle_eoi)(uint8_t vector, int isr);
+    int (*pi_update_irte)(const struct vcpu *v, const struct pirq *pirq,
+                          uint8_t gvec);
 
     /*Walk nested p2m  */
     int (*nhvm_hap_walk_L1_p2m)(struct vcpu *v, paddr_t L2_gpa,
@@ -776,6 +780,12 @@ static inline void hvm_set_nonreg_state(struct vcpu *v,
         alternative_vcall(hvm_funcs.set_nonreg_state, v, nrs);
 }
 
+static inline int hvm_pi_update_irte(const struct vcpu *v,
+                                     const struct pirq *pirq, uint8_t gvec)
+{
+    return alternative_call(hvm_funcs.pi_update_irte, v, pirq, gvec);
+}
+
 #else  /* CONFIG_HVM */
 
 #define hvm_enabled false
diff --git a/xen/arch/x86/include/asm/iommu.h b/xen/arch/x86/include/asm/iommu.h
index fc0afe35bf..586c7434f2 100644
--- a/xen/arch/x86/include/asm/iommu.h
+++ b/xen/arch/x86/include/asm/iommu.h
@@ -21,7 +21,6 @@
 #include <asm/apicdef.h>
 #include <asm/cache.h>
 #include <asm/processor.h>
-#include <asm/hvm/vmx/vmcs.h>
 
 #define DEFAULT_DOMAIN_ADDRESS_WIDTH 48
 
@@ -129,9 +128,6 @@ void iommu_identity_map_teardown(struct domain *d);
 
 extern bool untrusted_msi;
 
-int pi_update_irte(const struct pi_desc *pi_desc, const struct pirq *pirq,
-                   const uint8_t gvec);
-
 extern bool iommu_non_coherent, iommu_superpages;
 
 static inline void iommu_sync_cache(const void *addr, unsigned int size)
diff --git a/xen/drivers/passthrough/vtd/intremap.c b/xen/drivers/passthrough/vtd/intremap.c
index 1512e4866b..b39bc83282 100644
--- a/xen/drivers/passthrough/vtd/intremap.c
+++ b/xen/drivers/passthrough/vtd/intremap.c
@@ -866,39 +866,3 @@ void cf_check intel_iommu_disable_eim(void)
     for_each_drhd_unit ( drhd )
         disable_qinval(drhd->iommu);
 }
-
-/*
- * This function is used to update the IRTE for posted-interrupt
- * when guest changes MSI/MSI-X information.
- */
-int pi_update_irte(const struct pi_desc *pi_desc, const struct pirq *pirq,
-    const uint8_t gvec)
-{
-    struct irq_desc *desc;
-    struct msi_desc *msi_desc;
-    int rc;
-
-    desc = pirq_spin_lock_irq_desc(pirq, NULL);
-    if ( !desc )
-        return -EINVAL;
-
-    msi_desc = desc->msi_desc;
-    if ( !msi_desc )
-    {
-        rc = -ENODEV;
-        goto unlock_out;
-    }
-    msi_desc->pi_desc = pi_desc;
-    msi_desc->gvec = gvec;
-
-    spin_unlock_irq(&desc->lock);
-
-    ASSERT(pcidevs_locked());
-
-    return msi_msg_write_remap_rte(msi_desc, &msi_desc->msg);
-
- unlock_out:
-    spin_unlock_irq(&desc->lock);
-
-    return rc;
-}
diff --git a/xen/drivers/passthrough/x86/hvm.c b/xen/drivers/passthrough/x86/hvm.c
index dd09ec22f1..7b9ad7bae2 100644
--- a/xen/drivers/passthrough/x86/hvm.c
+++ b/xen/drivers/passthrough/x86/hvm.c
@@ -380,8 +380,7 @@ int pt_irq_create_bind(
 
         /* Use interrupt posting if it is supported. */
         if ( iommu_intpost )
-            pi_update_irte(vcpu ? &vcpu->arch.hvm.vmx.pi_desc : NULL,
-                           info, pirq_dpci->gmsi.gvec);
+            hvm_pi_update_irte(vcpu, info, pirq_dpci->gmsi.gvec);
 
         if ( pt_irq_bind->u.msi.gflags & XEN_DOMCTL_VMSI_X86_UNMASKED )
         {
@@ -671,7 +670,7 @@ int pt_irq_destroy_bind(
             what = "bogus";
     }
     else if ( pirq_dpci && pirq_dpci->gmsi.posted )
-        pi_update_irte(NULL, pirq, 0);
+        hvm_pi_update_irte(NULL, pirq, 0);
 
     if ( pirq_dpci && (pirq_dpci->flags & HVM_IRQ_DPCI_MAPPED) &&
          list_empty(&pirq_dpci->digl_list) )
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Feb 14 11:22:43 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 14 Feb 2023 11:22:43 +0000
Received: from list by lists.xenproject.org with outflank-mailman.495144.765408 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pRtOV-0002y1-D9; Tue, 14 Feb 2023 11:22:43 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 495144.765408; Tue, 14 Feb 2023 11: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 1pRtOV-0002xu-Af; Tue, 14 Feb 2023 11:22:43 +0000
Received: by outflank-mailman (input) for mailman id 495144;
 Tue, 14 Feb 2023 11:22:42 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pRtOU-0002xk-Q0
 for xen-changelog@lists.xenproject.org; Tue, 14 Feb 2023 11:22:42 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pRtOU-0005AE-PE
 for xen-changelog@lists.xenproject.org; Tue, 14 Feb 2023 11:22:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pRtOU-0001U6-Nf
 for xen-changelog@lists.xenproject.org; Tue, 14 Feb 2023 11:22:42 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=D7BxeDVn7i4nTezsfWMJRfj2ftJGDsaMxd9F+bqUrBw=; b=edVvR6S8u5KrCq8g8oSmv9DSrp
	O0xUak8hZ51nivbwzTS0iB+tjtI6boASGl0owkPUvZwKO1mu4xEICyfU/9WHKmEA9afLlF+z3nLFK
	YyGEIehREDAfvXQvvZPSa2xPjQ7u/beslOfwimbZcWNkDRSomapKiBcL7tWjRCLsWpCo=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/dpci: move hvm_dpci_isairq_eoi() to generic HVM code
Message-Id: <E1pRtOU-0001U6-Nf@xenbits.xenproject.org>
Date: Tue, 14 Feb 2023 11:22:42 +0000

commit bb1057ed40840633a9f430edb95df2d7fb23470c
Author:     Xenia Ragiadakou <burzalodowa@gmail.com>
AuthorDate: Mon Feb 13 16:29:20 2023 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Feb 13 16:29:20 2023 +0100

    x86/dpci: move hvm_dpci_isairq_eoi() to generic HVM code
    
    The function hvm_dpci_isairq_eoi() has no dependencies on VT-d driver code
    and can be moved from xen/drivers/passthrough/vtd/x86/hvm.c to
    xen/drivers/passthrough/x86/hvm.c, along with the corresponding copyrights.
    
    Remove the now empty xen/drivers/passthrough/vtd/x86/hvm.c.
    
    Since the function is used only in this file, declare it static.
    
    No functional change intended.
    
    Signed-off-by: Xenia Ragiadakou <burzalodowa@gmail.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Kevin Tian <kevin.tian@intel.com>
---
 xen/drivers/passthrough/vtd/x86/Makefile |  1 -
 xen/drivers/passthrough/vtd/x86/hvm.c    | 64 --------------------------------
 xen/drivers/passthrough/x86/hvm.c        | 45 ++++++++++++++++++++++
 xen/include/xen/iommu.h                  |  1 -
 4 files changed, 45 insertions(+), 66 deletions(-)

diff --git a/xen/drivers/passthrough/vtd/x86/Makefile b/xen/drivers/passthrough/vtd/x86/Makefile
index 4ef00a4c5b..fe20a0b019 100644
--- a/xen/drivers/passthrough/vtd/x86/Makefile
+++ b/xen/drivers/passthrough/vtd/x86/Makefile
@@ -1,3 +1,2 @@
 obj-y += ats.o
-obj-$(CONFIG_HVM) += hvm.o
 obj-y += vtd.o
diff --git a/xen/drivers/passthrough/vtd/x86/hvm.c b/xen/drivers/passthrough/vtd/x86/hvm.c
deleted file mode 100644
index bc776cf7da..0000000000
--- a/xen/drivers/passthrough/vtd/x86/hvm.c
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Copyright (c) 2008, Intel Corporation.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms and conditions of the GNU General Public License,
- * version 2, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
- * more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program; If not, see <http://www.gnu.org/licenses/>.
- *
- * Copyright (C) Allen Kay <allen.m.kay@intel.com>
- * Copyright (C) Weidong Han <weidong.han@intel.com>
- */
-
-#include <xen/iommu.h>
-#include <xen/irq.h>
-#include <xen/sched.h>
-
-static int cf_check _hvm_dpci_isairq_eoi(
-    struct domain *d, struct hvm_pirq_dpci *pirq_dpci, void *arg)
-{
-    struct hvm_irq *hvm_irq = hvm_domain_irq(d);
-    unsigned int isairq = (long)arg;
-    const struct dev_intx_gsi_link *digl;
-
-    list_for_each_entry ( digl, &pirq_dpci->digl_list, list )
-    {
-        unsigned int link = hvm_pci_intx_link(digl->device, digl->intx);
-
-        if ( hvm_irq->pci_link.route[link] == isairq )
-        {
-            hvm_pci_intx_deassert(d, digl->device, digl->intx);
-            if ( --pirq_dpci->pending == 0 )
-                pirq_guest_eoi(dpci_pirq(pirq_dpci));
-        }
-    }
-
-    return 0;
-}
-
-void hvm_dpci_isairq_eoi(struct domain *d, unsigned int isairq)
-{
-    struct hvm_irq_dpci *dpci = NULL;
-
-    ASSERT(isairq < NR_ISAIRQS);
-    if ( !is_iommu_enabled(d) )
-        return;
-
-    write_lock(&d->event_lock);
-
-    dpci = domain_get_irq_dpci(d);
-
-    if ( dpci && test_bit(isairq, dpci->isairq_map) )
-    {
-        /* Multiple mirq may be mapped to one isa irq */
-        pt_pirq_iterate(d, _hvm_dpci_isairq_eoi, (void *)(long)isairq);
-    }
-    write_unlock(&d->event_lock);
-}
diff --git a/xen/drivers/passthrough/x86/hvm.c b/xen/drivers/passthrough/x86/hvm.c
index 7b9ad7bae2..8175ba629a 100644
--- a/xen/drivers/passthrough/x86/hvm.c
+++ b/xen/drivers/passthrough/x86/hvm.c
@@ -14,6 +14,7 @@
  * this program; If not, see <http://www.gnu.org/licenses/>.
  *
  * Copyright (C) Allen Kay <allen.m.kay@intel.com>
+ * Copyright (C) Weidong Han <weidong.han@intel.com>
  * Copyright (C) Xiaohui Xin <xiaohui.xin@intel.com>
  */
 
@@ -923,6 +924,50 @@ static void hvm_gsi_eoi(struct domain *d, unsigned int gsi)
     hvm_pirq_eoi(pirq);
 }
 
+static int cf_check _hvm_dpci_isairq_eoi(
+    struct domain *d, struct hvm_pirq_dpci *pirq_dpci, void *arg)
+{
+    const struct hvm_irq *hvm_irq = hvm_domain_irq(d);
+    unsigned int isairq = (long)arg;
+    const struct dev_intx_gsi_link *digl;
+
+    list_for_each_entry ( digl, &pirq_dpci->digl_list, list )
+    {
+        unsigned int link = hvm_pci_intx_link(digl->device, digl->intx);
+
+        if ( hvm_irq->pci_link.route[link] == isairq )
+        {
+            hvm_pci_intx_deassert(d, digl->device, digl->intx);
+            if ( --pirq_dpci->pending == 0 )
+                pirq_guest_eoi(dpci_pirq(pirq_dpci));
+        }
+    }
+
+    return 0;
+}
+
+static void hvm_dpci_isairq_eoi(struct domain *d, unsigned int isairq)
+{
+    const struct hvm_irq_dpci *dpci = NULL;
+
+    ASSERT(isairq < NR_ISAIRQS);
+
+    if ( !is_iommu_enabled(d) )
+        return;
+
+    write_lock(&d->event_lock);
+
+    dpci = domain_get_irq_dpci(d);
+
+    if ( dpci && test_bit(isairq, dpci->isairq_map) )
+    {
+        /* Multiple mirq may be mapped to one isa irq */
+        pt_pirq_iterate(d, _hvm_dpci_isairq_eoi, (void *)(long)isairq);
+    }
+
+    write_unlock(&d->event_lock);
+}
+
 void hvm_dpci_eoi(struct domain *d, unsigned int guest_gsi)
 {
     const struct hvm_irq_dpci *hvm_irq_dpci;
diff --git a/xen/include/xen/iommu.h b/xen/include/xen/iommu.h
index 626731941b..405db59971 100644
--- a/xen/include/xen/iommu.h
+++ b/xen/include/xen/iommu.h
@@ -201,7 +201,6 @@ int hvm_do_IRQ_dpci(struct domain *, struct pirq *);
 int pt_irq_create_bind(struct domain *, const struct xen_domctl_bind_pt_irq *);
 int pt_irq_destroy_bind(struct domain *, const struct xen_domctl_bind_pt_irq *);
 
-void hvm_dpci_isairq_eoi(struct domain *d, unsigned int isairq);
 struct hvm_irq_dpci *domain_get_irq_dpci(const struct domain *);
 void free_hvm_irq_dpci(struct hvm_irq_dpci *dpci);
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Feb 14 11:22:53 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 14 Feb 2023 11:22:53 +0000
Received: from list by lists.xenproject.org with outflank-mailman.495145.765413 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pRtOf-00030Z-F5; Tue, 14 Feb 2023 11:22:53 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 495145.765413; Tue, 14 Feb 2023 11:22:53 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pRtOf-00030P-CD; Tue, 14 Feb 2023 11:22:53 +0000
Received: by outflank-mailman (input) for mailman id 495145;
 Tue, 14 Feb 2023 11:22: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 1pRtOe-00030J-Su
 for xen-changelog@lists.xenproject.org; Tue, 14 Feb 2023 11:22:52 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pRtOe-0005Ad-SD
 for xen-changelog@lists.xenproject.org; Tue, 14 Feb 2023 11:22:52 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pRtOe-0001UX-RL
 for xen-changelog@lists.xenproject.org; Tue, 14 Feb 2023 11:22:52 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=c+AQUk8hdH3ouBc4EpbYLmRCwD0KGwzJ4HbtBG2dOTw=; b=Zk3Www2HnI6G1ef43cKsvV/87l
	BYWgMoGbCg7YsZJN+7Ms2UG9SfAiZInlao+JxT3vmrlaK8jm/nc3gavJuBCKV6C2/aJQ/OARUwJ07
	qSu1PhTuW6LVF3rl/bqJ24Qj3UxuYDOAaP6xAR/5sgfCEgazhhXKjjEpZxHklpsPbtNE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/iommu: make AMD-Vi and Intel VT-d support configurable
Message-Id: <E1pRtOe-0001UX-RL@xenbits.xenproject.org>
Date: Tue, 14 Feb 2023 11:22:52 +0000

commit 9b70bc6d9678142a40e6c1c6934a32c7a0966e38
Author:     Xenia Ragiadakou <burzalodowa@gmail.com>
AuthorDate: Mon Feb 13 16:30:06 2023 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Feb 13 16:30:06 2023 +0100

    x86/iommu: make AMD-Vi and Intel VT-d support configurable
    
    Provide the user with configuration control over the IOMMU support by making
    AMD_IOMMU and INTEL_IOMMU options user selectable and able to be turned off.
    
    However, there are cases where the IOMMU support is required, for instance for
    a system with more than 254 CPUs. In order to prevent users from unknowingly
    disabling it and ending up with a broken hypervisor, make the support user
    selectable only if EXPERT is enabled.
    
    To preserve the current default configuration of an x86 system, both options
    depend on X86 and default to Y.
    
    Signed-off-by: Xenia Ragiadakou <burzalodowa@gmail.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/drivers/passthrough/Kconfig | 22 ++++++++++++++++++++--
 1 file changed, 20 insertions(+), 2 deletions(-)

diff --git a/xen/drivers/passthrough/Kconfig b/xen/drivers/passthrough/Kconfig
index 5c65567744..864fcf3b0c 100644
--- a/xen/drivers/passthrough/Kconfig
+++ b/xen/drivers/passthrough/Kconfig
@@ -38,10 +38,28 @@ config IPMMU_VMSA
 endif
 
 config AMD_IOMMU
-	def_bool y if X86
+	bool "AMD IOMMU" if EXPERT
+	depends on X86
+	default y
+	help
+	  Enables I/O virtualization on platforms that implement the
+	  AMD I/O Virtualization Technology (IOMMU).
+
+	  If your system includes an IOMMU implementing AMD-Vi, say Y.
+	  This is required if your system has more than 254 CPUs.
+	  If in doubt, say Y.
 
 config INTEL_IOMMU
-	def_bool y if X86
+	bool "Intel VT-d" if EXPERT
+	depends on X86
+	default y
+	help
+	  Enables I/O virtualization on platforms that implement the
+	  Intel Virtualization Technology for Directed I/O (Intel VT-d).
+
+	  If your system includes an IOMMU implementing Intel VT-d, say Y.
+	  This is required if your system has more than 254 CPUs.
+	  If in doubt, say Y.
 
 config IOMMU_FORCE_PT_SHARE
 	bool
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Feb 15 04:55:07 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 15 Feb 2023 04:55:07 +0000
Received: from list by lists.xenproject.org with outflank-mailman.495721.766136 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pS9ot-0000TY-1y; Wed, 15 Feb 2023 04:55:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 495721.766136; Wed, 15 Feb 2023 04: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 1pS9os-0000TM-UR; Wed, 15 Feb 2023 04:55:02 +0000
Received: by outflank-mailman (input) for mailman id 495721;
 Wed, 15 Feb 2023 04: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 1pS9or-0000TE-Dv
 for xen-changelog@lists.xenproject.org; Wed, 15 Feb 2023 04:55:01 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pS9or-00069n-D5
 for xen-changelog@lists.xenproject.org; Wed, 15 Feb 2023 04:55:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pS9or-00043U-C8
 for xen-changelog@lists.xenproject.org; Wed, 15 Feb 2023 04:55:01 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=bkJJQVRWWEixZrb+QMXo+hkCUIqUMGx1kK985iICJdI=; b=OAoVk+9qI9883LRxXOyUJ0OeFv
	M1yfxf27DV25kr1pwt/7He42AekKrFmSj+PzxFthSFyeEpZbCDREgWuH/lFj1u+S8Ek1jUt7qEIB3
	ZkC95n2UK6/X1+xDhfTxjGsG+U4dqH8WQ8YX0KCeecxDT0YF1CxXiqZAsqstnHJdg9W8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.17] x86/spec-ctrl: Mitigate Cross-Thread Return Address Predictions
Message-Id: <E1pS9or-00043U-C8@xenbits.xenproject.org>
Date: Wed, 15 Feb 2023 04:55:01 +0000

commit 3685e754e6017c616769b28133286d06bf07b613
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu Sep 8 21:27:58 2022 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Feb 14 17:53:49 2023 +0000

    x86/spec-ctrl: Mitigate Cross-Thread Return Address Predictions
    
    This is XSA-426 / CVE-2022-27672
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    (cherry picked from commit 63305e5392ec2d17b85e7996a97462744425db80)
---
 docs/misc/xen-command-line.pandoc      |  2 +-
 xen/arch/x86/include/asm/cpufeatures.h |  3 ++-
 xen/arch/x86/include/asm/spec_ctrl.h   | 15 +++++++++++++++
 xen/arch/x86/spec_ctrl.c               | 31 ++++++++++++++++++++++++++++---
 4 files changed, 46 insertions(+), 5 deletions(-)

diff --git a/docs/misc/xen-command-line.pandoc b/docs/misc/xen-command-line.pandoc
index 424b12cfb2..e7fe8b0cc9 100644
--- a/docs/misc/xen-command-line.pandoc
+++ b/docs/misc/xen-command-line.pandoc
@@ -2343,7 +2343,7 @@ guests to use.
   on entry and exit.  These blocks are necessary to virtualise support for
   guests and if disabled, guests will be unable to use IBRS/STIBP/SSBD/etc.
 * `rsb=` offers control over whether to overwrite the Return Stack Buffer /
-  Return Address Stack on entry to Xen.
+  Return Address Stack on entry to Xen and on idle.
 * `md-clear=` offers control over whether to use VERW to flush
   microarchitectural buffers on idle and exit from Xen.  *Note: For
   compatibility with development versions of this fix, `mds=` is also accepted
diff --git a/xen/arch/x86/include/asm/cpufeatures.h b/xen/arch/x86/include/asm/cpufeatures.h
index 865f110986..da0593de85 100644
--- a/xen/arch/x86/include/asm/cpufeatures.h
+++ b/xen/arch/x86/include/asm/cpufeatures.h
@@ -35,7 +35,8 @@ XEN_CPUFEATURE(SC_RSB_HVM,        X86_SYNTH(19)) /* RSB overwrite needed for HVM
 XEN_CPUFEATURE(XEN_SELFSNOOP,     X86_SYNTH(20)) /* SELFSNOOP gets used by Xen itself */
 XEN_CPUFEATURE(SC_MSR_IDLE,       X86_SYNTH(21)) /* Clear MSR_SPEC_CTRL on idle */
 XEN_CPUFEATURE(XEN_LBR,           X86_SYNTH(22)) /* Xen uses MSR_DEBUGCTL.LBR */
-/* Bits 23,24 unused. */
+/* Bits 23 unused. */
+XEN_CPUFEATURE(SC_RSB_IDLE,       X86_SYNTH(24)) /* RSB overwrite needed for idle. */
 XEN_CPUFEATURE(SC_VERW_IDLE,      X86_SYNTH(25)) /* VERW used by Xen for idle */
 XEN_CPUFEATURE(XEN_SHSTK,         X86_SYNTH(26)) /* Xen uses CET Shadow Stacks */
 XEN_CPUFEATURE(XEN_IBT,           X86_SYNTH(27)) /* Xen uses CET Indirect Branch Tracking */
diff --git a/xen/arch/x86/include/asm/spec_ctrl.h b/xen/arch/x86/include/asm/spec_ctrl.h
index 6a77c39378..391973ef6a 100644
--- a/xen/arch/x86/include/asm/spec_ctrl.h
+++ b/xen/arch/x86/include/asm/spec_ctrl.h
@@ -159,6 +159,21 @@ static always_inline void spec_ctrl_enter_idle(struct cpu_info *info)
      */
     alternative_input("", "verw %[sel]", X86_FEATURE_SC_VERW_IDLE,
                       [sel] "m" (info->verw_sel));
+
+    /*
+     * Cross-Thread Return Address Predictions:
+     *
+     * On vulnerable systems, the return predictions (RSB/RAS) are statically
+     * partitioned between active threads.  When entering idle, our entries
+     * are re-partitioned to allow the other threads to use them.
+     *
+     * In some cases, we might still have guest entries in the RAS, so flush
+     * them before injecting them sideways to our sibling thread.
+     *
+     * (ab)use alternative_input() to specify clobbers.
+     */
+    alternative_input("", "DO_OVERWRITE_RSB", X86_FEATURE_SC_RSB_IDLE,
+                      : "rax", "rcx");
 }
 
 /* WARNING! `ret`, `call *`, `jmp *` not safe before this call. */
diff --git a/xen/arch/x86/spec_ctrl.c b/xen/arch/x86/spec_ctrl.c
index a320b81947..e80e2a5ed1 100644
--- a/xen/arch/x86/spec_ctrl.c
+++ b/xen/arch/x86/spec_ctrl.c
@@ -1327,13 +1327,38 @@ void __init init_speculation_mitigations(void)
      * 3) Some CPUs have RSBs which are not full width, which allow the
      *    attacker's entries to alias Xen addresses.
      *
+     * 4) Some CPUs have RSBs which are re-partitioned based on thread
+     *    idleness, which allows an attacker to inject entries into the other
+     *    thread.  We still active the optimisation in this case, and mitigate
+     *    in the idle path which has lower overhead.
+     *
      * It is safe to turn off RSB stuffing when Xen is using SMEP itself, and
      * 32bit PV guests are disabled, and when the RSB is full width.
      */
     BUILD_BUG_ON(RO_MPT_VIRT_START != PML4_ADDR(256));
-    if ( opt_rsb_pv == -1 && boot_cpu_has(X86_FEATURE_XEN_SMEP) &&
-         !opt_pv32 && rsb_is_full_width() )
-        opt_rsb_pv = 0;
+    if ( opt_rsb_pv == -1 )
+    {
+        opt_rsb_pv = (opt_pv32 || !boot_cpu_has(X86_FEATURE_XEN_SMEP) ||
+                      !rsb_is_full_width());
+
+        /*
+         * Cross-Thread Return Address Predictions.
+         *
+         * Vulnerable systems are Zen1/Zen2 uarch, which is AMD Fam17 / Hygon
+         * Fam18, when SMT is active.
+         *
+         * To mitigate, we must flush the RSB/RAS/RAP once between entering
+         * Xen and going idle.
+         *
+         * Most cases flush on entry to Xen anyway.  The one case where we
+         * don't is when using the SMEP optimisation for PV guests.  Flushing
+         * before going idle is less overhead than flushing on PV entry.
+         */
+        if ( !opt_rsb_pv && hw_smt_enabled &&
+             (boot_cpu_data.x86_vendor & (X86_VENDOR_AMD|X86_VENDOR_HYGON)) &&
+             (boot_cpu_data.x86 == 0x17 || boot_cpu_data.x86 == 0x18) )
+            setup_force_cpu_cap(X86_FEATURE_SC_RSB_IDLE);
+    }
 
     if ( opt_rsb_pv )
     {
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.17


From xen-changelog-bounces@lists.xenproject.org Wed Feb 15 10:33:08 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 15 Feb 2023 10:33:08 +0000
Received: from list by lists.xenproject.org with outflank-mailman.495843.766272 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pSF5z-0005JS-7x; Wed, 15 Feb 2023 10:33:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 495843.766272; Wed, 15 Feb 2023 10:33:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pSF5z-0005JL-56; Wed, 15 Feb 2023 10:33:03 +0000
Received: by outflank-mailman (input) for mailman id 495843;
 Wed, 15 Feb 2023 10: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 1pSF5y-0005JF-1Q
 for xen-changelog@lists.xenproject.org; Wed, 15 Feb 2023 10:33:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pSF5x-0006us-Vz
 for xen-changelog@lists.xenproject.org; Wed, 15 Feb 2023 10:33:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pSF5x-0002Z8-V6
 for xen-changelog@lists.xenproject.org; Wed, 15 Feb 2023 10:33:01 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=5tnhEHe4XKPq3Rh2j8Ck260XfCGnk9zJAozlIk0+BfA=; b=Qx8XK7dTj6WIlnM6GQvQjRvGzt
	vxUBh5Y6Q19o9DqKvdWqE1w+v1MXur9Ok+cV/V1aupisGDRd4tRa+AdssXL+b9jYSTpdY86wISCuk
	BZUy6/AM7WCJFJoew9/KJEeKzdfzBlnMEKoYRA12UFV12sJ03gQVQ/rwpzwrySrN6MTY=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/spec-ctrl: Mitigate Cross-Thread Return Address Predictions
Message-Id: <E1pSF5x-0002Z8-V6@xenbits.xenproject.org>
Date: Wed, 15 Feb 2023 10:33:01 +0000

commit 63305e5392ec2d17b85e7996a97462744425db80
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu Sep 8 21:27:58 2022 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Feb 14 17:53:32 2023 +0000

    x86/spec-ctrl: Mitigate Cross-Thread Return Address Predictions
    
    This is XSA-426 / CVE-2022-27672
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 docs/misc/xen-command-line.pandoc      |  2 +-
 xen/arch/x86/include/asm/cpufeatures.h |  3 ++-
 xen/arch/x86/include/asm/spec_ctrl.h   | 15 +++++++++++++++
 xen/arch/x86/spec_ctrl.c               | 31 ++++++++++++++++++++++++++++---
 4 files changed, 46 insertions(+), 5 deletions(-)

diff --git a/docs/misc/xen-command-line.pandoc b/docs/misc/xen-command-line.pandoc
index 19d4d815bd..63dfda4a7a 100644
--- a/docs/misc/xen-command-line.pandoc
+++ b/docs/misc/xen-command-line.pandoc
@@ -2360,7 +2360,7 @@ guests to use.
   on entry and exit.  These blocks are necessary to virtualise support for
   guests and if disabled, guests will be unable to use IBRS/STIBP/SSBD/etc.
 * `rsb=` offers control over whether to overwrite the Return Stack Buffer /
-  Return Address Stack on entry to Xen.
+  Return Address Stack on entry to Xen and on idle.
 * `md-clear=` offers control over whether to use VERW to flush
   microarchitectural buffers on idle and exit from Xen.  *Note: For
   compatibility with development versions of this fix, `mds=` is also accepted
diff --git a/xen/arch/x86/include/asm/cpufeatures.h b/xen/arch/x86/include/asm/cpufeatures.h
index 865f110986..da0593de85 100644
--- a/xen/arch/x86/include/asm/cpufeatures.h
+++ b/xen/arch/x86/include/asm/cpufeatures.h
@@ -35,7 +35,8 @@ XEN_CPUFEATURE(SC_RSB_HVM,        X86_SYNTH(19)) /* RSB overwrite needed for HVM
 XEN_CPUFEATURE(XEN_SELFSNOOP,     X86_SYNTH(20)) /* SELFSNOOP gets used by Xen itself */
 XEN_CPUFEATURE(SC_MSR_IDLE,       X86_SYNTH(21)) /* Clear MSR_SPEC_CTRL on idle */
 XEN_CPUFEATURE(XEN_LBR,           X86_SYNTH(22)) /* Xen uses MSR_DEBUGCTL.LBR */
-/* Bits 23,24 unused. */
+/* Bits 23 unused. */
+XEN_CPUFEATURE(SC_RSB_IDLE,       X86_SYNTH(24)) /* RSB overwrite needed for idle. */
 XEN_CPUFEATURE(SC_VERW_IDLE,      X86_SYNTH(25)) /* VERW used by Xen for idle */
 XEN_CPUFEATURE(XEN_SHSTK,         X86_SYNTH(26)) /* Xen uses CET Shadow Stacks */
 XEN_CPUFEATURE(XEN_IBT,           X86_SYNTH(27)) /* Xen uses CET Indirect Branch Tracking */
diff --git a/xen/arch/x86/include/asm/spec_ctrl.h b/xen/arch/x86/include/asm/spec_ctrl.h
index e928596450..3cf8a7d304 100644
--- a/xen/arch/x86/include/asm/spec_ctrl.h
+++ b/xen/arch/x86/include/asm/spec_ctrl.h
@@ -159,6 +159,21 @@ static always_inline void spec_ctrl_enter_idle(struct cpu_info *info)
      */
     alternative_input("", "verw %[sel]", X86_FEATURE_SC_VERW_IDLE,
                       [sel] "m" (info->verw_sel));
+
+    /*
+     * Cross-Thread Return Address Predictions:
+     *
+     * On vulnerable systems, the return predictions (RSB/RAS) are statically
+     * partitioned between active threads.  When entering idle, our entries
+     * are re-partitioned to allow the other threads to use them.
+     *
+     * In some cases, we might still have guest entries in the RAS, so flush
+     * them before injecting them sideways to our sibling thread.
+     *
+     * (ab)use alternative_input() to specify clobbers.
+     */
+    alternative_input("", "DO_OVERWRITE_RSB", X86_FEATURE_SC_RSB_IDLE,
+                      : "rax", "rcx");
 }
 
 /* WARNING! `ret`, `call *`, `jmp *` not safe before this call. */
diff --git a/xen/arch/x86/spec_ctrl.c b/xen/arch/x86/spec_ctrl.c
index a320b81947..e80e2a5ed1 100644
--- a/xen/arch/x86/spec_ctrl.c
+++ b/xen/arch/x86/spec_ctrl.c
@@ -1327,13 +1327,38 @@ void __init init_speculation_mitigations(void)
      * 3) Some CPUs have RSBs which are not full width, which allow the
      *    attacker's entries to alias Xen addresses.
      *
+     * 4) Some CPUs have RSBs which are re-partitioned based on thread
+     *    idleness, which allows an attacker to inject entries into the other
+     *    thread.  We still active the optimisation in this case, and mitigate
+     *    in the idle path which has lower overhead.
+     *
      * It is safe to turn off RSB stuffing when Xen is using SMEP itself, and
      * 32bit PV guests are disabled, and when the RSB is full width.
      */
     BUILD_BUG_ON(RO_MPT_VIRT_START != PML4_ADDR(256));
-    if ( opt_rsb_pv == -1 && boot_cpu_has(X86_FEATURE_XEN_SMEP) &&
-         !opt_pv32 && rsb_is_full_width() )
-        opt_rsb_pv = 0;
+    if ( opt_rsb_pv == -1 )
+    {
+        opt_rsb_pv = (opt_pv32 || !boot_cpu_has(X86_FEATURE_XEN_SMEP) ||
+                      !rsb_is_full_width());
+
+        /*
+         * Cross-Thread Return Address Predictions.
+         *
+         * Vulnerable systems are Zen1/Zen2 uarch, which is AMD Fam17 / Hygon
+         * Fam18, when SMT is active.
+         *
+         * To mitigate, we must flush the RSB/RAS/RAP once between entering
+         * Xen and going idle.
+         *
+         * Most cases flush on entry to Xen anyway.  The one case where we
+         * don't is when using the SMEP optimisation for PV guests.  Flushing
+         * before going idle is less overhead than flushing on PV entry.
+         */
+        if ( !opt_rsb_pv && hw_smt_enabled &&
+             (boot_cpu_data.x86_vendor & (X86_VENDOR_AMD|X86_VENDOR_HYGON)) &&
+             (boot_cpu_data.x86 == 0x17 || boot_cpu_data.x86 == 0x18) )
+            setup_force_cpu_cap(X86_FEATURE_SC_RSB_IDLE);
+    }
 
     if ( opt_rsb_pv )
     {
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Feb 16 03:33:07 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 16 Feb 2023 03:33:07 +0000
Received: from list by lists.xenproject.org with outflank-mailman.496340.767029 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pSV14-0002ti-ON; Thu, 16 Feb 2023 03:33:02 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 496340.767029; Thu, 16 Feb 2023 03: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 1pSV14-0002tZ-LE; Thu, 16 Feb 2023 03:33:02 +0000
Received: by outflank-mailman (input) for mailman id 496340;
 Thu, 16 Feb 2023 03: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 1pSV13-0002tT-GI
 for xen-changelog@lists.xenproject.org; Thu, 16 Feb 2023 03:33:01 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pSV13-0005BM-DX
 for xen-changelog@lists.xenproject.org; Thu, 16 Feb 2023 03:33:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pSV13-0000tx-Bn
 for xen-changelog@lists.xenproject.org; Thu, 16 Feb 2023 03:33:01 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=LfUjX3q0fTMfiZIjuuAjnSrpyXSJSNeULrJxLARuEdY=; b=b0+mJlGSbyPviLV2I1uh8IcXti
	k8SM6BYtgwx/0G6Eg2MCvxfYyXPYAu1wBQFzGzkHSF9CEqGI3YcWYQ1BxHNJsbVgKG7TMWy8wk8Ch
	cyct3ldroPtA08CTqJiATeSfo3Mm9ntwXc0vSXgwkfEDY/H+Sot/BvIL4Lz68FkjJErE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.16] x86/spec-ctrl: Mitigate Cross-Thread Return Address Predictions
Message-Id: <E1pSV13-0000tx-Bn@xenbits.xenproject.org>
Date: Thu, 16 Feb 2023 03:33:01 +0000

commit d4e286db89d80c862b4a24bf971dd71008c8b53e
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu Sep 8 21:27:58 2022 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Wed Feb 15 16:17:04 2023 +0000

    x86/spec-ctrl: Mitigate Cross-Thread Return Address Predictions
    
    This is XSA-426 / CVE-2022-27672
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    (cherry picked from commit 63305e5392ec2d17b85e7996a97462744425db80)
---
 docs/misc/xen-command-line.pandoc |  2 +-
 xen/arch/x86/spec_ctrl.c          | 31 ++++++++++++++++++++++++++++---
 xen/include/asm-x86/cpufeatures.h |  3 ++-
 xen/include/asm-x86/spec_ctrl.h   | 15 +++++++++++++++
 4 files changed, 46 insertions(+), 5 deletions(-)

diff --git a/docs/misc/xen-command-line.pandoc b/docs/misc/xen-command-line.pandoc
index bd6826d0ae..b3f60cd923 100644
--- a/docs/misc/xen-command-line.pandoc
+++ b/docs/misc/xen-command-line.pandoc
@@ -2275,7 +2275,7 @@ guests to use.
   on entry and exit.  These blocks are necessary to virtualise support for
   guests and if disabled, guests will be unable to use IBRS/STIBP/SSBD/etc.
 * `rsb=` offers control over whether to overwrite the Return Stack Buffer /
-  Return Address Stack on entry to Xen.
+  Return Address Stack on entry to Xen and on idle.
 * `md-clear=` offers control over whether to use VERW to flush
   microarchitectural buffers on idle and exit from Xen.  *Note: For
   compatibility with development versions of this fix, `mds=` is also accepted
diff --git a/xen/arch/x86/spec_ctrl.c b/xen/arch/x86/spec_ctrl.c
index 90d86fe5cb..14649d92f5 100644
--- a/xen/arch/x86/spec_ctrl.c
+++ b/xen/arch/x86/spec_ctrl.c
@@ -1317,13 +1317,38 @@ void __init init_speculation_mitigations(void)
      * 3) Some CPUs have RSBs which are not full width, which allow the
      *    attacker's entries to alias Xen addresses.
      *
+     * 4) Some CPUs have RSBs which are re-partitioned based on thread
+     *    idleness, which allows an attacker to inject entries into the other
+     *    thread.  We still active the optimisation in this case, and mitigate
+     *    in the idle path which has lower overhead.
+     *
      * It is safe to turn off RSB stuffing when Xen is using SMEP itself, and
      * 32bit PV guests are disabled, and when the RSB is full width.
      */
     BUILD_BUG_ON(RO_MPT_VIRT_START != PML4_ADDR(256));
-    if ( opt_rsb_pv == -1 && boot_cpu_has(X86_FEATURE_XEN_SMEP) &&
-         !opt_pv32 && rsb_is_full_width() )
-        opt_rsb_pv = 0;
+    if ( opt_rsb_pv == -1 )
+    {
+        opt_rsb_pv = (opt_pv32 || !boot_cpu_has(X86_FEATURE_XEN_SMEP) ||
+                      !rsb_is_full_width());
+
+        /*
+         * Cross-Thread Return Address Predictions.
+         *
+         * Vulnerable systems are Zen1/Zen2 uarch, which is AMD Fam17 / Hygon
+         * Fam18, when SMT is active.
+         *
+         * To mitigate, we must flush the RSB/RAS/RAP once between entering
+         * Xen and going idle.
+         *
+         * Most cases flush on entry to Xen anyway.  The one case where we
+         * don't is when using the SMEP optimisation for PV guests.  Flushing
+         * before going idle is less overhead than flushing on PV entry.
+         */
+        if ( !opt_rsb_pv && hw_smt_enabled &&
+             (boot_cpu_data.x86_vendor & (X86_VENDOR_AMD|X86_VENDOR_HYGON)) &&
+             (boot_cpu_data.x86 == 0x17 || boot_cpu_data.x86 == 0x18) )
+            setup_force_cpu_cap(X86_FEATURE_SC_RSB_IDLE);
+    }
 
     if ( opt_rsb_pv )
     {
diff --git a/xen/include/asm-x86/cpufeatures.h b/xen/include/asm-x86/cpufeatures.h
index ecc1bb0950..ccf9d7287c 100644
--- a/xen/include/asm-x86/cpufeatures.h
+++ b/xen/include/asm-x86/cpufeatures.h
@@ -35,7 +35,8 @@ XEN_CPUFEATURE(SC_RSB_HVM,        X86_SYNTH(19)) /* RSB overwrite needed for HVM
 XEN_CPUFEATURE(XEN_SELFSNOOP,     X86_SYNTH(20)) /* SELFSNOOP gets used by Xen itself */
 XEN_CPUFEATURE(SC_MSR_IDLE,       X86_SYNTH(21)) /* Clear MSR_SPEC_CTRL on idle */
 XEN_CPUFEATURE(XEN_LBR,           X86_SYNTH(22)) /* Xen uses MSR_DEBUGCTL.LBR */
-/* Bits 23,24 unused. */
+/* Bits 23 unused. */
+XEN_CPUFEATURE(SC_RSB_IDLE,       X86_SYNTH(24)) /* RSB overwrite needed for idle. */
 XEN_CPUFEATURE(SC_VERW_IDLE,      X86_SYNTH(25)) /* VERW used by Xen for idle */
 XEN_CPUFEATURE(XEN_SHSTK,         X86_SYNTH(26)) /* Xen uses CET Shadow Stacks */
 XEN_CPUFEATURE(XEN_IBT,           X86_SYNTH(27)) /* Xen uses CET Indirect Branch Tracking */
diff --git a/xen/include/asm-x86/spec_ctrl.h b/xen/include/asm-x86/spec_ctrl.h
index 6a77c39378..391973ef6a 100644
--- a/xen/include/asm-x86/spec_ctrl.h
+++ b/xen/include/asm-x86/spec_ctrl.h
@@ -159,6 +159,21 @@ static always_inline void spec_ctrl_enter_idle(struct cpu_info *info)
      */
     alternative_input("", "verw %[sel]", X86_FEATURE_SC_VERW_IDLE,
                       [sel] "m" (info->verw_sel));
+
+    /*
+     * Cross-Thread Return Address Predictions:
+     *
+     * On vulnerable systems, the return predictions (RSB/RAS) are statically
+     * partitioned between active threads.  When entering idle, our entries
+     * are re-partitioned to allow the other threads to use them.
+     *
+     * In some cases, we might still have guest entries in the RAS, so flush
+     * them before injecting them sideways to our sibling thread.
+     *
+     * (ab)use alternative_input() to specify clobbers.
+     */
+    alternative_input("", "DO_OVERWRITE_RSB", X86_FEATURE_SC_RSB_IDLE,
+                      : "rax", "rcx");
 }
 
 /* WARNING! `ret`, `call *`, `jmp *` not safe before this call. */
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.16


From xen-changelog-bounces@lists.xenproject.org Thu Feb 16 10:22:13 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 16 Feb 2023 10:22:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.496429.767165 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pSbOt-0003kC-5d; Thu, 16 Feb 2023 10:22:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 496429.767165; Thu, 16 Feb 2023 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 1pSbOt-0003k5-2l; Thu, 16 Feb 2023 10:22:03 +0000
Received: by outflank-mailman (input) for mailman id 496429;
 Thu, 16 Feb 2023 10: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 1pSbOr-0003jz-PE
 for xen-changelog@lists.xenproject.org; Thu, 16 Feb 2023 10:22:01 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pSbOr-00084F-Nk
 for xen-changelog@lists.xenproject.org; Thu, 16 Feb 2023 10:22:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pSbOr-0002AE-MZ
 for xen-changelog@lists.xenproject.org; Thu, 16 Feb 2023 10:22:01 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=nogwUQBkAMm8UMInt7GuYr9emQPX7/xj2I7lvDHDVvE=; b=VT6nwH5DfE1UcG2rqu9xKdsS+Q
	o2stF59T93DZTwzGaGT8Mxv9jXLdJKpip7RX1t2a1EN652429i+qyh7RNq3e3rdSMHJ4b05kFBAOG
	Zq91PAG4Fk2QgEGrR5oJqJ0X1vt7MelHjRjmjI3I2V0XP3U2Iw0KqG9rSiEHeUa1Umwg=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] credit2: respect credit2_runqueue=all when arranging runqueues
Message-Id: <E1pSbOr-0002AE-MZ@xenbits.xenproject.org>
Date: Thu, 16 Feb 2023 10:22:01 +0000

commit 1f5747ee929fbbcae58d7234c6c38a77495d0cfe
Author:     Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
AuthorDate: Wed Feb 15 16:12:42 2023 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Feb 15 16:12:42 2023 +0100

    credit2: respect credit2_runqueue=all when arranging runqueues
    
    Documentation for credit2_runqueue=all says it should create one queue
    for all pCPUs on the host. But since introduction
    sched_credit2_max_cpus_runqueue, it actually created separate runqueue
    per socket, even if the CPUs count is below
    sched_credit2_max_cpus_runqueue.
    
    Adjust the condition to skip syblink check in case of
    credit2_runqueue=all.
    
    Fixes: 8e2aa76dc167 ("xen: credit2: limit the max number of CPUs in a runqueue")
    Signed-off-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
    Reviewed-by: Juergen Gross <jgross@suse.com>
---
 docs/misc/xen-command-line.pandoc | 5 +++++
 xen/common/sched/credit2.c        | 9 +++++++--
 2 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/docs/misc/xen-command-line.pandoc b/docs/misc/xen-command-line.pandoc
index 63dfda4a7a..f68deaa6a9 100644
--- a/docs/misc/xen-command-line.pandoc
+++ b/docs/misc/xen-command-line.pandoc
@@ -726,6 +726,11 @@ Available alternatives, with their meaning, are:
 * `all`: just one runqueue shared by all the logical pCPUs of
          the host
 
+Regardless of the above choice, Xen attempts to respect
+`sched_credit2_max_cpus_runqueue` limit, which may mean more than one runqueue
+for the `all` value. If that isn't intended, raise
+the `sched_credit2_max_cpus_runqueue` value.
+
 ### dbgp
 > `= ehci[ <integer> | @pci<bus>:<slot>.<func> ]`
 > `= xhci[ <integer> | @pci<bus>:<slot>.<func> ][,share=<bool>|hwdom]`
diff --git a/xen/common/sched/credit2.c b/xen/common/sched/credit2.c
index 0e3f89e537..ae55feea34 100644
--- a/xen/common/sched/credit2.c
+++ b/xen/common/sched/credit2.c
@@ -996,9 +996,14 @@ cpu_add_to_runqueue(const struct scheduler *ops, unsigned int cpu)
              *
              * Otherwise, let's try to make sure that siblings stay in the
              * same runqueue, pretty much under any cinrcumnstances.
+             *
+             * Furthermore, try to respect credit2_runqueue=all, as long as
+             * max_cpus_runq isn't violated.
              */
-            if ( rqd->refcnt < max_cpus_runq && (ops->cpupool->gran != SCHED_GRAN_cpu ||
-                  cpu_runqueue_siblings_match(rqd, cpu, max_cpus_runq)) )
+            if ( rqd->refcnt < max_cpus_runq &&
+                 (ops->cpupool->gran != SCHED_GRAN_cpu ||
+                  cpu_runqueue_siblings_match(rqd, cpu, max_cpus_runq) ||
+                  opt_runqueue == OPT_RUNQUEUE_ALL) )
             {
                 /*
                  * This runqueue is ok, but as we said, we also want an even
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Feb 16 10:22:13 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 16 Feb 2023 10:22:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.496430.767169 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pSbP3-0003lv-73; Thu, 16 Feb 2023 10:22:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 496430.767169; Thu, 16 Feb 2023 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 1pSbP3-0003ln-4L; Thu, 16 Feb 2023 10:22:13 +0000
Received: by outflank-mailman (input) for mailman id 496430;
 Thu, 16 Feb 2023 10:22: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 1pSbP1-0003lQ-Tr
 for xen-changelog@lists.xenproject.org; Thu, 16 Feb 2023 10:22:11 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pSbP1-00084c-T6
 for xen-changelog@lists.xenproject.org; Thu, 16 Feb 2023 10:22:11 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pSbP1-0002Aj-Py
 for xen-changelog@lists.xenproject.org; Thu, 16 Feb 2023 10:22:11 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=vfe39D7FsplKE0iJEBQNxHTFp8lRioax/VWuaygNCMg=; b=b5Xsr8mIpBZBhC0Ud8RCczTDlw
	aIW7P02AOogXXpli4Ua9RkB2TnsBWnp6CECM+GbToKofMxkyk7DOxFWxSn6hkL0xsgXRB4LesaW9s
	b04MAqdwJ8djm7ZJ5ygDkQA8RU5gndMnshYro/6V6E0FfmFVgAStKR9JwLZekJe5yqGU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] build: make FILE symbol paths consistent
Message-Id: <E1pSbP1-0002Aj-Py@xenbits.xenproject.org>
Date: Thu, 16 Feb 2023 10:22:11 +0000

commit 5b9bb91abba7c983def3b4bef71ab08ad360a242
Author:     Ross Lagerwall <ross.lagerwall@citrix.com>
AuthorDate: Wed Feb 15 16:13:49 2023 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Feb 15 16:13:49 2023 +0100

    build: make FILE symbol paths consistent
    
    The FILE symbols in out-of-tree builds may be either a relative path to
    the object dir or an absolute path depending on how the build is
    invoked. Fix the paths for C files so that they are consistent with
    in-tree builds - the path is relative to the "xen" directory (e.g.
    common/irq.c).
    
    This fixes livepatch builds when the original Xen build was out-of-tree
    since livepatch-build always does in-tree builds. Note that this doesn't
    fix the behaviour for Clang < 6 which always embeds full paths.
    
    Fixes: 7115fa562fe7 ("build: adding out-of-tree support to the xen build")
    Signed-off-by: Ross Lagerwall <ross.lagerwall@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/Rules.mk | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/xen/Rules.mk b/xen/Rules.mk
index 70b7489ea8..d6b7cec0a8 100644
--- a/xen/Rules.mk
+++ b/xen/Rules.mk
@@ -228,8 +228,9 @@ quiet_cmd_cc_o_c = CC      $@
 ifeq ($(CONFIG_ENFORCE_UNIQUE_SYMBOLS),y)
     cmd_cc_o_c = $(CC) $(c_flags) -c $< -o $(dot-target).tmp -MQ $@
     ifneq ($(CONFIG_CC_IS_CLANG)$(call clang-ifversion,-lt,600,y),yy)
+        rel-path = $(patsubst $(abs_srctree)/%,%,$(call realpath,$(1)))
         cmd_objcopy_fix_sym = \
-	    $(OBJCOPY) --redefine-sym $(<F)=$< $(dot-target).tmp $@ && rm -f $(dot-target).tmp
+           $(OBJCOPY) --redefine-sym $(<F)=$(call rel-path,$<) $(dot-target).tmp $@ && rm -f $(dot-target).tmp
     else
         cmd_objcopy_fix_sym = mv -f $(dot-target).tmp $@
     endif
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Feb 17 23:22:08 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 17 Feb 2023 23:22:08 +0000
Received: from list by lists.xenproject.org with outflank-mailman.497366.768303 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pTA3I-0006In-69; Fri, 17 Feb 2023 23:22:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 497366.768303; Fri, 17 Feb 2023 23:22: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 1pTA3I-0006If-2y; Fri, 17 Feb 2023 23:22:04 +0000
Received: by outflank-mailman (input) for mailman id 497366;
 Fri, 17 Feb 2023 23: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 1pTA3G-0006IZ-Cd
 for xen-changelog@lists.xenproject.org; Fri, 17 Feb 2023 23:22:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pTA3G-0002r6-Bt
 for xen-changelog@lists.xenproject.org; Fri, 17 Feb 2023 23:22:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pTA3G-0000hz-Ar
 for xen-changelog@lists.xenproject.org; Fri, 17 Feb 2023 23:22:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=ML4M1hRAwjjvJh3sfOCcEpWXZpeh5h+2CHmSSl2OZ28=; b=Qd0g2Y7/nJ20f9OVbS2Wenco2/
	M5aRp0fj5NsI/Z6JI+7xkKOwRNebcpNdsD/Lj7sE67T+AEReDNF4DxBx6ykU8lqigvbEOrXLgssFv
	GCPOq4Nl6b8ZYSm3CONtY9HfaAZYUg44+Qb4bG+jcSY7cJtzFSbck6nSdDcylBVLArO8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] automation: Switch arm32 cross builds to run on arm64
Message-Id: <E1pTA3G-0000hz-Ar@xenbits.xenproject.org>
Date: Fri, 17 Feb 2023 23:22:02 +0000

commit a35fccc8df93de7154dba87db6e7bcf391e9d51c
Author:     Michal Orzel <michal.orzel@amd.com>
AuthorDate: Tue Feb 14 16:38:38 2023 +0100
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Wed Feb 15 13:46:10 2023 -0800

    automation: Switch arm32 cross builds to run on arm64
    
    Due to the limited x86 CI resources slowing down the whole pipeline,
    switch the arm32 cross builds to be executed on arm64 which is much more
    capable. For that, rename the existing debian container dockerfile
    from unstable-arm32-gcc to unstable-arm64v8-arm32-gcc and use
    arm64v8/debian:unstable as an image. Note, that we cannot use the same
    container name as we have to keep the backwards compatibility.
    Take the opportunity to remove extra empty line at the end of a file.
    
    Modify the tag of .arm32-cross-build-tmpl to arm64 and update the build
    jobs accordingly.
    
    Signed-off-by: Michal Orzel <michal.orzel@amd.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
---
 .../build/debian/unstable-arm32-gcc.dockerfile     | 24 ----------------------
 .../debian/unstable-arm64v8-arm32-gcc.dockerfile   | 23 +++++++++++++++++++++
 automation/gitlab-ci/build.yaml                    | 10 ++++-----
 3 files changed, 28 insertions(+), 29 deletions(-)

diff --git a/automation/build/debian/unstable-arm32-gcc.dockerfile b/automation/build/debian/unstable-arm32-gcc.dockerfile
deleted file mode 100644
index b41a57f197..0000000000
--- a/automation/build/debian/unstable-arm32-gcc.dockerfile
+++ /dev/null
@@ -1,24 +0,0 @@
-FROM debian:unstable
-LABEL maintainer.name="The Xen Project" \
-      maintainer.email="xen-devel@lists.xenproject.org"
-
-ENV DEBIAN_FRONTEND=noninteractive
-ENV USER root
-ENV CROSS_COMPILE /usr/bin/arm-linux-gnueabihf-
-
-RUN mkdir /build
-WORKDIR /build
-
-# build depends
-RUN apt-get update && \
-    apt-get --quiet --yes install \
-        build-essential \
-        flex \
-        bison \
-        git \
-        gcc-arm-linux-gnueabihf \
-        && \
-        apt-get autoremove -y && \
-        apt-get clean && \
-        rm -rf /var/lib/apt/lists* /tmp/* /var/tmp/*
-
diff --git a/automation/build/debian/unstable-arm64v8-arm32-gcc.dockerfile b/automation/build/debian/unstable-arm64v8-arm32-gcc.dockerfile
new file mode 100644
index 0000000000..11860425a6
--- /dev/null
+++ b/automation/build/debian/unstable-arm64v8-arm32-gcc.dockerfile
@@ -0,0 +1,23 @@
+FROM arm64v8/debian:unstable
+LABEL maintainer.name="The Xen Project" \
+      maintainer.email="xen-devel@lists.xenproject.org"
+
+ENV DEBIAN_FRONTEND=noninteractive
+ENV USER root
+ENV CROSS_COMPILE /usr/bin/arm-linux-gnueabihf-
+
+RUN mkdir /build
+WORKDIR /build
+
+# build depends
+RUN apt-get update && \
+    apt-get --quiet --yes install \
+        build-essential \
+        flex \
+        bison \
+        git \
+        gcc-arm-linux-gnueabihf \
+        && \
+        apt-get autoremove -y && \
+        apt-get clean && \
+        rm -rf /var/lib/apt/lists* /tmp/* /var/tmp/*
diff --git a/automation/gitlab-ci/build.yaml b/automation/gitlab-ci/build.yaml
index a053c5c732..f8e156e0a9 100644
--- a/automation/gitlab-ci/build.yaml
+++ b/automation/gitlab-ci/build.yaml
@@ -123,7 +123,7 @@
   variables:
     XEN_TARGET_ARCH: arm32
   tags:
-    - x86_64
+    - arm64
 
 .arm32-cross-build:
   extends: .arm32-cross-build-tmpl
@@ -542,26 +542,26 @@ alpine-3.12-clang-debug:
 debian-unstable-gcc-arm32:
   extends: .gcc-arm32-cross-build
   variables:
-    CONTAINER: debian:unstable-arm32-gcc
+    CONTAINER: debian:unstable-arm64v8-arm32-gcc
     HYPERVISOR_ONLY: y
 
 debian-unstable-gcc-arm32-debug:
   extends: .gcc-arm32-cross-build-debug
   variables:
-    CONTAINER: debian:unstable-arm32-gcc
+    CONTAINER: debian:unstable-arm64v8-arm32-gcc
     HYPERVISOR_ONLY: y
 
 debian-unstable-gcc-arm32-randconfig:
   extends: .gcc-arm32-cross-build
   variables:
-    CONTAINER: debian:unstable-arm32-gcc
+    CONTAINER: debian:unstable-arm64v8-arm32-gcc
     HYPERVISOR_ONLY: y
     RANDCONFIG: y
 
 debian-unstable-gcc-arm32-debug-randconfig:
   extends: .gcc-arm32-cross-build-debug
   variables:
-    CONTAINER: debian:unstable-arm32-gcc
+    CONTAINER: debian:unstable-arm64v8-arm32-gcc
     HYPERVISOR_ONLY: y
     RANDCONFIG: y
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Feb 17 23:22:14 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 17 Feb 2023 23:22:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.497367.768306 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pTA3S-0006Kr-7D; Fri, 17 Feb 2023 23:22:14 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 497367.768306; Fri, 17 Feb 2023 23:22:14 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pTA3S-0006Kk-4h; Fri, 17 Feb 2023 23:22:14 +0000
Received: by outflank-mailman (input) for mailman id 497367;
 Fri, 17 Feb 2023 23: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 1pTA3Q-0006KW-Fl
 for xen-changelog@lists.xenproject.org; Fri, 17 Feb 2023 23:22:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pTA3Q-0002rH-F3
 for xen-changelog@lists.xenproject.org; Fri, 17 Feb 2023 23:22:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pTA3Q-0000iU-E0
 for xen-changelog@lists.xenproject.org; Fri, 17 Feb 2023 23:22:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=35HvofBwztnKY/wtrp8KO3oMqiaoWqwZBO/FJvikW3M=; b=M2Jzo9mBBUZGhzOR4RybnNzjl/
	Sh5Q3yW3bdtlr2MIO7GhDW/CwWMZU4Xopzb3ZsJ/+lescU3ngsWDlO++i9PsSLADAqWcSW5XzWdfe
	kq/vNoEQb+Zy4Chqngxb+Tu7LfzVeL1O+lcmFVflfAy+j0dwynVmMqbfD756ww5DAXDM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] automation: Add arm32 dom0less testing
Message-Id: <E1pTA3Q-0000iU-E0@xenbits.xenproject.org>
Date: Fri, 17 Feb 2023 23:22:12 +0000

commit 42ea8ddab8e003d272e897abec0b89270a90a9b0
Author:     Michal Orzel <michal.orzel@amd.com>
AuthorDate: Tue Feb 14 16:38:39 2023 +0100
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Wed Feb 15 13:46:10 2023 -0800

    automation: Add arm32 dom0less testing
    
    At the moment, we only perform a single arm32 test in our CI, checking
    whether dom0 boots successfully or not. This is mostly because we do not
    have any arm32 runners and we only execute a hypervisor only build.
    
    In order not to leave the arm32 testing in such a poor state, add a
    script qemu-smoke-dom0less-arm32.sh to start testing dom0less
    configuration, while keeping dom0 to make the test more interesting.
    
    The script is mostly based on the one used for dom0 arm32 testing as well
    as the one used for dom0less arm64 testing. We obtain Debian Bullseye
    kernel and Alpine Linux busybox-based rootfs. Depending on the test
    variant, we prepare a test case contained within domU_check variable,
    that will be executed as part of /init script from domU rootfs.
    
    Signed-off-by: Michal Orzel <michal.orzel@amd.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
---
 automation/gitlab-ci/test.yaml                  | 16 ++++
 automation/scripts/qemu-smoke-dom0less-arm32.sh | 99 +++++++++++++++++++++++++
 2 files changed, 115 insertions(+)

diff --git a/automation/gitlab-ci/test.yaml b/automation/gitlab-ci/test.yaml
index ce543ef5c0..84ab1fee50 100644
--- a/automation/gitlab-ci/test.yaml
+++ b/automation/gitlab-ci/test.yaml
@@ -210,6 +210,22 @@ qemu-smoke-dom0-arm32-gcc-debug:
     - *arm32-test-needs
     - debian-unstable-gcc-arm32-debug
 
+qemu-smoke-dom0less-arm32-gcc:
+  extends: .qemu-arm32
+  script:
+    - ./automation/scripts/qemu-smoke-dom0less-arm32.sh 2>&1 | tee ${LOGFILE}
+  needs:
+    - *arm32-test-needs
+    - debian-unstable-gcc-arm32
+
+qemu-smoke-dom0less-arm32-gcc-debug:
+  extends: .qemu-arm32
+  script:
+    - ./automation/scripts/qemu-smoke-dom0less-arm32.sh 2>&1 | tee ${LOGFILE}
+  needs:
+    - *arm32-test-needs
+    - debian-unstable-gcc-arm32-debug
+
 qemu-alpine-x86_64-gcc:
   extends: .qemu-x86-64
   script:
diff --git a/automation/scripts/qemu-smoke-dom0less-arm32.sh b/automation/scripts/qemu-smoke-dom0less-arm32.sh
new file mode 100755
index 0000000000..e3f2b28f3f
--- /dev/null
+++ b/automation/scripts/qemu-smoke-dom0less-arm32.sh
@@ -0,0 +1,99 @@
+#!/bin/bash
+
+set -ex
+
+test_variant=$1
+
+# Prompt to grep for to check if dom0 booted successfully
+dom0_prompt="^/ #"
+
+cd binaries
+# Use the kernel from Debian
+curl --fail --silent --show-error --location --output vmlinuz https://deb.debian.org/debian/dists/bullseye/main/installer-armhf/current/images/netboot/vmlinuz
+# Use a tiny initrd based on busybox from Alpine Linux
+curl --fail --silent --show-error --location --output initrd.tar.gz https://dl-cdn.alpinelinux.org/alpine/v3.15/releases/armhf/alpine-minirootfs-3.15.1-armhf.tar.gz
+
+if [ -z "${test_variant}" ]; then
+    passed="generic test passed"
+    domU_check="
+echo \"${passed}\"
+"
+fi
+
+# dom0/domU rootfs
+# We are using the same rootfs for dom0 and domU. The only difference is
+# that for the former, we set explictly rdinit to /bin/sh, whereas for the
+# latter we rely on using custom /init script with test case inside.
+mkdir rootfs
+cd rootfs
+tar xvzf ../initrd.tar.gz
+echo "#!/bin/sh
+
+mount -t proc proc /proc
+mount -t sysfs sysfs /sys
+mount -t devtmpfs devtmpfs /dev
+${domU_check}
+/bin/sh" > init
+chmod +x init
+find . | cpio -H newc -o | gzip > ../initrd.gz
+cd ..
+
+# XXX QEMU looks for "efi-virtio.rom" even if it is unneeded
+curl -fsSLO https://github.com/qemu/qemu/raw/v5.2.0/pc-bios/efi-virtio.rom
+./qemu-system-arm \
+    -machine virt \
+    -machine virtualization=true \
+    -smp 4 \
+    -m 2048 \
+    -serial stdio \
+    -monitor none \
+    -display none \
+    -machine dumpdtb=virt.dtb
+
+# ImageBuilder
+echo 'MEMORY_START="0x40000000"
+MEMORY_END="0xC0000000"
+
+DEVICE_TREE="virt.dtb"
+XEN="xen"
+XEN_CMD="console=dtuart dom0_mem=512M bootscrub=0"
+
+DOM0_KERNEL="vmlinuz"
+DOM0_RAMDISK="initrd.gz"
+DOM0_CMD="console=hvc0 earlyprintk clk_ignore_unused root=/dev/ram0 rdinit=/bin/sh"
+
+DOMU_KERNEL[0]="vmlinuz"
+DOMU_RAMDISK[0]="initrd.gz"
+DOMU_MEM[0]="512"
+NUM_DOMUS=1
+
+LOAD_CMD="tftpb"
+BOOT_CMD="bootm"
+UBOOT_SOURCE="boot.source"
+UBOOT_SCRIPT="boot.scr"' > config
+
+rm -rf imagebuilder
+git clone https://gitlab.com/ViryaOS/imagebuilder
+bash imagebuilder/scripts/uboot-script-gen -t tftp -d . -c config
+
+# Run the test
+rm -f smoke.serial
+set +e
+echo "  virtio scan; dhcp; tftpb 0x40000000 boot.scr; source 0x40000000"| \
+timeout -k 1 240 \
+./qemu-system-arm \
+    -machine virt \
+    -machine virtualization=true \
+    -smp 4 \
+    -m 2048 \
+    -serial stdio \
+    -monitor none \
+    -display none \
+    -no-reboot \
+    -device virtio-net-pci,netdev=n0 \
+    -netdev user,id=n0,tftp=./ \
+    -bios /usr/lib/u-boot/qemu_arm/u-boot.bin |& tee smoke.serial
+
+set -e
+(grep -q "${dom0_prompt}" smoke.serial && grep -q "${passed}" smoke.serial) || exit 1
+exit 0
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Feb 17 23:22:24 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 17 Feb 2023 23:22:24 +0000
Received: from list by lists.xenproject.org with outflank-mailman.497368.768311 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pTA3c-0006NJ-8r; Fri, 17 Feb 2023 23:22:24 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 497368.768311; Fri, 17 Feb 2023 23:22: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 1pTA3c-0006NB-6C; Fri, 17 Feb 2023 23:22:24 +0000
Received: by outflank-mailman (input) for mailman id 497368;
 Fri, 17 Feb 2023 23: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 1pTA3a-0006Mv-J8
 for xen-changelog@lists.xenproject.org; Fri, 17 Feb 2023 23:22:22 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pTA3a-0002rY-IP
 for xen-changelog@lists.xenproject.org; Fri, 17 Feb 2023 23:22:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pTA3a-0000ix-HP
 for xen-changelog@lists.xenproject.org; Fri, 17 Feb 2023 23:22:22 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=WyB0ayL/PLKJH5S2V81B+cegcWsbVBOOgki3FgktsoU=; b=NTjG7bk/RYSvKeqguf30364L04
	VFEaR0QHO3jI7/SIOtGADrhg3Kd1v6VSBi9UWMHpSLVRvMpA8bFWayX3XC5Pu0Nvtg7w8hjrdMS0G
	5Vy3oNlId0rJyFsKpfX/MKcswxOzsV4O7MAJZ0IaltfKLeIa97tizOXb3W8JxOUF4F64=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] automation: Add a static memory allocation test on arm32
Message-Id: <E1pTA3a-0000ix-HP@xenbits.xenproject.org>
Date: Fri, 17 Feb 2023 23:22:22 +0000

commit a6ce51ac3de8267ed4e2e7f2e1cf93d51c6d797a
Author:     Michal Orzel <michal.orzel@amd.com>
AuthorDate: Tue Feb 14 16:38:40 2023 +0100
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Wed Feb 15 13:46:11 2023 -0800

    automation: Add a static memory allocation test on arm32
    
    Add a new test job qemu-smoke-dom0less-arm32-gcc-staticmem in debug
    and non-debug variant that will execute qemu-smoke-dom0less-arm32.sh
    script to test static memory allocation feature. The test case itself
    is directly taken from dom0less arm64 testing.
    
    Populate build jobs to compile Xen with config options necessary to
    enable static memory feature. Populate test jobs passing "static-mem"
    as a test variant. The test configures domU with a static memory region
    (direct-mapped) and adds a check using /proc/iomem to determine the
    memory region marked as "System RAM".
    
    Signed-off-by: Michal Orzel <michal.orzel@amd.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
---
 automation/gitlab-ci/build.yaml                 | 20 ++++++++++++++++++++
 automation/gitlab-ci/test.yaml                  | 16 ++++++++++++++++
 automation/scripts/qemu-smoke-dom0less-arm32.sh | 17 +++++++++++++++++
 3 files changed, 53 insertions(+)

diff --git a/automation/gitlab-ci/build.yaml b/automation/gitlab-ci/build.yaml
index f8e156e0a9..079e9b73f6 100644
--- a/automation/gitlab-ci/build.yaml
+++ b/automation/gitlab-ci/build.yaml
@@ -565,6 +565,26 @@ debian-unstable-gcc-arm32-debug-randconfig:
     HYPERVISOR_ONLY: y
     RANDCONFIG: y
 
+debian-unstable-gcc-arm32-staticmem:
+  extends: .gcc-arm32-cross-build
+  variables:
+    CONTAINER: debian:unstable-arm64v8-arm32-gcc
+    HYPERVISOR_ONLY: y
+    EXTRA_XEN_CONFIG: |
+      CONFIG_EXPERT=y
+      CONFIG_UNSUPPORTED=y
+      CONFIG_STATIC_MEMORY=y
+
+debian-unstable-gcc-arm32-debug-staticmem:
+  extends: .gcc-arm32-cross-build-debug
+  variables:
+    CONTAINER: debian:unstable-arm64v8-arm32-gcc
+    HYPERVISOR_ONLY: y
+    EXTRA_XEN_CONFIG: |
+      CONFIG_EXPERT=y
+      CONFIG_UNSUPPORTED=y
+      CONFIG_STATIC_MEMORY=y
+
 # Arm builds
 
 debian-unstable-gcc-arm64:
diff --git a/automation/gitlab-ci/test.yaml b/automation/gitlab-ci/test.yaml
index 84ab1fee50..c2bcc5d4d3 100644
--- a/automation/gitlab-ci/test.yaml
+++ b/automation/gitlab-ci/test.yaml
@@ -226,6 +226,22 @@ qemu-smoke-dom0less-arm32-gcc-debug:
     - *arm32-test-needs
     - debian-unstable-gcc-arm32-debug
 
+qemu-smoke-dom0less-arm32-gcc-staticmem:
+  extends: .qemu-arm32
+  script:
+    - ./automation/scripts/qemu-smoke-dom0less-arm32.sh static-mem 2>&1 | tee ${LOGFILE}
+  needs:
+    - *arm32-test-needs
+    - debian-unstable-gcc-arm32-staticmem
+
+qemu-smoke-dom0less-arm32-gcc-debug-staticmem:
+  extends: .qemu-arm32
+  script:
+    - ./automation/scripts/qemu-smoke-dom0less-arm32.sh static-mem 2>&1 | tee ${LOGFILE}
+  needs:
+    - *arm32-test-needs
+    - debian-unstable-gcc-arm32-debug-staticmem
+
 qemu-alpine-x86_64-gcc:
   extends: .qemu-x86-64
   script:
diff --git a/automation/scripts/qemu-smoke-dom0less-arm32.sh b/automation/scripts/qemu-smoke-dom0less-arm32.sh
index e3f2b28f3f..bd89a3f8b4 100755
--- a/automation/scripts/qemu-smoke-dom0less-arm32.sh
+++ b/automation/scripts/qemu-smoke-dom0less-arm32.sh
@@ -20,6 +20,19 @@ echo \"${passed}\"
 "
 fi
 
+if [[ "${test_variant}" == "static-mem" ]]; then
+    # Memory range that is statically allocated to domU1
+    domu_base="0x50000000"
+    domu_size="0x20000000"
+    passed="${test_variant} test passed"
+    domU_check="
+mem_range=$(printf \"%08x-%08x\" ${domu_base} $(( ${domu_base} + ${domu_size} - 1 )))
+if grep -q -x \"\${mem_range} : System RAM\" /proc/iomem; then
+    echo \"${passed}\"
+fi
+"
+fi
+
 # dom0/domU rootfs
 # We are using the same rootfs for dom0 and domU. The only difference is
 # that for the former, we set explictly rdinit to /bin/sh, whereas for the
@@ -72,6 +85,10 @@ BOOT_CMD="bootm"
 UBOOT_SOURCE="boot.source"
 UBOOT_SCRIPT="boot.scr"' > config
 
+if [[ "${test_variant}" == "static-mem" ]]; then
+    echo -e "\nDOMU_STATIC_MEM[0]=\"${domu_base} ${domu_size}\"" >> config
+fi
+
 rm -rf imagebuilder
 git clone https://gitlab.com/ViryaOS/imagebuilder
 bash imagebuilder/scripts/uboot-script-gen -t tftp -d . -c config
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Feb 17 23:22:34 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 17 Feb 2023 23:22:34 +0000
Received: from list by lists.xenproject.org with outflank-mailman.497369.768316 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pTA3m-0006Pj-Az; Fri, 17 Feb 2023 23:22:34 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 497369.768316; Fri, 17 Feb 2023 23:22:34 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pTA3m-0006Pb-7k; Fri, 17 Feb 2023 23:22:34 +0000
Received: by outflank-mailman (input) for mailman id 497369;
 Fri, 17 Feb 2023 23: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 1pTA3k-0006PS-M4
 for xen-changelog@lists.xenproject.org; Fri, 17 Feb 2023 23:22:32 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pTA3k-0002s6-LK
 for xen-changelog@lists.xenproject.org; Fri, 17 Feb 2023 23:22:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pTA3k-0000jW-KU
 for xen-changelog@lists.xenproject.org; Fri, 17 Feb 2023 23:22:32 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=t4O9mneB2ZNBPrKrRfgh40GgBA75kc2X/kCKJUWcmsE=; b=WpnVSLVc3qcrnjCkMF2DI5O9rT
	3ePVfURo2qTZ8I5WKVme9hD001aaCCuj0/DWfntgN19ASg4G/pzRADvi8r8afur79VpavdhIKHlaT
	prM8bmV7kA5/xNKJ49PRYYLf2tjdTpYtByqhKlV9RDDHAY/nb3fT+G+aTqeyt9KwgE7g=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] automation: Add a gzip compressed kernel image test on arm32
Message-Id: <E1pTA3k-0000jW-KU@xenbits.xenproject.org>
Date: Fri, 17 Feb 2023 23:22:32 +0000

commit d28b226244abcb4b32e07de52df96b6b1686a240
Author:     Michal Orzel <michal.orzel@amd.com>
AuthorDate: Tue Feb 14 16:38:41 2023 +0100
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Wed Feb 15 13:46:12 2023 -0800

    automation: Add a gzip compressed kernel image test on arm32
    
    Xen supports booting gzip compressed kernels, therefore add a new test
    job qemu-smoke-dom0less-arm32-gcc-gzip in debug and non-debug variant
    that will execute qemu-smoke-dom0less-arm32.sh script to test booting
    a domU with a gzip compressed kernel image (in our case zImage).
    
    By passing "gzip" as a test variant, the test will call gzip command
    to compress kernel image and use it in ImageBuilder configuration for
    domU1. No need for a specific check to be executed from domU. Being able
    to see a test message from a boot log is sufficient to mark a test as
    passed.
    
    Signed-off-by: Michal Orzel <michal.orzel@amd.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
---
 automation/gitlab-ci/test.yaml                  | 16 ++++++++++++++++
 automation/scripts/qemu-smoke-dom0less-arm32.sh | 13 +++++++++++++
 2 files changed, 29 insertions(+)

diff --git a/automation/gitlab-ci/test.yaml b/automation/gitlab-ci/test.yaml
index c2bcc5d4d3..be7a55d897 100644
--- a/automation/gitlab-ci/test.yaml
+++ b/automation/gitlab-ci/test.yaml
@@ -242,6 +242,22 @@ qemu-smoke-dom0less-arm32-gcc-debug-staticmem:
     - *arm32-test-needs
     - debian-unstable-gcc-arm32-debug-staticmem
 
+qemu-smoke-dom0less-arm32-gcc-gzip:
+  extends: .qemu-arm32
+  script:
+    - ./automation/scripts/qemu-smoke-dom0less-arm32.sh gzip 2>&1 | tee ${LOGFILE}
+  needs:
+    - *arm32-test-needs
+    - debian-unstable-gcc-arm32
+
+qemu-smoke-dom0less-arm32-gcc-debug-gzip:
+  extends: .qemu-arm32
+  script:
+    - ./automation/scripts/qemu-smoke-dom0less-arm32.sh gzip 2>&1 | tee ${LOGFILE}
+  needs:
+    - *arm32-test-needs
+    - debian-unstable-gcc-arm32-debug
+
 qemu-alpine-x86_64-gcc:
   extends: .qemu-x86-64
   script:
diff --git a/automation/scripts/qemu-smoke-dom0less-arm32.sh b/automation/scripts/qemu-smoke-dom0less-arm32.sh
index bd89a3f8b4..c2e331451d 100755
--- a/automation/scripts/qemu-smoke-dom0less-arm32.sh
+++ b/automation/scripts/qemu-smoke-dom0less-arm32.sh
@@ -33,6 +33,15 @@ fi
 "
 fi
 
+if [[ "${test_variant}" == "gzip" ]]; then
+    # Compress kernel image with gzip (keep unmodified one for dom0)
+    gzip -k vmlinuz
+    passed="${test_variant} test passed"
+    domU_check="
+echo \"${passed}\"
+"
+fi
+
 # dom0/domU rootfs
 # We are using the same rootfs for dom0 and domU. The only difference is
 # that for the former, we set explictly rdinit to /bin/sh, whereas for the
@@ -89,6 +98,10 @@ if [[ "${test_variant}" == "static-mem" ]]; then
     echo -e "\nDOMU_STATIC_MEM[0]=\"${domu_base} ${domu_size}\"" >> config
 fi
 
+if [[ "${test_variant}" == "gzip" ]]; then
+    sed -i 's/DOMU_KERNEL\[0\]=.*/DOMU_KERNEL\[0\]="vmlinuz.gz"/' config
+fi
+
 rm -rf imagebuilder
 git clone https://gitlab.com/ViryaOS/imagebuilder
 bash imagebuilder/scripts/uboot-script-gen -t tftp -d . -c config
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Feb 17 23:22:44 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 17 Feb 2023 23:22:44 +0000
Received: from list by lists.xenproject.org with outflank-mailman.497371.768318 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pTA3w-0006SZ-CF; Fri, 17 Feb 2023 23:22:44 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 497371.768318; Fri, 17 Feb 2023 23:22:44 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pTA3w-0006SS-9F; Fri, 17 Feb 2023 23:22:44 +0000
Received: by outflank-mailman (input) for mailman id 497371;
 Fri, 17 Feb 2023 23:22:42 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pTA3u-0006SI-Py
 for xen-changelog@lists.xenproject.org; Fri, 17 Feb 2023 23:22:42 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pTA3u-0002sL-PE
 for xen-changelog@lists.xenproject.org; Fri, 17 Feb 2023 23:22:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pTA3u-0000kF-NR
 for xen-changelog@lists.xenproject.org; Fri, 17 Feb 2023 23:22:42 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=7j/DMRcLvmA4otg62GszU6/+BLrQwxiLJVxzB7iqTSo=; b=VqAqeejSqd4xINcXxY1N0ywjPS
	uX8n1vF7CFnBZgfB9C25wbDAJOi0rWgrveYDZ2fJIjRllu+xWz6cypnhdrPRFSIlh28xGk+nPlYbJ
	xwQl6jX/n1B+9Fejjx5VyPkAf0BaBamJmzRs0OXMYxq9wr5q/uEvbyyMTf1SrXiYWIaA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] automation: Add a true dom0less test on arm32
Message-Id: <E1pTA3u-0000kF-NR@xenbits.xenproject.org>
Date: Fri, 17 Feb 2023 23:22:42 +0000

commit 768e405feabe58effbba75e5b1f782d678119c60
Author:     Michal Orzel <michal.orzel@amd.com>
AuthorDate: Tue Feb 14 16:38:42 2023 +0100
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Wed Feb 15 13:46:12 2023 -0800

    automation: Add a true dom0less test on arm32
    
    Add a new test job qemu-smoke-dom0less-arm32-gcc-without-dom0 in debug
    and non-debug variant that will execute qemu-smoke-dom0less-arm32.sh
    script to test dom0less domU boot without dom0 (i.e. true dom0less
    configuration).
    
    By passing "without-dom0" as a test variant, the test will clear the
    dom0 prompt that we grep for as a last step and remove all the DOM0
    related options in ImageBuilder configuration.
    
    Signed-off-by: Michal Orzel <michal.orzel@amd.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
---
 automation/gitlab-ci/test.yaml                  | 16 ++++++++++++++++
 automation/scripts/qemu-smoke-dom0less-arm32.sh | 13 +++++++++++++
 2 files changed, 29 insertions(+)

diff --git a/automation/gitlab-ci/test.yaml b/automation/gitlab-ci/test.yaml
index be7a55d897..c0b4a90e0d 100644
--- a/automation/gitlab-ci/test.yaml
+++ b/automation/gitlab-ci/test.yaml
@@ -258,6 +258,22 @@ qemu-smoke-dom0less-arm32-gcc-debug-gzip:
     - *arm32-test-needs
     - debian-unstable-gcc-arm32-debug
 
+qemu-smoke-dom0less-arm32-gcc-without-dom0:
+  extends: .qemu-arm32
+  script:
+    - ./automation/scripts/qemu-smoke-dom0less-arm32.sh without-dom0 2>&1 | tee ${LOGFILE}
+  needs:
+    - *arm32-test-needs
+    - debian-unstable-gcc-arm32
+
+qemu-smoke-dom0less-arm32-gcc-debug-without-dom0:
+  extends: .qemu-arm32
+  script:
+    - ./automation/scripts/qemu-smoke-dom0less-arm32.sh without-dom0 2>&1 | tee ${LOGFILE}
+  needs:
+    - *arm32-test-needs
+    - debian-unstable-gcc-arm32-debug
+
 qemu-alpine-x86_64-gcc:
   extends: .qemu-x86-64
   script:
diff --git a/automation/scripts/qemu-smoke-dom0less-arm32.sh b/automation/scripts/qemu-smoke-dom0less-arm32.sh
index c2e331451d..cc91238f42 100755
--- a/automation/scripts/qemu-smoke-dom0less-arm32.sh
+++ b/automation/scripts/qemu-smoke-dom0less-arm32.sh
@@ -42,6 +42,15 @@ echo \"${passed}\"
 "
 fi
 
+if [[ "${test_variant}" == "without-dom0" ]]; then
+    # Clear dom0 prompt
+    dom0_prompt=""
+    passed="${test_variant} test passed"
+    domU_check="
+echo \"${passed}\"
+"
+fi
+
 # dom0/domU rootfs
 # We are using the same rootfs for dom0 and domU. The only difference is
 # that for the former, we set explictly rdinit to /bin/sh, whereas for the
@@ -102,6 +111,10 @@ if [[ "${test_variant}" == "gzip" ]]; then
     sed -i 's/DOMU_KERNEL\[0\]=.*/DOMU_KERNEL\[0\]="vmlinuz.gz"/' config
 fi
 
+if [[ "${test_variant}" == "without-dom0" ]]; then
+    sed -i '/^DOM0/d' config
+fi
+
 rm -rf imagebuilder
 git clone https://gitlab.com/ViryaOS/imagebuilder
 bash imagebuilder/scripts/uboot-script-gen -t tftp -d . -c config
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Feb 17 23:22:54 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 17 Feb 2023 23:22:54 +0000
Received: from list by lists.xenproject.org with outflank-mailman.497373.768324 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pTA46-0006Vo-GS; Fri, 17 Feb 2023 23:22:54 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 497373.768324; Fri, 17 Feb 2023 23: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 1pTA46-0006VF-DD; Fri, 17 Feb 2023 23:22:54 +0000
Received: by outflank-mailman (input) for mailman id 497373;
 Fri, 17 Feb 2023 23:22: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 1pTA44-0006V3-T9
 for xen-changelog@lists.xenproject.org; Fri, 17 Feb 2023 23:22:52 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pTA44-0002se-SQ
 for xen-changelog@lists.xenproject.org; Fri, 17 Feb 2023 23:22:52 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pTA44-0000ki-RU
 for xen-changelog@lists.xenproject.org; Fri, 17 Feb 2023 23:22:52 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=62/N7kcPb1vMst4KQ0wwiqiwIHtsUjJ23cYfl1TfwTI=; b=W9DuXNz3Uwy3bLeWmQU07IJGkc
	FHqUf5qXcIkqbrX1Jk8PLGHcVa85vzfiEKM5EJDTwopPwQqapCmOX/3ceIT3kv3mFRhUgARA9aC8b
	CE9g/rQ/gquvPxyekZiuhhnGPuupBGFXgoGkoBZZMnF0QHpK4Sc31/DHAz3Mr1PmWspk=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/arm: Print return code from domain_create and construct_dom{0,U} on panic
Message-Id: <E1pTA44-0000ki-RU@xenbits.xenproject.org>
Date: Fri, 17 Feb 2023 23:22:52 +0000

commit 91c45cfbab5d9878c0a7021f762988a688d5e91d
Author:     Michal Orzel <michal.orzel@amd.com>
AuthorDate: Mon Feb 6 14:05:28 2023 +0100
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Wed Feb 15 13:49:58 2023 -0800

    xen/arm: Print return code from domain_create and construct_dom{0,U} on panic
    
    This might be helpful in providing additional debugging information (in
    most cases, at least to distinguish -EINVAL from -ENOMEM), so modify the
    code to include printing return code in panic message. In create_dom0,
    move the call to alloc_dom0_vcpu0() to a separate condition and call a
    meaningful panic message.
    
    Signed-off-by: Michal Orzel <michal.orzel@amd.com>
    Reviewed-by: Luca Fancellu <luca.fancellu@arm.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
---
 xen/arch/arm/domain_build.c | 23 ++++++++++++++++-------
 1 file changed, 16 insertions(+), 7 deletions(-)

diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c
index c2b97fa21e..edca23b986 100644
--- a/xen/arch/arm/domain_build.c
+++ b/xen/arch/arm/domain_build.c
@@ -3874,6 +3874,7 @@ void __init create_domUs(void)
         };
         unsigned int flags = 0U;
         uint32_t val;
+        int rc;
 
         if ( !dt_device_is_compatible(node, "xen,domain") )
             continue;
@@ -3966,13 +3967,16 @@ void __init create_domUs(void)
          */
         d = domain_create(++max_init_domid, &d_cfg, flags);
         if ( IS_ERR(d) )
-            panic("Error creating domain %s\n", dt_node_name(node));
+            panic("Error creating domain %s (rc = %ld)\n",
+                  dt_node_name(node), PTR_ERR(d));
 
         d->is_console = true;
         dt_device_set_used_by(node, d->domain_id);
 
-        if ( construct_domU(d, node) != 0 )
-            panic("Could not set up domain %s\n", dt_node_name(node));
+        rc = construct_domU(d, node);
+        if ( rc )
+            panic("Could not set up domain %s (rc = %d)\n",
+                  dt_node_name(node), rc);
     }
 }
 
@@ -4060,6 +4064,7 @@ void __init create_dom0(void)
         .max_maptrack_frames = -1,
         .grant_opts = XEN_DOMCTL_GRANT_version(opt_gnttab_max_version),
     };
+    int rc;
 
     /* The vGIC for DOM0 is exactly emulating the hardware GIC */
     dom0_cfg.arch.gic_version = XEN_DOMCTL_CONFIG_GIC_NATIVE;
@@ -4077,11 +4082,15 @@ void __init create_dom0(void)
         dom0_cfg.flags |= XEN_DOMCTL_CDF_iommu;
 
     dom0 = domain_create(0, &dom0_cfg, CDF_privileged | CDF_directmap);
-    if ( IS_ERR(dom0) || (alloc_dom0_vcpu0(dom0) == NULL) )
-        panic("Error creating domain 0\n");
+    if ( IS_ERR(dom0) )
+        panic("Error creating domain 0 (rc = %ld)\n", PTR_ERR(dom0));
+
+    if ( alloc_dom0_vcpu0(dom0) == NULL )
+        panic("Error creating domain 0 vcpu0\n");
 
-    if ( construct_dom0(dom0) != 0)
-        panic("Could not set up DOM0 guest OS\n");
+    rc = construct_dom0(dom0);
+    if ( rc )
+        panic("Could not set up DOM0 guest OS (rc = %d)\n", rc);
 }
 
 /*
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Feb 17 23:23:04 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 17 Feb 2023 23:23:04 +0000
Received: from list by lists.xenproject.org with outflank-mailman.497374.768327 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pTA4G-0006Z6-Hk; Fri, 17 Feb 2023 23:23:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 497374.768327; Fri, 17 Feb 2023 23: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 1pTA4G-0006Yy-Es; Fri, 17 Feb 2023 23:23:04 +0000
Received: by outflank-mailman (input) for mailman id 497374;
 Fri, 17 Feb 2023 23:23:03 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pTA4F-0006Yc-0A
 for xen-changelog@lists.xenproject.org; Fri, 17 Feb 2023 23:23:03 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pTA4E-0002tC-Vf
 for xen-changelog@lists.xenproject.org; Fri, 17 Feb 2023 23:23:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pTA4E-0000lb-Uf
 for xen-changelog@lists.xenproject.org; Fri, 17 Feb 2023 23: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=mHjxveyWvERxw2e0p6SCu982O7ZlYAfEU/aH4wSwHV4=; b=X7vLBxhX3dtbG4EaslSZL8w01M
	Yf3iVaGpGfIZcS62UK3q+XOU5w2P1CBHS/mW9AC2Am7UvjcvPBRdx7oqbaZMyyWPwLt3GUReA2N0H
	/qJfrahvhIxe31vTxaFJGkwcIV3nbzq0ljshajRCmFTk+E4iG3Tg58Vv7J6GODTwYA/M=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] ACPI/CPER: use standard C types
Message-Id: <E1pTA4E-0000lb-Uf@xenbits.xenproject.org>
Date: Fri, 17 Feb 2023 23:23:02 +0000

commit 727bf4cd0751782d100603a076f0e66f218cc3b8
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Feb 16 10:14:49 2023 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Feb 16 10:14:49 2023 +0100

    ACPI/CPER: use standard C types
    
    Consolidate cper.h to use exclusively standard types.
    
    No functional change intended.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/include/xen/cper.h | 46 +++++++++++++++++++++++-----------------------
 1 file changed, 23 insertions(+), 23 deletions(-)

diff --git a/xen/include/xen/cper.h b/xen/include/xen/cper.h
index 8788ceff12..f8e5272bc1 100644
--- a/xen/include/xen/cper.h
+++ b/xen/include/xen/cper.h
@@ -27,7 +27,7 @@
 extern unsigned long get_sec(void);
 
 typedef struct {
-	__u8 b[16];
+	uint8_t b[16];
 } uuid_le;
 
 static inline int uuid_le_cmp(const uuid_le u1, const uuid_le u2)
@@ -35,12 +35,12 @@ static inline int uuid_le_cmp(const uuid_le u1, const uuid_le u2)
         return memcmp(&u1, &u2, sizeof(uuid_le));
 }
 
-static inline u64 cper_next_record_id(void)
+static inline uint64_t cper_next_record_id(void)
 {
-	static u64 record_id;
+	static uint64_t record_id;
 
 	if (!record_id)
-		record_id = (u64)get_sec() << 32;
+		record_id = (uint64_t)get_sec() << 32;
 
 	return ++record_id;
 }
@@ -154,36 +154,36 @@ static inline u64 cper_next_record_id(void)
 
 struct cper_record_header {
 	char	signature[CPER_SIG_SIZE];	/* must be CPER_SIG_RECORD */
-	__u16	revision;			/* must be CPER_RECORD_REV */
-	__u32	signature_end;			/* must be CPER_SIG_END */
-	__u16	section_count;
-	__u32	error_severity;
-	__u32	validation_bits;
-	__u32	record_length;
-	__u64	timestamp;
+	uint16_t revision;			/* must be CPER_RECORD_REV */
+	uint32_t signature_end;			/* must be CPER_SIG_END */
+	uint16_t section_count;
+	uint32_t error_severity;
+	uint32_t validation_bits;
+	uint32_t record_length;
+	uint64_t timestamp;
 	uuid_le	platform_id;
 	uuid_le	partition_id;
 	uuid_le	creator_id;
 	uuid_le	notification_type;
-	__u64	record_id;
-	__u32	flags;
-	__u64	persistence_information;
-	__u8	reserved[12];			/* must be zero */
+	uint64_t record_id;
+	uint32_t flags;
+	uint64_t persistence_information;
+	uint8_t reserved[12];			/* must be zero */
 };
 
 struct cper_section_descriptor {
-	__u32	section_offset;		/* Offset in bytes of the
+	uint32_t section_offset;	/* Offset in bytes of the
 					 *  section body from the base
 					 *  of the record header */
-	__u32	section_length;
-	__u16	revision;		/* must be CPER_RECORD_REV */
-	__u8	validation_bits;
-	__u8	reserved;		/* must be zero */
-	__u32	flags;
+	uint32_t section_length;
+	uint16_t revision;		/* must be CPER_RECORD_REV */
+	uint8_t	validation_bits;
+	uint8_t	reserved;		/* must be zero */
+	uint32_t flags;
 	uuid_le	section_type;
 	uuid_le	fru_id;
-	__u32	section_severity;
-	__u8	fru_text[20];
+	uint32_t section_severity;
+	uint8_t	fru_text[20];
 };
 
 /* Reset to default packing */
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Feb 17 23:23:14 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 17 Feb 2023 23:23:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.497375.768331 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pTA4Q-0006bl-J0; Fri, 17 Feb 2023 23:23:14 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 497375.768331; Fri, 17 Feb 2023 23: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 1pTA4Q-0006bd-GM; Fri, 17 Feb 2023 23:23:14 +0000
Received: by outflank-mailman (input) for mailman id 497375;
 Fri, 17 Feb 2023 23:23:13 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pTA4P-0006bO-3I
 for xen-changelog@lists.xenproject.org; Fri, 17 Feb 2023 23:23:13 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pTA4P-0002tN-2c
 for xen-changelog@lists.xenproject.org; Fri, 17 Feb 2023 23:23:13 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pTA4P-0000m8-1n
 for xen-changelog@lists.xenproject.org; Fri, 17 Feb 2023 23:23:13 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=6wkhwZjvebXe0cySa2sVAXRpxbHqjI400w+1uoRwPoY=; b=jXj5jkJgx09sd356GRTpfPNt1w
	Xk53YxY8Sd1qSxTcTAZ/aSsBEEjWa0fkWFVoSQS1Mes24nqFLFbsnN37xSy7jJkwq1bXJ2YASStNr
	9naxiYTO001utbsbznzEQ98WcoDbdxEhi2Y/42DY+u6fb19z38opgFOPzXIMEL4+Ic2o=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/vlapic: call vmx_vlapic_msr_changed through an hvm_function callback
Message-Id: <E1pTA4P-0000m8-1n@xenbits.xenproject.org>
Date: Fri, 17 Feb 2023 23:23:13 +0000

commit 2e52dcc853a7183784cd9bdfb1e78ff366035209
Author:     Xenia Ragiadakou <burzalodowa@gmail.com>
AuthorDate: Thu Feb 16 10:15:35 2023 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Feb 16 10:15:35 2023 +0100

    x86/vlapic: call vmx_vlapic_msr_changed through an hvm_function callback
    
    APIC virtualization support is currently implemented only for Intel VT-x.
    To aid future work on separating AMD-V from Intel VT-x code, instead of
    calling directly vmx_vlapic_msr_changed() from common hvm code, add a stub
    to the hvm_function_table, named update_vlapic_mode, and create a wrapper
    function, called hvm_vlapic_mode(), to be used by common hvm code.
    
    After the change above, do not include header asm/hvm/vmx/vmx.h as it is
    not required anymore and resolve subsequent build errors for implicit
    declaration of functions ‘TRACE_2_LONG_3D’ and ‘TRC_PAR_LONG’ by including
    missing asm/hvm/trace.h header.
    
    No functional change intended.
    
    Signed-off-by: Xenia Ragiadakou <burzalodowa@gmail.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Kevin Tian <kevin.tian@intel.com>
---
 xen/arch/x86/hvm/vlapic.c              | 6 +++---
 xen/arch/x86/hvm/vmx/vmx.c             | 3 ++-
 xen/arch/x86/include/asm/hvm/hvm.h     | 7 +++++++
 xen/arch/x86/include/asm/hvm/vmx/vmx.h | 2 +-
 4 files changed, 13 insertions(+), 5 deletions(-)

diff --git a/xen/arch/x86/hvm/vlapic.c b/xen/arch/x86/hvm/vlapic.c
index eb32f12e2d..dc93b5e930 100644
--- a/xen/arch/x86/hvm/vlapic.c
+++ b/xen/arch/x86/hvm/vlapic.c
@@ -37,8 +37,8 @@
 #include <asm/hvm/hvm.h>
 #include <asm/hvm/io.h>
 #include <asm/hvm/support.h>
-#include <asm/hvm/vmx/vmx.h>
 #include <asm/hvm/nestedhvm.h>
+#include <asm/hvm/trace.h>
 #include <asm/hvm/viridian.h>
 #include <public/hvm/ioreq.h>
 #include <public/hvm/params.h>
@@ -1165,7 +1165,7 @@ int guest_wrmsr_apic_base(struct vcpu *v, uint64_t value)
     if ( vlapic_x2apic_mode(vlapic) )
         set_x2apic_id(vlapic);
 
-    vmx_vlapic_msr_changed(vlapic_vcpu(vlapic));
+    hvm_update_vlapic_mode(vlapic_vcpu(vlapic));
 
     HVM_DBG_LOG(DBG_LEVEL_VLAPIC,
                 "apic base msr is 0x%016"PRIx64, vlapic->hw.apic_base_msr);
@@ -1561,7 +1561,7 @@ static int cf_check lapic_load_hidden(struct domain *d, hvm_domain_context_t *h)
          unlikely(vlapic_x2apic_mode(s)) )
         return -EINVAL;
 
-    vmx_vlapic_msr_changed(v);
+    hvm_update_vlapic_mode(v);
 
     return 0;
 }
diff --git a/xen/arch/x86/hvm/vmx/vmx.c b/xen/arch/x86/hvm/vmx/vmx.c
index 270bc98195..0ec33bcc18 100644
--- a/xen/arch/x86/hvm/vmx/vmx.c
+++ b/xen/arch/x86/hvm/vmx/vmx.c
@@ -2763,6 +2763,7 @@ static struct hvm_function_table __initdata_cf_clobber vmx_function_table = {
     .nhvm_vcpu_vmexit_event = nvmx_vmexit_event,
     .nhvm_intr_blocked    = nvmx_intr_blocked,
     .nhvm_domain_relinquish_resources = nvmx_domain_relinquish_resources,
+    .update_vlapic_mode = vmx_vlapic_msr_changed,
     .nhvm_hap_walk_L1_p2m = nvmx_hap_walk_L1_p2m,
     .enable_msr_interception = vmx_enable_msr_interception,
     .altp2m_vcpu_update_p2m = vmx_vcpu_update_eptp,
@@ -3472,7 +3473,7 @@ static void vmx_install_vlapic_mapping(struct vcpu *v)
     vmx_vmcs_exit(v);
 }
 
-void vmx_vlapic_msr_changed(struct vcpu *v)
+void cf_check vmx_vlapic_msr_changed(struct vcpu *v)
 {
     int virtualize_x2apic_mode;
     struct vlapic *vlapic = vcpu_vlapic(v);
diff --git a/xen/arch/x86/include/asm/hvm/hvm.h b/xen/arch/x86/include/asm/hvm/hvm.h
index 80e4565bd2..43d3fc2498 100644
--- a/xen/arch/x86/include/asm/hvm/hvm.h
+++ b/xen/arch/x86/include/asm/hvm/hvm.h
@@ -217,6 +217,7 @@ struct hvm_function_table {
     void (*handle_eoi)(uint8_t vector, int isr);
     int (*pi_update_irte)(const struct vcpu *v, const struct pirq *pirq,
                           uint8_t gvec);
+    void (*update_vlapic_mode)(struct vcpu *v);
 
     /*Walk nested p2m  */
     int (*nhvm_hap_walk_L1_p2m)(struct vcpu *v, paddr_t L2_gpa,
@@ -786,6 +787,12 @@ static inline int hvm_pi_update_irte(const struct vcpu *v,
     return alternative_call(hvm_funcs.pi_update_irte, v, pirq, gvec);
 }
 
+static inline void hvm_update_vlapic_mode(struct vcpu *v)
+{
+    if ( hvm_funcs.update_vlapic_mode )
+        alternative_vcall(hvm_funcs.update_vlapic_mode, v);
+}
+
 #else  /* CONFIG_HVM */
 
 #define hvm_enabled false
diff --git a/xen/arch/x86/include/asm/hvm/vmx/vmx.h b/xen/arch/x86/include/asm/hvm/vmx/vmx.h
index 234da4a7f4..97d6b810ec 100644
--- a/xen/arch/x86/include/asm/hvm/vmx/vmx.h
+++ b/xen/arch/x86/include/asm/hvm/vmx/vmx.h
@@ -85,7 +85,7 @@ typedef enum {
 void vmx_asm_vmexit_handler(struct cpu_user_regs);
 void vmx_intr_assist(void);
 void noreturn cf_check vmx_do_resume(void);
-void vmx_vlapic_msr_changed(struct vcpu *v);
+void cf_check vmx_vlapic_msr_changed(struct vcpu *v);
 struct hvm_emulate_ctxt;
 void vmx_realmode_emulate_one(struct hvm_emulate_ctxt *hvmemul_ctxt);
 void vmx_realmode(struct cpu_user_regs *regs);
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Feb 17 23:23:24 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 17 Feb 2023 23:23:24 +0000
Received: from list by lists.xenproject.org with outflank-mailman.497376.768335 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pTA4a-0006eq-Kb; Fri, 17 Feb 2023 23:23:24 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 497376.768335; Fri, 17 Feb 2023 23: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 1pTA4a-0006ei-Hr; Fri, 17 Feb 2023 23:23:24 +0000
Received: by outflank-mailman (input) for mailman id 497376;
 Fri, 17 Feb 2023 23:23:23 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pTA4Z-0006eY-6C
 for xen-changelog@lists.xenproject.org; Fri, 17 Feb 2023 23:23:23 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pTA4Z-0002td-5S
 for xen-changelog@lists.xenproject.org; Fri, 17 Feb 2023 23:23:23 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pTA4Z-0000mb-4d
 for xen-changelog@lists.xenproject.org; Fri, 17 Feb 2023 23:23:23 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=psHouw0Ibm7Cp4Dje+FBJi8B4x16EzJcNcfy7/9Q72U=; b=i9J36diKHfP4/mOghW5h6vvoUw
	hBwjQsfxrACN8SreFVBgsT/g7574nyyZgq0eL5CBz2Iw9f//UXuwUjN2W6rjqKzOYglQcq2fMA14X
	UEarjDr1G/H+8svFr+SIpeNI4ioLClQ6DL0JDIL5gU26KD6hMa5LGBZcE389JURPC+wY=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/common: Constify the parameter of _spin_is_locked()
Message-Id: <E1pTA4Z-0000mb-4d@xenbits.xenproject.org>
Date: Fri, 17 Feb 2023 23:23:23 +0000

commit 543f426eceded943f76f6a943e057b2917d0e72b
Author:     Julien Grall <jgrall@amazon.com>
AuthorDate: Fri Jan 27 19:05:16 2023 +0000
Commit:     Julien Grall <julien@xen.org>
CommitDate: Thu Feb 16 21:56:09 2023 +0000

    xen/common: Constify the parameter of _spin_is_locked()
    
    The lock is not meant to be modified by _spin_is_locked(). So constify
    it.
    
    This is helpful to be able to assert the locked is taken when the
    underlying structure is const.
    
    Signed-off-by: Julien Grall <jgrall@amazon.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Henry Wang <Henry.Wang@arm.com>
    Tested-by: Henry Wang <Henry.Wang@arm.com> #Arm
---
 xen/common/spinlock.c      | 2 +-
 xen/include/xen/spinlock.h | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/xen/common/spinlock.c b/xen/common/spinlock.c
index 84996c3fbc..a15f0a2eb6 100644
--- a/xen/common/spinlock.c
+++ b/xen/common/spinlock.c
@@ -368,7 +368,7 @@ void _spin_unlock_irqrestore(spinlock_t *lock, unsigned long flags)
     local_irq_restore(flags);
 }
 
-int _spin_is_locked(spinlock_t *lock)
+int _spin_is_locked(const spinlock_t *lock)
 {
     /*
      * Recursive locks may be locked by another CPU, yet we return
diff --git a/xen/include/xen/spinlock.h b/xen/include/xen/spinlock.h
index 2fa6ba3654..ca40c71c88 100644
--- a/xen/include/xen/spinlock.h
+++ b/xen/include/xen/spinlock.h
@@ -185,7 +185,7 @@ void _spin_unlock(spinlock_t *lock);
 void _spin_unlock_irq(spinlock_t *lock);
 void _spin_unlock_irqrestore(spinlock_t *lock, unsigned long flags);
 
-int _spin_is_locked(spinlock_t *lock);
+int _spin_is_locked(const spinlock_t *lock);
 int _spin_trylock(spinlock_t *lock);
 void _spin_barrier(spinlock_t *lock);
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Feb 17 23:23:34 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 17 Feb 2023 23:23:34 +0000
Received: from list by lists.xenproject.org with outflank-mailman.497377.768339 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pTA4k-0006hZ-Lv; Fri, 17 Feb 2023 23:23:34 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 497377.768339; Fri, 17 Feb 2023 23: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 1pTA4k-0006hR-JK; Fri, 17 Feb 2023 23:23:34 +0000
Received: by outflank-mailman (input) for mailman id 497377;
 Fri, 17 Feb 2023 23:23:33 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pTA4j-0006hG-90
 for xen-changelog@lists.xenproject.org; Fri, 17 Feb 2023 23:23:33 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pTA4j-0002u1-8M
 for xen-changelog@lists.xenproject.org; Fri, 17 Feb 2023 23:23:33 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pTA4j-0000nC-7Z
 for xen-changelog@lists.xenproject.org; Fri, 17 Feb 2023 23:23:33 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=4Lg78r9cfcSZtTTywYv3+Ao0/9qEtZPwV1IRdApOjlQ=; b=3mqFUzGzIO4SC8WsVwX7whx0qj
	O/ioUIY51vwugVB87McCT1J1u2keHXzSKWGy0A0kd90J8R/ZVv09p/CtxNdF8sbi8dI6kV9SLeyYS
	mSAOyWeLyx9EnVQxERWEYYLhyy0DwMzEvaPaOgXR038CdP990KTGPCBdjogwqyEMw+Zs=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/common: rwlock: Constify the parameter of _rw_is{,_write}_locked()
Message-Id: <E1pTA4j-0000nC-7Z@xenbits.xenproject.org>
Date: Fri, 17 Feb 2023 23:23:33 +0000

commit 720944ea26014a1830f9b44bda13b79e8e7d753b
Author:     Julien Grall <jgrall@amazon.com>
AuthorDate: Mon Jan 30 18:28:58 2023 +0000
Commit:     Julien Grall <julien@xen.org>
CommitDate: Thu Feb 16 21:58:26 2023 +0000

    xen/common: rwlock: Constify the parameter of _rw_is{,_write}_locked()
    
    The lock is not meant to be modified by _rw_is{,_write}_locked(). So
    constify it.
    
    This is helpful to be able to assert if the lock is taken when the
    underlying structure is const.
    
    Requested-by: Jan Beulich <jbeulich@suse.com>
    Signed-off-by: Julien Grall <jgrall@amazon.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/include/xen/rwlock.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/xen/include/xen/rwlock.h b/xen/include/xen/rwlock.h
index b8d52a5aa9..e0d2b41c5c 100644
--- a/xen/include/xen/rwlock.h
+++ b/xen/include/xen/rwlock.h
@@ -149,7 +149,7 @@ static inline void _read_unlock_irqrestore(rwlock_t *lock, unsigned long flags)
     local_irq_restore(flags);
 }
 
-static inline int _rw_is_locked(rwlock_t *lock)
+static inline int _rw_is_locked(const rwlock_t *lock)
 {
     return atomic_read(&lock->cnts);
 }
@@ -254,7 +254,7 @@ static inline void _write_unlock_irqrestore(rwlock_t *lock, unsigned long flags)
     local_irq_restore(flags);
 }
 
-static inline int _rw_is_write_locked(rwlock_t *lock)
+static inline int _rw_is_write_locked(const rwlock_t *lock)
 {
     return (atomic_read(&lock->cnts) & _QW_WMASK) == _QW_LOCKED;
 }
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Feb 17 23:23:43 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 17 Feb 2023 23:23:43 +0000
Received: from list by lists.xenproject.org with outflank-mailman.497378.768343 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pTA4t-0006kI-Od; Fri, 17 Feb 2023 23:23:43 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 497378.768343; Fri, 17 Feb 2023 23:23: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 1pTA4t-0006kA-Kl; Fri, 17 Feb 2023 23:23:43 +0000
Received: by outflank-mailman (input) for mailman id 497378;
 Fri, 17 Feb 2023 23:23:43 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pTA4t-0006k4-DA
 for xen-changelog@lists.xenproject.org; Fri, 17 Feb 2023 23:23:43 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pTA4t-0002uC-B6
 for xen-changelog@lists.xenproject.org; Fri, 17 Feb 2023 23:23:43 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pTA4t-0000nd-AP
 for xen-changelog@lists.xenproject.org; Fri, 17 Feb 2023 23:23:43 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Q9P7M8NEfRk4hRO7qgzHjOyfKeSZrLevB9cea1ZKMDY=; b=d+BwoU6D+xn3M/5EYInabOCdZP
	GJrcfRU0wIAiPN4UQ7qiL2kf2AevW+sBmElXeSAGXkNbqfD/1PZ0cl1pTD+EVj6daPPgpE+p+9uuU
	Xi4ACDHxEDTy+WQBEd1DPTrD4o7FgVM4MafQaXo/wudpBaDore0evH2KMOWq66k9dowI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] libs: Fix unstable libs build with LLVM, auto-generate version-script
Message-Id: <E1pTA4t-0000nd-AP@xenbits.xenproject.org>
Date: Fri, 17 Feb 2023 23:23:43 +0000

commit f5c1a6374aae8be471b895a43359dcff355577f5
Author:     Anthony PERARD <anthony.perard@citrix.com>
AuthorDate: Thu Feb 16 14:10:07 2023 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Feb 16 22:45:20 2023 +0000

    libs: Fix unstable libs build with LLVM, auto-generate version-script
    
    Unfortunatly, --default-symver doesn't work with LLVM's LD, LLD.
    Instead, we will generate a temporary version-script.
    
    In order to allow regenerating the script, we'll have a different
    filename. In order to check if the content is up-to-date, we'll always
    generated it and compare.
    
    Reported-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Fixes: 98d95437edb6 ("libs: Fix auto-generation of version-script for unstable libs")
    Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 tools/libs/libs.mk | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/tools/libs/libs.mk b/tools/libs/libs.mk
index 0e4b5e0bd0..ffb6c9f064 100644
--- a/tools/libs/libs.mk
+++ b/tools/libs/libs.mk
@@ -5,6 +5,7 @@
 #   MAJOR:   major version of lib (Xen version if empty)
 #   MINOR:   minor version of lib (0 if empty)
 #   version-script: Specify the name of a version script to the linker.
+#     (If empty, a temporary one for unstable library is created)
 
 LIBNAME := $(notdir $(CURDIR))
 
@@ -27,6 +28,8 @@ ifneq ($(nosharedlibs),y)
 TARGETS += lib$(LIB_FILE_NAME).so
 endif
 
+version-script ?= lib$(LIB_FILE_NAME).map.tmp
+
 PKG_CONFIG ?= $(LIB_FILE_NAME).pc
 PKG_CONFIG_NAME ?= Xen$(LIBNAME)
 PKG_CONFIG_DESC ?= The $(PKG_CONFIG_NAME) library for Xen hypervisor
@@ -72,6 +75,10 @@ headers.lst: FORCE
 	@{ set -e; $(foreach h,$(LIBHEADERS),echo $(h);) } > $@.tmp
 	@$(call move-if-changed,$@.tmp,$@)
 
+lib$(LIB_FILE_NAME).map.tmp: FORCE
+	echo 'lib$(LIB_FILE_NAME)_$(MAJOR).$(MINOR) { global: *; };' >$(@D)/.$(@F)
+	$(call move-if-changed,$(@D)/.$(@F),$@)
+
 lib$(LIB_FILE_NAME).a: $(OBJS-y)
 	$(AR) rc $@ $^
 
@@ -81,7 +88,7 @@ lib$(LIB_FILE_NAME).so.$(MAJOR): lib$(LIB_FILE_NAME).so.$(MAJOR).$(MINOR)
 	$(SYMLINK_SHLIB) $< $@
 
 lib$(LIB_FILE_NAME).so.$(MAJOR).$(MINOR): $(PIC_OBJS) $(version-script)
-	$(CC) $(LDFLAGS) $(PTHREAD_LDFLAGS) -Wl,$(SONAME_LDFLAG) -Wl,lib$(LIB_FILE_NAME).so.$(MAJOR) -Wl,$(if $(version-script),--version-script=$(version-script),--default-symver) $(SHLIB_LDFLAGS) -o $@ $(PIC_OBJS) $(LDLIBS) $(APPEND_LDFLAGS)
+	$(CC) $(LDFLAGS) $(PTHREAD_LDFLAGS) -Wl,$(SONAME_LDFLAG) -Wl,lib$(LIB_FILE_NAME).so.$(MAJOR) -Wl,--version-script=$(version-script) $(SHLIB_LDFLAGS) -o $@ $(PIC_OBJS) $(LDLIBS) $(APPEND_LDFLAGS)
 
 # If abi-dumper is available, write out the ABI analysis
 ifneq ($(ABI_DUMPER),)
@@ -120,7 +127,7 @@ TAGS:
 clean::
 	rm -rf $(TARGETS) *~ $(DEPS_RM) $(OBJS-y) $(PIC_OBJS)
 	rm -f lib$(LIB_FILE_NAME).so.$(MAJOR).$(MINOR) lib$(LIB_FILE_NAME).so.$(MAJOR)
-	rm -f headers.chk headers.lst
+	rm -f headers.chk headers.lst lib*.map.tmp .*.tmp
 
 .PHONY: distclean
 distclean: clean
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Feb 18 10:33:12 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 18 Feb 2023 10:33:12 +0000
Received: from list by lists.xenproject.org with outflank-mailman.497487.768424 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pTKWe-0003Zv-D2; Sat, 18 Feb 2023 10:33:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 497487.768424; Sat, 18 Feb 2023 10:33:04 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pTKWe-0003Zn-9v; Sat, 18 Feb 2023 10:33:04 +0000
Received: by outflank-mailman (input) for mailman id 497487;
 Sat, 18 Feb 2023 10: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 1pTKWc-0003Zh-8P
 for xen-changelog@lists.xenproject.org; Sat, 18 Feb 2023 10:33:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pTKWc-0001wn-7Z
 for xen-changelog@lists.xenproject.org; Sat, 18 Feb 2023 10:33:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pTKWc-0003XI-5a
 for xen-changelog@lists.xenproject.org; Sat, 18 Feb 2023 10:33:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=d3J0CX6OY0vSrLSFFsnQqFagAFzVY3D2AwsgIwC8pE8=; b=5j3vbXyQR8LLANyfVeRUYTm2+f
	KbalCpzlFbgMVBD1Xg8kY8k/TIMQgbTSUcK2cjzvuUimnFgkhbwBz5DyCc8aQe+F/7KKmWV9w9J9D
	/NAiAdBWT6UdvIqGYbsEHMR4zruq1KE0ULLmUdd0MOeFYTxFxtDY6OqLSMdIr/tSnf8M=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/x86: Remove the use of K&R functions
Message-Id: <E1pTKWc-0003XI-5a@xenbits.xenproject.org>
Date: Sat, 18 Feb 2023 10:33:02 +0000

commit 22b2fa4766728c3057757c00e79da5f7803fff33
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu Feb 16 22:14:12 2023 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Feb 17 11:01:54 2023 +0000

    xen/x86: Remove the use of K&R functions
    
    Clang-15 (as seen in the FreeBSD 14 tests) complains:
    
      arch/x86/time.c:1364:20: error: a function declaration without a
      prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes]
      s_time_t get_s_time()
                         ^
                          void
    
    The error message is a bit confusing but appears to new as part of
    -Wdeprecated-non-prototype which is part of supporting C2x which formally
    removes K&R syntax.
    
    Either way, fix the identified functions.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/hvm/vmx/vmcs.c     | 2 +-
 xen/arch/x86/time.c             | 2 +-
 xen/drivers/passthrough/iommu.c | 4 ++--
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/xen/arch/x86/hvm/vmx/vmcs.c b/xen/arch/x86/hvm/vmx/vmcs.c
index 09edbd23b3..e1c268789e 100644
--- a/xen/arch/x86/hvm/vmx/vmcs.c
+++ b/xen/arch/x86/hvm/vmx/vmcs.c
@@ -781,7 +781,7 @@ static int _vmx_cpu_up(bool bsp)
     return 0;
 }
 
-int cf_check vmx_cpu_up()
+int cf_check vmx_cpu_up(void)
 {
     return _vmx_cpu_up(false);
 }
diff --git a/xen/arch/x86/time.c b/xen/arch/x86/time.c
index 782b11c8a9..4e44a43cc5 100644
--- a/xen/arch/x86/time.c
+++ b/xen/arch/x86/time.c
@@ -1361,7 +1361,7 @@ s_time_t get_s_time_fixed(u64 at_tsc)
     return t->stamp.local_stime + scale_delta(delta, &t->tsc_scale);
 }
 
-s_time_t get_s_time()
+s_time_t get_s_time(void)
 {
     return get_s_time_fixed(0);
 }
diff --git a/xen/drivers/passthrough/iommu.c b/xen/drivers/passthrough/iommu.c
index 921b71e819..0e187f6ae3 100644
--- a/xen/drivers/passthrough/iommu.c
+++ b/xen/drivers/passthrough/iommu.c
@@ -606,7 +606,7 @@ int __init iommu_setup(void)
     return rc;
 }
 
-int iommu_suspend()
+int iommu_suspend(void)
 {
     if ( iommu_enabled )
         return iommu_call(iommu_get_ops(), suspend);
@@ -614,7 +614,7 @@ int iommu_suspend()
     return 0;
 }
 
-void iommu_resume()
+void iommu_resume(void)
 {
     if ( iommu_enabled )
         iommu_vcall(iommu_get_ops(), resume);
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Feb 18 10:33:13 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 18 Feb 2023 10:33:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.497488.768429 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pTKWn-0003ck-Gj; Sat, 18 Feb 2023 10:33:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 497488.768429; Sat, 18 Feb 2023 10:33:13 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pTKWn-0003cc-DT; Sat, 18 Feb 2023 10:33:13 +0000
Received: by outflank-mailman (input) for mailman id 497488;
 Sat, 18 Feb 2023 10:33:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pTKWm-0003cJ-Bu
 for xen-changelog@lists.xenproject.org; Sat, 18 Feb 2023 10:33:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pTKWm-0001x1-B7
 for xen-changelog@lists.xenproject.org; Sat, 18 Feb 2023 10:33:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pTKWm-0003Yg-9f
 for xen-changelog@lists.xenproject.org; Sat, 18 Feb 2023 10:33:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=/uoFVsgH3Ph4hxA14/qesQB7F9tlak8kcLEdyNQMl4M=; b=z1+M3BSUctIBVEb6gwyjWPBCwM
	wKz9npxnO9diDAOnT/Z3coFGt14v3nSas6TXmNgQhBDJYoXH6HBAo2N5ycAYwRrQ1UQdNmpCLZcce
	sVu6QQq7/ZcxKENOTyuNKTugItjdphm2yoygxE323BdLIq7mEZec27SR29yT+XGq6SK8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools: Remove the use of K&R functions
Message-Id: <E1pTKWm-0003Yg-9f@xenbits.xenproject.org>
Date: Sat, 18 Feb 2023 10:33:12 +0000

commit e2312e41f05c0f2e3b714710bd2551a3cd74cedd
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu Feb 16 22:47:50 2023 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Feb 17 11:01:54 2023 +0000

    tools: Remove the use of K&R functions
    
    Clang-15 (as seen in the FreeBSD 14 tests) complains:
    
      xg_main.c:1248 error: a function declaration without a
      prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes]
      xg_init()
             ^
              void
    
    The error message is a bit confusing but appears to new as part of
    -Wdeprecated-non-prototype which is part of supporting C2x which formally
    removes K&R syntax.
    
    Either way, fix the identified function.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Anthony PERARD <anthony.perard@citrix.com>
---
 tools/debugger/gdbsx/xg/xg_main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/debugger/gdbsx/xg/xg_main.c b/tools/debugger/gdbsx/xg/xg_main.c
index 4576c762af..580fe237b2 100644
--- a/tools/debugger/gdbsx/xg/xg_main.c
+++ b/tools/debugger/gdbsx/xg/xg_main.c
@@ -121,7 +121,7 @@ xgprt(const char *fn, const char *fmt, ...)
  *         -1 failure, errno set.
  */
 int 
-xg_init()
+xg_init(void)
 {
     int flags, saved_errno;
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Mon Feb 20 04:11:10 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 20 Feb 2023 04:11:10 +0000
Received: from list by lists.xenproject.org with outflank-mailman.497931.768708 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pTxW3-0003me-Gc; Mon, 20 Feb 2023 04:11:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 497931.768708; Mon, 20 Feb 2023 04: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 1pTxW3-0003mV-Ck; Mon, 20 Feb 2023 04:11:03 +0000
Received: by outflank-mailman (input) for mailman id 497931;
 Mon, 20 Feb 2023 04:11:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pTxW2-0003mP-2I
 for xen-changelog@lists.xenproject.org; Mon, 20 Feb 2023 04:11:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pTxW1-0003Uy-VJ
 for xen-changelog@lists.xenproject.org; Mon, 20 Feb 2023 04:11:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pTxW1-0006lG-U6
 for xen-changelog@lists.xenproject.org; Mon, 20 Feb 2023 04:11:01 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=yOADK88aK4VVxkPDnLvw7zvwDPzWex/1M67lPYsAvB8=; b=YqrbiLcg96vCQDmxejNxdnyF83
	7NBrolbrIjGzgox/9i3WWOj7g5F63I6b4Gvm8f8B1dn53TKO2BmyS7pGrI4zlQeswoaooOwFnLtI5
	MBt+ZSVyFeRNaPm556Hcp3dgiiQ5XOUc5xcQDvkUAcLUX1blaIuTA4vNKw5gqOKkSHog=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] docs/process: branching-checklist: Reword the section about Config.mk
Message-Id: <E1pTxW1-0006lG-U6@xenbits.xenproject.org>
Date: Mon, 20 Feb 2023 04:11:01 +0000

commit 163b3cf7af475ca1ad5ba26a51f5fe2e2a647ee3
Author:     Julien Grall <jgrall@amazon.com>
AuthorDate: Sun Feb 19 18:42:42 2023 +0000
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Sun Feb 19 18:44:02 2023 +0000

    docs/process: branching-checklist: Reword the section about Config.mk
    
    Since at least Xen 4.12, the revision for external trees don't contain
    the word "unstable". So explicitly list the *_REVISION variables that
    need to be updated as part of the branching process.
    
    Signed-off-by: Julien Grall <jgrall@amazon.com>
    Reviewed-by: Henry Wang <Henry.Wang@arm.com>
    
    ----
        Changes in v2:
            * Explain what should be the tag format for each variables
---
 docs/process/branching-checklist.txt | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/docs/process/branching-checklist.txt b/docs/process/branching-checklist.txt
index d1550385c9..7c4c107c25 100644
--- a/docs/process/branching-checklist.txt
+++ b/docs/process/branching-checklist.txt
@@ -69,11 +69,12 @@ ov=4.0
     git add versions
     git commit -m "Branch for $v"
 
-Ensure references to qemu trees in xen.git's Config.mk are updated.
-Check this with
-    grep unstable Config.mk
-which should produce no output.  Replace as necessary.
-(There may well be none.)
+Ensure references to qemu trees and Mini-OS in xen.git's Config.mk are updated.
+The variables and there content should be:
+  * QEMU_UPSTREAM_REVISION: qemu-xen-X.Y.0
+  * QEMU_TRADITIONAL_REVISION: xen-X.Y.0
+  * MINIOS_UPSTREAM_REVISION: xen-RELEASE-X.Y.0
+Where X.Y is the release version (e.g. 4.17).
 
 Update newly diverging staging (unstable) according to
 release-technician-checklist.txt section re README etc.
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Mon Feb 20 04:11:13 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 20 Feb 2023 04:11:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.497932.768711 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pTxWD-0003oB-H2; Mon, 20 Feb 2023 04:11:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 497932.768711; Mon, 20 Feb 2023 04: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 1pTxWD-0003o3-EN; Mon, 20 Feb 2023 04:11:13 +0000
Received: by outflank-mailman (input) for mailman id 497932;
 Mon, 20 Feb 2023 04:11:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pTxWC-0003nv-3C
 for xen-changelog@lists.xenproject.org; Mon, 20 Feb 2023 04:11:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pTxWC-0003V2-2R
 for xen-changelog@lists.xenproject.org; Mon, 20 Feb 2023 04:11:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pTxWC-0006ln-16
 for xen-changelog@lists.xenproject.org; Mon, 20 Feb 2023 04:11:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=mlBdvbksiSvyaZb0jF6UV8mmq6vNvlZrGqDQiyq20qI=; b=CKrjoHjw6AfkP7uxs0pyVHPAfG
	RSwDYucS05i3ZHrQm/3yTgMs5LXffOFEMj/aQlRyFDXCglVtDN/xPtzxXJ1A+noozwCdNzrvD9kie
	IrHpQAFGjjyq6H0TFkLf12qf0OxxIgCclijatfT4My44OoVH6CkXsaTv8QourYCO3RL0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] docs/process: branching-checklist: Remove section about the cambridge colo
Message-Id: <E1pTxWC-0006ln-16@xenbits.xenproject.org>
Date: Mon, 20 Feb 2023 04:11:12 +0000

commit 7708b13acf3d101086ece01cb2cd4f21b7d10bf3
Author:     Julien Grall <jgrall@amazon.com>
AuthorDate: Sun Feb 19 18:43:14 2023 +0000
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Sun Feb 19 18:44:02 2023 +0000

    docs/process: branching-checklist: Remove section about the cambridge colo
    
    The cambridge colo was internal to Citrix (now Cloud) and hasn't been used
    by the community for a while.
    
    So remove the section.
    
    Signed-off-by: Julien Grall <jgrall@amazon.com>
    Acked-by: George Dunlap <george.dunlap@cloud.com>
    Reviewed-by: Henry Wang <Henry.Wang@arm.com>
    
    ----
        Changes in v2:
            - Add George's acked-by
            - Add Henry's reviewed-by
---
 docs/process/branching-checklist.txt | 6 ------
 1 file changed, 6 deletions(-)

diff --git a/docs/process/branching-checklist.txt b/docs/process/branching-checklist.txt
index 7c4c107c25..6fd1ab3341 100644
--- a/docs/process/branching-checklist.txt
+++ b/docs/process/branching-checklist.txt
@@ -42,12 +42,6 @@ ov=4.0
     OSSTEST_CONFIG=production-config ./mg-branch-setup xen-$v-testing bisect
     OSSTEST_CONFIG=production-config ./mg-branch-setup qemu-upstream-$v-testing bisect
 
-# make branches etc. in Cambridge osstest
-    ssh osstest@osstest.xs.citrite.net
-    cd testing.git
-    OSSTEST_CONFIG=production-config-cambridge ./mg-branch-setup xen-$v-testing bisect
-    OSSTEST_CONFIG=production-config-cambridge ./mg-branch-setup qemu-upstream-$v-testing bisect
-
 * add branch to osstest
     Add both qemu-upstream-$v-testing and xen-$v-testing to BRANCHES in cr-for-branches
     git add -p
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Mon Feb 20 04:11:23 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 20 Feb 2023 04:11:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.497933.768715 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pTxWN-0003qO-Ih; Mon, 20 Feb 2023 04:11:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 497933.768715; Mon, 20 Feb 2023 04: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 1pTxWN-0003qE-Ft; Mon, 20 Feb 2023 04:11:23 +0000
Received: by outflank-mailman (input) for mailman id 497933;
 Mon, 20 Feb 2023 04:11:22 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pTxWM-0003q6-6L
 for xen-changelog@lists.xenproject.org; Mon, 20 Feb 2023 04:11:22 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pTxWM-0003VQ-5S
 for xen-changelog@lists.xenproject.org; Mon, 20 Feb 2023 04:11:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pTxWM-0006mD-4W
 for xen-changelog@lists.xenproject.org; Mon, 20 Feb 2023 04:11:22 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=ENV8eJCWQn81382pW7WokY4H1/ja2uxdB/r2C/LyrcY=; b=ltW9hIozpTqfWOWR/WV9BeY7fY
	ydMk21QtqVbEpCcpWb94BmniwJOTcTnEA87Pv7OIi5zz3JlfKeazTkupSEi5VElWfzwqp5RwCZR8b
	M0XKnndi0Lgm38OP4KYCfdJh5con1fXZHAbiYKHesS/SSn15QKEmOi0m9x1bBhXiSlc0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] docs/proces: branching-checklist: Update the section "add to patchbot"
Message-Id: <E1pTxWM-0006mD-4W@xenbits.xenproject.org>
Date: Mon, 20 Feb 2023 04:11:22 +0000

commit e1d08321ef71ef7757cd721cb93d62646482f13e
Author:     Julien Grall <jgrall@amazon.com>
AuthorDate: Sun Feb 19 18:43:15 2023 +0000
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Sun Feb 19 18:44:02 2023 +0000

    docs/proces: branching-checklist: Update the section "add to patchbot"
    
    Make clear the patchbot is accessible from the user "xen" on xenbits.
    
    Signed-off-by: Julien Grall <jgrall@amazon.com>
    Acked-by: George Dunlap <george.dunlap@citrix.com>
    Reviewed-by: Henry Wang <Henry.Wang@arm.com>
    
    ----
        Changes in v2:
            - Add Henry's reviewed-by
            - Add George's acked-by
---
 docs/process/branching-checklist.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/docs/process/branching-checklist.txt b/docs/process/branching-checklist.txt
index 6fd1ab3341..6710cc2340 100644
--- a/docs/process/branching-checklist.txt
+++ b/docs/process/branching-checklist.txt
@@ -48,7 +48,7 @@ ov=4.0
     git commit -m "cr-for-branches: Add Xen and QEMU $v branch"
 
 * add to patchbot
-    on xenbits
+    ssh xen@xenbits.xen.org
     cd ~/HG/patchbot/
 
     cp xen--master.patchbot-reported-heads xen--stable-$v.patchbot-reported-heads
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Mon Feb 20 04:11:33 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 20 Feb 2023 04:11:33 +0000
Received: from list by lists.xenproject.org with outflank-mailman.497934.768719 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pTxWX-0003ti-Jz; Mon, 20 Feb 2023 04:11:33 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 497934.768719; Mon, 20 Feb 2023 04: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 1pTxWX-0003ta-HP; Mon, 20 Feb 2023 04:11:33 +0000
Received: by outflank-mailman (input) for mailman id 497934;
 Mon, 20 Feb 2023 04:11:32 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pTxWW-0003tK-CM
 for xen-changelog@lists.xenproject.org; Mon, 20 Feb 2023 04:11:32 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pTxWW-0003Ve-Ba
 for xen-changelog@lists.xenproject.org; Mon, 20 Feb 2023 04:11:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pTxWW-0006mc-7U
 for xen-changelog@lists.xenproject.org; Mon, 20 Feb 2023 04:11:32 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=fOkiXXi0LxaGXVsSxyMFJrm/9/EH+7onUVj7i5j/tp8=; b=aVCSfWP9SjSq149mIQVopq1epS
	BLW5Lrwtymt8zvgLW67N2mIRbZu+1XF6ie3QkMWmOstvoYNqqtkpTNSYwZmjsOCNqW8AqoYt7hKf7
	+daESAfFcwFxNChEawlTdIbr0NRnKUDInIeLIn3bqyVg86XL4u055CC4gUk9FVlfGavU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] docs/process: branching-checklist: Add a list of accounts at the beginning
Message-Id: <E1pTxWW-0006mc-7U@xenbits.xenproject.org>
Date: Mon, 20 Feb 2023 04:11:32 +0000

commit 406cea1970535cd7b9d6bcf09bc164ef9bb64bac
Author:     Julien Grall <jgrall@amazon.com>
AuthorDate: Sun Feb 19 18:43:16 2023 +0000
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Sun Feb 19 18:44:02 2023 +0000

    docs/process: branching-checklist: Add a list of accounts at the beginning
    
    The checklist requires to have access to several accounts on both
    xenbits and osstest. List those accounts at the beginning of the file
    so it is easier to check if one has the permissions before starting
    the branching process.
    
    Signed-off-by: Julien Grall <jgrall@amazon.com>
    Reviewed-by: Henry Wang <Henry.Wang@arm.com>
    
    ----
        Changes in v2:
            - Add Henry's reviewed-by
---
 docs/process/branching-checklist.txt | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/docs/process/branching-checklist.txt b/docs/process/branching-checklist.txt
index 6710cc2340..3dfa8ec257 100644
--- a/docs/process/branching-checklist.txt
+++ b/docs/process/branching-checklist.txt
@@ -1,3 +1,11 @@
+=== Before starting ===
+
+Access to the following accounts is necessary:
+    * xenbits.xen.org: xen, xendocs
+    * osstest.osstest-test-lab: osstest
+
+=== Check list ===
+
 v=4.1
 ov=4.0
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Mon Feb 20 16:22:12 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 20 Feb 2023 16:22:12 +0000
Received: from list by lists.xenproject.org with outflank-mailman.498217.769028 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pU8vU-0003iQ-Mo; Mon, 20 Feb 2023 16:22:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 498217.769028; Mon, 20 Feb 2023 16:22: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 1pU8vU-0003iI-Jr; Mon, 20 Feb 2023 16:22:04 +0000
Received: by outflank-mailman (input) for mailman id 498217;
 Mon, 20 Feb 2023 16: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 1pU8vS-0003iC-PQ
 for xen-changelog@lists.xenproject.org; Mon, 20 Feb 2023 16:22:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pU8vS-000506-Nd
 for xen-changelog@lists.xenproject.org; Mon, 20 Feb 2023 16:22:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pU8vS-0006Vp-Mk
 for xen-changelog@lists.xenproject.org; Mon, 20 Feb 2023 16:22:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=m9fuMTA4GxotLh0BeYEYlCEkV6ZLOpZc3sPfp+SnC+0=; b=dkieLonBrezPnlJ6zoh67xRBFP
	n29tsPuQx07/z4atHsuDrdHVjs4Pfkjl1FnKhlNPOAAEceA45L10XAbWJFKgwPPJaSBuTKErBpR27
	mrM/ZTmwVRWfljWU1IhsgPNHvTfzr5yreWVkI9ILm/CaapC2GUcH2EBedHRU/cVtzCcw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [mini-os master] Mini-OS: xenbus: add support for reading node from directory
Message-Id: <E1pU8vS-0006Vp-Mk@xenbits.xenproject.org>
Date: Mon, 20 Feb 2023 16:22:02 +0000

commit 17a0d062c23026f4768c51c793c1ab35f501ad78
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Mon Feb 13 09:44:06 2023 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Mon Feb 20 15:17:35 2023 +0000

    Mini-OS: xenbus: add support for reading node from directory
    
    Especially PV device drivers often need to read multiple Xenstore
    nodes from a common directory. Add support for reading a string or an
    unsigned value by specifying the directory and the node.
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
---
 include/xenbus.h |  6 ++++++
 xenbus.c         | 40 +++++++++++++++++++++++++++++++++++++---
 2 files changed, 43 insertions(+), 3 deletions(-)

diff --git a/include/xenbus.h b/include/xenbus.h
index 3871f35..c0fc0ac 100644
--- a/include/xenbus.h
+++ b/include/xenbus.h
@@ -108,6 +108,12 @@ int xenbus_read_integer(const char *path);
  * read and parsing were successful, 0 if not */
 int xenbus_read_uuid(const char* path, unsigned char uuid[16]);
 
+/* Support functions for reading values from directory/node tuple. */
+char *xenbus_read_string(xenbus_transaction_t xbt, const char *dir,
+                         const char *node, char **value);
+char *xenbus_read_unsigned(xenbus_transaction_t xbt, const char *dir,
+                           const char *node, unsigned int *value);
+
 /* Contraction of snprintf and xenbus_write(path/node). */
 char* xenbus_printf(xenbus_transaction_t xbt,
                                   const char* node, const char* path,
diff --git a/xenbus.c b/xenbus.c
index 81e9b65..923e818 100644
--- a/xenbus.c
+++ b/xenbus.c
@@ -936,16 +936,21 @@ int xenbus_read_uuid(const char *path, unsigned char uuid[16])
     return 1;
 }
 
+#define BUFFER_SIZE 256
+static void xenbus_build_path(const char *dir, const char *node, char *res)
+{
+    BUG_ON(strlen(dir) + strlen(node) + 1 >= BUFFER_SIZE);
+    sprintf(res,"%s/%s", dir, node);
+}
+
 char *xenbus_printf(xenbus_transaction_t xbt, const char* node,
                     const char* path, const char* fmt, ...)
 {
-#define BUFFER_SIZE 256
     char fullpath[BUFFER_SIZE];
     char val[BUFFER_SIZE];
     va_list args;
 
-    BUG_ON(strlen(node) + strlen(path) + 1 >= BUFFER_SIZE);
-    sprintf(fullpath,"%s/%s", node, path);
+    xenbus_build_path(node, path, fullpath);
     va_start(args, fmt);
     vsprintf(val, fmt, args);
     va_end(args);
@@ -964,6 +969,35 @@ domid_t xenbus_get_self_id(void)
     return ret;
 }
 
+char *xenbus_read_string(xenbus_transaction_t xbt, const char *dir,
+                         const char *node, char **value)
+{
+    char path[BUFFER_SIZE];
+
+    xenbus_build_path(dir, node, path);
+
+    return xenbus_read(xbt, path, value);
+}
+
+char *xenbus_read_unsigned(xenbus_transaction_t xbt, const char *dir,
+                           const char *node, unsigned int *value)
+{
+    char path[BUFFER_SIZE];
+    char *msg;
+    char *str;
+
+    xenbus_build_path(dir, node, path);
+    msg = xenbus_read(xbt, path, &str);
+    if ( msg )
+        return msg;
+
+    if ( sscanf(str, "%u", value) != 1 )
+        msg = strdup("EINVAL");
+    free(str);
+
+    return msg;
+}
+
 /*
  * Local variables:
  * mode: C
--
generated by git-patchbot for /home/xen/git/mini-os.git#master


From xen-changelog-bounces@lists.xenproject.org Mon Feb 20 16:22:14 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 20 Feb 2023 16:22:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.498218.769032 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pU8ve-0003kB-Oh; Mon, 20 Feb 2023 16:22:14 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 498218.769032; Mon, 20 Feb 2023 16:22:14 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pU8ve-0003k2-Lc; Mon, 20 Feb 2023 16:22:14 +0000
Received: by outflank-mailman (input) for mailman id 498218;
 Mon, 20 Feb 2023 16: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 1pU8vc-0003jm-TE
 for xen-changelog@lists.xenproject.org; Mon, 20 Feb 2023 16:22:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pU8vc-00050W-SL
 for xen-changelog@lists.xenproject.org; Mon, 20 Feb 2023 16:22:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pU8vc-0006Wh-Pr
 for xen-changelog@lists.xenproject.org; Mon, 20 Feb 2023 16:22:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=wpDErbU9EjfAyOtneTwEjR+mu8xoBY6nc7YJOWbbQZU=; b=werwgRJYSL23CYZfNvnpjMtZF/
	Ej/rU2XtnmdP4L8tC2qTN92BTqkQgv5rqshAtwO6Pq8R3lvgA95Q7H3EJ0p1lm8QxN/qY31LnZbn+
	8XNBgEe4e0HHtuDlhkjGPUxALtMrOMkdKoAjWWj+uVRmIqDRU0UTCAVipzXY2MQzwGF0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [mini-os master] Mini-OS: add concept of mount points
Message-Id: <E1pU8vc-0006Wh-Pr@xenbits.xenproject.org>
Date: Mon, 20 Feb 2023 16:22:12 +0000

commit 15e0ed068007e55aa6bddd80c03ddda1ed758cdb
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Mon Feb 13 09:44:07 2023 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Mon Feb 20 15:17:35 2023 +0000

    Mini-OS: add concept of mount points
    
    Add the concept of mount points to Mini-OS. A mount point is a path
    associated with a device pointer and an open() callback. A mount point
    can be either a file (e.g. "/dev/mem") or a directory ("/var/log").
    
    This allows to replace the special casing in the generic open()
    handling with a generic mount point handling.
    
    Prepare the open() callbacks to support creating new files by adding a
    mode parameter.
    
    Additionally add a close() prototype to include/lib.h, as it is missing
    today.
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
---
 include/lib.h |  9 +++++++
 lib/sys.c     | 80 +++++++++++++++++++++++++++++++++++++++++++++--------------
 2 files changed, 70 insertions(+), 19 deletions(-)

diff --git a/include/lib.h b/include/lib.h
index bec9964..36d94ec 100644
--- a/include/lib.h
+++ b/include/lib.h
@@ -187,6 +187,13 @@ struct file_ops {
     bool (*select_wr)(struct file *file);
 };
 
+struct mount_point {
+    const char *path;
+    int (*open)(struct mount_point *mnt, const char *pathname, int flags,
+                mode_t mode);
+    void *dev;
+};
+
 unsigned int alloc_file_type(const struct file_ops *ops);
 
 off_t lseek_default(struct file *file, off_t offset, int whence);
@@ -198,6 +205,8 @@ int alloc_fd(unsigned int type);
 void close_all_files(void);
 extern struct thread *main_thread;
 void sparse(unsigned long data, size_t size);
+
+int close(int fd);
 #endif
 
 #endif /* _LIB_H_ */
diff --git a/lib/sys.c b/lib/sys.c
index 8f8a3de..2f33c93 100644
--- a/lib/sys.c
+++ b/lib/sys.c
@@ -263,11 +263,6 @@ char *getcwd(char *buf, size_t size)
     return buf;
 }
 
-#define LOG_PATH "/var/log/"
-#define SAVE_PATH "/var/lib/xen"
-#define SAVE_CONSOLE 1
-#define RESTORE_CONSOLE 2
-
 int mkdir(const char *pathname, mode_t mode)
 {
     errno = EIO;
@@ -286,18 +281,30 @@ int posix_openpt(int flags)
     return fd;
 }
 
+static int open_pt(struct mount_point *mnt, const char *pathname, int flags,
+                   mode_t mode)
+{
+    return posix_openpt(flags);
+}
+
 int open_savefile(const char *path, int save)
 {
     int fd;
     char nodename[64];
 
-    snprintf(nodename, sizeof(nodename), "device/console/%d", save ? SAVE_CONSOLE : RESTORE_CONSOLE);
+    snprintf(nodename, sizeof(nodename), "device/console/%d", save ? 1 : 2);
 
     fd = open_consfront(nodename);
     printk("fd(%d) = open_savefile\n", fd);
 
     return fd;
 }
+
+static int open_save(struct mount_point *mnt, const char *pathname, int flags,
+                     mode_t mode)
+{
+    return open_savefile(pathname, flags & O_WRONLY);
+}
 #else
 int posix_openpt(int flags)
 {
@@ -311,24 +318,59 @@ int open_savefile(const char *path, int save)
 }
 #endif
 
-int open(const char *pathname, int flags, ...)
+static int open_log(struct mount_point *mnt, const char *pathname, int flags,
+                    mode_t mode)
 {
     int fd;
+
     /* Ugly, but fine.  */
-    if (!strncmp(pathname,LOG_PATH,strlen(LOG_PATH))) {
-	fd = alloc_fd(FTYPE_CONSOLE);
-        printk("open(%s) -> %d\n", pathname, fd);
-        return fd;
+    fd = alloc_fd(FTYPE_CONSOLE);
+    printk("open(%s%s) -> %d\n", mnt->path, pathname, fd);
+    return fd;
+}
+
+static int open_mem(struct mount_point *mnt, const char *pathname, int flags,
+                    mode_t mode)
+{
+    int fd;
+
+    fd = alloc_fd(FTYPE_MEM);
+    printk("open(%s%s) -> %d\n", mnt->path, pathname, fd);
+    return fd;
+}
+
+static struct mount_point mount_points[] = {
+    { .path = "/var/log",     .open = open_log,  .dev = NULL },
+    { .path = "/dev/mem",     .open = open_mem,  .dev = NULL },
+#ifdef CONFIG_CONSFRONT
+    { .path = "/dev/ptmx",    .open = open_pt,   .dev = NULL },
+    { .path = "/var/lib/xen", .open = open_save, .dev = NULL },
+#endif
+};
+
+int open(const char *pathname, int flags, ...)
+{
+    unsigned int m, mlen;
+    struct mount_point *mnt;
+    mode_t mode = 0;
+    va_list ap;
+
+    if ( flags & O_CREAT )
+    {
+        va_start(ap, flags);
+        mode = va_arg(ap, mode_t);
+        va_end(ap);
     }
-    if (!strncmp(pathname, "/dev/mem", strlen("/dev/mem"))) {
-        fd = alloc_fd(FTYPE_MEM);
-        printk("open(/dev/mem) -> %d\n", fd);
-        return fd;
+
+    for ( m = 0; m < ARRAY_SIZE(mount_points); m++ )
+    {
+        mnt = mount_points + m;
+        mlen = strlen(mnt->path);
+        if ( !strncmp(pathname, mnt->path, mlen) &&
+             (pathname[mlen] == '/' || pathname[mlen] == 0) )
+            return mnt->open(mnt, pathname + mlen, flags, mode);
     }
-    if (!strncmp(pathname, "/dev/ptmx", strlen("/dev/ptmx")))
-        return posix_openpt(flags);
-    if (!strncmp(pathname,SAVE_PATH,strlen(SAVE_PATH)))
-        return open_savefile(pathname, flags & O_WRONLY);
+
     errno = EIO;
     return -1;
 }
--
generated by git-patchbot for /home/xen/git/mini-os.git#master


From xen-changelog-bounces@lists.xenproject.org Mon Feb 20 16:22:24 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 20 Feb 2023 16:22:24 +0000
Received: from list by lists.xenproject.org with outflank-mailman.498219.769036 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pU8vo-0003nI-Pz; Mon, 20 Feb 2023 16:22:24 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 498219.769036; Mon, 20 Feb 2023 16:22: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 1pU8vo-0003nA-N8; Mon, 20 Feb 2023 16:22:24 +0000
Received: by outflank-mailman (input) for mailman id 498219;
 Mon, 20 Feb 2023 16:22:23 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pU8vn-0003mp-09
 for xen-changelog@lists.xenproject.org; Mon, 20 Feb 2023 16:22:23 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pU8vm-000511-Vb
 for xen-changelog@lists.xenproject.org; Mon, 20 Feb 2023 16:22:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pU8vm-0006XX-UX
 for xen-changelog@lists.xenproject.org; Mon, 20 Feb 2023 16:22:22 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=mBcJudeDaEvV4qGX27I2va4VSMSQHWZtiHRjYFN3vcQ=; b=uNv1cBN+5h7s65ZOR5S9bQXrRh
	f8fcgWqEoTPiWipN/EyX1U9R+DfhNZrTq+yHQ3VPIx8TkdN50EHukkOOe9HkZjXBGnIFfpvVwveT6
	skZ4DCCjXTxxZPyZ8dZ3spZyGmP05++X+wNXuEZfIVTSNFu9wKXP62wG14ycT+xqa1o4=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [mini-os master] Mini-OS: add support for runtime mounts
Message-Id: <E1pU8vm-0006XX-UX@xenbits.xenproject.org>
Date: Mon, 20 Feb 2023 16:22:22 +0000

commit cb9df0df37815851a2c25b3b60d14140397d88f1
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Mon Feb 13 09:44:08 2023 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Mon Feb 20 15:17:35 2023 +0000

    Mini-OS: add support for runtime mounts
    
    Add the support to mount a device at runtime. The number of dynamic
    mounts is limited by a #define.
    
    For devices supporting multiple files struct file is modified to hold
    a pointer to file specific data in contrast to device specific data.
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
---
 include/lib.h |  5 +++++
 lib/sys.c     | 45 ++++++++++++++++++++++++++++++++++++++++++++-
 2 files changed, 49 insertions(+), 1 deletion(-)

diff --git a/include/lib.h b/include/lib.h
index 36d94ec..fd8c36d 100644
--- a/include/lib.h
+++ b/include/lib.h
@@ -172,6 +172,7 @@ struct file {
     union {
         int fd; /* Any fd from an upper layer. */
         void *dev;
+        void *filedata;
     };
 };
 
@@ -194,6 +195,10 @@ struct mount_point {
     void *dev;
 };
 
+int mount(const char *path, void *dev,
+          int (*open)(struct mount_point *, const char *, int, mode_t));
+void umount(const char *path);
+
 unsigned int alloc_file_type(const struct file_ops *ops);
 
 off_t lseek_default(struct file *file, off_t offset, int whence);
diff --git a/lib/sys.c b/lib/sys.c
index 2f33c93..118fc44 100644
--- a/lib/sys.c
+++ b/lib/sys.c
@@ -85,6 +85,8 @@
     }
 
 #define NOFILE 32
+#define N_MOUNTS  16
+
 extern void minios_evtchn_close_fd(int fd);
 extern void minios_gnttab_close_fd(int fd);
 
@@ -339,7 +341,7 @@ static int open_mem(struct mount_point *mnt, const char *pathname, int flags,
     return fd;
 }
 
-static struct mount_point mount_points[] = {
+static struct mount_point mount_points[N_MOUNTS] = {
     { .path = "/var/log",     .open = open_log,  .dev = NULL },
     { .path = "/dev/mem",     .open = open_mem,  .dev = NULL },
 #ifdef CONFIG_CONSFRONT
@@ -365,6 +367,8 @@ int open(const char *pathname, int flags, ...)
     for ( m = 0; m < ARRAY_SIZE(mount_points); m++ )
     {
         mnt = mount_points + m;
+        if ( !mnt->path )
+            continue;
         mlen = strlen(mnt->path);
         if ( !strncmp(pathname, mnt->path, mlen) &&
              (pathname[mlen] == '/' || pathname[mlen] == 0) )
@@ -375,6 +379,45 @@ int open(const char *pathname, int flags, ...)
     return -1;
 }
 
+int mount(const char *path, void *dev,
+          int (*open)(struct mount_point *, const char *, int, mode_t))
+{
+    unsigned int m;
+    struct mount_point *mnt;
+
+    for ( m = 0; m < ARRAY_SIZE(mount_points); m++ )
+    {
+        mnt = mount_points + m;
+        if ( !mnt->path )
+        {
+            mnt->path = strdup(path);
+            mnt->open = open;
+            mnt->dev = dev;
+            return 0;
+        }
+    }
+
+    errno = ENOSPC;
+    return -1;
+}
+
+void umount(const char *path)
+{
+    unsigned int m;
+    struct mount_point *mnt;
+
+    for ( m = 0; m < ARRAY_SIZE(mount_points); m++ )
+    {
+        mnt = mount_points + m;
+        if ( mnt->path && !strcmp(mnt->path, path) )
+        {
+            free((char *)mnt->path);
+            mnt->path = NULL;
+            return;
+        }
+    }
+}
+
 int isatty(int fd)
 {
     return files[fd].type == FTYPE_CONSOLE;
--
generated by git-patchbot for /home/xen/git/mini-os.git#master


From xen-changelog-bounces@lists.xenproject.org Mon Feb 20 16:22:34 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 20 Feb 2023 16:22:34 +0000
Received: from list by lists.xenproject.org with outflank-mailman.498220.769039 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pU8vy-0003qU-RT; Mon, 20 Feb 2023 16:22:34 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 498220.769039; Mon, 20 Feb 2023 16:22:34 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pU8vy-0003qN-Oq; Mon, 20 Feb 2023 16:22:34 +0000
Received: by outflank-mailman (input) for mailman id 498220;
 Mon, 20 Feb 2023 16:22:33 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pU8vx-0003qA-34
 for xen-changelog@lists.xenproject.org; Mon, 20 Feb 2023 16:22:33 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pU8vx-00051H-2H
 for xen-changelog@lists.xenproject.org; Mon, 20 Feb 2023 16:22:33 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pU8vx-0006YW-1R
 for xen-changelog@lists.xenproject.org; Mon, 20 Feb 2023 16:22:33 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=X39pSLIoVosWDyO61Z1tS4t/WJm+AQ6dE+YzdRwe104=; b=MsoEI+fkJ1HyYIIAAPXXpsNPRJ
	6USR1oMY8T5F+Xn7cjAFkkrpiIAzpnnJ2vAQBYGPmNoVw4c+nqtN2ikUCW1vNPgJP0ArOJNKxnuR2
	yLf5I+gGgkYc8kqMhdh03yc6WdkP0l7UrBlHPycTH/O2HcgAATJxCXe4SFX9ePMv3d+I=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [mini-os master] Mini-OS: add 9pfs frontend
Message-Id: <E1pU8vx-0006YW-1R@xenbits.xenproject.org>
Date: Mon, 20 Feb 2023 16:22:33 +0000

commit 82ac70d7c35264028f19faa0c9207c48ede6bcb1
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Mon Feb 13 09:44:09 2023 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Mon Feb 20 15:17:35 2023 +0000

    Mini-OS: add 9pfs frontend
    
    Add a frontend for the 9pfs PV device. For now add only the code needed
    to connect to the backend and the related disconnect functionality. The
    9pfs protocol support will be added later.
    
    Due to its nature (ability to access files) the whole code is guarded
    by "#ifdef HAVE_LIBC".
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
---
 9pfront.c                     | 286 ++++++++++++++++++++++++++++++++++++++++++
 Config.mk                     |   1 +
 Makefile                      |   1 +
 arch/x86/testbuild/all-no     |   1 +
 arch/x86/testbuild/all-yes    |   1 +
 arch/x86/testbuild/newxen-yes |   1 +
 include/9pfront.h             |   7 ++
 7 files changed, 298 insertions(+)

diff --git a/9pfront.c b/9pfront.c
new file mode 100644
index 0000000..89ecb3a
--- /dev/null
+++ b/9pfront.c
@@ -0,0 +1,286 @@
+/*
+ * Minimal 9pfs PV frontend for Mini-OS.
+ * Copyright (c) 2023 Juergen Gross, SUSE Software Solution GmbH
+ */
+
+#include <mini-os/os.h>
+#include <mini-os/lib.h>
+#include <mini-os/events.h>
+#include <mini-os/gnttab.h>
+#include <mini-os/xenbus.h>
+#include <mini-os/xmalloc.h>
+#include <errno.h>
+#include <xen/io/9pfs.h>
+#include <mini-os/9pfront.h>
+
+#ifdef HAVE_LIBC
+struct dev_9pfs {
+    int id;
+    char nodename[20];
+    unsigned int dom;
+    char *backend;
+
+    char *tag;
+    const char *mnt;
+
+    struct xen_9pfs_data_intf *intf;
+    struct xen_9pfs_data data;
+    RING_IDX prod_pvt_out;
+    RING_IDX cons_pvt_in;
+
+    grant_ref_t ring_ref;
+    evtchn_port_t evtchn;
+    unsigned int ring_order;
+    xenbus_event_queue events;
+};
+
+#define DEFAULT_9PFS_RING_ORDER  4
+
+static unsigned int ftype_9pfs;
+
+static void intr_9pfs(evtchn_port_t port, struct pt_regs *regs, void *data)
+{
+}
+
+static int open_9pfs(struct mount_point *mnt, const char *pathname, int flags,
+                     mode_t mode)
+{
+    errno = ENOSYS;
+
+    return -1;
+}
+
+static void free_9pfront(struct dev_9pfs *dev)
+{
+    unsigned int i;
+
+    if ( dev->data.in && dev->intf )
+    {
+        for ( i = 0; i < (1 << dev->ring_order); i++ )
+            gnttab_end_access(dev->intf->ref[i]);
+        free_pages(dev->data.in, dev->ring_order);
+    }
+    unbind_evtchn(dev->evtchn);
+    gnttab_end_access(dev->ring_ref);
+    free_page(dev->intf);
+    free(dev->backend);
+    free(dev->tag);
+    free(dev);
+}
+
+void *init_9pfront(unsigned int id, const char *mnt)
+{
+    struct dev_9pfs *dev;
+    char *msg;
+    char *reason = "";
+    xenbus_transaction_t xbt;
+    int retry = 1;
+    char bepath[64] = { 0 };
+    XenbusState state;
+    unsigned int i;
+    void *addr;
+    char *version;
+    char *v;
+
+    printk("9pfsfront add %u, for mount at %s\n", id, mnt);
+    dev = malloc(sizeof(*dev));
+    memset(dev, 0, sizeof(*dev));
+    snprintf(dev->nodename, sizeof(dev->nodename), "device/9pfs/%u", id);
+    dev->id = id;
+
+    msg = xenbus_read_unsigned(XBT_NIL, dev->nodename, "backend-id", &dev->dom);
+    if ( msg )
+        goto err;
+    msg = xenbus_read_string(XBT_NIL, dev->nodename, "backend", &dev->backend);
+    if ( msg )
+        goto err;
+    msg = xenbus_read_string(XBT_NIL, dev->nodename, "tag", &dev->tag);
+    if ( msg )
+        goto err;
+
+    snprintf(bepath, sizeof(bepath), "%s/state", dev->backend);
+    free(xenbus_watch_path_token(XBT_NIL, bepath, bepath, &dev->events));
+    state = xenbus_read_integer(bepath);
+    while ( msg == NULL && state < XenbusStateInitWait )
+        msg = xenbus_wait_for_state_change(bepath, &state, &dev->events);
+    if ( msg || state != XenbusStateInitWait )
+    {
+        reason = "illegal backend state";
+        goto err;
+    }
+
+    msg = xenbus_read_unsigned(XBT_NIL, dev->backend, "max-ring-page-order",
+                               &dev->ring_order);
+    if ( msg )
+        goto err;
+    if ( dev->ring_order > DEFAULT_9PFS_RING_ORDER )
+        dev->ring_order = DEFAULT_9PFS_RING_ORDER;
+
+    msg = xenbus_read_string(XBT_NIL, dev->backend, "versions", &version);
+    if ( msg )
+        goto err;
+    for ( v = version; *v; v++ )
+    {
+        if ( strtoul(v, &v, 10) == 1 && (*v == ',' || *v == 0) )
+        {
+            v = NULL;
+            break;
+        }
+        if ( *v != ',' && *v != 0 )
+        {
+            reason = "backend published illegal version string";
+            free(version);
+            goto err;
+        }
+    }
+    free(version);
+    if ( v )
+    {
+        reason = "backend doesn't support version 1";
+        goto err;
+    }
+
+    dev->ring_ref = gnttab_alloc_and_grant((void **)&dev->intf);
+    memset(dev->intf, 0, PAGE_SIZE);
+    if ( evtchn_alloc_unbound(dev->dom, intr_9pfs, dev, &dev->evtchn) )
+    {
+        reason = "no event channel";
+        goto err;
+    }
+    dev->intf->ring_order = dev->ring_order;
+    dev->data.in = (void *)alloc_pages(dev->ring_order);
+    dev->data.out = dev->data.in + XEN_FLEX_RING_SIZE(dev->ring_order);
+    for ( i = 0; i < (1 << dev->ring_order); i++ )
+    {
+        addr = dev->data.in + i * PAGE_SIZE;
+        dev->intf->ref[i] = gnttab_grant_access(dev->dom, virt_to_mfn(addr), 0);
+    }
+
+    while ( retry )
+    {
+        msg = xenbus_transaction_start(&xbt);
+        if ( msg )
+        {
+            free(msg);
+            msg = NULL;
+            reason = "starting transaction";
+            goto err;
+        }
+
+        msg = xenbus_printf(xbt, dev->nodename, "version", "%u", 1);
+        if ( msg )
+            goto err_tr;
+        msg = xenbus_printf(xbt, dev->nodename, "num-rings", "%u", 1);
+        if ( msg )
+            goto err_tr;
+        msg = xenbus_printf(xbt, dev->nodename, "ring-ref0", "%u",
+                            dev->ring_ref);
+        if ( msg )
+            goto err_tr;
+        msg = xenbus_printf(xbt, dev->nodename, "event-channel-0", "%u",
+                            dev->evtchn);
+        if ( msg )
+            goto err_tr;
+        msg = xenbus_printf(xbt, dev->nodename, "state", "%u",
+                            XenbusStateInitialised);
+        if ( msg )
+            goto err_tr;
+
+        free(xenbus_transaction_end(xbt, 0, &retry));
+    }
+
+    state = xenbus_read_integer(bepath);
+    while ( msg == NULL && state < XenbusStateConnected )
+        msg = xenbus_wait_for_state_change(bepath, &state, &dev->events);
+    if ( msg || state != XenbusStateConnected )
+    {
+        reason = "illegal backend state";
+        goto err;
+    }
+
+    msg = xenbus_printf(XBT_NIL, dev->nodename, "state", "%u",
+                        XenbusStateConnected);
+    if ( msg )
+        goto err;
+
+    unmask_evtchn(dev->evtchn);
+
+    dev->mnt = mnt;
+    if ( mount(dev->mnt, dev, open_9pfs) )
+    {
+        reason = "mount failed";
+        goto err;
+    }
+
+    return dev;
+
+ err_tr:
+    free(xenbus_transaction_end(xbt, 1, &retry));
+
+ err:
+    if ( bepath[0] )
+        free(xenbus_unwatch_path_token(XBT_NIL, bepath, bepath));
+    if ( msg )
+        printk("9pfsfront add %u failed, error %s accessing Xenstore\n",
+               id, msg);
+    else
+        printk("9pfsfront add %u failed, %s\n", id, reason);
+    free_9pfront(dev);
+    free(msg);
+    return NULL;
+}
+
+void shutdown_9pfront(void *dev)
+{
+    struct dev_9pfs *dev9p = dev;
+    char bepath[64];
+    XenbusState state;
+    char *msg;
+    char *reason = "";
+
+    umount(dev9p->mnt);
+    snprintf(bepath, sizeof(bepath), "%s/state", dev9p->backend);
+
+    msg = xenbus_printf(XBT_NIL, dev9p->nodename, "state", "%u",
+                        XenbusStateClosing);
+    if ( msg )
+        goto err;
+
+    state = xenbus_read_integer(bepath);
+    while ( msg == NULL && state < XenbusStateClosing)
+        msg = xenbus_wait_for_state_change(bepath, &state, &dev9p->events);
+    if ( msg || state != XenbusStateClosing )
+    {
+        reason = "illegal backend state";
+        goto err;
+    }
+
+    msg = xenbus_printf(XBT_NIL, dev9p->nodename, "state", "%u",
+                        XenbusStateClosed);
+    if ( msg )
+        goto err;
+
+    free_9pfront(dev9p);
+
+    return;
+
+ err:
+    if ( msg )
+        printk("9pfsfront shutdown %u failed, error %s accessing Xenstore\n",
+               dev9p->id, msg);
+    else
+        printk("9pfsfront shutdown %u failed, %s\n", dev9p->id, reason);
+    free(msg);
+}
+
+static const struct file_ops ops_9pfs = {
+    .name = "9pfs",
+};
+
+__attribute__((constructor))
+static void initialize_9pfs(void)
+{
+    ftype_9pfs = alloc_file_type(&ops_9pfs);
+}
+
+#endif /* HAVE_LIBC */
diff --git a/Config.mk b/Config.mk
index 1a24b30..677e93d 100644
--- a/Config.mk
+++ b/Config.mk
@@ -187,6 +187,7 @@ CONFIG-n += CONFIG_QEMU_XS_ARGS
 CONFIG-n += CONFIG_TEST
 CONFIG-n += CONFIG_PCIFRONT
 CONFIG-n += CONFIG_TPMFRONT
+CONFIG-n += CONFIG_9PFRONT
 CONFIG-n += CONFIG_TPM_TIS
 CONFIG-n += CONFIG_TPMBACK
 CONFIG-n += CONFIG_BALLOON
diff --git a/Makefile b/Makefile
index 747c7c0..7ee181a 100644
--- a/Makefile
+++ b/Makefile
@@ -39,6 +39,7 @@ SUBDIRS := lib
 src-$(CONFIG_BLKFRONT) += blkfront.c
 src-$(CONFIG_CONSFRONT) += consfront.c
 src-$(CONFIG_TPMFRONT) += tpmfront.c
+src-$(CONFIG_9PFRONT) += 9pfront.c
 src-$(CONFIG_TPM_TIS) += tpm_tis.c
 src-$(CONFIG_TPMBACK) += tpmback.c
 src-y += console.c
diff --git a/arch/x86/testbuild/all-no b/arch/x86/testbuild/all-no
index f79a101..5b3e99e 100644
--- a/arch/x86/testbuild/all-no
+++ b/arch/x86/testbuild/all-no
@@ -12,6 +12,7 @@ CONFIG_NETFRONT = n
 CONFIG_FBFRONT = n
 CONFIG_KBDFRONT = n
 CONFIG_CONSFRONT = n
+CONFIG_9PFRONT = n
 CONFIG_XENBUS = n
 CONFIG_LIBXS = n
 CONFIG_LWIP = n
diff --git a/arch/x86/testbuild/all-yes b/arch/x86/testbuild/all-yes
index faa3af3..8ae489a 100644
--- a/arch/x86/testbuild/all-yes
+++ b/arch/x86/testbuild/all-yes
@@ -12,6 +12,7 @@ CONFIG_NETFRONT = y
 CONFIG_FBFRONT = y
 CONFIG_KBDFRONT = y
 CONFIG_CONSFRONT = y
+CONFIG_9PFRONT = y
 CONFIG_XENBUS = y
 CONFIG_LIBXS = y
 CONFIG_BALLOON = y
diff --git a/arch/x86/testbuild/newxen-yes b/arch/x86/testbuild/newxen-yes
index dc83e67..ee27a32 100644
--- a/arch/x86/testbuild/newxen-yes
+++ b/arch/x86/testbuild/newxen-yes
@@ -12,6 +12,7 @@ CONFIG_NETFRONT = y
 CONFIG_FBFRONT = y
 CONFIG_KBDFRONT = y
 CONFIG_CONSFRONT = y
+CONFIG_9PFRONT = y
 CONFIG_XENBUS = y
 CONFIG_LIBXS = y
 CONFIG_BALLOON = y
diff --git a/include/9pfront.h b/include/9pfront.h
new file mode 100644
index 0000000..722ec56
--- /dev/null
+++ b/include/9pfront.h
@@ -0,0 +1,7 @@
+#ifndef __9PFRONT_H__
+#define __9PFRONT_H__
+
+void *init_9pfront(unsigned int id, const char *mnt);
+void shutdown_9pfront(void *dev);
+
+#endif /* __9PFRONT_H__ */
--
generated by git-patchbot for /home/xen/git/mini-os.git#master


From xen-changelog-bounces@lists.xenproject.org Mon Feb 20 16:22:44 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 20 Feb 2023 16:22:44 +0000
Received: from list by lists.xenproject.org with outflank-mailman.498221.769044 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pU8w7-0003u5-VY; Mon, 20 Feb 2023 16:22:43 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 498221.769044; Mon, 20 Feb 2023 16:22:43 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pU8w7-0003tw-SD; Mon, 20 Feb 2023 16:22:43 +0000
Received: by outflank-mailman (input) for mailman id 498221;
 Mon, 20 Feb 2023 16:22:43 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pU8w7-0003tM-67
 for xen-changelog@lists.xenproject.org; Mon, 20 Feb 2023 16:22:43 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pU8w7-00051X-5H
 for xen-changelog@lists.xenproject.org; Mon, 20 Feb 2023 16:22:43 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pU8w7-0006Z6-4Q
 for xen-changelog@lists.xenproject.org; Mon, 20 Feb 2023 16:22:43 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Ke+0y9uBPhRjqsLxSR7ffLAQ1WaDrpW5hp7U8FS5fAQ=; b=sAUmFtxvA2/W1GrpzXVStaS7mN
	UTYYA3XIG6U6oRSW4bqn5/WUiWfG2pAtnFlnRKhaTlj4mmcvxU2lcStE7m/4/TnFyU8BCcXefoR0M
	pSA7hKRTirvey2NogTGv0CJM3ymRccZBt9KUt9mTLhomImydLx83lzrao9fy/14oI38o=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [mini-os master] Mini-OS: add 9pfs transport layer
Message-Id: <E1pU8w7-0006Z6-4Q@xenbits.xenproject.org>
Date: Mon, 20 Feb 2023 16:22:43 +0000

commit 0924fec1de588e7b6620d8f0be3aa0e2324c7bd6
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Mon Feb 13 09:44:10 2023 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Mon Feb 20 15:17:35 2023 +0000

    Mini-OS: add 9pfs transport layer
    
    Add the transport layer of 9pfs. This is basically the infrastructure
    to send requests to the backend and to receive the related answers via
    the rings.
    
    As a first example add the version and attach requests of the 9pfs
    protocol when mounting a new 9pfs device. For the version use the
    "9P2000.u" variant, as it is the smallest subset supported by the qemu
    based backend.
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
---
 9pfront.c | 478 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 478 insertions(+)

diff --git a/9pfront.c b/9pfront.c
index 89ecb3a..0b8d546 100644
--- a/9pfront.c
+++ b/9pfront.c
@@ -7,6 +7,8 @@
 #include <mini-os/lib.h>
 #include <mini-os/events.h>
 #include <mini-os/gnttab.h>
+#include <mini-os/semaphore.h>
+#include <mini-os/wait.h>
 #include <mini-os/xenbus.h>
 #include <mini-os/xmalloc.h>
 #include <errno.h>
@@ -14,6 +16,9 @@
 #include <mini-os/9pfront.h>
 
 #ifdef HAVE_LIBC
+
+#define N_REQS   64
+
 struct dev_9pfs {
     int id;
     char nodename[20];
@@ -22,6 +27,7 @@ struct dev_9pfs {
 
     char *tag;
     const char *mnt;
+    unsigned int msize_max;
 
     struct xen_9pfs_data_intf *intf;
     struct xen_9pfs_data data;
@@ -32,14 +38,470 @@ struct dev_9pfs {
     evtchn_port_t evtchn;
     unsigned int ring_order;
     xenbus_event_queue events;
+
+    unsigned int free_reqs;
+    struct req {
+        unsigned int id;
+        unsigned int next_free;     /* N_REQS == end of list. */
+        unsigned int cmd;
+        int result;
+        bool inflight;
+        unsigned char *data;        /* Returned data. */
+    } req[N_REQS];
+
+    struct wait_queue_head waitq;
+    struct semaphore ring_out_sem;
+    struct semaphore ring_in_sem;
 };
 
 #define DEFAULT_9PFS_RING_ORDER  4
 
+#define P9_CMD_VERSION    100
+#define P9_CMD_ATTACH     104
+#define P9_CMD_ERROR      107
+
+#define P9_QID_SIZE    13
+
+struct p9_header {
+    uint32_t size;
+    uint8_t cmd;
+    uint16_t tag;
+} __attribute__((packed));
+
+#define P9_VERSION        "9P2000.u"
+#define P9_ROOT_FID       ~0
+
 static unsigned int ftype_9pfs;
 
+static struct req *get_free_req(struct dev_9pfs *dev)
+{
+    struct req *req;
+
+    if ( dev->free_reqs == N_REQS )
+        return NULL;
+
+    req = dev->req + dev->free_reqs;
+    dev->free_reqs = req->next_free;
+
+    return req;
+}
+
+static void put_free_req(struct dev_9pfs *dev, struct req *req)
+{
+    req->next_free = dev->free_reqs;
+    req->inflight = false;
+    req->data = NULL;
+    dev->free_reqs = req->id;
+}
+
+static unsigned int ring_out_free(struct dev_9pfs *dev)
+{
+    RING_IDX ring_size = XEN_FLEX_RING_SIZE(dev->ring_order);
+    unsigned int queued;
+
+    queued = xen_9pfs_queued(dev->prod_pvt_out, dev->intf->out_cons, ring_size);
+    rmb();
+
+    return ring_size - queued;
+}
+
+static unsigned int ring_in_data(struct dev_9pfs *dev)
+{
+    RING_IDX ring_size = XEN_FLEX_RING_SIZE(dev->ring_order);
+    unsigned int queued;
+
+    queued = xen_9pfs_queued(dev->intf->in_prod, dev->cons_pvt_in, ring_size);
+    rmb();
+
+    return queued;
+}
+
+static void copy_to_ring(struct dev_9pfs *dev, void *data, unsigned int len)
+{
+    RING_IDX ring_size = XEN_FLEX_RING_SIZE(dev->ring_order);
+    RING_IDX prod = xen_9pfs_mask(dev->prod_pvt_out, ring_size);
+    RING_IDX cons = xen_9pfs_mask(dev->intf->out_cons, ring_size);
+
+    xen_9pfs_write_packet(dev->data.out, data, len, &prod, cons, ring_size);
+    dev->prod_pvt_out += len;
+}
+
+static void copy_from_ring(struct dev_9pfs *dev, void *data, unsigned int len)
+{
+    RING_IDX ring_size = XEN_FLEX_RING_SIZE(dev->ring_order);
+    RING_IDX prod = xen_9pfs_mask(dev->intf->in_prod, ring_size);
+    RING_IDX cons = xen_9pfs_mask(dev->cons_pvt_in, ring_size);
+
+    xen_9pfs_read_packet(data, dev->data.in, len, prod, &cons, ring_size);
+    dev->cons_pvt_in += len;
+}
+
+/*
+ * send_9p() and rcv_9p() are using a special format string for specifying
+ * the kind of data sent/expected. Each data item is represented by a single
+ * character:
+ * U: 4 byte unsigned integer (uint32_t)
+ * S: String (2 byte length + <length> characters)
+ *    in the rcv_9p() case the data for string is allocated (length omitted,
+ *    string terminated by a NUL character)
+ * Q: A 13 byte "qid", consisting of 1 byte file type, 4 byte file version
+ *    and 8 bytes unique file id. Only valid for receiving.
+ */
+static void send_9p(struct dev_9pfs *dev, struct req *req, const char *fmt, ...)
+{
+    struct p9_header hdr;
+    va_list ap, aq;
+    const char *f;
+    uint32_t intval;
+    uint16_t len;
+    char *strval;
+
+    hdr.size = sizeof(hdr);
+    hdr.cmd = req->cmd;
+    hdr.tag = req->id;
+
+    va_start(ap, fmt);
+
+    va_copy(aq, ap);
+    for ( f = fmt; *f; f++ )
+    {
+        switch ( *f )
+        {
+        case 'U':
+            hdr.size += 4;
+            intval = va_arg(aq, unsigned int);
+            break;
+        case 'S':
+            hdr.size += 2;
+            strval = va_arg(aq, char *);
+            hdr.size += strlen(strval);
+            break;
+        default:
+            printk("send_9p: unknown format character %c\n", *f);
+            break;
+        }
+    }
+    va_end(aq);
+
+    /*
+     * Waiting for free space must be done in the critical section!
+     * Otherwise we might get overtaken by other short requests.
+     */
+    down(&dev->ring_out_sem);
+
+    wait_event(dev->waitq, ring_out_free(dev) >= hdr.size);
+
+    copy_to_ring(dev, &hdr, sizeof(hdr));
+    for ( f = fmt; *f; f++ )
+    {
+        switch ( *f )
+        {
+        case 'U':
+            intval = va_arg(ap, unsigned int);
+            copy_to_ring(dev, &intval, sizeof(intval));
+            break;
+        case 'S':
+            strval = va_arg(ap, char *);
+            len = strlen(strval);
+            copy_to_ring(dev, &len, sizeof(len));
+            copy_to_ring(dev, strval, len);
+            break;
+        }
+    }
+
+    wmb();   /* Data on ring must be seen before updating index. */
+    dev->intf->out_prod = dev->prod_pvt_out;
+    req->inflight = true;
+
+    up(&dev->ring_out_sem);
+
+    va_end(ap);
+
+    notify_remote_via_evtchn(dev->evtchn);
+}
+
+/*
+ * Using an opportunistic approach for receiving data: in case multiple
+ * requests are outstanding (which is very unlikely), we nevertheless need
+ * to consume all data available until we reach the desired request.
+ * For requests other than the one we are waiting for, we link the complete
+ * data to the request via an intermediate buffer. For our own request we can
+ * omit that buffer and directly fill the caller provided variables.
+ *
+ * Helper functions:
+ *
+ * copy_bufs(): copy raw data into a target buffer. There can be 2 source
+ *   buffers involved (in case the copy is done from the ring and it is across
+ *   the ring end). The buffer pointers and lengths are updated according to
+ *   the number of bytes copied.
+ *
+ * rcv_9p_copy(): copy the data (without the generic header) of a 9p response
+ *   to the specified variables using the specified format string for
+ *   deciphering the single item types. The decision whether to copy from the
+ *   ring or an allocated buffer is done via the "hdr" parameter, which is
+ *   NULL in the buffer case (in that case the header is located at the start
+ *   of the buffer).
+ *
+ * rcv_9p_one(): Checks for an already filled buffer with the correct tag in
+ *   it. If none is found, consumes one response. It checks the tag of the
+ *   response in order to decide whether to allocate a buffer for putting the
+ *   data into, or to fill the user supplied variables. Return true, if the
+ *   tag did match. Waits if no data is ready to be consumed.
+ */
+static void copy_bufs(unsigned char **buf1, unsigned char **buf2,
+                      unsigned int *len1, unsigned int *len2,
+                      void *target, unsigned int len)
+{
+    if ( len <= *len1 )
+    {
+        memcpy(target, *buf1, len);
+        *buf1 += len;
+        *len1 -= len;
+    }
+    else
+    {
+        memcpy(target, *buf1, *len1);
+        target = (char *)target + *len1;
+        len -= *len1;
+        *buf1 = *buf2;
+        *len1 = *len2;
+        *buf2 = NULL;
+        *len2 = 0;
+        if ( len > *len1 )
+        {
+            printk("9pfs: short copy (dropping %u bytes)\n", len - *len1);
+            len = *len1;
+        }
+        memcpy(target, *buf1, *len1);
+    }
+}
+
+static void rcv_9p_copy(struct dev_9pfs *dev, struct req *req,
+                        struct p9_header *hdr, const char *fmt, va_list ap)
+{
+    struct p9_header *h = hdr ? hdr : (void *)req->data;
+    RING_IDX cons = dev->cons_pvt_in + h->size - sizeof(*h);
+    RING_IDX ring_size = XEN_FLEX_RING_SIZE(dev->ring_order);
+    unsigned char *buf1, *buf2;
+    unsigned int len1, len2;
+    const char *f;
+    char *str;
+    uint16_t len;
+    uint32_t err;
+    uint32_t *val;
+    char **strval;
+    uint8_t *qval;
+
+    if ( hdr )
+    {
+        buf1 = xen_9pfs_get_ring_ptr(dev->data.in, dev->cons_pvt_in, ring_size);
+        buf2 = xen_9pfs_get_ring_ptr(dev->data.in, 0,  ring_size);
+        len1 = ring_size - xen_9pfs_mask(dev->cons_pvt_in, ring_size);
+        if ( len1 > h->size - sizeof(*h) )
+            len1 = h->size - sizeof(*h);
+        len2 = h->size - sizeof(*h) - len1;
+    }
+    else
+    {
+        buf1 = req->data + sizeof(*h);
+        buf2 = NULL;
+        len1 = h->size - sizeof(*h);
+        len2 = 0;
+    }
+
+    if ( h->cmd == P9_CMD_ERROR )
+    {
+        copy_bufs(&buf1, &buf2, &len1, &len2, &len, sizeof(len));
+        str = malloc(len + 1);
+        copy_bufs(&buf1, &buf2, &len1, &len2, str, len);
+        str[len] = 0;
+        printk("9pfs: request %u resulted in \"%s\"\n", req->cmd, str);
+        free(str);
+        err = EIO;
+        copy_bufs(&buf1, &buf2, &len1, &len2, &err, sizeof(err));
+        req->result = err;
+
+        if ( hdr )
+            dev->cons_pvt_in = cons;
+
+        return;
+    }
+
+    if ( h->cmd != req->cmd + 1 )
+    {
+        req->result = EDOM;
+        printk("9pfs: illegal response: wrong return type (%u instead of %u)\n",
+               h->cmd, req->cmd + 1);
+
+        if ( hdr )
+            dev->cons_pvt_in = cons;
+
+        return;
+    }
+
+    req->result = 0;
+
+    for ( f = fmt; *f; f++ )
+    {
+        switch ( *f )
+        {
+        case 'U':
+            val = va_arg(ap, uint32_t *);
+            copy_bufs(&buf1, &buf2, &len1, &len2, val, sizeof(*val));
+            break;
+        case 'S':
+            strval = va_arg(ap, char **);
+            copy_bufs(&buf1, &buf2, &len1, &len2, &len, sizeof(len));
+            *strval = malloc(len + 1);
+            copy_bufs(&buf1, &buf2, &len1, &len2, *strval, len);
+            (*strval)[len] = 0;
+            break;
+        case 'Q':
+            qval = va_arg(ap, uint8_t *);
+            copy_bufs(&buf1, &buf2, &len1, &len2, qval, P9_QID_SIZE);
+            break;
+        default:
+            printk("rcv_9p: unknown format character %c\n", *f);
+            break;
+        }
+    }
+
+    if ( hdr )
+        dev->cons_pvt_in = cons;
+}
+
+static bool rcv_9p_one(struct dev_9pfs *dev, struct req *req, const char *fmt,
+                       va_list ap)
+{
+    struct p9_header hdr;
+    struct req *tmp;
+
+    if ( req->data )
+    {
+        rcv_9p_copy(dev, req, NULL, fmt, ap);
+        free(req->data);
+        req->data = NULL;
+
+        return true;
+    }
+
+    wait_event(dev->waitq, ring_in_data(dev) >= sizeof(hdr));
+
+    copy_from_ring(dev, &hdr, sizeof(hdr));
+
+    wait_event(dev->waitq, ring_in_data(dev) >= hdr.size - sizeof(hdr));
+
+    tmp = dev->req + hdr.tag;
+    if ( hdr.tag >= N_REQS || !tmp->inflight )
+    {
+        printk("9pfs: illegal response: %s\n",
+               hdr.tag >= N_REQS ? "tag out of bounds" : "request not pending");
+        dev->cons_pvt_in += hdr.size - sizeof(hdr);
+
+        return false;
+    }
+
+    tmp->inflight = false;
+
+    if ( tmp != req )
+    {
+        tmp->data = malloc(hdr.size);
+        memcpy(tmp->data, &hdr, sizeof(hdr));
+        copy_from_ring(dev, tmp->data + sizeof(hdr), hdr.size - sizeof(hdr));
+
+        return false;
+    }
+
+    rcv_9p_copy(dev, req, &hdr, fmt, ap);
+
+    return true;
+}
+
+static void rcv_9p(struct dev_9pfs *dev, struct req *req, const char *fmt, ...)
+{
+    va_list ap;
+
+    va_start(ap, fmt);
+
+    down(&dev->ring_in_sem);
+
+    while ( !rcv_9p_one(dev, req, fmt, ap) );
+
+    rmb(); /* Read all data before updating ring index. */
+    dev->intf->in_cons = dev->cons_pvt_in;
+
+    notify_remote_via_evtchn(dev->evtchn);
+
+    up(&dev->ring_in_sem);
+
+    va_end(ap);
+}
+
+static int p9_version(struct dev_9pfs *dev)
+{
+    unsigned int msize = XEN_FLEX_RING_SIZE(dev->ring_order) / 2;
+    struct req *req = get_free_req(dev);
+    char *verret;
+    int ret;
+
+    if ( !req )
+        return EAGAIN;
+
+    req->cmd = P9_CMD_VERSION;
+    send_9p(dev, req, "US", msize, P9_VERSION);
+    rcv_9p(dev, req, "US", &dev->msize_max, &verret);
+    ret = req->result;
+
+    put_free_req(dev, req);
+
+    if ( ret )
+        return ret;
+
+    if ( strcmp(verret, P9_VERSION) )
+        ret = ENOMSG;
+    free(verret);
+
+    return ret;
+}
+
+static int p9_attach(struct dev_9pfs *dev)
+{
+    uint32_t fid = P9_ROOT_FID;
+    uint32_t afid = 0;
+    uint32_t uid = 0;
+    uint8_t qid[P9_QID_SIZE];
+    struct req *req = get_free_req(dev);
+    int ret;
+
+    if ( !req )
+        return EAGAIN;
+
+    req->cmd = P9_CMD_ATTACH;
+    send_9p(dev, req, "UUSSU", fid, afid, "root", "root", uid);
+    rcv_9p(dev, req, "Q", qid);
+    ret = req->result;
+
+    put_free_req(dev, req);
+
+    return ret;
+}
+
+static int connect_9pfs(struct dev_9pfs *dev)
+{
+    int ret;
+
+    ret = p9_version(dev);
+    if ( ret )
+        return ret;
+
+    return p9_attach(dev);
+}
+
 static void intr_9pfs(evtchn_port_t port, struct pt_regs *regs, void *data)
 {
+    struct dev_9pfs *dev = data;
+
+    wake_up(&dev->waitq);
 }
 
 static int open_9pfs(struct mount_point *mnt, const char *pathname, int flags,
@@ -87,6 +549,16 @@ void *init_9pfront(unsigned int id, const char *mnt)
     memset(dev, 0, sizeof(*dev));
     snprintf(dev->nodename, sizeof(dev->nodename), "device/9pfs/%u", id);
     dev->id = id;
+    init_waitqueue_head(&dev->waitq);
+    init_SEMAPHORE(&dev->ring_out_sem, 1);
+    init_SEMAPHORE(&dev->ring_in_sem, 1);
+
+    for ( i = 0; i < N_REQS; i++ )
+    {
+        dev->req[i].id = i;
+        dev->req[i].next_free = i + 1;
+    }
+    dev->free_reqs = 0;
 
     msg = xenbus_read_unsigned(XBT_NIL, dev->nodename, "backend-id", &dev->dom);
     if ( msg )
@@ -205,6 +677,12 @@ void *init_9pfront(unsigned int id, const char *mnt)
 
     unmask_evtchn(dev->evtchn);
 
+    if ( connect_9pfs(dev) )
+    {
+        reason = "9pfs connect failed";
+        goto err;
+    }
+
     dev->mnt = mnt;
     if ( mount(dev->mnt, dev, open_9pfs) )
     {
--
generated by git-patchbot for /home/xen/git/mini-os.git#master


From xen-changelog-bounces@lists.xenproject.org Mon Feb 20 16:22:54 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 20 Feb 2023 16:22:54 +0000
Received: from list by lists.xenproject.org with outflank-mailman.498223.769048 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pU8wI-0003wt-0h; Mon, 20 Feb 2023 16:22:54 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 498223.769048; Mon, 20 Feb 2023 16:22:53 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pU8wH-0003wl-U5; Mon, 20 Feb 2023 16:22:53 +0000
Received: by outflank-mailman (input) for mailman id 498223;
 Mon, 20 Feb 2023 16:22:53 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pU8wH-0003wf-9h
 for xen-changelog@lists.xenproject.org; Mon, 20 Feb 2023 16:22:53 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pU8wH-00051l-8q
 for xen-changelog@lists.xenproject.org; Mon, 20 Feb 2023 16:22:53 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pU8wH-0006Zp-7O
 for xen-changelog@lists.xenproject.org; Mon, 20 Feb 2023 16:22:53 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=cOryPKRGxUqUJyF9/HE8SMxp126ELqHseRtVZUi7DAE=; b=fP965WmnG9+B2ARaOhoDdwa6BK
	uqKyB0JcFmw0i0pGcHEDv3mJqfJJpCJuzS46y3KbhL+stli2EwMrk5b4ovpwwlTacAMM+IaVdjIV1
	d19FTvXppW+1VXHunJ/ujPu1R4Fzupj8c9FGLD9fVoGr6YBrbXvPivQUVIikDMPjlm24=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [mini-os master] Mini-OS: add open and close handling to the 9pfs frontend
Message-Id: <E1pU8wH-0006Zp-7O@xenbits.xenproject.org>
Date: Mon, 20 Feb 2023 16:22:53 +0000

commit 76a46192cca9ec895ea7bb434487bf6b9f117570
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Mon Feb 13 09:44:11 2023 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Mon Feb 20 15:17:35 2023 +0000

    Mini-OS: add open and close handling to the 9pfs frontend
    
    Add the open() and close() support to the 9pfs frontend. This requires
    to split the path name and to walk to the desired directory level.
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
---
 9pfront.c | 324 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 322 insertions(+), 2 deletions(-)

diff --git a/9pfront.c b/9pfront.c
index 0b8d546..fb2e566 100644
--- a/9pfront.c
+++ b/9pfront.c
@@ -6,6 +6,7 @@
 #include <mini-os/os.h>
 #include <mini-os/lib.h>
 #include <mini-os/events.h>
+#include <mini-os/fcntl.h>
 #include <mini-os/gnttab.h>
 #include <mini-os/semaphore.h>
 #include <mini-os/wait.h>
@@ -52,13 +53,32 @@ struct dev_9pfs {
     struct wait_queue_head waitq;
     struct semaphore ring_out_sem;
     struct semaphore ring_in_sem;
+
+    unsigned long long fid_mask;              /* Bit mask for free fids. */
+};
+
+struct file_9pfs {
+    uint32_t fid;
+    struct dev_9pfs *dev;
+    bool append;
 };
 
 #define DEFAULT_9PFS_RING_ORDER  4
 
+/* P9 protocol commands (response is either cmd+1 or P9_CMD_ERROR). */
 #define P9_CMD_VERSION    100
 #define P9_CMD_ATTACH     104
 #define P9_CMD_ERROR      107
+#define P9_CMD_WALK       110
+#define P9_CMD_OPEN       112
+#define P9_CMD_CREATE     114
+#define P9_CMD_CLUNK      120
+
+/* P9 protocol open flags. */
+#define P9_OREAD            0   /* read */
+#define P9_OWRITE           1   /* write */
+#define P9_ORDWR            2   /* read and write */
+#define P9_OTRUNC          16   /* or'ed in, truncate file first */
 
 #define P9_QID_SIZE    13
 
@@ -69,10 +89,27 @@ struct p9_header {
 } __attribute__((packed));
 
 #define P9_VERSION        "9P2000.u"
-#define P9_ROOT_FID       ~0
+#define P9_ROOT_FID       0
 
 static unsigned int ftype_9pfs;
 
+static unsigned int get_fid(struct dev_9pfs *dev)
+{
+    unsigned int fid;
+
+    fid = ffs(dev->fid_mask);
+    if ( fid )
+        dev->fid_mask &= ~(1ULL << (fid - 1));
+
+     return fid;
+}
+
+static void put_fid(struct dev_9pfs *dev, unsigned int fid)
+{
+    if ( fid )
+        dev->fid_mask |= 1ULL << (fid - 1);
+}
+
 static struct req *get_free_req(struct dev_9pfs *dev)
 {
     struct req *req;
@@ -140,6 +177,9 @@ static void copy_from_ring(struct dev_9pfs *dev, void *data, unsigned int len)
  * send_9p() and rcv_9p() are using a special format string for specifying
  * the kind of data sent/expected. Each data item is represented by a single
  * character:
+ * b: 1 byte unsigned integer (uint8_t)
+ *    Only valid for sending.
+ * u: 2 byte unsigned integer (uint16_t)
  * U: 4 byte unsigned integer (uint32_t)
  * S: String (2 byte length + <length> characters)
  *    in the rcv_9p() case the data for string is allocated (length omitted,
@@ -153,7 +193,9 @@ static void send_9p(struct dev_9pfs *dev, struct req *req, const char *fmt, ...)
     va_list ap, aq;
     const char *f;
     uint32_t intval;
+    uint16_t shortval;
     uint16_t len;
+    uint8_t byte;
     char *strval;
 
     hdr.size = sizeof(hdr);
@@ -167,6 +209,14 @@ static void send_9p(struct dev_9pfs *dev, struct req *req, const char *fmt, ...)
     {
         switch ( *f )
         {
+        case 'b':
+            hdr.size += 1;
+            byte = va_arg(aq, unsigned int);
+            break;
+        case 'u':
+            hdr.size += 2;
+            shortval = va_arg(aq, unsigned int);
+            break;
         case 'U':
             hdr.size += 4;
             intval = va_arg(aq, unsigned int);
@@ -196,6 +246,14 @@ static void send_9p(struct dev_9pfs *dev, struct req *req, const char *fmt, ...)
     {
         switch ( *f )
         {
+        case 'b':
+            byte = va_arg(ap, unsigned int);
+            copy_to_ring(dev, &byte, sizeof(byte));
+            break;
+        case 'u':
+            shortval = va_arg(ap, unsigned int);
+            copy_to_ring(dev, &shortval, sizeof(shortval));
+            break;
         case 'U':
             intval = va_arg(ap, unsigned int);
             copy_to_ring(dev, &intval, sizeof(intval));
@@ -288,6 +346,7 @@ static void rcv_9p_copy(struct dev_9pfs *dev, struct req *req,
     char *str;
     uint16_t len;
     uint32_t err;
+    uint16_t *shortval;
     uint32_t *val;
     char **strval;
     uint8_t *qval;
@@ -345,6 +404,10 @@ static void rcv_9p_copy(struct dev_9pfs *dev, struct req *req,
     {
         switch ( *f )
         {
+        case 'u':
+            shortval = va_arg(ap, uint16_t *);
+            copy_bufs(&buf1, &buf2, &len1, &len2, shortval, sizeof(*shortval));
+            break;
         case 'U':
             val = va_arg(ap, uint32_t *);
             copy_bufs(&buf1, &buf2, &len1, &len2, val, sizeof(*val));
@@ -486,6 +549,170 @@ static int p9_attach(struct dev_9pfs *dev)
     return ret;
 }
 
+static int p9_clunk(struct dev_9pfs *dev, uint32_t fid)
+{
+    struct req *req = get_free_req(dev);
+    int ret;
+
+    if ( !req )
+        return EAGAIN;
+
+    req->cmd = P9_CMD_CLUNK;
+    send_9p(dev, req, "U", fid);
+    rcv_9p(dev, req, "");
+    ret = req->result;
+
+    put_free_req(dev, req);
+
+    return ret;
+}
+
+static int p9_walk(struct dev_9pfs *dev, uint32_t fid, uint32_t newfid,
+                   char *name)
+{
+    struct req *req = get_free_req(dev);
+    int ret;
+    uint16_t nqid;
+    uint8_t qid[P9_QID_SIZE];
+
+    if ( !req )
+        return EAGAIN;
+
+    req->cmd = P9_CMD_WALK;
+    if ( name[0] )
+    {
+        send_9p(dev, req, "UUuS", fid, newfid, 1, name);
+        rcv_9p(dev, req, "uQ", &nqid, qid);
+    }
+    else
+    {
+        send_9p(dev, req, "UUu", fid, newfid, 0);
+        rcv_9p(dev, req, "u", &nqid);
+    }
+
+    ret = req->result;
+
+    put_free_req(dev, req);
+
+    return ret;
+}
+
+static int p9_open(struct dev_9pfs *dev, uint32_t fid, uint8_t omode)
+{
+    struct req *req = get_free_req(dev);
+    int ret;
+    uint8_t qid[P9_QID_SIZE];
+    uint32_t iounit;
+
+    if ( !req )
+        return EAGAIN;
+
+    req->cmd = P9_CMD_OPEN;
+    send_9p(dev, req, "Ub", fid, omode);
+    rcv_9p(dev, req, "QU", qid, &iounit);
+
+    ret = req->result;
+
+    put_free_req(dev, req);
+
+    return ret;
+}
+
+static int p9_create(struct dev_9pfs *dev, uint32_t fid, char *path,
+                     uint32_t mode, uint8_t omode)
+{
+    struct req *req = get_free_req(dev);
+    int ret;
+    uint8_t qid[P9_QID_SIZE];
+    uint32_t iounit;
+
+    if ( !req )
+        return EAGAIN;
+
+    req->cmd = P9_CMD_CREATE;
+    send_9p(dev, req, "USUbS", fid, path, mode, omode, "");
+    rcv_9p(dev, req, "QU", qid, &iounit);
+
+    ret = req->result;
+
+    put_free_req(dev, req);
+
+    return ret;
+}
+
+/*
+ * Walk from root <steps> levels with the levels listed in <*paths> as a
+ * sequence of names. Returns the number of steps not having been able to
+ * walk, with <*paths> pointing at the name of the failing walk step.
+ * <fid> will be associated with the last successful walk step. Note that
+ * the first step should always succeed, as it is an empty walk in order
+ * to start at the root (needed for creating new files in root).
+ */
+static unsigned int walk_9pfs(struct dev_9pfs *dev, uint32_t fid,
+                              unsigned int steps, char **paths)
+{
+    uint32_t curr_fid = P9_ROOT_FID;
+    int ret;
+
+    while ( steps-- )
+    {
+        ret = p9_walk(dev, curr_fid, fid, *paths);
+        if ( ret )
+            return steps + 1;
+        curr_fid = fid;
+        *paths += strlen(*paths) + 1;
+    }
+
+    return 0;
+}
+
+static unsigned int split_path(const char *pathname, char **split_ptr)
+{
+    unsigned int parts = 1;
+    char *p;
+
+    *split_ptr = strdup(pathname);
+
+    for ( p = strchr(*split_ptr, '/'); p; p = strchr(p + 1, '/') )
+    {
+        *p = 0;
+        parts++;
+    }
+
+    return parts;
+}
+
+static bool path_canonical(const char *pathname)
+{
+    unsigned int len = strlen(pathname);
+    const char *c;
+
+    /* Empty path is allowed. */
+    if ( !len )
+        return true;
+
+    /* No trailing '/'. */
+    if ( pathname[len - 1] == '/' )
+        return false;
+
+    /* No self or parent references. */
+    c = pathname;
+    while ( (c = strstr(c, "/.")) != NULL )
+    {
+        if ( c[2] == '.' )
+            c++;
+        if ( c[2] == 0 || c[2] == '/' )
+            return false;
+        c += 2;
+    }
+
+    /* No "//". */
+    if ( strstr(pathname, "//") )
+        return false;
+
+    return true;
+}
+
 static int connect_9pfs(struct dev_9pfs *dev)
 {
     int ret;
@@ -504,10 +731,101 @@ static void intr_9pfs(evtchn_port_t port, struct pt_regs *regs, void *data)
     wake_up(&dev->waitq);
 }
 
+static int close_9pfs(struct file *file)
+{
+    struct file_9pfs *f9pfs = file->filedata;
+
+    if ( f9pfs->fid != P9_ROOT_FID )
+    {
+        p9_clunk(f9pfs->dev, f9pfs->fid);
+        put_fid(f9pfs->dev, f9pfs->fid);
+    }
+
+    free(f9pfs);
+
+    return 0;
+}
+
 static int open_9pfs(struct mount_point *mnt, const char *pathname, int flags,
                      mode_t mode)
 {
-    errno = ENOSYS;
+    int fd;
+    char *path = NULL;
+    char *p;
+    struct file *file;
+    struct file_9pfs *f9pfs;
+    uint16_t nwalk;
+    uint8_t omode;
+    int ret;
+
+    if ( !path_canonical(pathname) )
+        return EINVAL;
+
+    f9pfs = calloc(1, sizeof(*f9pfs));
+    f9pfs->dev = mnt->dev;
+    f9pfs->fid = P9_ROOT_FID;
+
+    fd = alloc_fd(ftype_9pfs);
+    file = get_file_from_fd(fd);
+    file->filedata = f9pfs;
+
+    switch ( flags & O_ACCMODE )
+    {
+    case O_RDONLY:
+        omode = P9_OREAD;
+        break;
+    case O_WRONLY:
+        omode = P9_OWRITE;
+        break;
+    case O_RDWR:
+        omode = P9_ORDWR;
+        break;
+    default:
+        ret = EINVAL;
+        goto err;
+    }
+
+    if ( flags & O_TRUNC )
+        omode |= P9_OTRUNC;
+    f9pfs->append = flags & O_APPEND;
+
+    nwalk = split_path(pathname, &path);
+
+    f9pfs->fid = get_fid(mnt->dev);
+    if ( !f9pfs->fid )
+    {
+        ret = ENFILE;
+        goto err;
+    }
+    p = path;
+    nwalk = walk_9pfs(mnt->dev, f9pfs->fid, nwalk, &p);
+    if ( nwalk )
+    {
+        if ( nwalk > 1 || !(flags & O_CREAT) )
+        {
+            ret = ENOENT;
+            goto err;
+        }
+
+        ret = p9_create(mnt->dev, f9pfs->fid, p, mode, omode);
+        if ( ret )
+            goto err;
+        goto out;
+    }
+
+    ret = p9_open(mnt->dev, f9pfs->fid, omode);
+    if ( ret )
+        goto err;
+
+ out:
+    free(path);
+
+    return fd;
+
+ err:
+    free(path);
+    close(fd);
+    errno = ret;
 
     return -1;
 }
@@ -552,6 +870,7 @@ void *init_9pfront(unsigned int id, const char *mnt)
     init_waitqueue_head(&dev->waitq);
     init_SEMAPHORE(&dev->ring_out_sem, 1);
     init_SEMAPHORE(&dev->ring_in_sem, 1);
+    dev->fid_mask = ~0ULL;
 
     for ( i = 0; i < N_REQS; i++ )
     {
@@ -753,6 +1072,7 @@ void shutdown_9pfront(void *dev)
 
 static const struct file_ops ops_9pfs = {
     .name = "9pfs",
+    .close = close_9pfs,
 };
 
 __attribute__((constructor))
--
generated by git-patchbot for /home/xen/git/mini-os.git#master


From xen-changelog-bounces@lists.xenproject.org Mon Feb 20 16:23:04 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 20 Feb 2023 16:23:04 +0000
Received: from list by lists.xenproject.org with outflank-mailman.498224.769052 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pU8wS-00040I-3n; Mon, 20 Feb 2023 16:23:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 498224.769052; Mon, 20 Feb 2023 16:23:04 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pU8wS-000409-0n; Mon, 20 Feb 2023 16:23:04 +0000
Received: by outflank-mailman (input) for mailman id 498224;
 Mon, 20 Feb 2023 16:23:03 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pU8wR-0003zy-Cf
 for xen-changelog@lists.xenproject.org; Mon, 20 Feb 2023 16:23:03 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pU8wR-00052A-Bt
 for xen-changelog@lists.xenproject.org; Mon, 20 Feb 2023 16:23:03 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pU8wR-0006b0-Az
 for xen-changelog@lists.xenproject.org; Mon, 20 Feb 2023 16:23:03 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=/EtppVwg4sJnQjEIlrTV21Tm8KOAh3fhj5VwO7aY/58=; b=vxqvIO/+H4q7q5FcyrWpvLBjI1
	FZ9/4xYBHs/RYzWy0KzfafbXI9Atd7r98W54qHlto/7fBiOFCcvV6YYC3Qq0wLUlqTrefLJMwAwvY
	uT5CZub0qkpzRDNWL4+Jc/YCdkiCe4K5xkMd9vf1Vx7eA7yt9F63a6f+djL8HoQLAhS8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [mini-os master] Mini-OS: add read and write support to 9pfsfront
Message-Id: <E1pU8wR-0006b0-Az@xenbits.xenproject.org>
Date: Mon, 20 Feb 2023 16:23:03 +0000

commit 2d1dfccd3aa343b53ec6b5e051c228dcf89aba7f
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Mon Feb 13 09:44:12 2023 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Mon Feb 20 15:17:35 2023 +0000

    Mini-OS: add read and write support to 9pfsfront
    
    Add support to read from and write to a file handled by 9pfsfront.
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
---
 9pfront.c | 216 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 216 insertions(+)

diff --git a/9pfront.c b/9pfront.c
index fb2e566..5da8a36 100644
--- a/9pfront.c
+++ b/9pfront.c
@@ -72,7 +72,10 @@ struct file_9pfs {
 #define P9_CMD_WALK       110
 #define P9_CMD_OPEN       112
 #define P9_CMD_CREATE     114
+#define P9_CMD_READ       116
+#define P9_CMD_WRITE      118
 #define P9_CMD_CLUNK      120
+#define P9_CMD_STAT       124
 
 /* P9 protocol open flags. */
 #define P9_OREAD            0   /* read */
@@ -88,11 +91,39 @@ struct p9_header {
     uint16_t tag;
 } __attribute__((packed));
 
+struct p9_stat {
+    uint16_t size;
+    uint16_t type;
+    uint32_t dev;
+    uint8_t qid[P9_QID_SIZE];
+    uint32_t mode;
+    uint32_t atime;
+    uint32_t mtime;
+    uint64_t length;
+    char *name;
+    char *uid;
+    char *gid;
+    char *muid;
+    char *extension;
+    uint32_t n_uid;
+    uint32_t n_gid;
+    uint32_t n_muid;
+};
+
 #define P9_VERSION        "9P2000.u"
 #define P9_ROOT_FID       0
 
 static unsigned int ftype_9pfs;
 
+static void free_stat(struct p9_stat *stat)
+{
+    free(stat->name);
+    free(stat->uid);
+    free(stat->gid);
+    free(stat->muid);
+    free(stat->extension);
+}
+
 static unsigned int get_fid(struct dev_9pfs *dev)
 {
     unsigned int fid;
@@ -181,9 +212,12 @@ static void copy_from_ring(struct dev_9pfs *dev, void *data, unsigned int len)
  *    Only valid for sending.
  * u: 2 byte unsigned integer (uint16_t)
  * U: 4 byte unsigned integer (uint32_t)
+ * L: 8 byte unsigned integer (uint64_t)
  * S: String (2 byte length + <length> characters)
  *    in the rcv_9p() case the data for string is allocated (length omitted,
  *    string terminated by a NUL character)
+ * D: Binary data (4 byte length + <length> bytes of data), requires a length
+ *    and a buffer pointer parameter.
  * Q: A 13 byte "qid", consisting of 1 byte file type, 4 byte file version
  *    and 8 bytes unique file id. Only valid for receiving.
  */
@@ -192,10 +226,12 @@ static void send_9p(struct dev_9pfs *dev, struct req *req, const char *fmt, ...)
     struct p9_header hdr;
     va_list ap, aq;
     const char *f;
+    uint64_t longval;
     uint32_t intval;
     uint16_t shortval;
     uint16_t len;
     uint8_t byte;
+    uint8_t *data;
     char *strval;
 
     hdr.size = sizeof(hdr);
@@ -221,11 +257,21 @@ static void send_9p(struct dev_9pfs *dev, struct req *req, const char *fmt, ...)
             hdr.size += 4;
             intval = va_arg(aq, unsigned int);
             break;
+        case 'L':
+            hdr.size += 8;
+            longval = va_arg(aq, uint64_t);
+            break;
         case 'S':
             hdr.size += 2;
             strval = va_arg(aq, char *);
             hdr.size += strlen(strval);
             break;
+        case 'D':
+            hdr.size += 4;
+            intval = va_arg(aq, unsigned int);
+            hdr.size += intval;
+            data = va_arg(aq, uint8_t *);
+            break;
         default:
             printk("send_9p: unknown format character %c\n", *f);
             break;
@@ -258,12 +304,22 @@ static void send_9p(struct dev_9pfs *dev, struct req *req, const char *fmt, ...)
             intval = va_arg(ap, unsigned int);
             copy_to_ring(dev, &intval, sizeof(intval));
             break;
+        case 'L':
+            longval = va_arg(ap, uint64_t);
+            copy_to_ring(dev, &longval, sizeof(longval));
+            break;
         case 'S':
             strval = va_arg(ap, char *);
             len = strlen(strval);
             copy_to_ring(dev, &len, sizeof(len));
             copy_to_ring(dev, strval, len);
             break;
+        case 'D':
+            intval = va_arg(ap, unsigned int);
+            copy_to_ring(dev, &intval, sizeof(intval));
+            data = va_arg(ap, uint8_t *);
+            copy_to_ring(dev, data, intval);
+            break;
         }
     }
 
@@ -348,6 +404,8 @@ static void rcv_9p_copy(struct dev_9pfs *dev, struct req *req,
     uint32_t err;
     uint16_t *shortval;
     uint32_t *val;
+    uint64_t *longval;
+    uint8_t *data;
     char **strval;
     uint8_t *qval;
 
@@ -412,6 +470,10 @@ static void rcv_9p_copy(struct dev_9pfs *dev, struct req *req,
             val = va_arg(ap, uint32_t *);
             copy_bufs(&buf1, &buf2, &len1, &len2, val, sizeof(*val));
             break;
+        case 'L':
+            longval = va_arg(ap, uint64_t *);
+            copy_bufs(&buf1, &buf2, &len1, &len2, longval, sizeof(*longval));
+            break;
         case 'S':
             strval = va_arg(ap, char **);
             copy_bufs(&buf1, &buf2, &len1, &len2, &len, sizeof(len));
@@ -419,6 +481,12 @@ static void rcv_9p_copy(struct dev_9pfs *dev, struct req *req,
             copy_bufs(&buf1, &buf2, &len1, &len2, *strval, len);
             (*strval)[len] = 0;
             break;
+        case 'D':
+            val = va_arg(ap, uint32_t *);
+            data = va_arg(ap, uint8_t *);
+            copy_bufs(&buf1, &buf2, &len1, &len2, val, sizeof(*val));
+            copy_bufs(&buf1, &buf2, &len1, &len2, data, *val);
+            break;
         case 'Q':
             qval = va_arg(ap, uint8_t *);
             copy_bufs(&buf1, &buf2, &len1, &len2, qval, P9_QID_SIZE);
@@ -640,6 +708,115 @@ static int p9_create(struct dev_9pfs *dev, uint32_t fid, char *path,
     return ret;
 }
 
+static int p9_stat(struct dev_9pfs *dev, uint32_t fid, struct p9_stat *stat)
+{
+    struct req *req = get_free_req(dev);
+    int ret;
+
+    if ( !req )
+        return EAGAIN;
+
+    memset(stat, 0, sizeof(*stat));
+    req->cmd = P9_CMD_STAT;
+    send_9p(dev, req, "U", fid);
+    rcv_9p(dev, req, "uuUQUUULSSSSSUUU", &stat->size, &stat->type, &stat->dev,
+           stat->qid, &stat->mode, &stat->atime, &stat->mtime, &stat->length,
+           &stat->name, &stat->uid, &stat->gid, &stat->muid, &stat->extension,
+           &stat->n_uid, &stat->n_gid, &stat->n_muid);
+
+    ret = req->result;
+
+    put_free_req(dev, req);
+
+    return ret;
+}
+
+static int p9_read(struct dev_9pfs *dev, uint32_t fid, uint64_t offset,
+                   uint8_t *data, uint32_t len)
+{
+    struct req *req = get_free_req(dev);
+    int ret = 0;
+    uint32_t count, count_max;
+
+    if ( !req )
+    {
+        errno = EAGAIN;
+        return -1;
+    }
+    req->cmd = P9_CMD_READ;
+    count_max = dev->msize_max - (sizeof(struct p9_header) + sizeof(uint32_t));
+
+    while ( len )
+    {
+        count = len;
+        if ( count > count_max )
+            count = count_max;
+
+        send_9p(dev, req, "ULU", fid, offset, count);
+        rcv_9p(dev, req, "D", &count, data);
+
+        if ( !count )
+            break;
+        if ( req->result )
+        {
+            ret = -1;
+            errno = EIO;
+            printk("9pfs: read got error %d\n", req->result);
+            break;
+        }
+        ret += count;
+        offset += count;
+        data += count;
+        len -= count;
+    }
+
+    put_free_req(dev, req);
+
+    return ret;
+}
+
+static int p9_write(struct dev_9pfs *dev, uint32_t fid, uint64_t offset,
+                    const uint8_t *data, uint32_t len)
+{
+    struct req *req = get_free_req(dev);
+    int ret = 0;
+    uint32_t count, count_max;
+
+    if ( !req )
+    {
+        errno = EAGAIN;
+        return -1;
+    }
+    req->cmd = P9_CMD_WRITE;
+    count_max = dev->msize_max - (sizeof(struct p9_header) + sizeof(uint32_t) +
+                                  sizeof(uint64_t) + sizeof(uint32_t));
+
+    while ( len )
+    {
+        count = len;
+        if ( count > count_max )
+            count = count_max;
+
+        send_9p(dev, req, "ULD", fid, offset, count, data);
+        rcv_9p(dev, req, "U", &count);
+        if ( req->result )
+        {
+            ret = -1;
+            errno = EIO;
+            printk("9pfs: write got error %d\n", req->result);
+            break;
+        }
+        ret += count;
+        offset += count;
+        data += count;
+        len -= count;
+    }
+
+    put_free_req(dev, req);
+
+    return ret;
+}
+
 /*
  * Walk from root <steps> levels with the levels listed in <*paths> as a
  * sequence of names. Returns the number of steps not having been able to
@@ -731,6 +908,43 @@ static void intr_9pfs(evtchn_port_t port, struct pt_regs *regs, void *data)
     wake_up(&dev->waitq);
 }
 
+static int read_9pfs(struct file *file, void *buf, size_t nbytes)
+{
+    struct file_9pfs *f9pfs = file->filedata;
+    int ret;
+
+    ret = p9_read(f9pfs->dev, f9pfs->fid, file->offset, buf, nbytes);
+    if ( ret >= 0 )
+        file->offset += ret;
+
+    return ret;
+}
+
+static int write_9pfs(struct file *file, const void *buf, size_t nbytes)
+{
+    struct file_9pfs *f9pfs = file->filedata;
+    struct p9_stat stat;
+    int ret;
+
+    if ( f9pfs->append )
+    {
+        ret = p9_stat(f9pfs->dev, f9pfs->fid, &stat);
+        free_stat(&stat);
+        if ( ret )
+        {
+            errno = EIO;
+            return -1;
+        }
+        file->offset = stat.length;
+    }
+
+    ret = p9_write(f9pfs->dev, f9pfs->fid, file->offset, buf, nbytes);
+    if ( ret >= 0 )
+        file->offset += ret;
+
+    return ret;
+}
+
 static int close_9pfs(struct file *file)
 {
     struct file_9pfs *f9pfs = file->filedata;
@@ -1072,6 +1286,8 @@ void shutdown_9pfront(void *dev)
 
 static const struct file_ops ops_9pfs = {
     .name = "9pfs",
+    .read = read_9pfs,
+    .write = write_9pfs,
     .close = close_9pfs,
 };
 
--
generated by git-patchbot for /home/xen/git/mini-os.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Feb 22 08:11:10 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 22 Feb 2023 08:11:10 +0000
Received: from list by lists.xenproject.org with outflank-mailman.499252.770305 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pUkDP-0005hp-AY; Wed, 22 Feb 2023 08:11:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 499252.770305; Wed, 22 Feb 2023 08:11:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pUkDP-0005hi-6n; Wed, 22 Feb 2023 08:11:03 +0000
Received: by outflank-mailman (input) for mailman id 499252;
 Wed, 22 Feb 2023 08: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 1pUkDO-0005hc-4f
 for xen-changelog@lists.xenproject.org; Wed, 22 Feb 2023 08:11:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pUkDO-0003kc-3V
 for xen-changelog@lists.xenproject.org; Wed, 22 Feb 2023 08:11:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pUkDO-0008Vl-1m
 for xen-changelog@lists.xenproject.org; Wed, 22 Feb 2023 08:11:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=SoBUF7+9qA3r9MoUHsmJLknBMRxLIghri8+c4bYQIBA=; b=mIVfVYNkFuQaimP8AlhMDHMeMm
	M7YYiHrQ0WtYKj7h7b0SIgmsKtDRU3yghaT4qlqGzGJykTnjFOhJ51u2+teALp7Z0nTLmckWKYT0p
	8g3XX7MIq3FNF6b4kjYlCCw7fmGWk1w0SZd81M+9Zn6zOoFa8oFFiqowA0WZQ8XRlzho=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/svm: cleanup svm.c
Message-Id: <E1pUkDO-0008Vl-1m@xenbits.xenproject.org>
Date: Wed, 22 Feb 2023 08:11:02 +0000

commit a90a0018f605e3bb0588816e5a1f957d6e4562eb
Author:     Xenia Ragiadakou <burzalodowa@gmail.com>
AuthorDate: Fri Feb 17 20:48:11 2023 +0200
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Feb 21 10:20:19 2023 +0000

    x86/svm: cleanup svm.c
    
    Do not include the headers:
      xen/irq.h
      asm/hvm/svm/intr.h
      asm/io.h
      asm/mem_sharing.h
      asm/regs.h
    because none of the declarations and macro definitions in them is used.
    Sort the rest of the headers alphabetically.
    
    Remove the forward declaration of svm_function_table and place start_svm()
    after the svm_function_table's definition.
    
    Replace double new lines with one.
    
    No functional change intended.
    
    Signed-off-by: Xenia Ragiadakou <burzalodowa@gmail.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/hvm/svm/svm.c | 161 +++++++++++++++++++++------------------------
 1 file changed, 74 insertions(+), 87 deletions(-)

diff --git a/xen/arch/x86/hvm/svm/svm.c b/xen/arch/x86/hvm/svm/svm.c
index fa73257203..f412b537aa 100644
--- a/xen/arch/x86/hvm/svm/svm.c
+++ b/xen/arch/x86/hvm/svm/svm.c
@@ -16,60 +16,49 @@
  * this program; If not, see <http://www.gnu.org/licenses/>.
  */
 
+#include <xen/domain_page.h>
 #include <xen/guest_access.h>
+#include <xen/hypercall.h>
 #include <xen/init.h>
 #include <xen/lib.h>
-#include <xen/trace.h>
 #include <xen/sched.h>
-#include <xen/irq.h>
-#include <xen/softirq.h>
-#include <xen/hypercall.h>
-#include <xen/domain_page.h>
+#include <xen/trace.h>
 #include <xen/xenoprof.h>
-#include <asm/current.h>
-#include <asm/io.h>
-#include <asm/paging.h>
-#include <asm/p2m.h>
-#include <asm/mem_sharing.h>
-#include <asm/regs.h>
-#include <asm/cpufeature.h>
-#include <asm/processor.h>
+
 #include <asm/amd.h>
+#include <asm/apic.h>
+#include <asm/cpufeature.h>
+#include <asm/current.h>
 #include <asm/debugreg.h>
-#include <asm/msr.h>
-#include <asm/i387.h>
-#include <asm/iocap.h>
+#include <asm/gdbsx.h>
 #include <asm/hvm/emulate.h>
 #include <asm/hvm/hvm.h>
-#include <asm/hvm/support.h>
 #include <asm/hvm/io.h>
-#include <asm/hvm/emulate.h>
+#include <asm/hvm/monitor.h>
+#include <asm/hvm/nestedhvm.h>
+#include <asm/hvm/support.h>
 #include <asm/hvm/svm/asid.h>
-#include <asm/hvm/svm/svm.h>
-#include <asm/hvm/svm/vmcb.h>
 #include <asm/hvm/svm/emulate.h>
-#include <asm/hvm/svm/intr.h>
-#include <asm/hvm/svm/svmdebug.h>
 #include <asm/hvm/svm/nestedsvm.h>
-#include <asm/hvm/nestedhvm.h>
-#include <asm/spec_ctrl.h>
-#include <asm/x86_emulate.h>
-#include <public/sched.h>
-#include <asm/hvm/vpt.h>
+#include <asm/hvm/svm/svm.h>
+#include <asm/hvm/svm/svmdebug.h>
+#include <asm/hvm/svm/vmcb.h>
 #include <asm/hvm/trace.h>
-#include <asm/hap.h>
-#include <asm/apic.h>
-#include <asm/gdbsx.h>
-#include <asm/hvm/monitor.h>
+#include <asm/iocap.h>
+#include <asm/i387.h>
 #include <asm/monitor.h>
-#include <asm/xstate.h>
+#include <asm/msr.h>
+#include <asm/paging.h>
+#include <asm/processor.h>
+#include <asm/p2m.h>
+#include <asm/x86_emulate.h>
+
+#include <public/sched.h>
 
 void noreturn svm_asm_do_resume(void);
 
 u32 svm_feature_flags;
 
-static struct hvm_function_table svm_function_table;
-
 /*
  * Physical addresses of the Host State Area (for hardware) and vmcb (for Xen)
  * which contains Xen's fs/gs/tr/ldtr and GSBASE/STAR/SYSENTER state when in
@@ -505,7 +494,6 @@ static int svm_vmcb_restore(struct vcpu *v, struct hvm_hw_cpu *c)
     return 0;
 }
 
-
 static void svm_save_cpu_state(struct vcpu *v, struct hvm_hw_cpu *data)
 {
     struct vmcb_struct *vmcb = v->arch.hvm.svm.vmcb;
@@ -517,7 +505,6 @@ static void svm_save_cpu_state(struct vcpu *v, struct hvm_hw_cpu *data)
     data->msr_syscall_mask = vmcb->sfmask;
 }
 
-
 static void svm_load_cpu_state(struct vcpu *v, struct hvm_hw_cpu *data)
 {
     struct vmcb_struct *vmcb = v->arch.hvm.svm.vmcb;
@@ -1649,57 +1636,6 @@ static int cf_check svm_cpu_up(void)
     return _svm_cpu_up(false);
 }
 
-const struct hvm_function_table * __init start_svm(void)
-{
-    bool_t printed = 0;
-
-    svm_host_osvw_reset();
-
-    if ( _svm_cpu_up(true) )
-    {
-        printk("SVM: failed to initialise.\n");
-        return NULL;
-    }
-
-    setup_vmcb_dump();
-
-    if ( boot_cpu_data.extended_cpuid_level >= 0x8000000a )
-        svm_feature_flags = cpuid_edx(0x8000000a);
-
-    printk("SVM: Supported advanced features:\n");
-
-    /* DecodeAssists fast paths assume nextrip is valid for fast rIP update. */
-    if ( !cpu_has_svm_nrips )
-        __clear_bit(SVM_FEATURE_DECODEASSISTS, &svm_feature_flags);
-
-    if ( cpu_has_tsc_ratio )
-        svm_function_table.tsc_scaling.ratio_frac_bits = 32;
-
-#define P(p,s) if ( p ) { printk(" - %s\n", s); printed = 1; }
-    P(cpu_has_svm_npt, "Nested Page Tables (NPT)");
-    P(cpu_has_svm_lbrv, "Last Branch Record (LBR) Virtualisation");
-    P(cpu_has_svm_nrips, "Next-RIP Saved on #VMEXIT");
-    P(cpu_has_svm_cleanbits, "VMCB Clean Bits");
-    P(cpu_has_svm_decode, "DecodeAssists");
-    P(cpu_has_svm_vloadsave, "Virtual VMLOAD/VMSAVE");
-    P(cpu_has_svm_vgif, "Virtual GIF");
-    P(cpu_has_pause_filter, "Pause-Intercept Filter");
-    P(cpu_has_pause_thresh, "Pause-Intercept Filter Threshold");
-    P(cpu_has_tsc_ratio, "TSC Rate MSR");
-    P(cpu_has_svm_sss, "NPT Supervisor Shadow Stack");
-    P(cpu_has_svm_spec_ctrl, "MSR_SPEC_CTRL virtualisation");
-#undef P
-
-    if ( !printed )
-        printk(" - none\n");
-
-    svm_function_table.hap_supported = !!cpu_has_svm_npt;
-    svm_function_table.hap_capabilities = HVM_HAP_SUPERPAGE_2MB |
-        (cpu_has_page1gb ? HVM_HAP_SUPERPAGE_1GB : 0);
-
-    return &svm_function_table;
-}
-
 static void svm_do_nested_pgfault(struct vcpu *v,
     struct cpu_user_regs *regs, uint64_t pfec, paddr_t gpa)
 {
@@ -2598,6 +2534,57 @@ static struct hvm_function_table __initdata_cf_clobber svm_function_table = {
     },
 };
 
+const struct hvm_function_table * __init start_svm(void)
+{
+    bool_t printed = 0;
+
+    svm_host_osvw_reset();
+
+    if ( _svm_cpu_up(true) )
+    {
+        printk("SVM: failed to initialise.\n");
+        return NULL;
+    }
+
+    setup_vmcb_dump();
+
+    if ( boot_cpu_data.extended_cpuid_level >= 0x8000000a )
+        svm_feature_flags = cpuid_edx(0x8000000a);
+
+    printk("SVM: Supported advanced features:\n");
+
+    /* DecodeAssists fast paths assume nextrip is valid for fast rIP update. */
+    if ( !cpu_has_svm_nrips )
+        __clear_bit(SVM_FEATURE_DECODEASSISTS, &svm_feature_flags);
+
+    if ( cpu_has_tsc_ratio )
+        svm_function_table.tsc_scaling.ratio_frac_bits = 32;
+
+#define P(p,s) if ( p ) { printk(" - %s\n", s); printed = 1; }
+    P(cpu_has_svm_npt, "Nested Page Tables (NPT)");
+    P(cpu_has_svm_lbrv, "Last Branch Record (LBR) Virtualisation");
+    P(cpu_has_svm_nrips, "Next-RIP Saved on #VMEXIT");
+    P(cpu_has_svm_cleanbits, "VMCB Clean Bits");
+    P(cpu_has_svm_decode, "DecodeAssists");
+    P(cpu_has_svm_vloadsave, "Virtual VMLOAD/VMSAVE");
+    P(cpu_has_svm_vgif, "Virtual GIF");
+    P(cpu_has_pause_filter, "Pause-Intercept Filter");
+    P(cpu_has_pause_thresh, "Pause-Intercept Filter Threshold");
+    P(cpu_has_tsc_ratio, "TSC Rate MSR");
+    P(cpu_has_svm_sss, "NPT Supervisor Shadow Stack");
+    P(cpu_has_svm_spec_ctrl, "MSR_SPEC_CTRL virtualisation");
+#undef P
+
+    if ( !printed )
+        printk(" - none\n");
+
+    svm_function_table.hap_supported = !!cpu_has_svm_npt;
+    svm_function_table.hap_capabilities = HVM_HAP_SUPERPAGE_2MB |
+        (cpu_has_page1gb ? HVM_HAP_SUPERPAGE_1GB : 0);
+
+    return &svm_function_table;
+}
+
 void svm_vmexit_handler(struct cpu_user_regs *regs)
 {
     uint64_t exit_reason;
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Feb 22 08:11:13 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 22 Feb 2023 08:11:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.499253.770307 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pUkDZ-0005jm-BC; Wed, 22 Feb 2023 08:11:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 499253.770307; Wed, 22 Feb 2023 08:11:13 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pUkDZ-0005je-8T; Wed, 22 Feb 2023 08:11:13 +0000
Received: by outflank-mailman (input) for mailman id 499253;
 Wed, 22 Feb 2023 08: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 1pUkDY-0005jY-8q
 for xen-changelog@lists.xenproject.org; Wed, 22 Feb 2023 08:11:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pUkDY-0003kg-7m
 for xen-changelog@lists.xenproject.org; Wed, 22 Feb 2023 08:11:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pUkDY-0008WG-5l
 for xen-changelog@lists.xenproject.org; Wed, 22 Feb 2023 08:11:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=QCBa3+guSxqVUkHt+dNBrG80R1VzytdhMvV0sp5tgo0=; b=2jdIZiNVJ0BD5NtGR1ZuNMAPZU
	PL6NyIjzA2B6p/sG8OUKpcfLEi2YfbOAd1SNIfvIjURe/VCCcixoXu+rYO4tsapwy0KiM4kDNdWvY
	X+b2MZ7ZdVYwvd46kdREEtHkUi8s6Xnq/+dfP/d77KOgLHtESUIXM7e0t32rDyghWv7w=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86: use standard C types in struct cpuinfo_x86
Message-Id: <E1pUkDY-0008WG-5l@xenbits.xenproject.org>
Date: Wed, 22 Feb 2023 08:11:12 +0000

commit 03430abdf570374fe89d14ca63f7f7c0826a3a4e
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Feb 21 15:06:55 2023 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Feb 21 15:06:55 2023 +0100

    x86: use standard C types in struct cpuinfo_x86
    
    Consolidate this to use exclusively standard types, and change oprofile
    code (apparently trying to mirror those types) at the same time. Where
    sensible actually drop local variables.
    
    No functional change intended.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/include/asm/processor.h | 24 ++++++++++++------------
 xen/arch/x86/oprofile/nmi_int.c      | 21 +++++++++------------
 2 files changed, 21 insertions(+), 24 deletions(-)

diff --git a/xen/arch/x86/include/asm/processor.h b/xen/arch/x86/include/asm/processor.h
index b95d248321..8a73d3d8b1 100644
--- a/xen/arch/x86/include/asm/processor.h
+++ b/xen/arch/x86/include/asm/processor.h
@@ -119,24 +119,24 @@ struct x86_cpu_id {
 };
 
 struct cpuinfo_x86 {
-    __u8 x86;            /* CPU family */
-    __u8 x86_vendor;     /* CPU vendor */
-    __u8 x86_model;
-    __u8 x86_mask;
+    uint8_t x86;            /* CPU family */
+    uint8_t x86_vendor;     /* CPU vendor */
+    uint8_t x86_model;
+    uint8_t x86_mask;
     int  cpuid_level;    /* Maximum supported CPUID level, -1=no CPUID */
-    __u32 extended_cpuid_level; /* Maximum supported CPUID extended level */
+    uint32_t extended_cpuid_level; /* Maximum supported CPUID extended level */
     unsigned int x86_capability[NCAPINTS];
     char x86_vendor_id[16];
     char x86_model_id[64];
     int  x86_cache_size; /* in KB - valid for CPUS which support this call  */
     int  x86_cache_alignment;    /* In bytes */
-    __u32 x86_max_cores; /* cpuid returned max cores value */
-    __u32 booted_cores;  /* number of cores as seen by OS */
-    __u32 x86_num_siblings; /* cpuid logical cpus per chip value */
-    __u32 apicid;
-    __u32 phys_proc_id;    /* package ID of each logical CPU */
-    __u32 cpu_core_id;     /* core ID of each logical CPU*/
-    __u32 compute_unit_id; /* AMD compute unit ID of each logical CPU */
+    uint32_t x86_max_cores;   /* cpuid returned max cores value */
+    uint32_t booted_cores;    /* number of cores as seen by OS */
+    uint32_t x86_num_siblings; /* cpuid logical cpus per chip value */
+    uint32_t apicid;
+    uint32_t phys_proc_id;    /* package ID of each logical CPU */
+    uint32_t cpu_core_id;     /* core ID of each logical CPU */
+    uint32_t compute_unit_id; /* AMD compute unit ID of each logical CPU */
     unsigned short x86_clflush_size;
 } __cacheline_aligned;
 
diff --git a/xen/arch/x86/oprofile/nmi_int.c b/xen/arch/x86/oprofile/nmi_int.c
index a90b728258..17bf3135f8 100644
--- a/xen/arch/x86/oprofile/nmi_int.c
+++ b/xen/arch/x86/oprofile/nmi_int.c
@@ -311,11 +311,11 @@ void nmi_stop(void)
 
 static int __init p4_init(char ** cpu_type)
 {
-	__u8 cpu_model = current_cpu_data.x86_model;
+	unsigned int cpu_model = current_cpu_data.x86_model;
 
 	if ((cpu_model > 6) || (cpu_model == 5)) {
 		printk("xenoprof: Initialization failed. "
-		       "Intel processor model %d for pentium 4 family is not "
+		       "Intel processor model %u for pentium 4 family is not "
 		       "supported\n", cpu_model);
 		return 0;
 	}
@@ -355,12 +355,10 @@ custom_param("cpu_type", force_cpu_type);
 
 static int __init ppro_init(char ** cpu_type)
 {
-	__u8 cpu_model = current_cpu_data.x86_model;
-
 	if (force_arch_perfmon && cpu_has_arch_perfmon)
 		return 0;
 
-	switch (cpu_model) {
+	switch (current_cpu_data.x86_model) {
 	case 14:
 		*cpu_type = "i386/core";
 		break;
@@ -390,9 +388,8 @@ static int __init arch_perfmon_init(char **cpu_type)
 
 static int __init cf_check nmi_init(void)
 {
-	__u8 vendor = current_cpu_data.x86_vendor;
-	__u8 family = current_cpu_data.x86;
-	__u8 _model = current_cpu_data.x86_model;
+	unsigned int vendor = current_cpu_data.x86_vendor;
+	unsigned int family = current_cpu_data.x86;
 
 	if (!cpu_has_apic) {
 		printk("xenoprof: Initialization failed. No APIC\n");
@@ -406,7 +403,7 @@ static int __init cf_check nmi_init(void)
 			switch (family) {
 			default:
 				printk("xenoprof: Initialization failed. "
-				       "AMD processor family %d is not "
+				       "AMD processor family %u is not "
 				       "supported\n", family);
 				return -ENODEV;
 			case 0xf:
@@ -458,15 +455,15 @@ static int __init cf_check nmi_init(void)
 			}
 			if (!cpu_type && !arch_perfmon_init(&cpu_type)) {
 				printk("xenoprof: Initialization failed. "
-				       "Intel processor family %d model %d "
-				       "is not supported\n", family, _model);
+				       "Intel processor family %u model %d is not supported\n",
+				       family, current_cpu_data.x86_model);
 				return -ENODEV;
 			}
 			break;
 
 		default:
 			printk("xenoprof: Initialization failed. "
-			       "Unsupported processor. Unknown vendor %d\n",
+			       "Unsupported processor. Unknown vendor %u\n",
 				vendor);
 			return -ENODEV;
 	}
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Feb 22 08:11:23 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 22 Feb 2023 08:11:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.499256.770311 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pUkDj-0005mx-F3; Wed, 22 Feb 2023 08:11:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 499256.770311; Wed, 22 Feb 2023 08:11:23 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pUkDj-0005mp-CD; Wed, 22 Feb 2023 08:11:23 +0000
Received: by outflank-mailman (input) for mailman id 499256;
 Wed, 22 Feb 2023 08: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 1pUkDi-0005mQ-Bc
 for xen-changelog@lists.xenproject.org; Wed, 22 Feb 2023 08:11:22 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pUkDi-0003lP-Aw
 for xen-changelog@lists.xenproject.org; Wed, 22 Feb 2023 08:11:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pUkDi-000052-A2
 for xen-changelog@lists.xenproject.org; Wed, 22 Feb 2023 08:11:22 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=CJJAQszyIIApbY645r1xgg1TGiiYvyat+x7K/XSeztM=; b=1qVuRaH25+JTrr2UNj2VNJ+E57
	8W5DrDWqgNkK7JKHdMenwUYybk9ra0rQ9oHcscMFeTDhjm92Kg5usc6a5pdrgAMTMQSLNpKvUrGA2
	g6qvPF+oN9SG3ULgXuGE1PplXJs3AhktScchfDPVWaGO0A6+5P7030wZHJ+ClcddxtTU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/ucode/AMD: apply the patch early on every logical thread
Message-Id: <E1pUkDi-000052-A2@xenbits.xenproject.org>
Date: Wed, 22 Feb 2023 08:11:22 +0000

commit f4ef8a41b80831db2136bdaff9f946a1a4b051e7
Author:     Sergey Dyasli <sergey.dyasli@citrix.com>
AuthorDate: Tue Feb 21 15:08:05 2023 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Feb 21 15:08:05 2023 +0100

    x86/ucode/AMD: apply the patch early on every logical thread
    
    The original issue has been reported on AMD Bulldozer-based CPUs where
    ucode loading loses the LWP feature bit in order to gain the IBPB bit.
    LWP disabling is per-SMT/CMT core modification and needs to happen on
    each sibling thread despite the shared microcode engine. Otherwise,
    logical CPUs will end up with different cpuid capabilities.
    Link: https://bugzilla.kernel.org/show_bug.cgi?id=216211
    
    Guests running under Xen happen to be not affected because of levelling
    logic for the feature masking/override MSRs which causes the LWP bit to
    fall out and hides the issue. The latest recommendation from AMD, after
    discussing this bug, is to load ucode on every logical CPU.
    
    In Linux kernel this issue has been addressed by e7ad18d1169c
    ("x86/microcode/AMD: Apply the patch early on every logical thread").
    Follow the same approach in Xen.
    
    Introduce SAME_UCODE match result and use it for early AMD ucode
    loading. Take this opportunity and move opt_ucode_allow_same out of
    compare_revisions() to the relevant callers and also modify the warning
    message based on it. Intel's side of things is modified for consistency
    but provides no functional change.
    
    Signed-off-by: Sergey Dyasli <sergey.dyasli@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/cpu/microcode/amd.c     | 11 ++++++++---
 xen/arch/x86/cpu/microcode/core.c    | 26 +++++++++++++++++---------
 xen/arch/x86/cpu/microcode/intel.c   | 10 +++++++---
 xen/arch/x86/cpu/microcode/private.h |  3 ++-
 4 files changed, 34 insertions(+), 16 deletions(-)

diff --git a/xen/arch/x86/cpu/microcode/amd.c b/xen/arch/x86/cpu/microcode/amd.c
index 4b097187a0..a9a5557835 100644
--- a/xen/arch/x86/cpu/microcode/amd.c
+++ b/xen/arch/x86/cpu/microcode/amd.c
@@ -176,8 +176,8 @@ static enum microcode_match_result compare_revisions(
     if ( new_rev > old_rev )
         return NEW_UCODE;
 
-    if ( opt_ucode_allow_same && new_rev == old_rev )
-        return NEW_UCODE;
+    if ( new_rev == old_rev )
+        return SAME_UCODE;
 
     return OLD_UCODE;
 }
@@ -220,8 +220,13 @@ static int cf_check apply_microcode(const struct microcode_patch *patch)
     unsigned int cpu = smp_processor_id();
     struct cpu_signature *sig = &per_cpu(cpu_sig, cpu);
     uint32_t rev, old_rev = sig->rev;
+    enum microcode_match_result result = microcode_fits(patch);
 
-    if ( microcode_fits(patch) != NEW_UCODE )
+    /*
+     * Allow application of the same revision to pick up SMT-specific changes
+     * even if the revision of the other SMT thread is already up-to-date.
+     */
+    if ( result != NEW_UCODE && result != SAME_UCODE )
         return -EINVAL;
 
     if ( check_final_patch_levels(sig) )
diff --git a/xen/arch/x86/cpu/microcode/core.c b/xen/arch/x86/cpu/microcode/core.c
index d14754e222..ba6e7b42c6 100644
--- a/xen/arch/x86/cpu/microcode/core.c
+++ b/xen/arch/x86/cpu/microcode/core.c
@@ -612,17 +612,25 @@ static long cf_check microcode_update_helper(void *data)
      * that ucode revision.
      */
     spin_lock(&microcode_mutex);
-    if ( microcode_cache &&
-         alternative_call(ucode_ops.compare_patch,
-                          patch, microcode_cache) != NEW_UCODE )
+    if ( microcode_cache )
     {
-        spin_unlock(&microcode_mutex);
-        printk(XENLOG_WARNING "microcode: couldn't find any newer revision "
-                              "in the provided blob!\n");
-        microcode_free_patch(patch);
-        ret = -ENOENT;
+        enum microcode_match_result result;
 
-        goto put;
+        result = alternative_call(ucode_ops.compare_patch, patch,
+                                  microcode_cache);
+
+        if ( result != NEW_UCODE &&
+             !(opt_ucode_allow_same && result == SAME_UCODE) )
+        {
+            spin_unlock(&microcode_mutex);
+            printk(XENLOG_WARNING
+                   "microcode: couldn't find any newer%s revision in the provided blob!\n",
+                   opt_ucode_allow_same ? " (or the same)" : "");
+            microcode_free_patch(patch);
+            ret = -ENOENT;
+
+            goto put;
+        }
     }
     spin_unlock(&microcode_mutex);
 
diff --git a/xen/arch/x86/cpu/microcode/intel.c b/xen/arch/x86/cpu/microcode/intel.c
index f7fec4b4ed..8d4d6574aa 100644
--- a/xen/arch/x86/cpu/microcode/intel.c
+++ b/xen/arch/x86/cpu/microcode/intel.c
@@ -232,8 +232,8 @@ static enum microcode_match_result compare_revisions(
     if ( new_rev > old_rev )
         return NEW_UCODE;
 
-    if ( opt_ucode_allow_same && new_rev == old_rev )
-        return NEW_UCODE;
+    if ( new_rev == old_rev )
+        return SAME_UCODE;
 
     /*
      * Treat pre-production as always applicable - anyone using pre-production
@@ -290,8 +290,12 @@ static int cf_check apply_microcode(const struct microcode_patch *patch)
     unsigned int cpu = smp_processor_id();
     struct cpu_signature *sig = &this_cpu(cpu_sig);
     uint32_t rev, old_rev = sig->rev;
+    enum microcode_match_result result;
+
+    result = microcode_update_match(patch);
 
-    if ( microcode_update_match(patch) != NEW_UCODE )
+    if ( result != NEW_UCODE &&
+         !(opt_ucode_allow_same && result == SAME_UCODE) )
         return -EINVAL;
 
     wbinvd();
diff --git a/xen/arch/x86/cpu/microcode/private.h b/xen/arch/x86/cpu/microcode/private.h
index 73b095d5bf..626aeb4d08 100644
--- a/xen/arch/x86/cpu/microcode/private.h
+++ b/xen/arch/x86/cpu/microcode/private.h
@@ -6,7 +6,8 @@
 extern bool opt_ucode_allow_same;
 
 enum microcode_match_result {
-    OLD_UCODE, /* signature matched, but revision id is older or equal */
+    OLD_UCODE, /* signature matched, but revision id is older */
+    SAME_UCODE, /* signature matched, but revision id is the same */
     NEW_UCODE, /* signature matched, but revision id is newer */
     MIS_UCODE, /* signature mismatched */
 };
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Feb 22 08:11:33 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 22 Feb 2023 08:11:33 +0000
Received: from list by lists.xenproject.org with outflank-mailman.499257.770315 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pUkDt-0005q6-Ga; Wed, 22 Feb 2023 08:11:33 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 499257.770315; Wed, 22 Feb 2023 08:11:33 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pUkDt-0005py-Dq; Wed, 22 Feb 2023 08:11:33 +0000
Received: by outflank-mailman (input) for mailman id 499257;
 Wed, 22 Feb 2023 08: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 1pUkDs-0005pn-Ed
 for xen-changelog@lists.xenproject.org; Wed, 22 Feb 2023 08:11:32 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pUkDs-0003lg-Du
 for xen-changelog@lists.xenproject.org; Wed, 22 Feb 2023 08:11:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pUkDs-00005S-D7
 for xen-changelog@lists.xenproject.org; Wed, 22 Feb 2023 08:11:32 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=k1K4FkLZ6Zta+eTLffJfQOF8OIpScuY3KdvTZVtvfYw=; b=BSwv6Afkh3IGg968KlYXJ1wsg3
	7uZyGgcLXjfwg79BfxSJ90oWNUtHbX0W0+4lvSTZWHOyOgMADR+UB5lj3zOf7quzmg+cHAYFfj9y4
	sdBf0gI43ryqSgDBNyquILh5KmWIUQ3nbQQ//K6Xd0m5WetlNK8G8+C5Y2Q2+uHnot6k=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/MSI: use standard C types in structures/unions
Message-Id: <E1pUkDs-00005S-D7@xenbits.xenproject.org>
Date: Wed, 22 Feb 2023 08:11:32 +0000

commit d58f3941ce3f8943df842fab2d4d761c483af6c4
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Feb 21 15:08:38 2023 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Feb 21 15:08:38 2023 +0100

    x86/MSI: use standard C types in structures/unions
    
    Consolidate this to use exclusively standard types, and change
    indentation style to Xen's there at the same time (the file already had
    a mix of styles).
    
    While there
    - switch boolean fields to use bool,
    - drop the notion of big-endian bitfields being a thing on x86,
    - drop the names for reserved fields,
    - adjust the comment on "dest32".
    
    No functional change intended.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/include/asm/msi.h | 134 +++++++++++++++++------------------------
 1 file changed, 56 insertions(+), 78 deletions(-)

diff --git a/xen/arch/x86/include/asm/msi.h b/xen/arch/x86/include/asm/msi.h
index fe670895ee..ec77c66642 100644
--- a/xen/arch/x86/include/asm/msi.h
+++ b/xen/arch/x86/include/asm/msi.h
@@ -66,15 +66,15 @@ struct msi_info {
 };
 
 struct msi_msg {
-	union {
-		u64	address; /* message address */
-		struct {
-			u32	address_lo; /* message address low 32 bits */
-			u32	address_hi; /* message address high 32 bits */
-		};
-	};
-	u32	data;		/* 16 bits of msi message data */
-	u32	dest32;		/* used when Interrupt Remapping with EIM is enabled */
+    union {
+        uint64_t address; /* message address */
+        struct {
+            uint32_t address_lo; /* message address low 32 bits */
+            uint32_t address_hi; /* message address high 32 bits */
+        };
+    };
+    uint32_t data;        /* 16 bits of msi message data */
+    uint32_t dest32;      /* used when Interrupt Remapping is enabled */
 };
 
 struct irq_desc;
@@ -94,35 +94,35 @@ extern int pci_restore_msi_state(struct pci_dev *pdev);
 extern int pci_reset_msix_state(struct pci_dev *pdev);
 
 struct msi_desc {
-	struct msi_attrib {
-		__u8	type;		/* {0: unused, 5h:MSI, 11h:MSI-X} */
-		__u8	pos;		/* Location of the MSI capability */
-		__u8	maskbit	: 1;	/* mask/pending bit supported ?   */
-		__u8	is_64	: 1;	/* Address size: 0=32bit 1=64bit  */
-		__u8	host_masked : 1;
-		__u8	guest_masked : 1;
-		__u16	entry_nr;	/* specific enabled entry 	  */
-	} msi_attrib;
-
-	bool irte_initialized;
-	uint8_t gvec;			/* guest vector. valid when pi_desc isn't NULL */
-	const struct pi_desc *pi_desc;	/* pointer to posted descriptor */
-
-	struct list_head list;
-
-	union {
-		void __iomem *mask_base;/* va for the entry in mask table */
-		struct {
-			unsigned int nvec;/* number of vectors            */
-			unsigned int mpos;/* location of mask register    */
-		} msi;
-		unsigned int hpet_id;   /* HPET (dev is NULL)             */
-	};
-	struct pci_dev *dev;
-	int irq;
-	int remap_index;		/* index in interrupt remapping table */
-
-	struct msi_msg msg;		/* Last set MSI message */
+    struct msi_attrib {
+        uint8_t type;        /* {0: unused, 5h:MSI, 11h:MSI-X} */
+        uint8_t pos;         /* Location of the MSI capability */
+        bool maskbit      : 1; /* mask/pending bit supported ?   */
+        bool is_64        : 1; /* Address size: 0=32bit 1=64bit  */
+        bool host_masked  : 1;
+        bool guest_masked : 1;
+        uint16_t entry_nr;   /* specific enabled entry */
+    } msi_attrib;
+
+    bool irte_initialized;
+    uint8_t gvec;            /* guest vector. valid when pi_desc isn't NULL */
+    const struct pi_desc *pi_desc; /* pointer to posted descriptor */
+
+    struct list_head list;
+
+    union {
+        void __iomem *mask_base; /* va for the entry in mask table */
+        struct {
+            unsigned int nvec; /* number of vectors */
+            unsigned int mpos; /* location of mask register */
+        } msi;
+        unsigned int hpet_id; /* HPET (dev is NULL) */
+    };
+    struct pci_dev *dev;
+    int irq;
+    int remap_index;         /* index in interrupt remapping table */
+
+    struct msi_msg msg;      /* Last set MSI message */
 };
 
 /*
@@ -179,49 +179,27 @@ int msi_free_irq(struct msi_desc *entry);
  */
 
 struct __packed msg_data {
-#if defined(__LITTLE_ENDIAN_BITFIELD)
-	__u32	vector		:  8;
-	__u32	delivery_mode	:  3;	/* 000b: FIXED | 001b: lowest prior */
-	__u32	reserved_1	:  3;
-	__u32	level		:  1;	/* 0: deassert | 1: assert */
-	__u32	trigger		:  1;	/* 0: edge | 1: level */
-	__u32	reserved_2	: 16;
-#elif defined(__BIG_ENDIAN_BITFIELD)
-	__u32	reserved_2	: 16;
-	__u32	trigger		:  1;	/* 0: edge | 1: level */
-	__u32	level		:  1;	/* 0: deassert | 1: assert */
-	__u32	reserved_1	:  3;
-	__u32	delivery_mode	:  3;	/* 000b: FIXED | 001b: lowest prior */
-	__u32	vector		:  8;
-#else
-#error "Bitfield endianness not defined! Check your byteorder.h"
-#endif
+    uint32_t vector        :  8;
+    uint32_t delivery_mode :  3;    /* 000b: FIXED | 001b: lowest prior */
+    uint32_t               :  3;
+    bool level             :  1;    /* 0: deassert | 1: assert */
+    bool trigger           :  1;    /* 0: edge | 1: level */
+    uint32_t               : 16;
 };
 
 struct __packed msg_address {
-	union {
-		struct {
-#if defined(__LITTLE_ENDIAN_BITFIELD)
-			__u32	reserved_1	:  2;
-			__u32	dest_mode	:  1;	/*0:physic | 1:logic */
-			__u32	redirection_hint:  1;  	/*0: dedicated CPU
-							  1: lowest priority */
-			__u32	reserved_2	:  4;
- 			__u32	dest_id		: 24;	/* Destination ID */
-#elif defined(__BIG_ENDIAN_BITFIELD)
- 			__u32	dest_id		: 24;	/* Destination ID */
-			__u32	reserved_2	:  4;
-			__u32	redirection_hint:  1;  	/*0: dedicated CPU
-							  1: lowest priority */
-			__u32	dest_mode	:  1;	/*0:physic | 1:logic */
-			__u32	reserved_1	:  2;
-#else
-#error "Bitfield endianness not defined! Check your byteorder.h"
-#endif
-      		}u;
-       		__u32  value;
-	}lo_address;
-	__u32 	hi_address;
+    union {
+        struct {
+            uint32_t              :  2;
+            bool dest_mode        :  1; /* 0:phys | 1:logic */
+            bool redirection_hint :  1; /* 0: dedicated CPU
+                                           1: lowest priority */
+            uint32_t              :  4;
+            uint32_t dest_id      : 24; /* Destination ID */
+        } u;
+        uint32_t value;
+    } lo_address;
+    uint32_t hi_address;
 };
 
 #define MAX_MSIX_TABLE_ENTRIES  (PCI_MSIX_FLAGS_QSIZE + 1)
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Feb 22 08:11:44 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 22 Feb 2023 08:11:44 +0000
Received: from list by lists.xenproject.org with outflank-mailman.499258.770319 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pUkE3-0005tD-JT; Wed, 22 Feb 2023 08:11:43 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 499258.770319; Wed, 22 Feb 2023 08:11:43 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pUkE3-0005t5-Gp; Wed, 22 Feb 2023 08:11:43 +0000
Received: by outflank-mailman (input) for mailman id 499258;
 Wed, 22 Feb 2023 08: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 1pUkE2-0005sx-Hm
 for xen-changelog@lists.xenproject.org; Wed, 22 Feb 2023 08:11:42 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pUkE2-0003mA-H1
 for xen-changelog@lists.xenproject.org; Wed, 22 Feb 2023 08:11:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pUkE2-00005u-GA
 for xen-changelog@lists.xenproject.org; Wed, 22 Feb 2023 08:11:42 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Zdf9at5uOEMCHBTTVrsiPu88/SE52Ni+URABiNj1tKI=; b=jIPXcfMdwFJiOaQOVdm+mAZ08d
	UygarKKTxTx+OmPrwYBJnJepjrTRpjxliyuZAnI6GOyCrifgE7r131beGxX8Nugd1jOLJaFffoFUC
	ZSk73aHCesdOGRZo1ehrUdlYim2A6IMhQ9X2ByX1FomTceqRl8J7Bp+o6edlIVDzxZhQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/svm: Remove regs param from asm-called functions
Message-Id: <E1pUkE2-00005u-GA@xenbits.xenproject.org>
Date: Wed, 22 Feb 2023 08:11:42 +0000

commit c76e4ff7d531ee2bf37c9d4037c8645f9e586fcd
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Wed Aug 10 21:25:52 2022 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Feb 21 15:00:32 2023 +0000

    x86/svm: Remove regs param from asm-called functions
    
    It is easier just to make the functions void and let the compiler do the (not
    very) hard work.
    
    Passing regs is a bit weird for HVM guests anyway, because the resulting
    pointer is invariant (this isn't native exception handling where the regs
    pointers *are* important), and all functions calculate current themselves
    which is another invariant.
    
    Finally, the compiler can merge the get_cpu_info() calculation which is common
    to both current and guest_cpu_user_regs(), meaning the delta in C really is
    just one LEA, and not any more expensive than MOV's in ASM anyway.
    
    No functional change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/hvm/svm/entry.S     | 3 ---
 xen/arch/x86/hvm/svm/nestedsvm.c | 3 ++-
 xen/arch/x86/hvm/svm/svm.c       | 6 ++++--
 3 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/xen/arch/x86/hvm/svm/entry.S b/xen/arch/x86/hvm/svm/entry.S
index 981cd82e7c..ad582f54b3 100644
--- a/xen/arch/x86/hvm/svm/entry.S
+++ b/xen/arch/x86/hvm/svm/entry.S
@@ -28,7 +28,6 @@ ENTRY(svm_asm_do_resume)
         GET_CURRENT(bx)
 .Lsvm_do_resume:
         call svm_intr_assist
-        mov  %rsp,%rdi
         call nsvm_vcpu_switch
         ASSERT_NOT_IN_ATOMIC
 
@@ -54,7 +53,6 @@ UNLIKELY_START(ne, nsvm_hap)
         jmp  .Lsvm_do_resume
 __UNLIKELY_END(nsvm_hap)
 
-        mov  %rsp, %rdi
         call svm_vmenter_helper
 
         clgi
@@ -134,7 +132,6 @@ __UNLIKELY_END(nsvm_hap)
          */
         stgi
 GLOBAL(svm_stgi_label)
-        mov  %rsp,%rdi
         call svm_vmexit_handler
         jmp  .Lsvm_do_resume
 
diff --git a/xen/arch/x86/hvm/svm/nestedsvm.c b/xen/arch/x86/hvm/svm/nestedsvm.c
index 9f5f35f16a..77f7547360 100644
--- a/xen/arch/x86/hvm/svm/nestedsvm.c
+++ b/xen/arch/x86/hvm/svm/nestedsvm.c
@@ -1460,8 +1460,9 @@ nestedsvm_vcpu_vmexit(struct vcpu *v, struct cpu_user_regs *regs,
 }
 
 /* VCPU switch */
-void nsvm_vcpu_switch(struct cpu_user_regs *regs)
+void nsvm_vcpu_switch(void)
 {
+    struct cpu_user_regs *regs = guest_cpu_user_regs();
     struct vcpu *v = current;
     struct nestedvcpu *nv;
     struct nestedsvm *svm;
diff --git a/xen/arch/x86/hvm/svm/svm.c b/xen/arch/x86/hvm/svm/svm.c
index f412b537aa..9c43227b76 100644
--- a/xen/arch/x86/hvm/svm/svm.c
+++ b/xen/arch/x86/hvm/svm/svm.c
@@ -1055,8 +1055,9 @@ static void noreturn cf_check svm_do_resume(void)
     reset_stack_and_jump(svm_asm_do_resume);
 }
 
-void svm_vmenter_helper(const struct cpu_user_regs *regs)
+void svm_vmenter_helper(void)
 {
+    const struct cpu_user_regs *regs = guest_cpu_user_regs();
     struct vcpu *curr = current;
     struct vmcb_struct *vmcb = curr->arch.hvm.svm.vmcb;
 
@@ -2585,8 +2586,9 @@ const struct hvm_function_table * __init start_svm(void)
     return &svm_function_table;
 }
 
-void svm_vmexit_handler(struct cpu_user_regs *regs)
+void svm_vmexit_handler(void)
 {
+    struct cpu_user_regs *regs = guest_cpu_user_regs();
     uint64_t exit_reason;
     struct vcpu *v = current;
     struct vmcb_struct *vmcb = v->arch.hvm.svm.vmcb;
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Feb 23 04:33:09 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 23 Feb 2023 04:33:09 +0000
Received: from list by lists.xenproject.org with outflank-mailman.499849.771124 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pV3Hy-0007tD-Ef; Thu, 23 Feb 2023 04:33:02 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 499849.771124; Thu, 23 Feb 2023 04: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 1pV3Hy-0007t5-Be; Thu, 23 Feb 2023 04:33:02 +0000
Received: by outflank-mailman (input) for mailman id 499849;
 Thu, 23 Feb 2023 04: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 1pV3Hy-0007sx-1e
 for xen-changelog@lists.xenproject.org; Thu, 23 Feb 2023 04:33:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pV3Hx-0007xU-VQ
 for xen-changelog@lists.xenproject.org; Thu, 23 Feb 2023 04:33:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pV3Hx-0007Aa-US
 for xen-changelog@lists.xenproject.org; Thu, 23 Feb 2023 04:33:01 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Ncmtx4Ui9qn6cjjaWzknGHcSYVvYiJVxLlTAorxQpNI=; b=jnOeh++jvXqPb8/ntey0H6KGA8
	jtE+RA2JKMTPXXB7mS9vQ6rx+/HhycEndA6GekB5QZZG1quAsTGXuIllgAnxDp59cZMy6EzKcAZhB
	OWIlLQzc+HDAhxskwJqgV9T6FIgwFqDrKPKzVCpVY2A3bBQ5simlK8U2AySwrh4KdjA0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.15] automation: Remove clang-8 from Debian unstable container
Message-Id: <E1pV3Hx-0007Aa-US@xenbits.xenproject.org>
Date: Thu, 23 Feb 2023 04:33:01 +0000

commit fa875574b73618daf3bc70e6ff4d342493fa11d9
Author:     Anthony PERARD <anthony.perard@citrix.com>
AuthorDate: Tue Feb 21 16:55:38 2023 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Wed Feb 22 14:14:34 2023 +0000

    automation: Remove clang-8 from Debian unstable container
    
    First, apt complain that it isn't the right way to add keys anymore,
    but hopefully that's just a warning.
    
    Second, we can't install clang-8:
    The following packages have unmet dependencies:
     clang-8 : Depends: libstdc++-8-dev but it is not installable
               Depends: libgcc-8-dev but it is not installable
               Depends: libobjc-8-dev but it is not installable
               Recommends: llvm-8-dev but it is not going to be installed
               Recommends: libomp-8-dev but it is not going to be installed
     libllvm8 : Depends: libffi7 (>= 3.3~20180313) but it is not installable
    E: Unable to correct problems, you have held broken packages.
    
    clang on Debian unstable is now version 14.0.6.
    
    Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
    (cherry picked from commit a6b1e2b80fe2053b1c9c9843fb086a668513ea36)
---
 automation/build/debian/unstable-llvm-8.list |  3 ---
 automation/build/debian/unstable.dockerfile  | 12 ------------
 automation/gitlab-ci/build.yaml              | 10 ----------
 3 files changed, 25 deletions(-)

diff --git a/automation/build/debian/unstable-llvm-8.list b/automation/build/debian/unstable-llvm-8.list
deleted file mode 100644
index dc119fa0b4..0000000000
--- a/automation/build/debian/unstable-llvm-8.list
+++ /dev/null
@@ -1,3 +0,0 @@
-# Unstable LLVM 8 repos
-deb http://apt.llvm.org/unstable/ llvm-toolchain-8 main
-deb-src http://apt.llvm.org/unstable/ llvm-toolchain-8 main
diff --git a/automation/build/debian/unstable.dockerfile b/automation/build/debian/unstable.dockerfile
index 9a10ee08d6..1200245c9b 100644
--- a/automation/build/debian/unstable.dockerfile
+++ b/automation/build/debian/unstable.dockerfile
@@ -51,15 +51,3 @@ RUN apt-get update && \
         apt-get autoremove -y && \
         apt-get clean && \
         rm -rf /var/lib/apt/lists* /tmp/* /var/tmp/*
-
-RUN wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key|apt-key add -
-COPY unstable-llvm-8.list /etc/apt/sources.list.d/
-
-RUN apt-get update && \
-    apt-get --quiet --yes install \
-        clang-8 \
-        lld-8 \
-        && \
-        apt-get autoremove -y && \
-        apt-get clean && \
-        rm -rf /var/lib/apt/lists* /tmp/* /var/tmp/*
diff --git a/automation/gitlab-ci/build.yaml b/automation/gitlab-ci/build.yaml
index 23ab81d892..6cca2122aa 100644
--- a/automation/gitlab-ci/build.yaml
+++ b/automation/gitlab-ci/build.yaml
@@ -276,16 +276,6 @@ debian-unstable-clang-debug:
   variables:
     CONTAINER: debian:unstable
 
-debian-unstable-clang-8:
-  extends: .clang-8-x86-64-build
-  variables:
-    CONTAINER: debian:unstable
-
-debian-unstable-clang-8-debug:
-  extends: .clang-8-x86-64-build-debug
-  variables:
-    CONTAINER: debian:unstable
-
 debian-unstable-gcc:
   extends: .gcc-x86-64-build
   variables:
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.15


From xen-changelog-bounces@lists.xenproject.org Thu Feb 23 16:11:08 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 23 Feb 2023 16:11:08 +0000
Received: from list by lists.xenproject.org with outflank-mailman.500574.772020 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pVEBT-0006gk-B2; Thu, 23 Feb 2023 16:11:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 500574.772020; Thu, 23 Feb 2023 16:11:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pVEBT-0006gc-87; Thu, 23 Feb 2023 16:11:03 +0000
Received: by outflank-mailman (input) for mailman id 500574;
 Thu, 23 Feb 2023 16: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 1pVEBS-0006gS-B7
 for xen-changelog@lists.xenproject.org; Thu, 23 Feb 2023 16:11:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pVEBS-0001NY-AA
 for xen-changelog@lists.xenproject.org; Thu, 23 Feb 2023 16:11:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pVEBS-00050Z-9A
 for xen-changelog@lists.xenproject.org; Thu, 23 Feb 2023 16:11:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=ruCHPvDAlHZzk0N1g8lR1PUbHeKLJ3FEQd1Pl34+H74=; b=Uq7YeLwP0kNo//GD2qfUsuuwTd
	EIC3PQjjwqzMjwcnHQG/ouuxdyzsLfwLInTeEo/b1CS+nUkfr/GrcsnPIcSuKeASpCpUbRaZDukhF
	MPGRDdHuJQGG0hN9nmwMGpvu4E4pTD5lB2fzwyAUBJmbyasNfIxKsOV7mKRXtwaKV11o=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/Hyper-V: use standard C types in hyperv-tlfs.h
Message-Id: <E1pVEBS-00050Z-9A@xenbits.xenproject.org>
Date: Thu, 23 Feb 2023 16:11:02 +0000

commit 43ae13269eb42b3425bb72b5c0b6dae9a06ad3aa
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Wed Feb 22 13:48:44 2023 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Feb 22 13:48:44 2023 +0100

    x86/Hyper-V: use standard C types in hyperv-tlfs.h
    
    This is the only file left with a use of an __s<N> type coming from
    Linux. Since the file has been using an apparently random mix of all
    three classes of fixed-width types (__{s,u}<N>, {s,u}<N>, and
    {,u}int<N>_t), consolidate this to use exclusively standard types.
    
    No functional change intended.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/include/asm/guest/hyperv-tlfs.h | 558 +++++++++++++--------------
 1 file changed, 279 insertions(+), 279 deletions(-)

diff --git a/xen/arch/x86/include/asm/guest/hyperv-tlfs.h b/xen/arch/x86/include/asm/guest/hyperv-tlfs.h
index 03b71af82f..38f997a0c8 100644
--- a/xen/arch/x86/include/asm/guest/hyperv-tlfs.h
+++ b/xen/arch/x86/include/asm/guest/hyperv-tlfs.h
@@ -283,11 +283,11 @@
  * Declare the MSR used to setup pages used to communicate with the hypervisor.
  */
 union hv_x64_msr_hypercall_contents {
-	u64 as_uint64;
+	uint64_t as_uint64;
 	struct {
-		u64 enable:1;
-		u64 reserved:11;
-		u64 guest_physical_address:52;
+		uint64_t enable:1;
+		uint64_t reserved:11;
+		uint64_t guest_physical_address:52;
 	};
 };
 
@@ -295,11 +295,11 @@ union hv_x64_msr_hypercall_contents {
  * TSC page layout.
  */
 struct ms_hyperv_tsc_page {
-	volatile u32 tsc_sequence;
-	u32 reserved1;
-	volatile u64 tsc_scale;
-	volatile s64 tsc_offset;
-	u64 reserved2[509];
+	volatile uint32_t tsc_sequence;
+	uint32_t reserved1;
+	volatile uint64_t tsc_scale;
+	volatile int64_t tsc_offset;
+	uint64_t reserved2[509];
 };
 
 /*
@@ -343,21 +343,21 @@ union hv_guest_os_id
 };
 
 struct hv_reenlightenment_control {
-	__u64 vector:8;
-	__u64 reserved1:8;
-	__u64 enabled:1;
-	__u64 reserved2:15;
-	__u64 target_vp:32;
+	uint64_t vector:8;
+	uint64_t reserved1:8;
+	uint64_t enabled:1;
+	uint64_t reserved2:15;
+	uint64_t target_vp:32;
 };
 
 struct hv_tsc_emulation_control {
-	__u64 enabled:1;
-	__u64 reserved:63;
+	uint64_t enabled:1;
+	uint64_t reserved:63;
 };
 
 struct hv_tsc_emulation_status {
-	__u64 inprogress:1;
-	__u64 reserved:63;
+	uint64_t inprogress:1;
+	uint64_t reserved:63;
 };
 
 #define HV_X64_MSR_HYPERCALL_ENABLE		0x00000001
@@ -442,10 +442,10 @@ enum HV_GENERIC_SET_FORMAT {
 #define HV_CLOCK_HZ (NSEC_PER_SEC/100)
 
 typedef struct _HV_REFERENCE_TSC_PAGE {
-	__u32 tsc_sequence;
-	__u32 res1;
-	__u64 tsc_scale;
-	__s64 tsc_offset;
+	uint32_t tsc_sequence;
+	uint32_t res1;
+	uint64_t tsc_scale;
+	int64_t tsc_offset;
 } HV_REFERENCE_TSC_PAGE, *PHV_REFERENCE_TSC_PAGE;
 
 /* Define the number of synthetic interrupt sources. */
@@ -499,30 +499,30 @@ enum hv_message_type {
 
 /* Define synthetic interrupt controller message flags. */
 union hv_message_flags {
-	__u8 asu8;
+	uint8_t asu8;
 	struct {
-		__u8 msg_pending:1;
-		__u8 reserved:7;
+		uint8_t msg_pending:1;
+		uint8_t reserved:7;
 	};
 };
 
 /* Define port identifier type. */
 union hv_port_id {
-	__u32 asu32;
+	uint32_t asu32;
 	struct {
-		__u32 id:24;
-		__u32 reserved:8;
+		uint32_t id:24;
+		uint32_t reserved:8;
 	} u;
 };
 
 /* Define synthetic interrupt controller message header. */
 struct hv_message_header {
-	__u32 message_type;
-	__u8 payload_size;
+	uint32_t message_type;
+	uint8_t payload_size;
 	union hv_message_flags message_flags;
-	__u8 reserved[2];
+	uint8_t reserved[2];
 	union {
-		__u64 sender;
+		uint64_t sender;
 		union hv_port_id port;
 	};
 };
@@ -531,7 +531,7 @@ struct hv_message_header {
 struct hv_message {
 	struct hv_message_header header;
 	union {
-		__u64 payload[HV_MESSAGE_PAYLOAD_QWORD_COUNT];
+		uint64_t payload[HV_MESSAGE_PAYLOAD_QWORD_COUNT];
 	} u;
 };
 
@@ -542,19 +542,19 @@ struct hv_message_page {
 
 /* Define timer message payload structure. */
 struct hv_timer_message_payload {
-	__u32 timer_index;
-	__u32 reserved;
-	__u64 expiration_time;	/* When the timer expired */
-	__u64 delivery_time;	/* When the message was delivered */
+	uint32_t timer_index;
+	uint32_t reserved;
+	uint64_t expiration_time; /* When the timer expired */
+	uint64_t delivery_time;   /* When the message was delivered */
 };
 
 struct hv_nested_enlightenments_control {
 	struct {
-		__u32 directhypercall:1;
-		__u32 reserved:31;
+		uint32_t directhypercall:1;
+		uint32_t reserved:31;
 	} features;
 	struct {
-		__u32 reserved;
+		uint32_t reserved;
 	} hypercallControls;
 };
 
@@ -571,199 +571,199 @@ union hv_vp_assist_page_msr
 
 /* Define virtual processor assist page structure. */
 struct hv_vp_assist_page {
-	__u32 apic_assist;
-	__u32 reserved1;
-	__u64 vtl_control[3];
+	uint32_t apic_assist;
+	uint32_t reserved1;
+	uint64_t vtl_control[3];
 	struct hv_nested_enlightenments_control nested_control;
-	__u8 enlighten_vmentry;
-	__u8 reserved2[7];
-	__u64 current_nested_vmcs;
+	uint8_t enlighten_vmentry;
+	uint8_t reserved2[7];
+	uint64_t current_nested_vmcs;
 };
 
 struct hv_enlightened_vmcs {
-	u32 revision_id;
-	u32 abort;
-
-	u16 host_es_selector;
-	u16 host_cs_selector;
-	u16 host_ss_selector;
-	u16 host_ds_selector;
-	u16 host_fs_selector;
-	u16 host_gs_selector;
-	u16 host_tr_selector;
-
-	u16 padding16_1;
-
-	u64 host_ia32_pat;
-	u64 host_ia32_efer;
-
-	u64 host_cr0;
-	u64 host_cr3;
-	u64 host_cr4;
-
-	u64 host_ia32_sysenter_esp;
-	u64 host_ia32_sysenter_eip;
-	u64 host_rip;
-	u32 host_ia32_sysenter_cs;
-
-	u32 pin_based_vm_exec_control;
-	u32 vm_exit_controls;
-	u32 secondary_vm_exec_control;
-
-	u64 io_bitmap_a;
-	u64 io_bitmap_b;
-	u64 msr_bitmap;
-
-	u16 guest_es_selector;
-	u16 guest_cs_selector;
-	u16 guest_ss_selector;
-	u16 guest_ds_selector;
-	u16 guest_fs_selector;
-	u16 guest_gs_selector;
-	u16 guest_ldtr_selector;
-	u16 guest_tr_selector;
-
-	u32 guest_es_limit;
-	u32 guest_cs_limit;
-	u32 guest_ss_limit;
-	u32 guest_ds_limit;
-	u32 guest_fs_limit;
-	u32 guest_gs_limit;
-	u32 guest_ldtr_limit;
-	u32 guest_tr_limit;
-	u32 guest_gdtr_limit;
-	u32 guest_idtr_limit;
-
-	u32 guest_es_ar_bytes;
-	u32 guest_cs_ar_bytes;
-	u32 guest_ss_ar_bytes;
-	u32 guest_ds_ar_bytes;
-	u32 guest_fs_ar_bytes;
-	u32 guest_gs_ar_bytes;
-	u32 guest_ldtr_ar_bytes;
-	u32 guest_tr_ar_bytes;
-
-	u64 guest_es_base;
-	u64 guest_cs_base;
-	u64 guest_ss_base;
-	u64 guest_ds_base;
-	u64 guest_fs_base;
-	u64 guest_gs_base;
-	u64 guest_ldtr_base;
-	u64 guest_tr_base;
-	u64 guest_gdtr_base;
-	u64 guest_idtr_base;
-
-	u64 padding64_1[3];
-
-	u64 vm_exit_msr_store_addr;
-	u64 vm_exit_msr_load_addr;
-	u64 vm_entry_msr_load_addr;
-
-	u64 cr3_target_value0;
-	u64 cr3_target_value1;
-	u64 cr3_target_value2;
-	u64 cr3_target_value3;
-
-	u32 page_fault_error_code_mask;
-	u32 page_fault_error_code_match;
-
-	u32 cr3_target_count;
-	u32 vm_exit_msr_store_count;
-	u32 vm_exit_msr_load_count;
-	u32 vm_entry_msr_load_count;
-
-	u64 tsc_offset;
-	u64 virtual_apic_page_addr;
-	u64 vmcs_link_pointer;
-
-	u64 guest_ia32_debugctl;
-	u64 guest_ia32_pat;
-	u64 guest_ia32_efer;
-
-	u64 guest_pdptr0;
-	u64 guest_pdptr1;
-	u64 guest_pdptr2;
-	u64 guest_pdptr3;
-
-	u64 guest_pending_dbg_exceptions;
-	u64 guest_sysenter_esp;
-	u64 guest_sysenter_eip;
-
-	u32 guest_activity_state;
-	u32 guest_sysenter_cs;
-
-	u64 cr0_guest_host_mask;
-	u64 cr4_guest_host_mask;
-	u64 cr0_read_shadow;
-	u64 cr4_read_shadow;
-	u64 guest_cr0;
-	u64 guest_cr3;
-	u64 guest_cr4;
-	u64 guest_dr7;
-
-	u64 host_fs_base;
-	u64 host_gs_base;
-	u64 host_tr_base;
-	u64 host_gdtr_base;
-	u64 host_idtr_base;
-	u64 host_rsp;
-
-	u64 ept_pointer;
-
-	u16 virtual_processor_id;
-	u16 padding16_2[3];
-
-	u64 padding64_2[5];
-	u64 guest_physical_address;
-
-	u32 vm_instruction_error;
-	u32 vm_exit_reason;
-	u32 vm_exit_intr_info;
-	u32 vm_exit_intr_error_code;
-	u32 idt_vectoring_info_field;
-	u32 idt_vectoring_error_code;
-	u32 vm_exit_instruction_len;
-	u32 vmx_instruction_info;
-
-	u64 exit_qualification;
-	u64 exit_io_instruction_ecx;
-	u64 exit_io_instruction_esi;
-	u64 exit_io_instruction_edi;
-	u64 exit_io_instruction_eip;
-
-	u64 guest_linear_address;
-	u64 guest_rsp;
-	u64 guest_rflags;
-
-	u32 guest_interruptibility_info;
-	u32 cpu_based_vm_exec_control;
-	u32 exception_bitmap;
-	u32 vm_entry_controls;
-	u32 vm_entry_intr_info_field;
-	u32 vm_entry_exception_error_code;
-	u32 vm_entry_instruction_len;
-	u32 tpr_threshold;
-
-	u64 guest_rip;
-
-	u32 hv_clean_fields;
-	u32 hv_padding_32;
-	u32 hv_synthetic_controls;
+	uint32_t revision_id;
+	uint32_t abort;
+
+	uint16_t host_es_selector;
+	uint16_t host_cs_selector;
+	uint16_t host_ss_selector;
+	uint16_t host_ds_selector;
+	uint16_t host_fs_selector;
+	uint16_t host_gs_selector;
+	uint16_t host_tr_selector;
+
+	uint16_t padding16_1;
+
+	uint64_t host_ia32_pat;
+	uint64_t host_ia32_efer;
+
+	uint64_t host_cr0;
+	uint64_t host_cr3;
+	uint64_t host_cr4;
+
+	uint64_t host_ia32_sysenter_esp;
+	uint64_t host_ia32_sysenter_eip;
+	uint64_t host_rip;
+	uint32_t host_ia32_sysenter_cs;
+
+	uint32_t pin_based_vm_exec_control;
+	uint32_t vm_exit_controls;
+	uint32_t secondary_vm_exec_control;
+
+	uint64_t io_bitmap_a;
+	uint64_t io_bitmap_b;
+	uint64_t msr_bitmap;
+
+	uint16_t guest_es_selector;
+	uint16_t guest_cs_selector;
+	uint16_t guest_ss_selector;
+	uint16_t guest_ds_selector;
+	uint16_t guest_fs_selector;
+	uint16_t guest_gs_selector;
+	uint16_t guest_ldtr_selector;
+	uint16_t guest_tr_selector;
+
+	uint32_t guest_es_limit;
+	uint32_t guest_cs_limit;
+	uint32_t guest_ss_limit;
+	uint32_t guest_ds_limit;
+	uint32_t guest_fs_limit;
+	uint32_t guest_gs_limit;
+	uint32_t guest_ldtr_limit;
+	uint32_t guest_tr_limit;
+	uint32_t guest_gdtr_limit;
+	uint32_t guest_idtr_limit;
+
+	uint32_t guest_es_ar_bytes;
+	uint32_t guest_cs_ar_bytes;
+	uint32_t guest_ss_ar_bytes;
+	uint32_t guest_ds_ar_bytes;
+	uint32_t guest_fs_ar_bytes;
+	uint32_t guest_gs_ar_bytes;
+	uint32_t guest_ldtr_ar_bytes;
+	uint32_t guest_tr_ar_bytes;
+
+	uint64_t guest_es_base;
+	uint64_t guest_cs_base;
+	uint64_t guest_ss_base;
+	uint64_t guest_ds_base;
+	uint64_t guest_fs_base;
+	uint64_t guest_gs_base;
+	uint64_t guest_ldtr_base;
+	uint64_t guest_tr_base;
+	uint64_t guest_gdtr_base;
+	uint64_t guest_idtr_base;
+
+	uint64_t padding64_1[3];
+
+	uint64_t vm_exit_msr_store_addr;
+	uint64_t vm_exit_msr_load_addr;
+	uint64_t vm_entry_msr_load_addr;
+
+	uint64_t cr3_target_value0;
+	uint64_t cr3_target_value1;
+	uint64_t cr3_target_value2;
+	uint64_t cr3_target_value3;
+
+	uint32_t page_fault_error_code_mask;
+	uint32_t page_fault_error_code_match;
+
+	uint32_t cr3_target_count;
+	uint32_t vm_exit_msr_store_count;
+	uint32_t vm_exit_msr_load_count;
+	uint32_t vm_entry_msr_load_count;
+
+	uint64_t tsc_offset;
+	uint64_t virtual_apic_page_addr;
+	uint64_t vmcs_link_pointer;
+
+	uint64_t guest_ia32_debugctl;
+	uint64_t guest_ia32_pat;
+	uint64_t guest_ia32_efer;
+
+	uint64_t guest_pdptr0;
+	uint64_t guest_pdptr1;
+	uint64_t guest_pdptr2;
+	uint64_t guest_pdptr3;
+
+	uint64_t guest_pending_dbg_exceptions;
+	uint64_t guest_sysenter_esp;
+	uint64_t guest_sysenter_eip;
+
+	uint32_t guest_activity_state;
+	uint32_t guest_sysenter_cs;
+
+	uint64_t cr0_guest_host_mask;
+	uint64_t cr4_guest_host_mask;
+	uint64_t cr0_read_shadow;
+	uint64_t cr4_read_shadow;
+	uint64_t guest_cr0;
+	uint64_t guest_cr3;
+	uint64_t guest_cr4;
+	uint64_t guest_dr7;
+
+	uint64_t host_fs_base;
+	uint64_t host_gs_base;
+	uint64_t host_tr_base;
+	uint64_t host_gdtr_base;
+	uint64_t host_idtr_base;
+	uint64_t host_rsp;
+
+	uint64_t ept_pointer;
+
+	uint16_t virtual_processor_id;
+	uint16_t padding16_2[3];
+
+	uint64_t padding64_2[5];
+	uint64_t guest_physical_address;
+
+	uint32_t vm_instruction_error;
+	uint32_t vm_exit_reason;
+	uint32_t vm_exit_intr_info;
+	uint32_t vm_exit_intr_error_code;
+	uint32_t idt_vectoring_info_field;
+	uint32_t idt_vectoring_error_code;
+	uint32_t vm_exit_instruction_len;
+	uint32_t vmx_instruction_info;
+
+	uint64_t exit_qualification;
+	uint64_t exit_io_instruction_ecx;
+	uint64_t exit_io_instruction_esi;
+	uint64_t exit_io_instruction_edi;
+	uint64_t exit_io_instruction_eip;
+
+	uint64_t guest_linear_address;
+	uint64_t guest_rsp;
+	uint64_t guest_rflags;
+
+	uint32_t guest_interruptibility_info;
+	uint32_t cpu_based_vm_exec_control;
+	uint32_t exception_bitmap;
+	uint32_t vm_entry_controls;
+	uint32_t vm_entry_intr_info_field;
+	uint32_t vm_entry_exception_error_code;
+	uint32_t vm_entry_instruction_len;
+	uint32_t tpr_threshold;
+
+	uint64_t guest_rip;
+
+	uint32_t hv_clean_fields;
+	uint32_t hv_padding_32;
+	uint32_t hv_synthetic_controls;
 	struct {
-		u32 nested_flush_hypercall:1;
-		u32 msr_bitmap:1;
-		u32 reserved:30;
+		uint32_t nested_flush_hypercall:1;
+		uint32_t msr_bitmap:1;
+		uint32_t reserved:30;
 	}  hv_enlightenments_control;
-	u32 hv_vp_id;
+	uint32_t hv_vp_id;
 
-	u64 hv_vm_id;
-	u64 partition_assist_page;
-	u64 padding64_4[4];
-	u64 guest_bndcfgs;
-	u64 padding64_5[7];
-	u64 xss_exit_bitmap;
-	u64 padding64_6[7];
+	uint64_t hv_vm_id;
+	uint64_t partition_assist_page;
+	uint64_t padding64_4[4];
+	uint64_t guest_bndcfgs;
+	uint64_t padding64_5[7];
+	uint64_t xss_exit_bitmap;
+	uint64_t padding64_6[7];
 };
 
 #define HV_VMX_ENLIGHTENED_CLEAN_FIELD_NONE			0
@@ -794,17 +794,17 @@ struct hv_enlightened_vmcs {
  * Synthetic timer configuration.
  */
 union hv_stimer_config {
-	u64 as_uint64;
+	uint64_t as_uint64;
 	struct {
-		u64 enable:1;
-		u64 periodic:1;
-		u64 lazy:1;
-		u64 auto_enable:1;
-		u64 apic_vector:8;
-		u64 direct_mode:1;
-		u64 reserved_z0:3;
-		u64 sintx:4;
-		u64 reserved_z1:44;
+		uint64_t enable:1;
+		uint64_t periodic:1;
+		uint64_t lazy:1;
+		uint64_t auto_enable:1;
+		uint64_t apic_vector:8;
+		uint64_t direct_mode:1;
+		uint64_t reserved_z0:3;
+		uint64_t sintx:4;
+		uint64_t reserved_z1:44;
 	};
 };
 
@@ -816,70 +816,70 @@ union hv_synic_event_flags {
 
 /* Define SynIC control register. */
 union hv_synic_scontrol {
-	u64 as_uint64;
+	uint64_t as_uint64;
 	struct {
-		u64 enable:1;
-		u64 reserved:63;
+		uint64_t enable:1;
+		uint64_t reserved:63;
 	};
 };
 
 /* Define synthetic interrupt source. */
 union hv_synic_sint {
-	u64 as_uint64;
+	uint64_t as_uint64;
 	struct {
-		u64 vector:8;
-		u64 reserved1:8;
-		u64 masked:1;
-		u64 auto_eoi:1;
-		u64 polling:1;
-		u64 reserved2:45;
+		uint64_t vector:8;
+		uint64_t reserved1:8;
+		uint64_t masked:1;
+		uint64_t auto_eoi:1;
+		uint64_t polling:1;
+		uint64_t reserved2:45;
 	};
 };
 
 /* Define the format of the SIMP register */
 union hv_synic_simp {
-	u64 as_uint64;
+	uint64_t as_uint64;
 	struct {
-		u64 simp_enabled:1;
-		u64 preserved:11;
-		u64 base_simp_gpa:52;
+		uint64_t simp_enabled:1;
+		uint64_t preserved:11;
+		uint64_t base_simp_gpa:52;
 	};
 };
 
 /* Define the format of the SIEFP register */
 union hv_synic_siefp {
-	u64 as_uint64;
+	uint64_t as_uint64;
 	struct {
-		u64 siefp_enabled:1;
-		u64 preserved:11;
-		u64 base_siefp_gpa:52;
+		uint64_t siefp_enabled:1;
+		uint64_t preserved:11;
+		uint64_t base_siefp_gpa:52;
 	};
 };
 
 struct hv_vpset {
-	u64 format;
-	u64 valid_bank_mask;
-	u64 bank_contents[];
+	uint64_t format;
+	uint64_t valid_bank_mask;
+	uint64_t bank_contents[];
 };
 
 /* HvCallSendSyntheticClusterIpi hypercall */
 struct hv_send_ipi {
-	u32 vector;
-	u32 reserved;
-	u64 cpu_mask;
+	uint32_t vector;
+	uint32_t reserved;
+	uint64_t cpu_mask;
 };
 
 /* HvCallSendSyntheticClusterIpiEx hypercall */
 struct hv_send_ipi_ex {
-	u32 vector;
-	u32 reserved;
+	uint32_t vector;
+	uint32_t reserved;
 	struct hv_vpset vp_set;
 };
 
 /* HvFlushGuestPhysicalAddressSpace hypercalls */
 struct hv_guest_mapping_flush {
-	u64 address_space;
-	u64 flags;
+	uint64_t address_space;
+	uint64_t flags;
 };
 
 /*
@@ -890,11 +890,11 @@ struct hv_guest_mapping_flush {
 
 /* HvFlushGuestPhysicalAddressList hypercall */
 union hv_gpa_page_range {
-	u64 address_space;
+	uint64_t address_space;
 	struct {
-		u64 additional_pages:11;
-		u64 largepage:1;
-		u64 basepfn:52;
+		uint64_t additional_pages:11;
+		uint64_t largepage:1;
+		uint64_t basepfn:52;
 	} page;
 };
 
@@ -903,32 +903,32 @@ union hv_gpa_page_range {
  * count is equal with how many entries of union hv_gpa_page_range can
  * be populated into the input parameter page.
  */
-#define HV_MAX_FLUSH_REP_COUNT ((HV_HYP_PAGE_SIZE - 2 * sizeof(u64)) /	\
+#define HV_MAX_FLUSH_REP_COUNT ((HV_HYP_PAGE_SIZE - 2 * sizeof(uint64_t)) / \
 				sizeof(union hv_gpa_page_range))
 
 struct hv_guest_mapping_flush_list {
-	u64 address_space;
-	u64 flags;
+	uint64_t address_space;
+	uint64_t flags;
 	union hv_gpa_page_range gpa_list[HV_MAX_FLUSH_REP_COUNT];
 };
 
 /* HvFlushVirtualAddressSpace, HvFlushVirtualAddressList hypercalls */
 struct hv_tlb_flush {
-	u64 address_space;
-	u64 flags;
-	u64 processor_mask;
-	u64 gva_list[];
+	uint64_t address_space;
+	uint64_t flags;
+	uint64_t processor_mask;
+	uint64_t gva_list[];
 };
 
 /* HvFlushVirtualAddressSpaceEx hypercall */
 struct hv_tlb_flush_ex {
-	u64 address_space;
-	u64 flags;
+	uint64_t address_space;
+	uint64_t flags;
 	struct hv_vpset hv_vp_set;
-	/* u64 gva_list[]; */
+	/* uint64_t gva_list[]; */
 };
 
 struct hv_partition_assist_pg {
-	u32 tlb_lock_count;
+	uint32_t tlb_lock_count;
 };
 #endif
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Feb 23 16:11:13 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 23 Feb 2023 16:11:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.500575.772023 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pVEBd-0006k3-CU; Thu, 23 Feb 2023 16:11:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 500575.772023; Thu, 23 Feb 2023 16:11:13 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pVEBd-0006jw-9s; Thu, 23 Feb 2023 16:11:13 +0000
Received: by outflank-mailman (input) for mailman id 500575;
 Thu, 23 Feb 2023 16: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 1pVEBc-0006jo-EL
 for xen-changelog@lists.xenproject.org; Thu, 23 Feb 2023 16:11:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pVEBc-0001Nc-DU
 for xen-changelog@lists.xenproject.org; Thu, 23 Feb 2023 16:11:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pVEBc-000515-CR
 for xen-changelog@lists.xenproject.org; Thu, 23 Feb 2023 16:11:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=udnYox6ilw+yV3uxiDK6CV6WFkU8ZmKFwHcclvy6mj0=; b=xXviAuZdOsqBhOS2H05jKYfaJc
	j2a+CsFlpEt9eJVqxqTOpPqu7AnL7ecwPMFrHJbkm4ASaOxbadYCQ3Y9BWxUfIRUrQYmXetmQCUP6
	op0xrkKFnUEsi8V1YWESrsNPApcgoXb1CcE65vfL478KtNDYC5DFRiA5zQ1Joq/AE4EE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] libelf: relax ELF_PADDR_OFFSET && !VIRT_BASE check for PVH
Message-Id: <E1pVEBc-000515-CR@xenbits.xenproject.org>
Date: Thu, 23 Feb 2023 16:11:12 +0000

commit b77ed96fce9fbc7577d68d563ac72d57bc230cdc
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Wed Feb 22 13:49:26 2023 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Feb 22 13:49:26 2023 +0100

    libelf: relax ELF_PADDR_OFFSET && !VIRT_BASE check for PVH
    
    Both values are unconditionally overridden (to 0) in the "hvm" (i.e.
    PVH) case. There's therefore no reason to punish a PVH kernel for
    setting the former but not the latter.
    
    Fixes: 632cbaf1243e ("libelf: improve PVH elfnote parsing")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Jason Andryuk <jandryuk@gmail.com>
---
 xen/common/libelf/libelf-dominfo.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/xen/common/libelf/libelf-dominfo.c b/xen/common/libelf/libelf-dominfo.c
index 24d1371dd7..e5644f6c7f 100644
--- a/xen/common/libelf/libelf-dominfo.c
+++ b/xen/common/libelf/libelf-dominfo.c
@@ -419,7 +419,8 @@ static elf_errorstatus elf_xen_addr_calc_check(struct elf_binary *elf,
     uint64_t virt_offset;
 
     if ( (parms->elf_paddr_offset != UNSET_ADDR) &&
-         (parms->virt_base == UNSET_ADDR) )
+         (parms->virt_base == UNSET_ADDR) &&
+         !hvm )
     {
         elf_err(elf, "ERROR: ELF_PADDR_OFFSET set, VIRT_BASE unset\n");
         return -1;
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Feb 23 16:11:23 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 23 Feb 2023 16:11:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.500576.772028 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pVEBn-0006mh-EG; Thu, 23 Feb 2023 16:11:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 500576.772028; Thu, 23 Feb 2023 16:11:23 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pVEBn-0006mY-BW; Thu, 23 Feb 2023 16:11:23 +0000
Received: by outflank-mailman (input) for mailman id 500576;
 Thu, 23 Feb 2023 16: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 1pVEBm-0006mJ-HX
 for xen-changelog@lists.xenproject.org; Thu, 23 Feb 2023 16:11:22 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pVEBm-0001Nz-GU
 for xen-changelog@lists.xenproject.org; Thu, 23 Feb 2023 16:11:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pVEBm-00051h-Ff
 for xen-changelog@lists.xenproject.org; Thu, 23 Feb 2023 16:11:22 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=jSDPUA2S5YP4O1M6FFClaWFlKlzKVyMEIivMRg29oxc=; b=W2XBKBpGyWyd4Bqj6W7dhzKx65
	wuzZ8/VDBXzkCxqCIXjkvTS6MFbzGmZkWeDjWgHqNaSdvS1mO9zq8OwOuez2YZFf23MbLYP8Sz4pQ
	unwEBG44naZnhOE1Ax5pAhprt6DlfOa2HF7AHrs3SnJLVPct9Xf6B/MRZ8rQiYda1po8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/extable: hide use of negative offset from array start
Message-Id: <E1pVEBm-00051h-Ff@xenbits.xenproject.org>
Date: Thu, 23 Feb 2023 16:11:22 +0000

commit 353b8cc56862dd808b75c6c96cd780cfee8f28bc
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Wed Feb 22 13:50:20 2023 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Feb 22 13:50:20 2023 +0100

    x86/extable: hide use of negative offset from array start
    
    In COVERAGE=y but DEBUG=n builds (observed by randconfig testing) gcc12
    takes issue with the subtraction of 1 from __stop___pre_ex_table[],
    considering this an out of bounds access. Not being able to know that
    the symbol actually marks the end of an array, the compiler is kind of
    right with this diagnosis. Move the subtraction into the function.
    
    Reported-by: Anthony Perard <anthony.perard@citrix.com>
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/extable.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/xen/arch/x86/extable.c b/xen/arch/x86/extable.c
index 4913c4a6dd..6758ba1dca 100644
--- a/xen/arch/x86/extable.c
+++ b/xen/arch/x86/extable.c
@@ -64,9 +64,10 @@ void __init sort_exception_tables(void)
 
 static unsigned long
 search_one_extable(const struct exception_table_entry *first,
-                   const struct exception_table_entry *last,
+                   const struct exception_table_entry *end,
                    unsigned long value)
 {
+    const struct exception_table_entry *last = end - 1;
     const struct exception_table_entry *mid;
     long diff;
 
@@ -91,7 +92,7 @@ search_exception_table(const struct cpu_user_regs *regs)
     unsigned long stub = this_cpu(stubs.addr);
 
     if ( region && region->ex )
-        return search_one_extable(region->ex, region->ex_end - 1, regs->rip);
+        return search_one_extable(region->ex, region->ex_end, regs->rip);
 
     if ( regs->rip >= stub + STUB_BUF_SIZE / 2 &&
          regs->rip < stub + STUB_BUF_SIZE &&
@@ -102,7 +103,7 @@ search_exception_table(const struct cpu_user_regs *regs)
 
         region = find_text_region(retptr);
         retptr = region && region->ex
-                 ? search_one_extable(region->ex, region->ex_end - 1, retptr)
+                 ? search_one_extable(region->ex, region->ex_end, retptr)
                  : 0;
         if ( retptr )
         {
@@ -198,7 +199,7 @@ search_pre_exception_table(struct cpu_user_regs *regs)
 {
     unsigned long addr = regs->rip;
     unsigned long fixup = search_one_extable(
-        __start___pre_ex_table, __stop___pre_ex_table-1, addr);
+        __start___pre_ex_table, __stop___pre_ex_table, addr);
     if ( fixup )
     {
         dprintk(XENLOG_INFO, "Pre-exception: %p -> %p\n", _p(addr), _p(fixup));
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Feb 23 16:11:33 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 23 Feb 2023 16:11:33 +0000
Received: from list by lists.xenproject.org with outflank-mailman.500578.772032 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pVEBx-0006q4-Fh; Thu, 23 Feb 2023 16:11:33 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 500578.772032; Thu, 23 Feb 2023 16:11:33 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pVEBx-0006pw-D4; Thu, 23 Feb 2023 16:11:33 +0000
Received: by outflank-mailman (input) for mailman id 500578;
 Thu, 23 Feb 2023 16: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 1pVEBw-0006pd-KM
 for xen-changelog@lists.xenproject.org; Thu, 23 Feb 2023 16:11:32 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pVEBw-0001OB-JY
 for xen-changelog@lists.xenproject.org; Thu, 23 Feb 2023 16:11:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pVEBw-00052C-Ig
 for xen-changelog@lists.xenproject.org; Thu, 23 Feb 2023 16:11:32 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=M7DEpszJ/Bp4orCsOYjPSo0CYvxc1ztF9fwJsV8nKX4=; b=zHZkNr1kdr6yY7+tJWbaXspE36
	vR67DGX+swkZyyyaQTsmvgkKsuf6uqV2YBSFI2v07ufIHTjgcAqX8AdwrP4bUtOs7bBLcTUfi5EOd
	Pc6ofO1K0QYzyBrFkxbf6EfDy50PwE6lp/ff/3cOJxe6hquV6XEPTl4WHqoXfVTyhWVE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/MSI: drop "packed" attribute from message data/address structures
Message-Id: <E1pVEBw-00052C-Ig@xenbits.xenproject.org>
Date: Thu, 23 Feb 2023 16:11:32 +0000

commit 40c12ba546729fdcc8b6731f675806dc268a5745
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Wed Feb 22 13:50:59 2023 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Feb 22 13:50:59 2023 +0100

    x86/MSI: drop "packed" attribute from message data/address structures
    
    The attribute has no purpose here and, in the worst case, could lead to
    the compiler generating worse code. In practice, however: No change to
    generated code (surprisingly not even to generated debug info), at least
    with gcc12 and the .config-s I've tried.
    
    Requested-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/include/asm/msi.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/include/asm/msi.h b/xen/arch/x86/include/asm/msi.h
index ec77c66642..a53ade95c9 100644
--- a/xen/arch/x86/include/asm/msi.h
+++ b/xen/arch/x86/include/asm/msi.h
@@ -178,7 +178,7 @@ int msi_free_irq(struct msi_desc *entry);
  * MSI Defined Data Structures
  */
 
-struct __packed msg_data {
+struct msg_data {
     uint32_t vector        :  8;
     uint32_t delivery_mode :  3;    /* 000b: FIXED | 001b: lowest prior */
     uint32_t               :  3;
@@ -187,7 +187,7 @@ struct __packed msg_data {
     uint32_t               : 16;
 };
 
-struct __packed msg_address {
+struct msg_address {
     union {
         struct {
             uint32_t              :  2;
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Feb 23 16:11:43 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 23 Feb 2023 16:11:43 +0000
Received: from list by lists.xenproject.org with outflank-mailman.500579.772035 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pVEC7-0006tN-J0; Thu, 23 Feb 2023 16:11:43 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 500579.772035; Thu, 23 Feb 2023 16:11:43 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pVEC7-0006tF-Fx; Thu, 23 Feb 2023 16:11:43 +0000
Received: by outflank-mailman (input) for mailman id 500579;
 Thu, 23 Feb 2023 16: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 1pVEC6-0006t2-OT
 for xen-changelog@lists.xenproject.org; Thu, 23 Feb 2023 16:11:42 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pVEC6-0001OM-NY
 for xen-changelog@lists.xenproject.org; Thu, 23 Feb 2023 16:11:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pVEC6-00052f-Lf
 for xen-changelog@lists.xenproject.org; Thu, 23 Feb 2023 16:11:42 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Q78JNMRRQj7z+Et3sg0ppfWyvscPa+xvK9jIw/cuSL0=; b=3/YdlDvvjwy4+83beMRA4IjQzI
	9Oz9c4fdAW3rgXULhvp1xvWggyXLZpqljYUfKInFaitBGtWAfOpy7F0JSY4Pa+2zUNokT48UUQniE
	+XRkCimnz2rowikevHdcvZpsFVmBp6kJDBHqTueTcFwg7luwNl+RoPaC+qYtNAq2lX6U=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] automation: Remove CentOS 7.2 containers and builds
Message-Id: <E1pVEC6-00052f-Lf@xenbits.xenproject.org>
Date: Thu, 23 Feb 2023 16:11:42 +0000

commit ba512629f76dfddb39ea9133ee51cdd9e392a927
Author:     Anthony PERARD <anthony.perard@citrix.com>
AuthorDate: Tue Feb 21 16:55:36 2023 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Wed Feb 22 13:04:23 2023 +0000

    automation: Remove CentOS 7.2 containers and builds
    
    We already have a container which track the latest CentOS 7, no need
    for this one as well.
    
    Also, 7.2 have outdated root certificate which prevent connection to
    website which use Let's Encrypt.
    
    Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 automation/build/centos/7.2.dockerfile  | 52 ---------------------------------
 automation/build/centos/CentOS-7.2.repo | 35 ----------------------
 automation/gitlab-ci/build.yaml         | 10 -------
 3 files changed, 97 deletions(-)

diff --git a/automation/build/centos/7.2.dockerfile b/automation/build/centos/7.2.dockerfile
deleted file mode 100644
index 4baa097e31..0000000000
--- a/automation/build/centos/7.2.dockerfile
+++ /dev/null
@@ -1,52 +0,0 @@
-FROM centos:7.2.1511
-LABEL maintainer.name="The Xen Project" \
-      maintainer.email="xen-devel@lists.xenproject.org"
-
-# ensure we only get bits from the vault for
-# the version we want
-COPY CentOS-7.2.repo /etc/yum.repos.d/CentOS-Base.repo
-
-# install EPEL for dev86, xz-devel and possibly other packages
-RUN yum -y install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm && \
-        yum clean all
-
-RUN mkdir /build
-WORKDIR /build
-
-# work around https://github.com/moby/moby/issues/10180
-# and install Xen depends
-RUN rpm --rebuilddb && \
-    yum -y install \
-        yum-plugin-ovl \
-        gcc \
-        gcc-c++ \
-        ncurses-devel \
-        zlib-devel \
-        openssl-devel \
-        python-devel \
-        libuuid-devel \
-        pkgconfig \
-        # gettext for Xen < 4.13
-        gettext \
-        flex \
-        bison \
-        libaio-devel \
-        glib2-devel \
-        yajl-devel \
-        pixman-devel \
-        glibc-devel \
-        # glibc-devel.i686 for Xen < 4.15
-        glibc-devel.i686 \
-        make \
-        binutils \
-        git \
-        wget \
-        acpica-tools \
-        python-markdown \
-        patch \
-        checkpolicy \
-        dev86 \
-        xz-devel \
-        bzip2 \
-        nasm \
-    && yum clean all
diff --git a/automation/build/centos/CentOS-7.2.repo b/automation/build/centos/CentOS-7.2.repo
deleted file mode 100644
index 4da27faeb5..0000000000
--- a/automation/build/centos/CentOS-7.2.repo
+++ /dev/null
@@ -1,35 +0,0 @@
-# CentOS-Base.repo
-#
-# This is a replacement file that pins things to just use CentOS 7.2
-# from the CentOS Vault.
-#
-
-[base]
-name=CentOS-7.2.1511 - Base
-baseurl=http://vault.centos.org/7.2.1511/os/$basearch/
-gpgcheck=1
-gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
-
-#released updates 
-[updates]
-name=CentOS-7.2.1511 - Updates
-baseurl=http://vault.centos.org/7.2.1511/updates/$basearch/
-gpgcheck=1
-gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
-
-#additional packages that may be useful
-[extras]
-name=CentOS-7.2.1511 - Extras
-baseurl=http://vault.centos.org/7.2.1511/extras/$basearch/
-gpgcheck=1
-gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
-
-#additional packages that extend functionality of existing packages
-[centosplus]
-name=CentOS-7.2.1511 - Plus
-baseurl=http://vault.centos.org/7.2.1511/centosplus/$basearch/
-gpgcheck=1
-gpgcheck=1
-enabled=0
-gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
-
diff --git a/automation/gitlab-ci/build.yaml b/automation/gitlab-ci/build.yaml
index 079e9b73f6..aed8fc0240 100644
--- a/automation/gitlab-ci/build.yaml
+++ b/automation/gitlab-ci/build.yaml
@@ -211,16 +211,6 @@ archlinux-gcc-debug:
   variables:
     CONTAINER: archlinux:current
 
-centos-7-2-gcc:
-  extends: .gcc-x86-64-build
-  variables:
-    CONTAINER: centos:7.2
-
-centos-7-2-gcc-debug:
-  extends: .gcc-x86-64-build-debug
-  variables:
-    CONTAINER: centos:7.2
-
 centos-7-gcc:
   extends: .gcc-x86-64-build
   variables:
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Feb 23 16:11:53 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 23 Feb 2023 16:11:53 +0000
Received: from list by lists.xenproject.org with outflank-mailman.500580.772040 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pVECH-0006wl-Kf; Thu, 23 Feb 2023 16:11:53 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 500580.772040; Thu, 23 Feb 2023 16:11:53 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pVECH-0006we-Hl; Thu, 23 Feb 2023 16:11:53 +0000
Received: by outflank-mailman (input) for mailman id 500580;
 Thu, 23 Feb 2023 16: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 1pVECG-0006wS-R4
 for xen-changelog@lists.xenproject.org; Thu, 23 Feb 2023 16:11:52 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pVECG-0001Ok-QK
 for xen-changelog@lists.xenproject.org; Thu, 23 Feb 2023 16:11:52 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pVECG-00053L-PZ
 for xen-changelog@lists.xenproject.org; Thu, 23 Feb 2023 16:11:52 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=kDxGiOOYrZXUa9W22nQw9K8K/gEKNYqHxdKMO7hsnwc=; b=0yEaRt0t4nW5KshBXajZOnwI6i
	8vQLTAcbVlaA45LPbQQhKI1fNAilv9BCENtwZXngYNhaHezhoOfdRUzNtibUxVrgSiTRU2v0dEHoX
	bv/lZ8I5Kc2JtkFZRnctk5IgWv86ENSgEK7e6alwohekymVBjNNqwO8ClGNleHtot/Zo=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] automation: Ensure that all packages are up-to-dates in CentOS 7 container
Message-Id: <E1pVECG-00053L-PZ@xenbits.xenproject.org>
Date: Thu, 23 Feb 2023 16:11:52 +0000

commit 0d83a431e960d1ccecc5609ab90019f2d4d80593
Author:     Anthony PERARD <anthony.perard@citrix.com>
AuthorDate: Tue Feb 21 16:55:37 2023 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Wed Feb 22 13:04:23 2023 +0000

    automation: Ensure that all packages are up-to-dates in CentOS 7 container
    
    This was prompt by the fact that `wget https://xenbits.xenproject.org`
    fails with expired certificates, which turned out to be an expired
    root certificates. Updating all packages fix the issue.
    
    Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 automation/build/centos/7.dockerfile | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/automation/build/centos/7.dockerfile b/automation/build/centos/7.dockerfile
index e688a4cece..f5264e02d9 100644
--- a/automation/build/centos/7.dockerfile
+++ b/automation/build/centos/7.dockerfile
@@ -15,7 +15,8 @@ RUN rpm --rebuilddb && \
     rm -rf /var/cache/yum
 
 # install Xen depends
-RUN yum -y install \
+RUN yum -y update \
+    && yum -y install \
         gcc \
         gcc-c++ \
         ncurses-devel \
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Feb 23 16:12:03 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 23 Feb 2023 16:12:03 +0000
Received: from list by lists.xenproject.org with outflank-mailman.500581.772044 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pVECR-0006zV-MP; Thu, 23 Feb 2023 16:12:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 500581.772044; Thu, 23 Feb 2023 16:12:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pVECR-0006zM-JV; Thu, 23 Feb 2023 16:12:03 +0000
Received: by outflank-mailman (input) for mailman id 500581;
 Thu, 23 Feb 2023 16:12: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 1pVECQ-0006zE-Tq
 for xen-changelog@lists.xenproject.org; Thu, 23 Feb 2023 16:12:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pVECQ-0001PK-T5
 for xen-changelog@lists.xenproject.org; Thu, 23 Feb 2023 16:12:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pVECQ-00055Q-SN
 for xen-changelog@lists.xenproject.org; Thu, 23 Feb 2023 16:12:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Jdn7lARpJzmjFPUymym1gZ/f5Ztda708kTu4dfzZcww=; b=kP9q7WCbtApd/i7PmPlglXHYms
	XkVeIav3jWIzNi4elG48m/RziDUin8YRVBmbWe2jaAIf11vhEPyVuWSLHeXhZGD60NnV66WZZ3vey
	esBc5/Jdhgo7OXcNFSMKcELQH5LH/Zp0W9mBqPdsyzOma33MZOPMxjlK5FWga7xjlk4g=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] automation: Remove clang-8 from Debian unstable container
Message-Id: <E1pVECQ-00055Q-SN@xenbits.xenproject.org>
Date: Thu, 23 Feb 2023 16:12:02 +0000

commit a6b1e2b80fe2053b1c9c9843fb086a668513ea36
Author:     Anthony PERARD <anthony.perard@citrix.com>
AuthorDate: Tue Feb 21 16:55:38 2023 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Wed Feb 22 13:04:23 2023 +0000

    automation: Remove clang-8 from Debian unstable container
    
    First, apt complain that it isn't the right way to add keys anymore,
    but hopefully that's just a warning.
    
    Second, we can't install clang-8:
    The following packages have unmet dependencies:
     clang-8 : Depends: libstdc++-8-dev but it is not installable
               Depends: libgcc-8-dev but it is not installable
               Depends: libobjc-8-dev but it is not installable
               Recommends: llvm-8-dev but it is not going to be installed
               Recommends: libomp-8-dev but it is not going to be installed
     libllvm8 : Depends: libffi7 (>= 3.3~20180313) but it is not installable
    E: Unable to correct problems, you have held broken packages.
    
    clang on Debian unstable is now version 14.0.6.
    
    Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 automation/build/debian/unstable-llvm-8.list |  3 ---
 automation/build/debian/unstable.dockerfile  | 12 ------------
 automation/gitlab-ci/build.yaml              | 10 ----------
 3 files changed, 25 deletions(-)

diff --git a/automation/build/debian/unstable-llvm-8.list b/automation/build/debian/unstable-llvm-8.list
deleted file mode 100644
index dc119fa0b4..0000000000
--- a/automation/build/debian/unstable-llvm-8.list
+++ /dev/null
@@ -1,3 +0,0 @@
-# Unstable LLVM 8 repos
-deb http://apt.llvm.org/unstable/ llvm-toolchain-8 main
-deb-src http://apt.llvm.org/unstable/ llvm-toolchain-8 main
diff --git a/automation/build/debian/unstable.dockerfile b/automation/build/debian/unstable.dockerfile
index 9de766d596..b560337b7a 100644
--- a/automation/build/debian/unstable.dockerfile
+++ b/automation/build/debian/unstable.dockerfile
@@ -51,15 +51,3 @@ RUN apt-get update && \
         apt-get autoremove -y && \
         apt-get clean && \
         rm -rf /var/lib/apt/lists* /tmp/* /var/tmp/*
-
-RUN wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key|apt-key add -
-COPY unstable-llvm-8.list /etc/apt/sources.list.d/
-
-RUN apt-get update && \
-    apt-get --quiet --yes install \
-        clang-8 \
-        lld-8 \
-        && \
-        apt-get autoremove -y && \
-        apt-get clean && \
-        rm -rf /var/lib/apt/lists* /tmp/* /var/tmp/*
diff --git a/automation/gitlab-ci/build.yaml b/automation/gitlab-ci/build.yaml
index aed8fc0240..22ce1c45e7 100644
--- a/automation/gitlab-ci/build.yaml
+++ b/automation/gitlab-ci/build.yaml
@@ -329,16 +329,6 @@ debian-unstable-clang-debug:
   variables:
     CONTAINER: debian:unstable
 
-debian-unstable-clang-8:
-  extends: .clang-8-x86-64-build
-  variables:
-    CONTAINER: debian:unstable
-
-debian-unstable-clang-8-debug:
-  extends: .clang-8-x86-64-build-debug
-  variables:
-    CONTAINER: debian:unstable
-
 debian-unstable-gcc:
   extends: .gcc-x86-64-build
   variables:
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Feb 23 16:12:13 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 23 Feb 2023 16:12:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.500582.772048 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pVECb-000728-Nx; Thu, 23 Feb 2023 16:12:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 500582.772048; Thu, 23 Feb 2023 16:12:13 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pVECb-000720-LJ; Thu, 23 Feb 2023 16:12:13 +0000
Received: by outflank-mailman (input) for mailman id 500582;
 Thu, 23 Feb 2023 16:12:13 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pVECb-00071s-0i
 for xen-changelog@lists.xenproject.org; Thu, 23 Feb 2023 16:12:13 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pVECa-0001PO-W7
 for xen-changelog@lists.xenproject.org; Thu, 23 Feb 2023 16:12:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pVECa-00055z-VF
 for xen-changelog@lists.xenproject.org; Thu, 23 Feb 2023 16:12:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=vMHuCVEwOvjAHVOtAV0p6yALwqEY+KYF1CFSQUWLtWQ=; b=hQlI2556yRFmSl5jCUwnE8tOjW
	LbA1AoROHAJzLWrygkAGqEkBC2B2yHHUpwOeBTP+q+Bxfqg5tNabw1uZBpKdc3v4j2+BKe4GBcuR7
	CIAqqdnU3E9mQwQS3nxqReesAtpMfz6hsvZYrHK8aJPbhg9FFp4tOEPzG8syKOgKDkec=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] automation: Add more aliases in containerize
Message-Id: <E1pVECa-00055z-VF@xenbits.xenproject.org>
Date: Thu, 23 Feb 2023 16:12:12 +0000

commit 64e39c35f09a59d7c03388a409c515a1c6239af8
Author:     Anthony PERARD <anthony.perard@citrix.com>
AuthorDate: Tue Feb 21 16:55:40 2023 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Wed Feb 22 13:04:23 2023 +0000

    automation: Add more aliases in containerize
    
    Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 automation/scripts/containerize | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/automation/scripts/containerize b/automation/scripts/containerize
index 9e508918bf..9b1a302d05 100755
--- a/automation/scripts/containerize
+++ b/automation/scripts/containerize
@@ -33,9 +33,12 @@ case "_${CONTAINER}" in
     _fedora) CONTAINER="${BASE}/fedora:29";;
     _focal) CONTAINER="${BASE}/ubuntu:focal" ;;
     _jessie) CONTAINER="${BASE}/debian:jessie" ;;
+    _jessie-i386) CONTAINER="${BASE}/debian:jessie-i386" ;;
     _stretch|_) CONTAINER="${BASE}/debian:stretch" ;;
+    _stretch-i386) CONTAINER="${BASE}/debian:stretch-i386" ;;
     _buster-gcc-ibt) CONTAINER="${BASE}/debian:buster-gcc-ibt" ;;
     _unstable|_) CONTAINER="${BASE}/debian:unstable" ;;
+    _unstable-i386) CONTAINER="${BASE}/debian:unstable-i386" ;;
     _unstable-arm32-gcc) CONTAINER="${BASE}/debian:unstable-arm32-gcc" ;;
     _unstable-arm64v8) CONTAINER="${BASE}/debian:unstable-arm64v8" ;;
     _trusty) CONTAINER="${BASE}/ubuntu:trusty" ;;
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Feb 23 16:12:24 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 23 Feb 2023 16:12:24 +0000
Received: from list by lists.xenproject.org with outflank-mailman.500583.772053 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pVECl-00075R-Pu; Thu, 23 Feb 2023 16:12:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 500583.772053; Thu, 23 Feb 2023 16:12:23 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pVECl-00075F-Ml; Thu, 23 Feb 2023 16:12:23 +0000
Received: by outflank-mailman (input) for mailman id 500583;
 Thu, 23 Feb 2023 16:12:23 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pVECl-000756-3j
 for xen-changelog@lists.xenproject.org; Thu, 23 Feb 2023 16:12:23 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pVECl-0001Pf-2u
 for xen-changelog@lists.xenproject.org; Thu, 23 Feb 2023 16:12:23 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pVECl-00056Y-27
 for xen-changelog@lists.xenproject.org; Thu, 23 Feb 2023 16:12:23 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=3zvCTkE9R8yPAxvvWLd3lKHwHoi7iCn+OBmTybYtLcQ=; b=Zwkxk1XE7ScQ5dUzYEkC0xYcNz
	aMNwSS+6GMVKjW2oCpx4Z0jIt0tTqqNnF+yFHvaS5yHWIdtx9toiheNrjEQ2IbZ9d6Nv16Hc1qpNc
	3hbtbSa+y3z7ZweDRP2NLuDZ6QJCLhDMBPMJ6iV+qJRMYs7Fy3uCZZVxO4+Wsk0ugv6M=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] CI: Drop gettext from containers
Message-Id: <E1pVECl-00056Y-27@xenbits.xenproject.org>
Date: Thu, 23 Feb 2023 16:12:23 +0000

commit c15e2d4c1c93d3d1744501b7f938db4ca23ee5e1
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Wed Feb 22 14:00:55 2023 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Wed Feb 22 15:00:00 2023 +0000

    CI: Drop gettext from containers
    
    Xen 4.13 is fully out of support now.  Drop this legacy build dependency.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Michal Orzel <michal.orzel@amd.com>
---
 automation/build/alpine/3.12-arm64v8.dockerfile           | 2 --
 automation/build/alpine/3.12.dockerfile                   | 2 --
 automation/build/centos/7.dockerfile                      | 2 --
 automation/build/debian/jessie-i386.dockerfile            | 2 --
 automation/build/debian/jessie.dockerfile                 | 2 --
 automation/build/debian/stretch-i386.dockerfile           | 2 --
 automation/build/debian/stretch.dockerfile                | 2 --
 automation/build/debian/unstable-arm64v8.dockerfile       | 2 --
 automation/build/debian/unstable-i386.dockerfile          | 2 --
 automation/build/debian/unstable.dockerfile               | 2 --
 automation/build/fedora/29.dockerfile                     | 2 --
 automation/build/suse/opensuse-leap.dockerfile            | 2 --
 automation/build/suse/opensuse-tumbleweed.dockerfile      | 2 --
 automation/build/ubuntu/bionic.dockerfile                 | 2 --
 automation/build/ubuntu/focal.dockerfile                  | 2 --
 automation/build/ubuntu/trusty.dockerfile                 | 2 --
 automation/build/ubuntu/xenial.dockerfile                 | 2 --
 automation/tests-artifacts/alpine/3.12-arm64v8.dockerfile | 2 --
 18 files changed, 36 deletions(-)

diff --git a/automation/build/alpine/3.12-arm64v8.dockerfile b/automation/build/alpine/3.12-arm64v8.dockerfile
index f8d3927ee3..180c978964 100644
--- a/automation/build/alpine/3.12-arm64v8.dockerfile
+++ b/automation/build/alpine/3.12-arm64v8.dockerfile
@@ -20,8 +20,6 @@ RUN apk --no-cache add \
   dtc-dev \
   flex \
   gcc \
-  # gettext for Xen < 4.13
-  gettext \
   git \
   iasl \
   libaio-dev \
diff --git a/automation/build/alpine/3.12.dockerfile b/automation/build/alpine/3.12.dockerfile
index fbf4aa4d3d..c847aa82d9 100644
--- a/automation/build/alpine/3.12.dockerfile
+++ b/automation/build/alpine/3.12.dockerfile
@@ -21,8 +21,6 @@ RUN apk --no-cache add \
   flex \
   g++ \
   gcc \
-  # gettext for Xen < 4.13
-  gettext \
   git \
   grep \
   iasl \
diff --git a/automation/build/centos/7.dockerfile b/automation/build/centos/7.dockerfile
index f5264e02d9..69dcefb2f0 100644
--- a/automation/build/centos/7.dockerfile
+++ b/automation/build/centos/7.dockerfile
@@ -25,8 +25,6 @@ RUN yum -y update \
         python-devel \
         libuuid-devel \
         pkgconfig \
-        # gettext for Xen < 4.13
-        gettext \
         flex \
         bison \
         libaio-devel \
diff --git a/automation/build/debian/jessie-i386.dockerfile b/automation/build/debian/jessie-i386.dockerfile
index 3f86d91f63..b152d658d3 100644
--- a/automation/build/debian/jessie-i386.dockerfile
+++ b/automation/build/debian/jessie-i386.dockerfile
@@ -28,8 +28,6 @@ RUN apt-get update && \
         pkg-config \
         flex \
         bison \
-        # gettext for Xen < 4.13
-        gettext \
         acpica-tools \
         bin86 \
         bcc \
diff --git a/automation/build/debian/jessie.dockerfile b/automation/build/debian/jessie.dockerfile
index 2f19adcad3..1e33e635d2 100644
--- a/automation/build/debian/jessie.dockerfile
+++ b/automation/build/debian/jessie.dockerfile
@@ -26,8 +26,6 @@ RUN apt-get update && \
         pkg-config \
         flex \
         bison \
-        # gettext for Xen < 4.13
-        gettext \
         acpica-tools \
         bin86 \
         bcc \
diff --git a/automation/build/debian/stretch-i386.dockerfile b/automation/build/debian/stretch-i386.dockerfile
index c7840d33ab..d93f74c979 100644
--- a/automation/build/debian/stretch-i386.dockerfile
+++ b/automation/build/debian/stretch-i386.dockerfile
@@ -29,8 +29,6 @@ RUN apt-get update && \
         pkg-config \
         flex \
         bison \
-        # gettext for Xen < 4.13
-        gettext \
         acpica-tools \
         bin86 \
         bcc \
diff --git a/automation/build/debian/stretch.dockerfile b/automation/build/debian/stretch.dockerfile
index 30fcc5288d..2c086b197c 100644
--- a/automation/build/debian/stretch.dockerfile
+++ b/automation/build/debian/stretch.dockerfile
@@ -27,8 +27,6 @@ RUN apt-get update && \
         pkg-config \
         flex \
         bison \
-        # gettext for Xen < 4.13
-        gettext \
         acpica-tools \
         bin86 \
         bcc \
diff --git a/automation/build/debian/unstable-arm64v8.dockerfile b/automation/build/debian/unstable-arm64v8.dockerfile
index 0080c22ba2..b9b1587f88 100644
--- a/automation/build/debian/unstable-arm64v8.dockerfile
+++ b/automation/build/debian/unstable-arm64v8.dockerfile
@@ -26,8 +26,6 @@ RUN apt-get update && \
         pkg-config \
         flex \
         bison \
-        # gettext for Xen < 4.13
-        gettext \
         acpica-tools \
         libfdt-dev \
         bin86 \
diff --git a/automation/build/debian/unstable-i386.dockerfile b/automation/build/debian/unstable-i386.dockerfile
index 6ce54a481b..1c4928b09e 100644
--- a/automation/build/debian/unstable-i386.dockerfile
+++ b/automation/build/debian/unstable-i386.dockerfile
@@ -28,8 +28,6 @@ RUN apt-get update && \
         pkg-config \
         flex \
         bison \
-        # gettext for Xen < 4.13
-        gettext \
         acpica-tools \
         bin86 \
         bcc \
diff --git a/automation/build/debian/unstable.dockerfile b/automation/build/debian/unstable.dockerfile
index b560337b7a..6ef2878200 100644
--- a/automation/build/debian/unstable.dockerfile
+++ b/automation/build/debian/unstable.dockerfile
@@ -26,8 +26,6 @@ RUN apt-get update && \
         pkg-config \
         flex \
         bison \
-        # gettext for Xen < 4.13
-        gettext \
         acpica-tools \
         bin86 \
         bcc \
diff --git a/automation/build/fedora/29.dockerfile b/automation/build/fedora/29.dockerfile
index 60a5d72266..e55b06a451 100644
--- a/automation/build/fedora/29.dockerfile
+++ b/automation/build/fedora/29.dockerfile
@@ -14,8 +14,6 @@ RUN dnf -y install \
         python3-devel \
         libuuid-devel \
         pkgconfig \
-        # gettext for Xen < 4.13
-        gettext \
         flex \
         bison \
         libaio-devel \
diff --git a/automation/build/suse/opensuse-leap.dockerfile b/automation/build/suse/opensuse-leap.dockerfile
index 5e8111f40b..bac9385412 100644
--- a/automation/build/suse/opensuse-leap.dockerfile
+++ b/automation/build/suse/opensuse-leap.dockerfile
@@ -22,8 +22,6 @@ RUN zypper install -y --no-recommends \
         flex \
         gcc \
         gcc-c++ \
-        # gettext-tools for Xen < 4.13
-        gettext-tools \
         git \
         glib2-devel \
         glibc-devel \
diff --git a/automation/build/suse/opensuse-tumbleweed.dockerfile b/automation/build/suse/opensuse-tumbleweed.dockerfile
index b165c48245..3e5771fccd 100644
--- a/automation/build/suse/opensuse-tumbleweed.dockerfile
+++ b/automation/build/suse/opensuse-tumbleweed.dockerfile
@@ -22,8 +22,6 @@ RUN zypper install -y --no-recommends \
         flex \
         gcc \
         gcc-c++ \
-        # gettext-tools for Xen < 4.13
-        gettext-tools \
         git \
         glib2-devel \
         glibc-devel \
diff --git a/automation/build/ubuntu/bionic.dockerfile b/automation/build/ubuntu/bionic.dockerfile
index 1e5a27c70f..e15f54431e 100644
--- a/automation/build/ubuntu/bionic.dockerfile
+++ b/automation/build/ubuntu/bionic.dockerfile
@@ -27,8 +27,6 @@ RUN apt-get update && \
         pkg-config \
         flex \
         bison \
-        # gettext for Xen < 4.13
-        gettext \
         acpica-tools \
         bin86 \
         bcc \
diff --git a/automation/build/ubuntu/focal.dockerfile b/automation/build/ubuntu/focal.dockerfile
index 74655b9876..9c851c0620 100644
--- a/automation/build/ubuntu/focal.dockerfile
+++ b/automation/build/ubuntu/focal.dockerfile
@@ -26,8 +26,6 @@ RUN apt-get update && \
         pkg-config \
         flex \
         bison \
-        # gettext for Xen < 4.13
-        gettext \
         acpica-tools \
         bin86 \
         bcc \
diff --git a/automation/build/ubuntu/trusty.dockerfile b/automation/build/ubuntu/trusty.dockerfile
index b4b2f85e73..b298a515c6 100644
--- a/automation/build/ubuntu/trusty.dockerfile
+++ b/automation/build/ubuntu/trusty.dockerfile
@@ -27,8 +27,6 @@ RUN apt-get update && \
         pkg-config \
         flex \
         bison \
-        # gettext for Xen < 4.13
-        gettext \
         acpica-tools \
         bin86 \
         bcc \
diff --git a/automation/build/ubuntu/xenial.dockerfile b/automation/build/ubuntu/xenial.dockerfile
index 82171d856d..2d2ba3e31f 100644
--- a/automation/build/ubuntu/xenial.dockerfile
+++ b/automation/build/ubuntu/xenial.dockerfile
@@ -27,8 +27,6 @@ RUN apt-get update && \
         pkg-config \
         flex \
         bison \
-        # gettext for Xen < 4.13
-        gettext \
         acpica-tools \
         bin86 \
         bcc \
diff --git a/automation/tests-artifacts/alpine/3.12-arm64v8.dockerfile b/automation/tests-artifacts/alpine/3.12-arm64v8.dockerfile
index 7eb1f22940..cb8e9e59bb 100644
--- a/automation/tests-artifacts/alpine/3.12-arm64v8.dockerfile
+++ b/automation/tests-artifacts/alpine/3.12-arm64v8.dockerfile
@@ -19,8 +19,6 @@ RUN \
   apk add dbus && \
   apk add bash && \
   apk add python2 && \
-  # gettext for Xen < 4.13
-  apk add gettext && \
   apk add zlib && \
   apk add ncurses && \
   apk add texinfo && \
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Feb 24 08:33:08 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 24 Feb 2023 08:33:08 +0000
Received: from list by lists.xenproject.org with outflank-mailman.500821.772329 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pVTVn-0006tI-7Z; Fri, 24 Feb 2023 08:33:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 500821.772329; Fri, 24 Feb 2023 08:33:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pVTVn-0006tA-4c; Fri, 24 Feb 2023 08:33:03 +0000
Received: by outflank-mailman (input) for mailman id 500821;
 Fri, 24 Feb 2023 08: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 1pVTVm-0006t0-4O
 for xen-changelog@lists.xenproject.org; Fri, 24 Feb 2023 08:33:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pVTVm-0007q5-3V
 for xen-changelog@lists.xenproject.org; Fri, 24 Feb 2023 08:33:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pVTVm-0001To-2X
 for xen-changelog@lists.xenproject.org; Fri, 24 Feb 2023 08:33:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=oIkU/A9SFlmUWBJ16OzuljXOaqwEKAaUXqNlYEciufc=; b=lHQ2RaCglTQ2Vy9DUwxneW4VPL
	7C1oUeBEOU3/2EYwTxeAdvAg3S8hvZCvFeu1NMHhoBzdNBTBtYTcYRsNW9D6aLQr1NzN7hJVUajFs
	2Ih7qWFj5JIImq0MXQQ4rrwLRWocCi7jBYWATs45AW9cTYhNbfr3xQwKA4OHvMTgw4XY=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.17] automation: Remove clang-8 from Debian unstable container
Message-Id: <E1pVTVm-0001To-2X@xenbits.xenproject.org>
Date: Fri, 24 Feb 2023 08:33:02 +0000

commit aaf74a532c02017998492c0bf60a9c6be3332f20
Author:     Anthony PERARD <anthony.perard@citrix.com>
AuthorDate: Tue Feb 21 16:55:38 2023 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Wed Feb 22 14:14:33 2023 +0000

    automation: Remove clang-8 from Debian unstable container
    
    First, apt complain that it isn't the right way to add keys anymore,
    but hopefully that's just a warning.
    
    Second, we can't install clang-8:
    The following packages have unmet dependencies:
     clang-8 : Depends: libstdc++-8-dev but it is not installable
               Depends: libgcc-8-dev but it is not installable
               Depends: libobjc-8-dev but it is not installable
               Recommends: llvm-8-dev but it is not going to be installed
               Recommends: libomp-8-dev but it is not going to be installed
     libllvm8 : Depends: libffi7 (>= 3.3~20180313) but it is not installable
    E: Unable to correct problems, you have held broken packages.
    
    clang on Debian unstable is now version 14.0.6.
    
    Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
    (cherry picked from commit a6b1e2b80fe2053b1c9c9843fb086a668513ea36)
---
 automation/build/debian/unstable-llvm-8.list |  3 ---
 automation/build/debian/unstable.dockerfile  | 12 ------------
 automation/gitlab-ci/build.yaml              | 10 ----------
 3 files changed, 25 deletions(-)

diff --git a/automation/build/debian/unstable-llvm-8.list b/automation/build/debian/unstable-llvm-8.list
deleted file mode 100644
index dc119fa0b4..0000000000
--- a/automation/build/debian/unstable-llvm-8.list
+++ /dev/null
@@ -1,3 +0,0 @@
-# Unstable LLVM 8 repos
-deb http://apt.llvm.org/unstable/ llvm-toolchain-8 main
-deb-src http://apt.llvm.org/unstable/ llvm-toolchain-8 main
diff --git a/automation/build/debian/unstable.dockerfile b/automation/build/debian/unstable.dockerfile
index 9de766d596..b560337b7a 100644
--- a/automation/build/debian/unstable.dockerfile
+++ b/automation/build/debian/unstable.dockerfile
@@ -51,15 +51,3 @@ RUN apt-get update && \
         apt-get autoremove -y && \
         apt-get clean && \
         rm -rf /var/lib/apt/lists* /tmp/* /var/tmp/*
-
-RUN wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key|apt-key add -
-COPY unstable-llvm-8.list /etc/apt/sources.list.d/
-
-RUN apt-get update && \
-    apt-get --quiet --yes install \
-        clang-8 \
-        lld-8 \
-        && \
-        apt-get autoremove -y && \
-        apt-get clean && \
-        rm -rf /var/lib/apt/lists* /tmp/* /var/tmp/*
diff --git a/automation/gitlab-ci/build.yaml b/automation/gitlab-ci/build.yaml
index 716ee0b1e4..bed161b471 100644
--- a/automation/gitlab-ci/build.yaml
+++ b/automation/gitlab-ci/build.yaml
@@ -312,16 +312,6 @@ debian-unstable-clang-debug:
   variables:
     CONTAINER: debian:unstable
 
-debian-unstable-clang-8:
-  extends: .clang-8-x86-64-build
-  variables:
-    CONTAINER: debian:unstable
-
-debian-unstable-clang-8-debug:
-  extends: .clang-8-x86-64-build-debug
-  variables:
-    CONTAINER: debian:unstable
-
 debian-unstable-gcc:
   extends: .gcc-x86-64-build
   variables:
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.17


From xen-changelog-bounces@lists.xenproject.org Fri Feb 24 13:11:08 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 24 Feb 2023 13:11:08 +0000
Received: from list by lists.xenproject.org with outflank-mailman.501041.772607 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pVXqp-0000Yb-MN; Fri, 24 Feb 2023 13:11:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 501041.772607; Fri, 24 Feb 2023 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 1pVXqp-0000YT-JX; Fri, 24 Feb 2023 13:11:03 +0000
Received: by outflank-mailman (input) for mailman id 501041;
 Fri, 24 Feb 2023 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 1pVXqn-0000YL-PF
 for xen-changelog@lists.xenproject.org; Fri, 24 Feb 2023 13:11:01 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pVXqn-0006Sc-O4
 for xen-changelog@lists.xenproject.org; Fri, 24 Feb 2023 13:11:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pVXqn-00055e-Mb
 for xen-changelog@lists.xenproject.org; Fri, 24 Feb 2023 13:11:01 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=hP13VeQi1pKPzAtpzbhNK9oaXJ21GvMCeP/w2N9etXg=; b=PjbWcwEjgUMYWLfVLVIcVBlbN/
	4dj/XT0FdJZY2dKKglmz1CfC7aYhKJePI3ie0z8PuXIz/iWyRjapCHl9iuLoXORemyks/C8Z4mCcq
	x1Esh85XTg6smd0w6JvgSQX1iH7HiHPz3UeM/95LpUUAq7RcJ3zpOeCQkx9aIkt2/j54=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86: perform mem_sharing teardown before paging teardown
Message-Id: <E1pVXqn-00055e-Mb@xenbits.xenproject.org>
Date: Fri, 24 Feb 2023 13:11:01 +0000

commit 2869349f0cb3a89dcbf1f1b30371f58df6309312
Author:     Tamas K Lengyel <tamas@tklengyel.com>
AuthorDate: Thu Feb 23 12:35:48 2023 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Feb 23 12:35:48 2023 +0100

    x86: perform mem_sharing teardown before paging teardown
    
    An assert failure has been observed in p2m_teardown when performing vm
    forking and then destroying the forked VM (p2m-basic.c:173). The assert
    checks whether the domain's shared pages counter is 0. According to the
    patch that originally added the assert (7bedbbb5c31) the p2m_teardown
    should only happen after mem_sharing already relinquished all shared pages.
    
    In this patch we flip the order in which relinquish ops are called to avoid
    tripping the assert. Conceptually sharing being torn down makes sense to
    happen before paging is torn down.
    
    Fixes: e7aa55c0aab3 ("x86/p2m: free the paging memory pool preemptively")
    Signed-off-by: Tamas K Lengyel <tamas@tklengyel.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/domain.c | 56 ++++++++++++++++++++++++++-------------------------
 1 file changed, 29 insertions(+), 27 deletions(-)

diff --git a/xen/arch/x86/domain.c b/xen/arch/x86/domain.c
index db3ebf062d..a42f03e8e5 100644
--- a/xen/arch/x86/domain.c
+++ b/xen/arch/x86/domain.c
@@ -2289,9 +2289,9 @@ int domain_relinquish_resources(struct domain *d)
 
         enum {
             PROG_iommu_pagetables = 1,
+            PROG_shared,
             PROG_paging,
             PROG_vcpu_pagetables,
-            PROG_shared,
             PROG_xen,
             PROG_l4,
             PROG_l3,
@@ -2310,6 +2310,34 @@ int domain_relinquish_resources(struct domain *d)
         if ( ret )
             return ret;
 
+#ifdef CONFIG_MEM_SHARING
+    PROGRESS(shared):
+
+        if ( is_hvm_domain(d) )
+        {
+            /*
+             * If the domain has shared pages, relinquish them allowing
+             * for preemption.
+             */
+            ret = relinquish_shared_pages(d);
+            if ( ret )
+                return ret;
+
+            /*
+             * If the domain is forked, decrement the parent's pause count
+             * and release the domain.
+             */
+            if ( mem_sharing_is_fork(d) )
+            {
+                struct domain *parent = d->parent;
+
+                d->parent = NULL;
+                domain_unpause(parent);
+                put_domain(parent);
+            }
+        }
+#endif
+
     PROGRESS(paging):
 
         /* Tear down paging-assistance stuff. */
@@ -2350,32 +2378,6 @@ int domain_relinquish_resources(struct domain *d)
             d->arch.auto_unmask = 0;
         }
 
-#ifdef CONFIG_MEM_SHARING
-    PROGRESS(shared):
-
-        if ( is_hvm_domain(d) )
-        {
-            /* If the domain has shared pages, relinquish them allowing
-             * for preemption. */
-            ret = relinquish_shared_pages(d);
-            if ( ret )
-                return ret;
-
-            /*
-             * If the domain is forked, decrement the parent's pause count
-             * and release the domain.
-             */
-            if ( mem_sharing_is_fork(d) )
-            {
-                struct domain *parent = d->parent;
-
-                d->parent = NULL;
-                domain_unpause(parent);
-                put_domain(parent);
-            }
-        }
-#endif
-
         spin_lock(&d->page_alloc_lock);
         page_list_splice(&d->arch.relmem_list, &d->page_list);
         INIT_PAGE_LIST_HEAD(&d->arch.relmem_list);
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Feb 24 13:11:13 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 24 Feb 2023 13:11:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.501042.772611 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pVXqz-0000vh-ON; Fri, 24 Feb 2023 13:11:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 501042.772611; Fri, 24 Feb 2023 13:11:13 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pVXqz-0000vb-L7; Fri, 24 Feb 2023 13:11:13 +0000
Received: by outflank-mailman (input) for mailman id 501042;
 Fri, 24 Feb 2023 13: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 1pVXqx-0000vK-Ua
 for xen-changelog@lists.xenproject.org; Fri, 24 Feb 2023 13:11:11 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pVXqx-0006Sw-Tm
 for xen-changelog@lists.xenproject.org; Fri, 24 Feb 2023 13:11:11 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pVXqx-00056E-QL
 for xen-changelog@lists.xenproject.org; Fri, 24 Feb 2023 13:11:11 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=UlXbcAucDbUTbJsGw//cG73TBqhT3b8OGN7HmybT7qk=; b=lQMmau0A25Zq9RrHhgmx+iO9Jn
	F6gqoQgVVs/ZmA8bCMDli6ARpyCj8dsHpzu5zqFgH+A46xe5Vbis034h1lj1P8S7/aOuEvYSKm0Oc
	dQufzPNuHzySz3qzlkUyj9CyThvvsZG7MhbWQs3xH1goUt9faAd+BIHFWx5cNHPfOu40=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/svm: opencode SVM_PAUSE{FILTER,THRESH}_INIT
Message-Id: <E1pVXqx-00056E-QL@xenbits.xenproject.org>
Date: Fri, 24 Feb 2023 13:11:11 +0000

commit 91d4d9506a4e8906253d1280bd5a1f39668fad64
Author:     Xenia Ragiadakou <burzalodowa@gmail.com>
AuthorDate: Thu Feb 23 12:36:42 2023 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Feb 23 12:36:42 2023 +0100

    x86/svm: opencode SVM_PAUSE{FILTER,THRESH}_INIT
    
    Delete the macros SVM_PAUSE{FILTER,THRESH}_INIT from svm.h and opencode
    their values, since they are used in a single place and using macros is
    just unnecessary obfuscation.
    
    Suggested-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Signed-off-by: Xenia Ragiadakou <burzalodowa@gmail.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/hvm/svm/vmcb.c            | 4 ++--
 xen/arch/x86/include/asm/hvm/svm/svm.h | 3 ---
 2 files changed, 2 insertions(+), 5 deletions(-)

diff --git a/xen/arch/x86/hvm/svm/vmcb.c b/xen/arch/x86/hvm/svm/vmcb.c
index 305d4767e3..ba93375e87 100644
--- a/xen/arch/x86/hvm/svm/vmcb.c
+++ b/xen/arch/x86/hvm/svm/vmcb.c
@@ -169,11 +169,11 @@ static int construct_vmcb(struct vcpu *v)
 
     if ( cpu_has_pause_filter )
     {
-        vmcb->_pause_filter_count = SVM_PAUSEFILTER_INIT;
+        vmcb->_pause_filter_count = 4000;
         vmcb->_general1_intercepts |= GENERAL1_INTERCEPT_PAUSE;
 
         if ( cpu_has_pause_thresh )
-            vmcb->_pause_filter_thresh = SVM_PAUSETHRESH_INIT;
+            vmcb->_pause_filter_thresh = 1000;
     }
 
     /*
diff --git a/xen/arch/x86/include/asm/hvm/svm/svm.h b/xen/arch/x86/include/asm/hvm/svm/svm.h
index 65e35a4f59..cf9ed517d5 100644
--- a/xen/arch/x86/include/asm/hvm/svm/svm.h
+++ b/xen/arch/x86/include/asm/hvm/svm/svm.h
@@ -96,9 +96,6 @@ extern u32 svm_feature_flags;
 #define cpu_has_svm_sss       cpu_has_svm_feature(SVM_FEATURE_SSS)
 #define cpu_has_svm_spec_ctrl cpu_has_svm_feature(SVM_FEATURE_SPEC_CTRL)
 
-#define SVM_PAUSEFILTER_INIT    4000
-#define SVM_PAUSETHRESH_INIT    1000
-
 /* TSC rate */
 #define DEFAULT_TSC_RATIO       0x0000000100000000ULL
 #define TSC_RATIO_RSVD_BITS     0xffffff0000000000ULL
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Feb 24 17:55:08 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 24 Feb 2023 17:55:08 +0000
Received: from list by lists.xenproject.org with outflank-mailman.501385.773096 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pVcHe-0007rd-Vh; Fri, 24 Feb 2023 17:55:02 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 501385.773096; Fri, 24 Feb 2023 17:55:02 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pVcHe-0007rW-Sg; Fri, 24 Feb 2023 17:55:02 +0000
Received: by outflank-mailman (input) for mailman id 501385;
 Fri, 24 Feb 2023 17: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 1pVcHd-0007rQ-Iz
 for xen-changelog@lists.xenproject.org; Fri, 24 Feb 2023 17:55:01 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pVcHd-0005E7-GV
 for xen-changelog@lists.xenproject.org; Fri, 24 Feb 2023 17:55:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pVcHd-0005rS-ER
 for xen-changelog@lists.xenproject.org; Fri, 24 Feb 2023 17:55:01 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=hzT855oATX3THRAkL/KpH/GxIOZKWXjne72SQTR4cxQ=; b=EbjYGTyi670ZbSGnc6l3Pf0U2U
	9XSG8BG4ggR9Kh3Dk60wLb9bltGSLPc1cOiqLaKsmO6V53/ZtOIHvO3yMORM6Z5PHhSsP2QvJWEIY
	Qm+0PQyLBiR79+wP+VqT9p3cj0wuz6fXOwf/udo+0DpatJhT6AYTRVHhoyrlLcEprXsU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.14] automation: Remove clang-8 from Debian unstable container
Message-Id: <E1pVcHd-0005rS-ER@xenbits.xenproject.org>
Date: Fri, 24 Feb 2023 17:55:01 +0000

commit c267abfaf2d8176371eda037f9b9152458e0656d
Author:     Anthony PERARD <anthony.perard@citrix.com>
AuthorDate: Tue Feb 21 16:55:38 2023 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Wed Feb 22 14:14:35 2023 +0000

    automation: Remove clang-8 from Debian unstable container
    
    First, apt complain that it isn't the right way to add keys anymore,
    but hopefully that's just a warning.
    
    Second, we can't install clang-8:
    The following packages have unmet dependencies:
     clang-8 : Depends: libstdc++-8-dev but it is not installable
               Depends: libgcc-8-dev but it is not installable
               Depends: libobjc-8-dev but it is not installable
               Recommends: llvm-8-dev but it is not going to be installed
               Recommends: libomp-8-dev but it is not going to be installed
     libllvm8 : Depends: libffi7 (>= 3.3~20180313) but it is not installable
    E: Unable to correct problems, you have held broken packages.
    
    clang on Debian unstable is now version 14.0.6.
    
    Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
    (cherry picked from commit a6b1e2b80fe2053b1c9c9843fb086a668513ea36)
---
 automation/build/debian/unstable-llvm-8.list |  3 ---
 automation/build/debian/unstable.dockerfile  | 12 ------------
 automation/gitlab-ci/build.yaml              | 10 ----------
 3 files changed, 25 deletions(-)

diff --git a/automation/build/debian/unstable-llvm-8.list b/automation/build/debian/unstable-llvm-8.list
deleted file mode 100644
index dc119fa0b4..0000000000
--- a/automation/build/debian/unstable-llvm-8.list
+++ /dev/null
@@ -1,3 +0,0 @@
-# Unstable LLVM 8 repos
-deb http://apt.llvm.org/unstable/ llvm-toolchain-8 main
-deb-src http://apt.llvm.org/unstable/ llvm-toolchain-8 main
diff --git a/automation/build/debian/unstable.dockerfile b/automation/build/debian/unstable.dockerfile
index aeb4f3448b..98384db9dd 100644
--- a/automation/build/debian/unstable.dockerfile
+++ b/automation/build/debian/unstable.dockerfile
@@ -50,15 +50,3 @@ RUN apt-get update && \
         apt-get autoremove -y && \
         apt-get clean && \
         rm -rf /var/lib/apt/lists* /tmp/* /var/tmp/*
-
-RUN wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key|apt-key add -
-COPY unstable-llvm-8.list /etc/apt/sources.list.d/
-
-RUN apt-get update && \
-    apt-get --quiet --yes install \
-        clang-8 \
-        lld-8 \
-        && \
-        apt-get autoremove -y && \
-        apt-get clean && \
-        rm -rf /var/lib/apt/lists* /tmp/* /var/tmp/*
diff --git a/automation/gitlab-ci/build.yaml b/automation/gitlab-ci/build.yaml
index 1e61d30c85..2ca12226cd 100644
--- a/automation/gitlab-ci/build.yaml
+++ b/automation/gitlab-ci/build.yaml
@@ -286,16 +286,6 @@ debian-unstable-clang-debug:
   variables:
     CONTAINER: debian:unstable
 
-debian-unstable-clang-8:
-  extends: .clang-8-x86-64-build
-  variables:
-    CONTAINER: debian:unstable
-
-debian-unstable-clang-8-debug:
-  extends: .clang-8-x86-64-build-debug
-  variables:
-    CONTAINER: debian:unstable
-
 debian-unstable-gcc:
   extends: .gcc-x86-64-build
   variables:
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.14


From xen-changelog-bounces@lists.xenproject.org Sat Feb 25 20:00:07 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 25 Feb 2023 20:00:07 +0000
Received: from list by lists.xenproject.org with outflank-mailman.501848.773603 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pW0iA-0001lr-MQ; Sat, 25 Feb 2023 20:00:02 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 501848.773603; Sat, 25 Feb 2023 20:00:02 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pW0iA-0001lP-JB; Sat, 25 Feb 2023 20:00:02 +0000
Received: by outflank-mailman (input) for mailman id 501848;
 Sat, 25 Feb 2023 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 1pW0i9-0001Y5-Lz
 for xen-changelog@lists.xenproject.org; Sat, 25 Feb 2023 20:00:01 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pW0i9-0000Li-LB
 for xen-changelog@lists.xenproject.org; Sat, 25 Feb 2023 20:00:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pW0i9-000778-Jc
 for xen-changelog@lists.xenproject.org; Sat, 25 Feb 2023 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>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=I4yjlW7TCPWe79DkaY0ipTFvLEJ4fJ9VlHKJ3i2PbKw=; b=ioyyEbukUMXFOgB2m0aMFT2I9W
	Bzvo2vnFqtiFwZ0VY5loPu84Cw2s0cNdaFKFrDBzYT1yq/l32enRgp2EKKYebCq752SwzMWv09hXF
	1QRO3//Xs1xOOdNYQmjMTmeRu9uAGGud2eN0qqGSRonS8hRs5wgdAyUghXQSzk9+3a6A=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] CI: Update FreeBSD to 13.1
Message-Id: <E1pW0i9-000778-Jc@xenbits.xenproject.org>
Date: Sat, 25 Feb 2023 20:00:01 +0000

commit 5e7667ea2dd33e0e5e0f3a96db37fdb4ecd98fba
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Fri Feb 17 11:16:32 2023 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Feb 24 17:44:29 2023 +0000

    CI: Update FreeBSD to 13.1
    
    Also print the compiler version before starting.  It's not easy to find
    otherwise, and does change from time to time.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Anthony PERARD <anthony.perard@citrix.com>
---
 .cirrus.yml | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/.cirrus.yml b/.cirrus.yml
index c38333e736..b133afb740 100644
--- a/.cirrus.yml
+++ b/.cirrus.yml
@@ -10,6 +10,7 @@ freebsd_template: &FREEBSD_TEMPLATE
                                  libxml2 glib git
 
   build_script:
+    - cc --version
     - ./configure --with-system-seabios=/usr/local/share/seabios/bios.bin
     - gmake -j`sysctl -n hw.ncpu` clang=y
 
@@ -22,7 +23,7 @@ task:
 task:
   name: 'FreeBSD 13'
   freebsd_instance:
-    image_family: freebsd-13-0
+    image_family: freebsd-13-1
   << : *FREEBSD_TEMPLATE
 
 task:
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Feb 25 20:00:12 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 25 Feb 2023 20:00:12 +0000
Received: from list by lists.xenproject.org with outflank-mailman.501851.773607 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pW0iK-0002Zd-Nc; Sat, 25 Feb 2023 20:00:12 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 501851.773607; Sat, 25 Feb 2023 20:00:12 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pW0iK-0002ZQ-Ke; Sat, 25 Feb 2023 20:00:12 +0000
Received: by outflank-mailman (input) for mailman id 501851;
 Sat, 25 Feb 2023 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 1pW0iJ-0002ZG-QT
 for xen-changelog@lists.xenproject.org; Sat, 25 Feb 2023 20:00:11 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pW0iJ-0000Lz-Pd
 for xen-changelog@lists.xenproject.org; Sat, 25 Feb 2023 20:00:11 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pW0iJ-00078j-NL
 for xen-changelog@lists.xenproject.org; Sat, 25 Feb 2023 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>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=ZH3I+h+0piO4LxU7l81oe7kc2fbZYB6F1r3P2O4JG9o=; b=C4YtkV141FA9bIZtoRdF12LyYR
	sTVTOhn3Jjl/gv1CwynRXpMVq4D8Wk4b/g8vIjRnnVLWq8Lu3KzFAQQAWkIbwH7kyGxQCsLaRDbnP
	ywYGI62ETe7kgqIbvS8oZxFdN/kgta63g2BMqevp2n+GPYDuEbLdI9F7s324o4RaxOAo=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen: Work around Clang-IAS macro \@ expansion bug
Message-Id: <E1pW0iJ-00078j-NL@xenbits.xenproject.org>
Date: Sat, 25 Feb 2023 20:00:11 +0000

commit a2adacff0b91cc7b977abb209dc419a2ef15963f
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Fri Feb 17 00:12:24 2023 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Feb 24 17:44:29 2023 +0000

    xen: Work around Clang-IAS macro \@ expansion bug
    
    https://github.com/llvm/llvm-project/issues/60792
    
    It turns out that Clang-IAS does not expand \@ uniquely in a translaition
    unit, and the XSA-426 change tickles this bug:
    
      <instantiation>:4:1: error: invalid symbol redefinition
      .L1_fill_rsb_loop:
      ^
      make[3]: *** [Rules.mk:247: arch/x86/acpi/cpu_idle.o] Error 1
    
    Extend DO_OVERWRITE_RSB with an optional parameter so C callers can mix %= in
    too, which Clang does seem to expand properly.
    
    Fixes: 63305e5392ec ("x86/spec-ctrl: Mitigate Cross-Thread Return Address Predictions")
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/include/asm/spec_ctrl.h     |  4 ++--
 xen/arch/x86/include/asm/spec_ctrl_asm.h | 19 ++++++++++++-------
 2 files changed, 14 insertions(+), 9 deletions(-)

diff --git a/xen/arch/x86/include/asm/spec_ctrl.h b/xen/arch/x86/include/asm/spec_ctrl.h
index 3cf8a7d304..f718f94088 100644
--- a/xen/arch/x86/include/asm/spec_ctrl.h
+++ b/xen/arch/x86/include/asm/spec_ctrl.h
@@ -83,7 +83,7 @@ static always_inline void spec_ctrl_new_guest_context(void)
     wrmsrl(MSR_PRED_CMD, PRED_CMD_IBPB);
 
     /* (ab)use alternative_input() to specify clobbers. */
-    alternative_input("", "DO_OVERWRITE_RSB", X86_BUG_IBPB_NO_RET,
+    alternative_input("", "DO_OVERWRITE_RSB xu=%=", X86_BUG_IBPB_NO_RET,
                       : "rax", "rcx");
 }
 
@@ -172,7 +172,7 @@ static always_inline void spec_ctrl_enter_idle(struct cpu_info *info)
      *
      * (ab)use alternative_input() to specify clobbers.
      */
-    alternative_input("", "DO_OVERWRITE_RSB", X86_FEATURE_SC_RSB_IDLE,
+    alternative_input("", "DO_OVERWRITE_RSB xu=%=", X86_FEATURE_SC_RSB_IDLE,
                       : "rax", "rcx");
 }
 
diff --git a/xen/arch/x86/include/asm/spec_ctrl_asm.h b/xen/arch/x86/include/asm/spec_ctrl_asm.h
index fab27ff553..f23bb105c5 100644
--- a/xen/arch/x86/include/asm/spec_ctrl_asm.h
+++ b/xen/arch/x86/include/asm/spec_ctrl_asm.h
@@ -117,11 +117,16 @@
 .L\@_done:
 .endm
 
-.macro DO_OVERWRITE_RSB tmp=rax
+.macro DO_OVERWRITE_RSB tmp=rax xu
 /*
  * Requires nothing
  * Clobbers \tmp (%rax by default), %rcx
  *
+ * xu is an optional parameter to add eXtra Uniqueness.  It is intended for
+ * passing %= in from an asm() block, in order to work around
+ * https://github.com/llvm/llvm-project/issues/60792 where Clang-IAS doesn't
+ * expand \@ uniquely.
+ *
  * Requires 256 bytes of {,shadow}stack space, but %rsp/SSP has no net
  * change. Based on Google's performance numbers, the loop is unrolled to 16
  * iterations and two calls per iteration.
@@ -136,27 +141,27 @@
     mov $16, %ecx                   /* 16 iterations, two calls per loop */
     mov %rsp, %\tmp                 /* Store the current %rsp */
 
-.L\@_fill_rsb_loop:
+.L\@_fill_rsb_loop\xu:
 
     .irp n, 1, 2                    /* Unrolled twice. */
-    call .L\@_insert_rsb_entry_\n   /* Create an RSB entry. */
+    call .L\@_insert_rsb_entry\xu\n /* Create an RSB entry. */
     int3                            /* Halt rogue speculation. */
 
-.L\@_insert_rsb_entry_\n:
+.L\@_insert_rsb_entry\xu\n:
     .endr
 
     sub $1, %ecx
-    jnz .L\@_fill_rsb_loop
+    jnz .L\@_fill_rsb_loop\xu
     mov %\tmp, %rsp                 /* Restore old %rsp */
 
 #ifdef CONFIG_XEN_SHSTK
     mov $1, %ecx
     rdsspd %ecx
     cmp $1, %ecx
-    je .L\@_shstk_done
+    je .L\@_shstk_done\xu
     mov $64, %ecx                   /* 64 * 4 bytes, given incsspd */
     incsspd %ecx                    /* Restore old SSP */
-.L\@_shstk_done:
+.L\@_shstk_done\xu:
 #endif
 .endm
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Feb 25 20:00:22 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 25 Feb 2023 20:00:22 +0000
Received: from list by lists.xenproject.org with outflank-mailman.501852.773611 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pW0iU-0002e6-PB; Sat, 25 Feb 2023 20:00:22 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 501852.773611; Sat, 25 Feb 2023 20: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 1pW0iU-0002dy-MF; Sat, 25 Feb 2023 20:00:22 +0000
Received: by outflank-mailman (input) for mailman id 501852;
 Sat, 25 Feb 2023 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 1pW0iT-0002dm-UI
 for xen-changelog@lists.xenproject.org; Sat, 25 Feb 2023 20:00:21 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pW0iT-0000M8-Sf
 for xen-changelog@lists.xenproject.org; Sat, 25 Feb 2023 20:00:21 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pW0iT-00079m-Rl
 for xen-changelog@lists.xenproject.org; Sat, 25 Feb 2023 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>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=t1YqycxCa6aua8H2G0JujsrWzndqGeyemoTGMyNEtkE=; b=2vcOTVurYDuXogNyrRC/CzbBgG
	0NJdv6bU7BIy5MmHo0OLcdEQkHUv57zxezNzaSguclZRjW6tuSQfR3UC9X5DTm/F5wY9d7Jv+b5ef
	aRsHJCV8MQxnTVW5JXO4isKPjCu8kH4EsztWPSpaMRJWElLUVt1qdKodmrGwE92h0uX0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen: Fix Clang -Wunicode diagnostic when building asm-macros
Message-Id: <E1pW0iT-00079m-Rl@xenbits.xenproject.org>
Date: Sat, 25 Feb 2023 20:00:21 +0000

commit 53f0d02040b1df08f0589f162790ca376e1c2040
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu Feb 23 21:53:26 2023 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Feb 24 17:44:29 2023 +0000

    xen: Fix Clang -Wunicode diagnostic when building asm-macros
    
    While trying to work around a different Clang-IAS bug (parent changeset), I
    stumbled onto:
    
      In file included from arch/x86/asm-macros.c:3:
      ./arch/x86/include/asm/spec_ctrl_asm.h:144:19: error: \u used with
      no following hex digits; treating as '\' followed by identifier [-Werror,-Wunicode]
      .L\@_fill_rsb_loop\uniq:
                        ^
    
    It turns out that Clang -E is sensitive to the file extension of the source
    file it is processing.  Furthermore, C explicitly permits the use of \u
    escapes in identifier names, so the diagnostic would be reasonable in
    principle if we trying to compile the result.
    
    asm-macros should really have been .S from the outset, as it is ultimately
    generating assembly, not C.  Rename it, which causes Clang not to complain.
    
    We need to introduce rules for generating a .i file from .S, and substituting
    c_flags for a_flags lets us drop the now-redundant -D__ASSEMBLY__.
    
    No functional change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/Rules.mk              | 6 ++++++
 xen/arch/x86/Makefile     | 2 +-
 xen/arch/x86/asm-macros.S | 3 +++
 xen/arch/x86/asm-macros.c | 3 ---
 4 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/xen/Rules.mk b/xen/Rules.mk
index d6b7cec0a8..59072ae8df 100644
--- a/xen/Rules.mk
+++ b/xen/Rules.mk
@@ -273,6 +273,9 @@ $(filter %.init.o,$(obj-y) $(obj-bin-y) $(extra-y)): $(obj)/%.init.o: $(obj)/%.o
 quiet_cmd_cpp_i_c = CPP     $@
 cmd_cpp_i_c = $(CPP) $(call cpp_flags,$(c_flags)) -MQ $@ -o $@ $<
 
+quiet_cmd_cpp_i_S = CPP     $@
+cmd_cpp_i_S = $(CPP) $(call cpp_flags,$(a_flags)) -MQ $@ -o $@ $<
+
 quiet_cmd_cc_s_c = CC      $@
 cmd_cc_s_c = $(CC) $(filter-out -Wa$(comma)%,$(c_flags)) -S $< -o $@
 
@@ -282,6 +285,9 @@ cmd_cpp_s_S = $(CPP) $(call cpp_flags,$(a_flags)) -MQ $@ -o $@ $<
 $(obj)/%.i: $(src)/%.c FORCE
 	$(call if_changed_dep,cpp_i_c)
 
+$(obj)/%.i: $(src)/%.S FORCE
+	$(call if_changed_dep,cpp_i_S)
+
 $(obj)/%.s: $(src)/%.c FORCE
 	$(call if_changed_dep,cc_s_c)
 
diff --git a/xen/arch/x86/Makefile b/xen/arch/x86/Makefile
index 177a2ff742..5accbe4c67 100644
--- a/xen/arch/x86/Makefile
+++ b/xen/arch/x86/Makefile
@@ -240,7 +240,7 @@ $(obj)/efi/buildid.o $(obj)/efi/relocs-dummy.o: ;
 .PHONY: include
 include: $(objtree)/arch/x86/include/asm/asm-macros.h
 
-$(obj)/asm-macros.i: CFLAGS-y += -D__ASSEMBLY__ -P
+$(obj)/asm-macros.i: CFLAGS-y += -P
 
 $(objtree)/arch/x86/include/asm/asm-macros.h: $(obj)/asm-macros.i $(src)/Makefile
 	$(call filechk,asm-macros.h)
diff --git a/xen/arch/x86/asm-macros.S b/xen/arch/x86/asm-macros.S
new file mode 100644
index 0000000000..891d86c765
--- /dev/null
+++ b/xen/arch/x86/asm-macros.S
@@ -0,0 +1,3 @@
+#include <asm/asm-defns.h>
+#include <asm/alternative-asm.h>
+#include <asm/spec_ctrl_asm.h>
diff --git a/xen/arch/x86/asm-macros.c b/xen/arch/x86/asm-macros.c
deleted file mode 100644
index 891d86c765..0000000000
--- a/xen/arch/x86/asm-macros.c
+++ /dev/null
@@ -1,3 +0,0 @@
-#include <asm/asm-defns.h>
-#include <asm/alternative-asm.h>
-#include <asm/spec_ctrl_asm.h>
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Feb 25 20:00:32 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 25 Feb 2023 20:00:32 +0000
Received: from list by lists.xenproject.org with outflank-mailman.501853.773615 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pW0ie-0002hE-QX; Sat, 25 Feb 2023 20:00:32 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 501853.773615; Sat, 25 Feb 2023 20: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 1pW0ie-0002h6-Nm; Sat, 25 Feb 2023 20:00:32 +0000
Received: by outflank-mailman (input) for mailman id 501853;
 Sat, 25 Feb 2023 20: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 1pW0ie-0002gv-0n
 for xen-changelog@lists.xenproject.org; Sat, 25 Feb 2023 20:00:32 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pW0id-0000Mb-WE
 for xen-changelog@lists.xenproject.org; Sat, 25 Feb 2023 20:00:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pW0id-0007Af-Ug
 for xen-changelog@lists.xenproject.org; Sat, 25 Feb 2023 20:00:31 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=yUTL+bDcvUhom3tXfKjZ0SHDTqbJ2kVRl2+nwMo2ivs=; b=iUjdW2Prwdv2lwUT+LibxFsgE5
	Y3jHp/8J05k7qVwsHV3Yazy2cAuvDsSr2WQe5aBxPR6DpRLRCyCeRaN0F7YD4qP0Rp014NTEHx80V
	IpYxAt8LHlVUmH7fEfYFzgsHYdbAD7II0qiNKdMTbPZjYh+6oT1An0z7HcmaFv9i3tHk=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools: Use PKG_CONFIG_FILE instead of PKG_CONFIG variable
Message-Id: <E1pW0id-0007Af-Ug@xenbits.xenproject.org>
Date: Sat, 25 Feb 2023 20:00:31 +0000

commit b97e2fe7b9e1f4706693552697239ac2b71efee4
Author:     Bertrand Marquis <bertrand.marquis@arm.com>
AuthorDate: Thu Feb 23 13:03:03 2023 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Feb 24 17:44:29 2023 +0000

    tools: Use PKG_CONFIG_FILE instead of PKG_CONFIG variable
    
    Replace PKG_CONFIG variable name with PKG_CONFIG_FILE for the name of
    the pkg-config file.
    This is preventing a conflict in some build systems where PKG_CONFIG
    actually contains the path to the pkg-config executable to use, as the
    default assignment in libs.mk is using a weak assignment (?=).
    
    This problem has been found when trying to build the latest version of
    Xen tools using buildroot.
    
    Fixes: d400dc5729e4 ("tools: tweak tools/libs/libs.mk for being able to support libxenctrl")
    Signed-off-by: Bertrand Marquis <bertrand.marquis@arm.com>
    Reviewed-by: Anthony PERARD <anthony.perard@citrix.com>
---
 tools/libs/ctrl/Makefile |  2 +-
 tools/libs/libs.mk       | 16 ++++++++--------
 2 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/tools/libs/ctrl/Makefile b/tools/libs/ctrl/Makefile
index 094e84b8d8..5fe0bfad0c 100644
--- a/tools/libs/ctrl/Makefile
+++ b/tools/libs/ctrl/Makefile
@@ -4,7 +4,7 @@ include $(XEN_ROOT)/tools/Rules.mk
 include Makefile.common
 
 LIBHEADER := xenctrl.h xenctrl_compat.h
-PKG_CONFIG := xencontrol.pc
+PKG_CONFIG_FILE := xencontrol.pc
 PKG_CONFIG_NAME := Xencontrol
 
 NO_HEADERS_CHK := y
diff --git a/tools/libs/libs.mk b/tools/libs/libs.mk
index ffb6c9f064..8115aa58a6 100644
--- a/tools/libs/libs.mk
+++ b/tools/libs/libs.mk
@@ -1,7 +1,7 @@
 # Common Makefile for building a lib.
 #
 # Variables taken as input:
-#   PKG_CONFIG: name of pkg-config file (xen$(LIBNAME).pc if empty)
+#   PKG_CONFIG_FILE: name of pkg-config file (xen$(LIBNAME).pc if empty)
 #   MAJOR:   major version of lib (Xen version if empty)
 #   MINOR:   minor version of lib (0 if empty)
 #   version-script: Specify the name of a version script to the linker.
@@ -30,7 +30,7 @@ endif
 
 version-script ?= lib$(LIB_FILE_NAME).map.tmp
 
-PKG_CONFIG ?= $(LIB_FILE_NAME).pc
+PKG_CONFIG_FILE ?= $(LIB_FILE_NAME).pc
 PKG_CONFIG_NAME ?= Xen$(LIBNAME)
 PKG_CONFIG_DESC ?= The $(PKG_CONFIG_NAME) library for Xen hypervisor
 PKG_CONFIG_VERSION := $(MAJOR).$(MINOR)
@@ -39,13 +39,13 @@ PKG_CONFIG_LIB := $(LIB_FILE_NAME)
 PKG_CONFIG_REQPRIV := $(subst $(space),$(comma),$(strip $(foreach lib,$(patsubst ctrl,control,$(USELIBS_$(LIBNAME))),xen$(lib))))
 
 ifneq ($(CONFIG_LIBXC_MINIOS),y)
-TARGETS += $(PKG_CONFIG)
-$(PKG_CONFIG): PKG_CONFIG_PREFIX = $(prefix)
-$(PKG_CONFIG): PKG_CONFIG_INCDIR = $(includedir)
-$(PKG_CONFIG): PKG_CONFIG_LIBDIR = $(libdir)
+TARGETS += $(PKG_CONFIG_FILE)
+$(PKG_CONFIG_FILE): PKG_CONFIG_PREFIX = $(prefix)
+$(PKG_CONFIG_FILE): PKG_CONFIG_INCDIR = $(includedir)
+$(PKG_CONFIG_FILE): PKG_CONFIG_LIBDIR = $(libdir)
 endif
 
-PKG_CONFIG_LOCAL := $(PKG_CONFIG_DIR)/$(PKG_CONFIG)
+PKG_CONFIG_LOCAL := $(PKG_CONFIG_DIR)/$(PKG_CONFIG_FILE)
 
 LIBHEADER ?= $(LIB_FILE_NAME).h
 LIBHEADERS = $(foreach h, $(LIBHEADER), $(XEN_INCLUDE)/$(h))
@@ -108,7 +108,7 @@ install:: all
 	$(SYMLINK_SHLIB) lib$(LIB_FILE_NAME).so.$(MAJOR).$(MINOR) $(DESTDIR)$(libdir)/lib$(LIB_FILE_NAME).so.$(MAJOR)
 	$(SYMLINK_SHLIB) lib$(LIB_FILE_NAME).so.$(MAJOR) $(DESTDIR)$(libdir)/lib$(LIB_FILE_NAME).so
 	for i in $(LIBHEADERS); do $(INSTALL_DATA) $$i $(DESTDIR)$(includedir); done
-	$(INSTALL_DATA) $(PKG_CONFIG) $(DESTDIR)$(PKG_INSTALLDIR)
+	$(INSTALL_DATA) $(PKG_CONFIG_FILE) $(DESTDIR)$(PKG_INSTALLDIR)
 
 .PHONY: uninstall
 uninstall::
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Feb 25 20:00:43 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 25 Feb 2023 20:00:43 +0000
Received: from list by lists.xenproject.org with outflank-mailman.501854.773619 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pW0io-0002je-Rz; Sat, 25 Feb 2023 20:00:42 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 501854.773619; Sat, 25 Feb 2023 20: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 1pW0io-0002jV-PC; Sat, 25 Feb 2023 20:00:42 +0000
Received: by outflank-mailman (input) for mailman id 501854;
 Sat, 25 Feb 2023 20: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 1pW0io-0002jL-3p
 for xen-changelog@lists.xenproject.org; Sat, 25 Feb 2023 20:00:42 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pW0io-0000Mk-30
 for xen-changelog@lists.xenproject.org; Sat, 25 Feb 2023 20:00:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pW0io-0007BW-2B
 for xen-changelog@lists.xenproject.org; Sat, 25 Feb 2023 20:00:42 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=s93LuxwnqEHukCbSaNKeDW9xmqDxKnuwE9FUxNIHo7M=; b=KYpyxZO64PI52XJVfYkkCy0Y/C
	252xVYGS7MSM+ZHMuWqJT1Ukf/OjOZ/5mXI9Dd/qt+YpgIHQ77fXouySXe/w08LIuNkZ1Vn/9oTmp
	zdBar9WmyN+n2PgXhPJhoZaDaXrtMB4VyoEnMk7peKfgV4LufU0o0Ty17ksltaxZjKw8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/vmx: Correct the declaration of vmx_asm_vmexit_handler()
Message-Id: <E1pW0io-0007BW-2B@xenbits.xenproject.org>
Date: Sat, 25 Feb 2023 20:00:42 +0000

commit 43e1387130dfbf201c3bf50c8967ad117a994754
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu Feb 23 11:57:48 2023 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Feb 24 17:44:29 2023 +0000

    x86/vmx: Correct the declaration of vmx_asm_vmexit_handler()
    
    Taking struct cpu_user_regs as a full object is bogus, and while what was
    probably meant was to take a struct cpu_user_regs pointer, that's still wrong.
    
    This isn't a function; its an address stored in the VMCS that the CPU resumes
    from on VMExit, meaning that it doesn't conform to a normal C API/ABI.
    
    Annotate it with `nocall`, and move the declaration into vmcs.c next to its
    sole user.
    
    Fixes: 9c3118a82523 ("bitkeeper revision 1.1159.1.483 (41c0c417XYObowWqbfqU0cdLx30C9w)")
                     `-> "Initial Intel VMX support"
    Reported-by: Jan Beulich <JBeulich@suse.com>
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/hvm/vmx/vmcs.c            | 2 ++
 xen/arch/x86/include/asm/hvm/vmx/vmx.h | 1 -
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/xen/arch/x86/hvm/vmx/vmcs.c b/xen/arch/x86/hvm/vmx/vmcs.c
index e1c268789e..ed71ecfb62 100644
--- a/xen/arch/x86/hvm/vmx/vmcs.c
+++ b/xen/arch/x86/hvm/vmx/vmcs.c
@@ -1074,6 +1074,8 @@ static void pi_desc_init(struct vcpu *v)
     v->arch.hvm.vmx.pi_desc.ndst = APIC_INVALID_DEST;
 }
 
+void nocall vmx_asm_vmexit_handler(void);
+
 static int construct_vmcs(struct vcpu *v)
 {
     struct domain *d = v->domain;
diff --git a/xen/arch/x86/include/asm/hvm/vmx/vmx.h b/xen/arch/x86/include/asm/hvm/vmx/vmx.h
index 97d6b810ec..f6308ed656 100644
--- a/xen/arch/x86/include/asm/hvm/vmx/vmx.h
+++ b/xen/arch/x86/include/asm/hvm/vmx/vmx.h
@@ -82,7 +82,6 @@ typedef enum {
 
 #define PI_xAPIC_NDST_MASK      0xFF00
 
-void vmx_asm_vmexit_handler(struct cpu_user_regs);
 void vmx_intr_assist(void);
 void noreturn cf_check vmx_do_resume(void);
 void cf_check vmx_vlapic_msr_changed(struct vcpu *v);
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Feb 25 20:00:52 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 25 Feb 2023 20:00:52 +0000
Received: from list by lists.xenproject.org with outflank-mailman.501855.773622 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pW0iy-0002mP-TF; Sat, 25 Feb 2023 20:00:52 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 501855.773622; Sat, 25 Feb 2023 20: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 1pW0iy-0002mH-Qd; Sat, 25 Feb 2023 20:00:52 +0000
Received: by outflank-mailman (input) for mailman id 501855;
 Sat, 25 Feb 2023 20: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 1pW0iy-0002m6-6i
 for xen-changelog@lists.xenproject.org; Sat, 25 Feb 2023 20:00:52 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pW0iy-0000Mx-5w
 for xen-changelog@lists.xenproject.org; Sat, 25 Feb 2023 20:00:52 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pW0iy-0007CS-52
 for xen-changelog@lists.xenproject.org; Sat, 25 Feb 2023 20:00:52 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=WdcbtyXpAg+dh0lfu2vCSRHXQ7JKmSgs6WT5tGIMJ+k=; b=6RG5LN/6jbaXh7QPbwwfnvcq6q
	DmvI/awB6bYvhnvwnkkZgaWeAmoI7oh3ZNNNKmHocfjJMkRYrjtO8LXwCjRoZNZGml45UXoOMwMX4
	X9MrxEowgTu90emuDd9oMBh6OGNkshXc/ORp6xM1t4jUJmiNb1wh/pHdJGI72IGfFISU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/compiler: Clang 14 and later understands attribute((error))
Message-Id: <E1pW0iy-0007CS-52@xenbits.xenproject.org>
Date: Sat, 25 Feb 2023 20:00:52 +0000

commit de6fda801cc2a0db6a52697fe49e60e1a9f7f322
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu Feb 23 12:18:57 2023 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Feb 24 17:44:29 2023 +0000

    xen/compiler: Clang 14 and later understands attribute((error))
    
    Adjust the ifdefary for `nocall`.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/include/xen/compiler.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/include/xen/compiler.h b/xen/include/xen/compiler.h
index a563130334..7d7ae2e5e4 100644
--- a/xen/include/xen/compiler.h
+++ b/xen/include/xen/compiler.h
@@ -31,7 +31,7 @@
 
 #define __weak        __attribute__((__weak__))
 
-#if !defined(__clang__)
+#if !CONFIG_CC_IS_CLANG || CONFIG_CLANG_VERSION >= 140000
 # define nocall       __attribute__((__error__("Nonstandard ABI")))
 #else
 # define nocall
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Feb 25 20:01:03 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 25 Feb 2023 20:01:03 +0000
Received: from list by lists.xenproject.org with outflank-mailman.501856.773626 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pW0j9-0002pC-VB; Sat, 25 Feb 2023 20:01:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 501856.773626; Sat, 25 Feb 2023 20:01:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pW0j9-0002p4-SG; Sat, 25 Feb 2023 20:01:03 +0000
Received: by outflank-mailman (input) for mailman id 501856;
 Sat, 25 Feb 2023 20: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 1pW0j8-0002oq-By
 for xen-changelog@lists.xenproject.org; Sat, 25 Feb 2023 20:01:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pW0j8-0000NO-BD
 for xen-changelog@lists.xenproject.org; Sat, 25 Feb 2023 20:01:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pW0j8-0007DZ-89
 for xen-changelog@lists.xenproject.org; Sat, 25 Feb 2023 20:01:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=nFetuVboXJLr2ihfkV4NrN5dw+euJEnMk/wY8B5ZJjg=; b=qvd0puPlqRD9fhphSY6c9pPwBp
	8N9IUu5T/8k1uqVpJ68B/uH7zY2BsaOgeByEXxli8DBt/T5E7qcR1Ot5Y22Hgek7CECLdAdAS2lM2
	9HCTL/LJsh/AoOVPwCx4J01r4a+l7pWDKj5Dot+pod4RTLd/m3oQtVJu8su9o6hfBih4=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/asm: ELF metadata for simple cases
Message-Id: <E1pW0j8-0007DZ-89@xenbits.xenproject.org>
Date: Sat, 25 Feb 2023 20:01:02 +0000

commit 9afcf3046b0fd3e52553aece191c34ca20115145
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Mon Feb 20 11:04:39 2023 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Feb 24 17:44:29 2023 +0000

    x86/asm: ELF metadata for simple cases
    
    This is generally good practice, and necessary for livepatch binary diffing to
    work.
    
    With this, livepatching of the SVM entry path works.  The only complication is
    with svm_stgi_label which is only used by oprofile to guestimate (not
    completely correctly) when an NMI hit guest context.
    
    Livepatching of VMX is still an open question, because the logic doesn't form
    anything remotely resembling functions.  Both code fragments jump into each
    other so need to be updated in tandem.  Also, both code fragment entries need
    trampolines in the case that patching actually occurs.  For now, just treat it
    as a single function.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/clear_page.S    | 3 +++
 xen/arch/x86/copy_page.S     | 3 +++
 xen/arch/x86/hvm/svm/entry.S | 3 +++
 xen/arch/x86/hvm/vmx/entry.S | 3 +++
 4 files changed, 12 insertions(+)

diff --git a/xen/arch/x86/clear_page.S b/xen/arch/x86/clear_page.S
index d9d524c79e..5b5622cc52 100644
--- a/xen/arch/x86/clear_page.S
+++ b/xen/arch/x86/clear_page.S
@@ -16,3 +16,6 @@ ENTRY(clear_page_sse2)
 
         sfence
         ret
+
+        .type clear_page_sse2, @function
+        .size clear_page_sse2, . - clear_page_sse2
diff --git a/xen/arch/x86/copy_page.S b/xen/arch/x86/copy_page.S
index 2da81126c5..ddb6e0ebbb 100644
--- a/xen/arch/x86/copy_page.S
+++ b/xen/arch/x86/copy_page.S
@@ -41,3 +41,6 @@ ENTRY(copy_page_sse2)
 
         sfence
         ret
+
+        .type copy_page_sse2, @function
+        .size copy_page_sse2, . - copy_page_sse2
diff --git a/xen/arch/x86/hvm/svm/entry.S b/xen/arch/x86/hvm/svm/entry.S
index ad582f54b3..9effd2199b 100644
--- a/xen/arch/x86/hvm/svm/entry.S
+++ b/xen/arch/x86/hvm/svm/entry.S
@@ -139,3 +139,6 @@ GLOBAL(svm_stgi_label)
         sti
         call do_softirq
         jmp  .Lsvm_do_resume
+
+        .type svm_asm_do_resume, @function
+        .size svm_asm_do_resume, . - svm_asm_do_resume
diff --git a/xen/arch/x86/hvm/vmx/entry.S b/xen/arch/x86/hvm/vmx/entry.S
index 5f5de45a13..e3f60d5a82 100644
--- a/xen/arch/x86/hvm/vmx/entry.S
+++ b/xen/arch/x86/hvm/vmx/entry.S
@@ -150,3 +150,6 @@ ENTRY(vmx_asm_do_vmentry)
         sti
         call do_softirq
         jmp  .Lvmx_do_vmentry
+
+        .type vmx_asm_vmexit_handler, @function
+        .size vmx_asm_vmexit_handler, . - vmx_asm_vmexit_handler
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Feb 25 20:01:14 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 25 Feb 2023 20:01:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.501857.773631 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pW0jK-0002sj-2L; Sat, 25 Feb 2023 20:01:14 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 501857.773631; Sat, 25 Feb 2023 20:01:14 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pW0jJ-0002sb-Vo; Sat, 25 Feb 2023 20:01:13 +0000
Received: by outflank-mailman (input) for mailman id 501857;
 Sat, 25 Feb 2023 20: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 1pW0jI-0002sN-F5
 for xen-changelog@lists.xenproject.org; Sat, 25 Feb 2023 20:01:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pW0jI-0000NV-EH
 for xen-changelog@lists.xenproject.org; Sat, 25 Feb 2023 20:01:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pW0jI-0007EM-DU
 for xen-changelog@lists.xenproject.org; Sat, 25 Feb 2023 20:01:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=6W+vLq7bwWUQ/vVqsEXsdDZUGLQV+mAeFimIKPP+D+k=; b=FIhpdLQb59QtJeTo3YM7mVPYdD
	5klEaT0KHHS1a6FC7iRfxwf17WW7Ch7Z1FgoR1mlfSIqKAx17rvOKNKrpeINUyIpc2ey111xMEOmU
	OubwEAAj7eiN5wInBevv1LY9NHpz+cJaLY6QAdO30G41vFFEzlyaziYRLel6ajOaDGtk=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] automation: Use EOL tag for Jessie container
Message-Id: <E1pW0jI-0007EM-DU@xenbits.xenproject.org>
Date: Sat, 25 Feb 2023 20:01:12 +0000

commit 083f745621d99c8c65b67c0c25d80552fe6e46b6
Author:     Anthony PERARD <anthony.perard@citrix.com>
AuthorDate: Fri Feb 24 17:29:12 2023 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Feb 24 17:44:29 2023 +0000

    automation: Use EOL tag for Jessie container
    
    As Jessie is EOL, the official tag isn't supported anymore. Also, the
    GPG key for the packages on the repository on the official image are
    expired and it isn't possible to update or install packages.
    
    But we can use the image from "debian/eol" tag which use repositories
    from archive.debian.org and have workaround to ignore the validity
    date of the keys.
    
    There isn't a dedicated i386 tag for jessie, but we can ask docker to
    pull the i386 image of the "debial/eol:jessie" tag.
    
    Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 automation/build/debian/jessie-i386.dockerfile | 2 +-
 automation/build/debian/jessie.dockerfile      | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/automation/build/debian/jessie-i386.dockerfile b/automation/build/debian/jessie-i386.dockerfile
index b152d658d3..c9ac15a3ff 100644
--- a/automation/build/debian/jessie-i386.dockerfile
+++ b/automation/build/debian/jessie-i386.dockerfile
@@ -1,4 +1,4 @@
-FROM i386/debian:jessie
+FROM --platform=linux/i386 debian/eol:jessie
 LABEL maintainer.name="The Xen Project" \
       maintainer.email="xen-devel@lists.xenproject.org"
 
diff --git a/automation/build/debian/jessie.dockerfile b/automation/build/debian/jessie.dockerfile
index 1e33e635d2..63b2c1e5b7 100644
--- a/automation/build/debian/jessie.dockerfile
+++ b/automation/build/debian/jessie.dockerfile
@@ -1,4 +1,4 @@
-FROM debian:jessie
+FROM debian/eol:jessie
 LABEL maintainer.name="The Xen Project" \
       maintainer.email="xen-devel@lists.xenproject.org"
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Feb 25 20:01:24 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 25 Feb 2023 20:01:24 +0000
Received: from list by lists.xenproject.org with outflank-mailman.501858.773636 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pW0jU-0002vw-4A; Sat, 25 Feb 2023 20:01:24 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 501858.773636; Sat, 25 Feb 2023 20: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 1pW0jU-0002vk-1D; Sat, 25 Feb 2023 20:01:24 +0000
Received: by outflank-mailman (input) for mailman id 501858;
 Sat, 25 Feb 2023 20: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 1pW0jS-0002vM-I6
 for xen-changelog@lists.xenproject.org; Sat, 25 Feb 2023 20:01:22 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pW0jS-0000Nl-HG
 for xen-changelog@lists.xenproject.org; Sat, 25 Feb 2023 20:01:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pW0jS-0007FL-GT
 for xen-changelog@lists.xenproject.org; Sat, 25 Feb 2023 20: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>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=nJJR7EW/1/WlCzsCDOR5phaSBxI7AGipamLOx8aXzhg=; b=Z0/rFMaPCZlkINJgQvMRvJw+WC
	bi+YmQj9678z9HDVOPxEVGybLpW3JA0s5yVfrtkUt1zuon3ZWSDj0Q7qXt/ZOeGcplCVT5VtPI0Jw
	KQvNZlOa7VZcfGoJ+HnnSlxlyEO4SyTNIygzOVChRPGKavVHru0yMC2oa7oKhhuQmwgU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] automation: Remove testing on Debian Jessie
Message-Id: <E1pW0jS-0007FL-GT@xenbits.xenproject.org>
Date: Sat, 25 Feb 2023 20:01:22 +0000

commit 3817e3c1b4b8eda6911169f97a2c1fc4adade58a
Author:     Anthony PERARD <anthony.perard@citrix.com>
AuthorDate: Fri Feb 24 17:29:13 2023 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Feb 24 17:44:29 2023 +0000

    automation: Remove testing on Debian Jessie
    
    Jessie as rearch EOL in 2020.
    
    Even if we update the containers, we would still not be able to reach
    HTTPS webside with Let's Encrypt certificates and thus would need more
    change to the container.
    
    Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 automation/gitlab-ci/build.yaml | 40 ----------------------------------------
 1 file changed, 40 deletions(-)

diff --git a/automation/gitlab-ci/build.yaml b/automation/gitlab-ci/build.yaml
index 22ce1c45e7..2be1b05d5c 100644
--- a/automation/gitlab-ci/build.yaml
+++ b/automation/gitlab-ci/build.yaml
@@ -221,46 +221,6 @@ centos-7-gcc-debug:
   variables:
     CONTAINER: centos:7
 
-debian-jessie-clang:
-  extends: .clang-x86-64-build
-  variables:
-    CONTAINER: debian:jessie
-
-debian-jessie-clang-debug:
-  extends: .clang-x86-64-build-debug
-  variables:
-    CONTAINER: debian:jessie
-
-debian-jessie-gcc:
-  extends: .gcc-x86-64-build
-  variables:
-    CONTAINER: debian:jessie
-
-debian-jessie-gcc-debug:
-  extends: .gcc-x86-64-build-debug
-  variables:
-    CONTAINER: debian:jessie
-
-debian-jessie-32-clang:
-  extends: .clang-x86-32-build
-  variables:
-    CONTAINER: debian:jessie-i386
-
-debian-jessie-32-clang-debug:
-  extends: .clang-x86-32-build-debug
-  variables:
-    CONTAINER: debian:jessie-i386
-
-debian-jessie-32-gcc:
-  extends: .gcc-x86-32-build
-  variables:
-    CONTAINER: debian:jessie-i386
-
-debian-jessie-32-gcc-debug:
-  extends: .gcc-x86-32-build-debug
-  variables:
-    CONTAINER: debian:jessie-i386
-
 debian-stretch-clang:
   extends: .clang-x86-64-build
   variables:
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Feb 25 20:01:34 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 25 Feb 2023 20:01:34 +0000
Received: from list by lists.xenproject.org with outflank-mailman.501859.773639 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pW0je-0002za-5U; Sat, 25 Feb 2023 20:01:34 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 501859.773639; Sat, 25 Feb 2023 20: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 1pW0je-0002zS-2e; Sat, 25 Feb 2023 20:01:34 +0000
Received: by outflank-mailman (input) for mailman id 501859;
 Sat, 25 Feb 2023 20: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 1pW0jc-0002z6-Lr
 for xen-changelog@lists.xenproject.org; Sat, 25 Feb 2023 20:01:32 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pW0jc-0000OM-L5
 for xen-changelog@lists.xenproject.org; Sat, 25 Feb 2023 20:01:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pW0jc-0007G8-JP
 for xen-changelog@lists.xenproject.org; Sat, 25 Feb 2023 20: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>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=LxpAoD7175CWSg0bcgGIQY68/cAbhgaPA27l9xtvzpU=; b=cRMdcnmx0/UeO8ndjt/nEzSjlI
	pt0ic8nlcjOAIkB7cpjoW3o8UQuv5OUiTgUVLlWIuCntgpPcfkheL8hg5E76AEtYYS6ltMCAX6jhV
	IT1quXKxgUNxuhhM2OcEq/mPnVpVLP/uKBdFQ4Cs2sedWN4h/l5OfiAKnQ0lx1pnpyDA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] automation: Remove expired root certificates used to be used by let's encrypt
Message-Id: <E1pW0jc-0007G8-JP@xenbits.xenproject.org>
Date: Sat, 25 Feb 2023 20:01:32 +0000

commit ba2370a55f83b8ce9d0e2c262e06b854604ba4b6
Author:     Anthony PERARD <anthony.perard@citrix.com>
AuthorDate: Fri Feb 24 17:29:14 2023 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Feb 24 17:44:29 2023 +0000

    automation: Remove expired root certificates used to be used by let's encrypt
    
    While the Let's Encrypt root certificate ISRG_Root_X1.crt is already
    present, openssl seems to still check for the root certificate
    DST_Root_CA_X3.crt which has expired. This prevent https connections.
    
    Removing DST_Root_CA_X3 fix the issue.
    
    Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 automation/build/ubuntu/trusty.dockerfile | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/automation/build/ubuntu/trusty.dockerfile b/automation/build/ubuntu/trusty.dockerfile
index b298a515c6..22e294c20c 100644
--- a/automation/build/ubuntu/trusty.dockerfile
+++ b/automation/build/ubuntu/trusty.dockerfile
@@ -47,3 +47,8 @@ RUN apt-get update && \
         apt-get autoremove -y && \
         apt-get clean && \
         rm -rf /var/lib/apt/lists* /tmp/* /var/tmp/*
+
+# Remove expired certificate that Let's Encrypt certificates used to relie on.
+# (Not needed anymore)
+RUN sed -i 's#mozilla/DST_Root_CA_X3\.crt#!\0#' /etc/ca-certificates.conf && \
+    update-ca-certificates
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Feb 25 20:01:44 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 25 Feb 2023 20:01:44 +0000
Received: from list by lists.xenproject.org with outflank-mailman.501860.773642 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pW0jo-00032r-74; Sat, 25 Feb 2023 20:01:44 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 501860.773642; Sat, 25 Feb 2023 20:01:44 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pW0jo-00032h-4J; Sat, 25 Feb 2023 20:01:44 +0000
Received: by outflank-mailman (input) for mailman id 501860;
 Sat, 25 Feb 2023 20:01: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 1pW0jm-00032U-Oe
 for xen-changelog@lists.xenproject.org; Sat, 25 Feb 2023 20:01:42 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pW0jm-0000OV-Nu
 for xen-changelog@lists.xenproject.org; Sat, 25 Feb 2023 20:01:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pW0jm-0007Gv-ND
 for xen-changelog@lists.xenproject.org; Sat, 25 Feb 2023 20:01:42 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=ihMHRfgXID/zlIkxMgD2cPqivgEMVqXojM67jUiOewc=; b=OkqiaAfIpbcDzpA5Ir89OPdhQu
	uTLbupNn3he/+18GR7YgGSaAajcSfAttimfAV4ybOQ23gQ6IJKmf9i/6dwPB22anD5yIJjUIO9MhA
	N6wfeJgUi0aDuslBTyJEYQLI1LLL1VB5fGBn5c0qnZonNLC2tuBf8d1OCPzkwHvbA7og=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] automation: Remove non-debug x86_32 build jobs
Message-Id: <E1pW0jm-0007Gv-ND@xenbits.xenproject.org>
Date: Sat, 25 Feb 2023 20:01:42 +0000

commit 7b66792ea7f77fb9e587e1e9c530a7c869eecba1
Author:     Anthony PERARD <anthony.perard@citrix.com>
AuthorDate: Fri Feb 24 17:29:15 2023 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Feb 24 17:44:29 2023 +0000

    automation: Remove non-debug x86_32 build jobs
    
    In the interest of having less jobs, we remove the x86_32 build jobs
    that do release build. Debug build is very likely to be enough to find
    32bit build issues.
    
    Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 automation/gitlab-ci/build.yaml | 20 --------------------
 1 file changed, 20 deletions(-)

diff --git a/automation/gitlab-ci/build.yaml b/automation/gitlab-ci/build.yaml
index 2be1b05d5c..a2891c5937 100644
--- a/automation/gitlab-ci/build.yaml
+++ b/automation/gitlab-ci/build.yaml
@@ -251,21 +251,11 @@ debian-stretch-gcc-debug:
   variables:
     CONTAINER: debian:stretch
 
-debian-stretch-32-clang:
-  extends: .clang-x86-32-build
-  variables:
-    CONTAINER: debian:stretch-i386
-
 debian-stretch-32-clang-debug:
   extends: .clang-x86-32-build-debug
   variables:
     CONTAINER: debian:stretch-i386
 
-debian-stretch-32-gcc:
-  extends: .gcc-x86-32-build
-  variables:
-    CONTAINER: debian:stretch-i386
-
 debian-stretch-32-gcc-debug:
   extends: .gcc-x86-32-build-debug
   variables:
@@ -311,21 +301,11 @@ debian-unstable-gcc-debug-randconfig:
     CONTAINER: debian:unstable
     RANDCONFIG: y
 
-debian-unstable-32-clang:
-  extends: .clang-x86-32-build
-  variables:
-    CONTAINER: debian:unstable-i386
-
 debian-unstable-32-clang-debug:
   extends: .clang-x86-32-build-debug
   variables:
     CONTAINER: debian:unstable-i386
 
-debian-unstable-32-gcc:
-  extends: .gcc-x86-32-build
-  variables:
-    CONTAINER: debian:unstable-i386
-
 debian-unstable-32-gcc-debug:
   extends: .gcc-x86-32-build-debug
   variables:
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Feb 25 20:01:54 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 25 Feb 2023 20:01:54 +0000
Received: from list by lists.xenproject.org with outflank-mailman.501861.773647 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pW0jy-00035Q-8n; Sat, 25 Feb 2023 20:01:54 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 501861.773647; Sat, 25 Feb 2023 20:01:54 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pW0jy-00035I-5q; Sat, 25 Feb 2023 20:01:54 +0000
Received: by outflank-mailman (input) for mailman id 501861;
 Sat, 25 Feb 2023 20:01: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 1pW0jw-000357-Rq
 for xen-changelog@lists.xenproject.org; Sat, 25 Feb 2023 20:01:52 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pW0jw-0000Od-R8
 for xen-changelog@lists.xenproject.org; Sat, 25 Feb 2023 20:01:52 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pW0jw-0007Hq-QI
 for xen-changelog@lists.xenproject.org; Sat, 25 Feb 2023 20:01:52 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=JnbqTQlcRYuQQrgFBlOb6n/4FpChBX7dKZO0esrsWzY=; b=iUvEwqAx/l6C5migOx+Qlf2RJw
	8ADjVXArTp+hwRn9J7v6o628RK27q+imAsiOChYxyQSiAJpd+GP1RIJguNdP4X39Bcg/UEG2WVvWC
	y5oo2wGKGmCStvfmNqMDhg8uEZENIeOyPUv2uR0wWq9Xc6vl24K4LAl4q/njsrCzcHmo=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/svm: move declarations used only by svm code from svm.h to private header
Message-Id: <E1pW0jw-0007Hq-QI@xenbits.xenproject.org>
Date: Sat, 25 Feb 2023 20:01:52 +0000

commit ba9a8ae44065b6f5219c8df2b0540b5fc259b57c
Author:     Xenia Ragiadakou <burzalodowa@gmail.com>
AuthorDate: Fri Feb 24 20:49:57 2023 +0200
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Feb 24 19:29:46 2023 +0000

    x86/svm: move declarations used only by svm code from svm.h to private header
    
    Create a new private header in arch/x86/hvm/svm called svm.h and move there
    all definitions and declarations that are used solely by svm code.
    
    Take the opportunity to remove the forward declaration of struct vcpu, that is
    a leftover since the removal of svm_update_guest_cr()'s declaration.
    
    Take the opportunity to re-arrange the header as follows, all structures first,
    then all variable decalarations, all function delarations, and finally all
    inline functions.
    
    No functional change intended.
    
    Signed-off-by: Xenia Ragiadakou <burzalodowa@gmail.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/hvm/svm/nestedsvm.c       |  1 +
 xen/arch/x86/hvm/svm/svm.c             |  2 ++
 xen/arch/x86/hvm/svm/svm.h             | 62 ++++++++++++++++++++++++++++++++++
 xen/arch/x86/include/asm/hvm/svm/svm.h | 41 ----------------------
 4 files changed, 65 insertions(+), 41 deletions(-)

diff --git a/xen/arch/x86/hvm/svm/nestedsvm.c b/xen/arch/x86/hvm/svm/nestedsvm.c
index 77f7547360..a341ccc876 100644
--- a/xen/arch/x86/hvm/svm/nestedsvm.c
+++ b/xen/arch/x86/hvm/svm/nestedsvm.c
@@ -27,6 +27,7 @@
 #include <asm/event.h> /* for local_event_delivery_(en|dis)able */
 #include <asm/p2m.h> /* p2m_get_pagetable, p2m_get_nestedp2m */
 
+#include "svm.h"
 
 #define NSVM_ERROR_VVMCB        1
 #define NSVM_ERROR_VMENTRY      2
diff --git a/xen/arch/x86/hvm/svm/svm.c b/xen/arch/x86/hvm/svm/svm.c
index 9c43227b76..6d394e4fe3 100644
--- a/xen/arch/x86/hvm/svm/svm.c
+++ b/xen/arch/x86/hvm/svm/svm.c
@@ -55,6 +55,8 @@
 
 #include <public/sched.h>
 
+#include "svm.h"
+
 void noreturn svm_asm_do_resume(void);
 
 u32 svm_feature_flags;
diff --git a/xen/arch/x86/hvm/svm/svm.h b/xen/arch/x86/hvm/svm/svm.h
new file mode 100644
index 0000000000..f700f26f90
--- /dev/null
+++ b/xen/arch/x86/hvm/svm/svm.h
@@ -0,0 +1,62 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * svm.h: SVM Architecture related definitions
+ *
+ * Copyright (c) 2005, AMD Corporation.
+ * Copyright (c) 2004, Intel Corporation.
+ */
+
+#ifndef __X86_HVM_SVM_SVM_PRIV_H__
+#define __X86_HVM_SVM_SVM_PRIV_H__
+
+#include <xen/types.h>
+
+struct cpu_user_regs;
+
+unsigned long *svm_msrbit(unsigned long *msr_bitmap, uint32_t msr);
+void __update_guest_eip(struct cpu_user_regs *regs, unsigned int inst_len);
+
+static inline void svm_vmload_pa(paddr_t vmcb)
+{
+    asm volatile (
+        ".byte 0x0f,0x01,0xda" /* vmload */
+        : : "a" (vmcb) : "memory" );
+}
+
+static inline void svm_vmsave_pa(paddr_t vmcb)
+{
+    asm volatile (
+        ".byte 0x0f,0x01,0xdb" /* vmsave */
+        : : "a" (vmcb) : "memory" );
+}
+
+static inline void svm_invlpga(unsigned long linear, uint32_t asid)
+{
+    asm volatile (
+        ".byte 0x0f,0x01,0xdf"
+        : /* output */
+        : /* input */
+        "a" (linear), "c" (asid) );
+}
+
+/* TSC rate */
+#define DEFAULT_TSC_RATIO       0x0000000100000000ULL
+#define TSC_RATIO_RSVD_BITS     0xffffff0000000000ULL
+
+/* EXITINFO1 fields on NPT faults */
+#define _NPT_PFEC_with_gla     32
+#define NPT_PFEC_with_gla      (1UL<<_NPT_PFEC_with_gla)
+#define _NPT_PFEC_in_gpt       33
+#define NPT_PFEC_in_gpt        (1UL<<_NPT_PFEC_in_gpt)
+
+#endif /* __X86_HVM_SVM_SVM_PRIV_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/arch/x86/include/asm/hvm/svm/svm.h b/xen/arch/x86/include/asm/hvm/svm/svm.h
index cf9ed517d5..7d5de0122a 100644
--- a/xen/arch/x86/include/asm/hvm/svm/svm.h
+++ b/xen/arch/x86/include/asm/hvm/svm/svm.h
@@ -20,37 +20,6 @@
 #ifndef __ASM_X86_HVM_SVM_H__
 #define __ASM_X86_HVM_SVM_H__
 
-#include <xen/types.h>
-
-static inline void svm_vmload_pa(paddr_t vmcb)
-{
-    asm volatile (
-        ".byte 0x0f,0x01,0xda" /* vmload */
-        : : "a" (vmcb) : "memory" );
-}
-
-static inline void svm_vmsave_pa(paddr_t vmcb)
-{
-    asm volatile (
-        ".byte 0x0f,0x01,0xdb" /* vmsave */
-        : : "a" (vmcb) : "memory" );
-}
-
-static inline void svm_invlpga(unsigned long linear, uint32_t asid)
-{
-    asm volatile (
-        ".byte 0x0f,0x01,0xdf"
-        : /* output */
-        : /* input */
-        "a" (linear), "c" (asid));
-}
-
-struct cpu_user_regs;
-struct vcpu;
-
-unsigned long *svm_msrbit(unsigned long *msr_bitmap, uint32_t msr);
-void __update_guest_eip(struct cpu_user_regs *regs, unsigned int inst_len);
-
 /*
  * PV context switch helpers.  Prefetching the VMCB area itself has been shown
  * to be useful for performance.
@@ -96,14 +65,4 @@ extern u32 svm_feature_flags;
 #define cpu_has_svm_sss       cpu_has_svm_feature(SVM_FEATURE_SSS)
 #define cpu_has_svm_spec_ctrl cpu_has_svm_feature(SVM_FEATURE_SPEC_CTRL)
 
-/* TSC rate */
-#define DEFAULT_TSC_RATIO       0x0000000100000000ULL
-#define TSC_RATIO_RSVD_BITS     0xffffff0000000000ULL
-
-/* EXITINFO1 fields on NPT faults */
-#define _NPT_PFEC_with_gla     32
-#define NPT_PFEC_with_gla      (1UL<<_NPT_PFEC_with_gla)
-#define _NPT_PFEC_in_gpt       33
-#define NPT_PFEC_in_gpt        (1UL<<_NPT_PFEC_in_gpt)
-
 #endif /* __ASM_X86_HVM_SVM_H__ */
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Feb 25 20:02:04 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 25 Feb 2023 20:02:04 +0000
Received: from list by lists.xenproject.org with outflank-mailman.501862.773652 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pW0k8-00037y-B5; Sat, 25 Feb 2023 20:02:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 501862.773652; Sat, 25 Feb 2023 20:02:04 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pW0k8-00037q-7O; Sat, 25 Feb 2023 20:02:04 +0000
Received: by outflank-mailman (input) for mailman id 501862;
 Sat, 25 Feb 2023 20:02:03 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pW0k6-00037g-VL
 for xen-changelog@lists.xenproject.org; Sat, 25 Feb 2023 20:02:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pW0k6-0000Oy-Ug
 for xen-changelog@lists.xenproject.org; Sat, 25 Feb 2023 20:02:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pW0k6-0007KK-TN
 for xen-changelog@lists.xenproject.org; Sat, 25 Feb 2023 20:02:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=q/7QpeC053ytiZ8mWUYUtutSC97TZYgGSpY+hwEPf/s=; b=O4hQikZH0RnWoGftp/WPHbHcf6
	vfM6csiD9UpcJDKincP+tOIPXFs1ESJY6keCTAP3nhIUE/2RxOxta43ik97Nvyjd5oobJAwqawDNP
	4ae7ueBui9yjdQC/kBiAaUSCkR2UI9/xc8ILwxfPxI/RNPm4zogJ+E9tYorbn0uhfuHw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/svm: delete header asm/hvm/svm/intr.h
Message-Id: <E1pW0k6-0007KK-TN@xenbits.xenproject.org>
Date: Sat, 25 Feb 2023 20:02:02 +0000

commit aa0a7ad1ab5092bf5f8f32d13840c1b37f1c23bd
Author:     Xenia Ragiadakou <burzalodowa@gmail.com>
AuthorDate: Fri Feb 24 20:49:59 2023 +0200
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Feb 24 19:29:46 2023 +0000

    x86/svm: delete header asm/hvm/svm/intr.h
    
    Delete asm/hvm/svm/intr.h because it contains only the declaration of
    svm_intr_assist() which is referenced only by assembly.
    
    No functional change intended.
    
    Signed-off-by: Xenia Ragiadakou <burzalodowa@gmail.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/hvm/svm/intr.c             |  1 -
 xen/arch/x86/include/asm/hvm/svm/intr.h | 25 -------------------------
 2 files changed, 26 deletions(-)

diff --git a/xen/arch/x86/hvm/svm/intr.c b/xen/arch/x86/hvm/svm/intr.c
index 9525f35593..d21e930af0 100644
--- a/xen/arch/x86/hvm/svm/intr.c
+++ b/xen/arch/x86/hvm/svm/intr.c
@@ -29,7 +29,6 @@
 #include <asm/hvm/io.h>
 #include <asm/hvm/vlapic.h>
 #include <asm/hvm/svm/svm.h>
-#include <asm/hvm/svm/intr.h>
 #include <asm/hvm/nestedhvm.h> /* for nestedhvm_vcpu_in_guestmode */
 #include <asm/vm_event.h>
 #include <xen/event.h>
diff --git a/xen/arch/x86/include/asm/hvm/svm/intr.h b/xen/arch/x86/include/asm/hvm/svm/intr.h
deleted file mode 100644
index ae52d9f948..0000000000
--- a/xen/arch/x86/include/asm/hvm/svm/intr.h
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * intr.h: SVM Architecture related definitions
- * Copyright (c) 2005, AMD Corporation.
- * Copyright (c) 2004, Intel Corporation.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms and conditions of the GNU General Public License,
- * version 2, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
- * more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program; If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-#ifndef __ASM_X86_HVM_SVM_INTR_H__
-#define __ASM_X86_HVM_SVM_INTR_H__
-
-void svm_intr_assist(void);
-
-#endif /* __ASM_X86_HVM_SVM_INTR_H__ */
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Feb 25 20:02:14 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 25 Feb 2023 20:02:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.501863.773655 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pW0kI-0003B9-CC; Sat, 25 Feb 2023 20:02:14 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 501863.773655; Sat, 25 Feb 2023 20:02:14 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pW0kI-0003B1-8y; Sat, 25 Feb 2023 20:02:14 +0000
Received: by outflank-mailman (input) for mailman id 501863;
 Sat, 25 Feb 2023 20:02:13 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pW0kH-0003As-28
 for xen-changelog@lists.xenproject.org; Sat, 25 Feb 2023 20:02:13 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pW0kH-0000P5-1U
 for xen-changelog@lists.xenproject.org; Sat, 25 Feb 2023 20:02:13 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pW0kH-0007Kq-0l
 for xen-changelog@lists.xenproject.org; Sat, 25 Feb 2023 20:02:13 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=sZQ5TCxBhrFTALhOHpYahpUe19qVF5kwnVeuIcWDjL0=; b=33iZV1OZIoc+k+W3ROQB+HLTNl
	4pXgghkfFCqR0OfvhuCfJV6fq2RW3UDm8XV9tqrlT85ULAUFCOl1SA65G/5csV0/MCdOwwafZN9DE
	D/i6cBKKqfoMXy4GIz9x3W+kDfmCiYNBrLDMnDnaTJI1cW2P0GtKSeAXDXSAUB5gpc9M=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/svm: Remove the asm/hvm/svm/asid.h header
Message-Id: <E1pW0kH-0007Kq-0l@xenbits.xenproject.org>
Date: Sat, 25 Feb 2023 20:02:13 +0000

commit 40840455ad8559444256d19bc0b8503c07776246
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Fri Feb 24 19:15:43 2023 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Feb 24 20:53:10 2023 +0000

    x86/svm: Remove the asm/hvm/svm/asid.h header
    
    Fold svm_asid_g_invlpg() into its single caller, deleting the #if 0 which has
    been present for the entire 16 years this helper has existed: c/s 322a078ab140
    "[HVM][SVM] Reintroduce ASIDs."
    
    Move the two remaining prototypes into the private svm.h, forward declaring
    cpuinfo_x86 in preference to including asm/processor.h
    
    No functional change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Xenia Ragiadakou <burzalodowa@gmail.com>
---
 xen/arch/x86/hvm/svm/asid.c             |  3 +-
 xen/arch/x86/hvm/svm/svm.c              |  4 +--
 xen/arch/x86/hvm/svm/svm.h              |  4 +++
 xen/arch/x86/include/asm/hvm/svm/asid.h | 49 ---------------------------------
 4 files changed, 8 insertions(+), 52 deletions(-)

diff --git a/xen/arch/x86/hvm/svm/asid.c b/xen/arch/x86/hvm/svm/asid.c
index ab06dd3f3a..150d8dfc81 100644
--- a/xen/arch/x86/hvm/svm/asid.c
+++ b/xen/arch/x86/hvm/svm/asid.c
@@ -17,9 +17,10 @@
 
 #include <asm/amd.h>
 #include <asm/hvm/nestedhvm.h>
-#include <asm/hvm/svm/asid.h>
 #include <asm/hvm/svm/svm.h>
 
+#include "svm.h"
+
 void svm_asid_init(const struct cpuinfo_x86 *c)
 {
     int nasids = 0;
diff --git a/xen/arch/x86/hvm/svm/svm.c b/xen/arch/x86/hvm/svm/svm.c
index 6d394e4fe3..46ae0b6602 100644
--- a/xen/arch/x86/hvm/svm/svm.c
+++ b/xen/arch/x86/hvm/svm/svm.c
@@ -37,7 +37,6 @@
 #include <asm/hvm/monitor.h>
 #include <asm/hvm/nestedhvm.h>
 #include <asm/hvm/support.h>
-#include <asm/hvm/svm/asid.h>
 #include <asm/hvm/svm/emulate.h>
 #include <asm/hvm/svm/nestedsvm.h>
 #include <asm/hvm/svm/svm.h>
@@ -2421,7 +2420,8 @@ static bool cf_check is_invlpg(
 
 static void cf_check svm_invlpg(struct vcpu *v, unsigned long linear)
 {
-    svm_asid_g_invlpg(v, linear);
+    /* Safe fallback. Take a new ASID. */
+    hvm_asid_flush_vcpu(v);
 }
 
 static bool cf_check svm_get_pending_event(
diff --git a/xen/arch/x86/hvm/svm/svm.h b/xen/arch/x86/hvm/svm/svm.h
index f700f26f90..b8178f6216 100644
--- a/xen/arch/x86/hvm/svm/svm.h
+++ b/xen/arch/x86/hvm/svm/svm.h
@@ -12,6 +12,10 @@
 #include <xen/types.h>
 
 struct cpu_user_regs;
+struct cpuinfo_x86;
+
+void svm_asid_init(const struct cpuinfo_x86 *c);
+void svm_asid_handle_vmrun(void);
 
 unsigned long *svm_msrbit(unsigned long *msr_bitmap, uint32_t msr);
 void __update_guest_eip(struct cpu_user_regs *regs, unsigned int inst_len);
diff --git a/xen/arch/x86/include/asm/hvm/svm/asid.h b/xen/arch/x86/include/asm/hvm/svm/asid.h
deleted file mode 100644
index 0e5ec3ab78..0000000000
--- a/xen/arch/x86/include/asm/hvm/svm/asid.h
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * asid.h: handling ASIDs in SVM.
- * Copyright (c) 2007, Advanced Micro Devices, Inc.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms and conditions of the GNU General Public License,
- * version 2, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
- * more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program; If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef __ASM_X86_HVM_SVM_ASID_H__
-#define __ASM_X86_HVM_SVM_ASID_H__
-
-#include <xen/types.h>
-#include <asm/hvm/asid.h>
-#include <asm/processor.h>
-
-void svm_asid_init(const struct cpuinfo_x86 *c);
-void svm_asid_handle_vmrun(void);
-
-static inline void svm_asid_g_invlpg(struct vcpu *v, unsigned long g_linear)
-{
-#if 0
-    /* Optimization? */
-    svm_invlpga(g_linear, v->arch.hvm.svm.vmcb->guest_asid);
-#endif
-
-    /* Safe fallback. Take a new ASID. */
-    hvm_asid_flush_vcpu(v);
-}
-
-#endif /* __ASM_X86_HVM_SVM_ASID_H__ */
-
-/*
- * Local variables:
- * mode: C
- * c-file-style: "BSD"
- * c-basic-offset: 4
- * tab-width: 4
- * indent-tabs-mode: nil
- * End:
- */
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Feb 25 20:02:24 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 25 Feb 2023 20:02:24 +0000
Received: from list by lists.xenproject.org with outflank-mailman.501864.773658 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pW0kS-0003EY-F3; Sat, 25 Feb 2023 20:02:24 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 501864.773658; Sat, 25 Feb 2023 20:02:24 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pW0kS-0003EQ-CL; Sat, 25 Feb 2023 20:02:24 +0000
Received: by outflank-mailman (input) for mailman id 501864;
 Sat, 25 Feb 2023 20:02:23 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pW0kR-0003EB-5R
 for xen-changelog@lists.xenproject.org; Sat, 25 Feb 2023 20:02:23 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pW0kR-0000PC-4d
 for xen-changelog@lists.xenproject.org; Sat, 25 Feb 2023 20:02:23 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pW0kR-0007LH-3n
 for xen-changelog@lists.xenproject.org; Sat, 25 Feb 2023 20:02:23 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=4F7vYUy6hI3Mw5PtDoIkRNySiwCy+tRCfGjRd7drsxU=; b=gWrnEyLmpFZGKrkUB+NVm7/IYi
	xMSsqPiZ2e5A/Zpyx1+3wx2KHW7w4ZrhS75PZj8HUBAyBOdTdSUdJsIjt7O/zze1r7eib/nr03ON2
	u0YXINeUQAhjg6IB5xF/K83u4/4B7+p0d7proV/1hTqWK+1gV/N2zrI4HZUtHviTyv/s=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/svm: Remove the asm/hvm/svm/emulate.h header
Message-Id: <E1pW0kR-0007LH-3n@xenbits.xenproject.org>
Date: Sat, 25 Feb 2023 20:02:23 +0000

commit d2b2d61de76c1d667d8d72bcca0eb0dd205fb06d
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Fri Feb 24 19:57:15 2023 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Feb 24 20:53:10 2023 +0000

    x86/svm: Remove the asm/hvm/svm/emulate.h header
    
    These days, this is just two length helpers.  Move into the private svm.h
    
    No functional change intended.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Xenia Ragiadakou <burzalodowa@gmail.com>
---
 xen/arch/x86/hvm/svm/emulate.c             |  3 +-
 xen/arch/x86/hvm/svm/nestedsvm.c           |  1 -
 xen/arch/x86/hvm/svm/svm.c                 |  1 -
 xen/arch/x86/hvm/svm/svm.h                 | 33 +++++++++++++++
 xen/arch/x86/include/asm/hvm/svm/emulate.h | 66 ------------------------------
 5 files changed, 35 insertions(+), 69 deletions(-)

diff --git a/xen/arch/x86/hvm/svm/emulate.c b/xen/arch/x86/hvm/svm/emulate.c
index 16fc134883..391f025516 100644
--- a/xen/arch/x86/hvm/svm/emulate.c
+++ b/xen/arch/x86/hvm/svm/emulate.c
@@ -24,7 +24,8 @@
 #include <asm/hvm/hvm.h>
 #include <asm/hvm/svm/svm.h>
 #include <asm/hvm/svm/vmcb.h>
-#include <asm/hvm/svm/emulate.h>
+
+#include "svm.h"
 
 static unsigned long svm_nextrip_insn_length(struct vcpu *v)
 {
diff --git a/xen/arch/x86/hvm/svm/nestedsvm.c b/xen/arch/x86/hvm/svm/nestedsvm.c
index a341ccc876..c0b5474756 100644
--- a/xen/arch/x86/hvm/svm/nestedsvm.c
+++ b/xen/arch/x86/hvm/svm/nestedsvm.c
@@ -17,7 +17,6 @@
  */
 
 #include <asm/hvm/support.h>
-#include <asm/hvm/svm/emulate.h>
 #include <asm/hvm/svm/svm.h>
 #include <asm/hvm/svm/vmcb.h>
 #include <asm/hvm/nestedhvm.h>
diff --git a/xen/arch/x86/hvm/svm/svm.c b/xen/arch/x86/hvm/svm/svm.c
index 46ae0b6602..97783b7f11 100644
--- a/xen/arch/x86/hvm/svm/svm.c
+++ b/xen/arch/x86/hvm/svm/svm.c
@@ -37,7 +37,6 @@
 #include <asm/hvm/monitor.h>
 #include <asm/hvm/nestedhvm.h>
 #include <asm/hvm/support.h>
-#include <asm/hvm/svm/emulate.h>
 #include <asm/hvm/svm/nestedsvm.h>
 #include <asm/hvm/svm/svm.h>
 #include <asm/hvm/svm/svmdebug.h>
diff --git a/xen/arch/x86/hvm/svm/svm.h b/xen/arch/x86/hvm/svm/svm.h
index b8178f6216..d2a781fc3f 100644
--- a/xen/arch/x86/hvm/svm/svm.h
+++ b/xen/arch/x86/hvm/svm/svm.h
@@ -13,6 +13,7 @@
 
 struct cpu_user_regs;
 struct cpuinfo_x86;
+struct vcpu;
 
 void svm_asid_init(const struct cpuinfo_x86 *c);
 void svm_asid_handle_vmrun(void);
@@ -43,6 +44,38 @@ static inline void svm_invlpga(unsigned long linear, uint32_t asid)
         "a" (linear), "c" (asid) );
 }
 
+/*
+ * Encoding for svm_get_insn_len().  We take X86EMUL_OPC() for the main
+ * opcode, shifted left to make room for the ModRM byte.
+ *
+ * The Grp7 instructions have their ModRM byte expressed in octal for easier
+ * cross referencing with the opcode extension table.
+ */
+#define INSTR_ENC(opc, modrm) (((opc) << 8) | (modrm))
+
+#define INSTR_PAUSE       INSTR_ENC(X86EMUL_OPC_F3(0, 0x90), 0)
+#define INSTR_INT3        INSTR_ENC(X86EMUL_OPC(   0, 0xcc), 0)
+#define INSTR_ICEBP       INSTR_ENC(X86EMUL_OPC(   0, 0xf1), 0)
+#define INSTR_HLT         INSTR_ENC(X86EMUL_OPC(   0, 0xf4), 0)
+#define INSTR_XSETBV      INSTR_ENC(X86EMUL_OPC(0x0f, 0x01), 0321)
+#define INSTR_VMRUN       INSTR_ENC(X86EMUL_OPC(0x0f, 0x01), 0330)
+#define INSTR_VMCALL      INSTR_ENC(X86EMUL_OPC(0x0f, 0x01), 0331)
+#define INSTR_VMLOAD      INSTR_ENC(X86EMUL_OPC(0x0f, 0x01), 0332)
+#define INSTR_VMSAVE      INSTR_ENC(X86EMUL_OPC(0x0f, 0x01), 0333)
+#define INSTR_STGI        INSTR_ENC(X86EMUL_OPC(0x0f, 0x01), 0334)
+#define INSTR_CLGI        INSTR_ENC(X86EMUL_OPC(0x0f, 0x01), 0335)
+#define INSTR_INVLPGA     INSTR_ENC(X86EMUL_OPC(0x0f, 0x01), 0337)
+#define INSTR_RDTSCP      INSTR_ENC(X86EMUL_OPC(0x0f, 0x01), 0371)
+#define INSTR_INVD        INSTR_ENC(X86EMUL_OPC(0x0f, 0x08), 0)
+#define INSTR_WBINVD      INSTR_ENC(X86EMUL_OPC(0x0f, 0x09), 0)
+#define INSTR_WRMSR       INSTR_ENC(X86EMUL_OPC(0x0f, 0x30), 0)
+#define INSTR_RDTSC       INSTR_ENC(X86EMUL_OPC(0x0f, 0x31), 0)
+#define INSTR_RDMSR       INSTR_ENC(X86EMUL_OPC(0x0f, 0x32), 0)
+#define INSTR_CPUID       INSTR_ENC(X86EMUL_OPC(0x0f, 0xa2), 0)
+
+unsigned int svm_get_insn_len(struct vcpu *v, unsigned int instr_enc);
+unsigned int svm_get_task_switch_insn_len(void);
+
 /* TSC rate */
 #define DEFAULT_TSC_RATIO       0x0000000100000000ULL
 #define TSC_RATIO_RSVD_BITS     0xffffff0000000000ULL
diff --git a/xen/arch/x86/include/asm/hvm/svm/emulate.h b/xen/arch/x86/include/asm/hvm/svm/emulate.h
deleted file mode 100644
index eb1a8c24af..0000000000
--- a/xen/arch/x86/include/asm/hvm/svm/emulate.h
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * emulate.h: SVM instruction emulation bits.
- * Copyright (c) 2005, AMD Corporation.
- * Copyright (c) 2004, Intel Corporation.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms and conditions of the GNU General Public License,
- * version 2, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
- * more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program; If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef __ASM_X86_HVM_SVM_EMULATE_H__
-#define __ASM_X86_HVM_SVM_EMULATE_H__
-
-/*
- * Encoding for svm_get_insn_len().  We take X86EMUL_OPC() for the main
- * opcode, shifted left to make room for the ModRM byte.
- *
- * The Grp7 instructions have their ModRM byte expressed in octal for easier
- * cross referencing with the opcode extension table.
- */
-#define INSTR_ENC(opc, modrm) (((opc) << 8) | (modrm))
-
-#define INSTR_PAUSE       INSTR_ENC(X86EMUL_OPC_F3(0, 0x90), 0)
-#define INSTR_INT3        INSTR_ENC(X86EMUL_OPC(   0, 0xcc), 0)
-#define INSTR_ICEBP       INSTR_ENC(X86EMUL_OPC(   0, 0xf1), 0)
-#define INSTR_HLT         INSTR_ENC(X86EMUL_OPC(   0, 0xf4), 0)
-#define INSTR_XSETBV      INSTR_ENC(X86EMUL_OPC(0x0f, 0x01), 0321)
-#define INSTR_VMRUN       INSTR_ENC(X86EMUL_OPC(0x0f, 0x01), 0330)
-#define INSTR_VMCALL      INSTR_ENC(X86EMUL_OPC(0x0f, 0x01), 0331)
-#define INSTR_VMLOAD      INSTR_ENC(X86EMUL_OPC(0x0f, 0x01), 0332)
-#define INSTR_VMSAVE      INSTR_ENC(X86EMUL_OPC(0x0f, 0x01), 0333)
-#define INSTR_STGI        INSTR_ENC(X86EMUL_OPC(0x0f, 0x01), 0334)
-#define INSTR_CLGI        INSTR_ENC(X86EMUL_OPC(0x0f, 0x01), 0335)
-#define INSTR_INVLPGA     INSTR_ENC(X86EMUL_OPC(0x0f, 0x01), 0337)
-#define INSTR_RDTSCP      INSTR_ENC(X86EMUL_OPC(0x0f, 0x01), 0371)
-#define INSTR_INVD        INSTR_ENC(X86EMUL_OPC(0x0f, 0x08), 0)
-#define INSTR_WBINVD      INSTR_ENC(X86EMUL_OPC(0x0f, 0x09), 0)
-#define INSTR_WRMSR       INSTR_ENC(X86EMUL_OPC(0x0f, 0x30), 0)
-#define INSTR_RDTSC       INSTR_ENC(X86EMUL_OPC(0x0f, 0x31), 0)
-#define INSTR_RDMSR       INSTR_ENC(X86EMUL_OPC(0x0f, 0x32), 0)
-#define INSTR_CPUID       INSTR_ENC(X86EMUL_OPC(0x0f, 0xa2), 0)
-
-struct vcpu;
-
-unsigned int svm_get_insn_len(struct vcpu *v, unsigned int instr_enc);
-unsigned int svm_get_task_switch_insn_len(void);
-
-#endif /* __ASM_X86_HVM_SVM_EMULATE_H__ */
-
-/*
- * Local variables:
- * mode: C
- * c-file-style: "BSD"
- * c-basic-offset: 4
- * tab-width: 4
- * indent-tabs-mode: nil
- * End:
- */
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Feb 25 20:02:34 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 25 Feb 2023 20:02:34 +0000
Received: from list by lists.xenproject.org with outflank-mailman.501865.773663 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pW0kc-0003H0-Gj; Sat, 25 Feb 2023 20:02:34 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 501865.773663; Sat, 25 Feb 2023 20:02:34 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pW0kc-0003Gt-Dp; Sat, 25 Feb 2023 20:02:34 +0000
Received: by outflank-mailman (input) for mailman id 501865;
 Sat, 25 Feb 2023 20:02:33 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pW0kb-0003Gd-8R
 for xen-changelog@lists.xenproject.org; Sat, 25 Feb 2023 20:02:33 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pW0kb-0000Pg-7o
 for xen-changelog@lists.xenproject.org; Sat, 25 Feb 2023 20:02:33 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pW0kb-0007Ll-74
 for xen-changelog@lists.xenproject.org; Sat, 25 Feb 2023 20:02:33 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=iaOAet+S1QvNxpxNOX+e90d3je1Zbsp20xahFzh/FIg=; b=29qF1oJexlQ+DWbPven6Ou+ZLt
	w7KTLBNERX6iWXnCCj8X0J+wZumYB2lzxf0c1oqH8IBksw6mu5N/m7HOKJ87d/5xwfqdtKFicA0sJ
	PzTkKTRO9r76gpDfEVnQVbZbEe6RRH9wWnxTc/XVPjq4s7am1AmNQt+FoEMENrWIrMFg=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/svm: move nestedsvm declarations used only by svm code to private header
Message-Id: <E1pW0kb-0007Ll-74@xenbits.xenproject.org>
Date: Sat, 25 Feb 2023 20:02:33 +0000

commit 608f85a1818697156b72ace4913a17c8178a0ef5
Author:     Xenia Ragiadakou <burzalodowa@gmail.com>
AuthorDate: Fri Feb 24 20:50:01 2023 +0200
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Feb 24 20:53:10 2023 +0000

    x86/svm: move nestedsvm declarations used only by svm code to private header
    
    Create a new private header in arch/x86/hvm/svm called nestedsvm.h and move
    there all definitions and declarations that are used only by svm code and
    don't need to reside in an external header.
    
    No functional change intended.
    
    Signed-off-by: Xenia Ragiadakou <burzalodowa@gmail.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/hvm/svm/intr.c                  |  2 +
 xen/arch/x86/hvm/svm/nestedhvm.h             | 77 ++++++++++++++++++++++++++++
 xen/arch/x86/hvm/svm/nestedsvm.c             |  2 +-
 xen/arch/x86/hvm/svm/svm.c                   |  2 +-
 xen/arch/x86/include/asm/hvm/svm/nestedsvm.h | 53 ++-----------------
 5 files changed, 85 insertions(+), 51 deletions(-)

diff --git a/xen/arch/x86/hvm/svm/intr.c b/xen/arch/x86/hvm/svm/intr.c
index d21e930af0..dbb0022190 100644
--- a/xen/arch/x86/hvm/svm/intr.c
+++ b/xen/arch/x86/hvm/svm/intr.c
@@ -37,6 +37,8 @@
 #include <xen/domain_page.h>
 #include <asm/hvm/trace.h>
 
+#include "nestedhvm.h"
+
 static void svm_inject_nmi(struct vcpu *v)
 {
     struct vmcb_struct *vmcb = v->arch.hvm.svm.vmcb;
diff --git a/xen/arch/x86/hvm/svm/nestedhvm.h b/xen/arch/x86/hvm/svm/nestedhvm.h
new file mode 100644
index 0000000000..43245e13de
--- /dev/null
+++ b/xen/arch/x86/hvm/svm/nestedhvm.h
@@ -0,0 +1,77 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * nestedsvm.h: Nested Virtualization
+ *
+ * Copyright (c) 2011, Advanced Micro Devices, Inc
+ */
+
+#ifndef __X86_HVM_SVM_NESTEDHVM_PRIV_H__
+#define __X86_HVM_SVM_NESTEDHVM_PRIV_H__
+
+#include <xen/mm.h>
+#include <xen/types.h>
+
+#include <asm/hvm/vcpu.h>
+#include <asm/hvm/hvm.h>
+#include <asm/hvm/nestedhvm.h>
+#include <asm/msr-index.h>
+
+/* SVM specific intblk types, cannot be an enum because gcc 4.5 complains */
+/* GIF cleared */
+#define hvm_intblk_svm_gif      hvm_intblk_arch
+
+#define vcpu_nestedsvm(v) (vcpu_nestedhvm(v).u.nsvm)
+
+/* True when l1 guest enabled SVM in EFER */
+#define nsvm_efer_svm_enabled(v) \
+    (!!((v)->arch.hvm.guest_efer & EFER_SVME))
+
+int nestedsvm_vmcb_map(struct vcpu *v, uint64_t vmcbaddr);
+void nestedsvm_vmexit_defer(struct vcpu *v,
+    uint64_t exitcode, uint64_t exitinfo1, uint64_t exitinfo2);
+enum nestedhvm_vmexits
+nestedsvm_vmexit_n2n1(struct vcpu *v, struct cpu_user_regs *regs);
+enum nestedhvm_vmexits
+nestedsvm_check_intercepts(struct vcpu *v, struct cpu_user_regs *regs,
+    uint64_t exitcode);
+void svm_nested_features_on_efer_update(struct vcpu *v);
+
+/* Interface methods */
+void cf_check nsvm_vcpu_destroy(struct vcpu *v);
+int cf_check nsvm_vcpu_initialise(struct vcpu *v);
+int cf_check nsvm_vcpu_reset(struct vcpu *v);
+int nsvm_vcpu_vmrun(struct vcpu *v, struct cpu_user_regs *regs);
+int cf_check nsvm_vcpu_vmexit_event(struct vcpu *v,
+                                    const struct x86_event *event);
+uint64_t cf_check nsvm_vcpu_hostcr3(struct vcpu *v);
+bool cf_check nsvm_vmcb_guest_intercepts_event(
+    struct vcpu *v, unsigned int vector, int errcode);
+bool cf_check nsvm_vmcb_hap_enabled(struct vcpu *v);
+enum hvm_intblk cf_check nsvm_intr_blocked(struct vcpu *v);
+
+/* Interrupts, vGIF */
+void svm_vmexit_do_clgi(struct cpu_user_regs *regs, struct vcpu *v);
+void svm_vmexit_do_stgi(struct cpu_user_regs *regs, struct vcpu *v);
+bool nestedsvm_gif_isset(struct vcpu *v);
+int cf_check nsvm_hap_walk_L1_p2m(
+    struct vcpu *v, paddr_t L2_gpa, paddr_t *L1_gpa, unsigned int *page_order,
+    uint8_t *p2m_acc, struct npfec npfec);
+
+#define NSVM_INTR_NOTHANDLED     3
+#define NSVM_INTR_NOTINTERCEPTED 2
+#define NSVM_INTR_FORCEVMEXIT    1
+#define NSVM_INTR_MASKED         0
+
+int nestedsvm_vcpu_interrupt(struct vcpu *v, const struct hvm_intack intack);
+
+#endif /* __X86_HVM_SVM_NESTEDHVM_PRIV_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/arch/x86/hvm/svm/nestedsvm.c b/xen/arch/x86/hvm/svm/nestedsvm.c
index c0b5474756..92316c6624 100644
--- a/xen/arch/x86/hvm/svm/nestedsvm.c
+++ b/xen/arch/x86/hvm/svm/nestedsvm.c
@@ -20,12 +20,12 @@
 #include <asm/hvm/svm/svm.h>
 #include <asm/hvm/svm/vmcb.h>
 #include <asm/hvm/nestedhvm.h>
-#include <asm/hvm/svm/nestedsvm.h>
 #include <asm/hvm/svm/svmdebug.h>
 #include <asm/paging.h> /* paging_mode_hap */
 #include <asm/event.h> /* for local_event_delivery_(en|dis)able */
 #include <asm/p2m.h> /* p2m_get_pagetable, p2m_get_nestedp2m */
 
+#include "nestedhvm.h"
 #include "svm.h"
 
 #define NSVM_ERROR_VVMCB        1
diff --git a/xen/arch/x86/hvm/svm/svm.c b/xen/arch/x86/hvm/svm/svm.c
index 97783b7f11..a43bcf2e92 100644
--- a/xen/arch/x86/hvm/svm/svm.c
+++ b/xen/arch/x86/hvm/svm/svm.c
@@ -37,7 +37,6 @@
 #include <asm/hvm/monitor.h>
 #include <asm/hvm/nestedhvm.h>
 #include <asm/hvm/support.h>
-#include <asm/hvm/svm/nestedsvm.h>
 #include <asm/hvm/svm/svm.h>
 #include <asm/hvm/svm/svmdebug.h>
 #include <asm/hvm/svm/vmcb.h>
@@ -53,6 +52,7 @@
 
 #include <public/sched.h>
 
+#include "nestedhvm.h"
 #include "svm.h"
 
 void noreturn svm_asm_do_resume(void);
diff --git a/xen/arch/x86/include/asm/hvm/svm/nestedsvm.h b/xen/arch/x86/include/asm/hvm/svm/nestedsvm.h
index 656d7d1a9a..94d45d2e8d 100644
--- a/xen/arch/x86/include/asm/hvm/svm/nestedsvm.h
+++ b/xen/arch/x86/include/asm/hvm/svm/nestedsvm.h
@@ -18,15 +18,12 @@
 #ifndef __ASM_X86_HVM_SVM_NESTEDSVM_H__
 #define __ASM_X86_HVM_SVM_NESTEDSVM_H__
 
-#include <asm/hvm/hvm.h>
-#include <asm/hvm/svm/vmcb.h>
+#include <xen/types.h>
 
-/* SVM specific intblk types, cannot be an enum because gcc 4.5 complains */
-/* GIF cleared */
-#define hvm_intblk_svm_gif      hvm_intblk_arch
+#include <asm/hvm/svm/vmcb.h>
 
 struct nestedsvm {
-    bool_t ns_gif;
+    bool ns_gif;
     uint64_t ns_msr_hsavepa; /* MSR HSAVE_PA value */
 
     /* l1 guest physical address of virtual vmcb used by prior VMRUN.
@@ -72,7 +69,7 @@ struct nestedsvm {
     uint64_t ns_vmcb_guestcr3, ns_vmcb_hostcr3;
     uint32_t ns_guest_asid;
 
-    bool_t ns_hap_enabled;
+    bool ns_hap_enabled;
 
     /* Only meaningful when vmexit_pending flag is set */
     struct {
@@ -90,48 +87,6 @@ struct nestedsvm {
     } ns_hostflags;
 };
 
-#define vcpu_nestedsvm(v) (vcpu_nestedhvm(v).u.nsvm)
-
-/* True when l1 guest enabled SVM in EFER */
-#define nsvm_efer_svm_enabled(v) \
-    (!!((v)->arch.hvm.guest_efer & EFER_SVME))
-
-int nestedsvm_vmcb_map(struct vcpu *v, uint64_t vmcbaddr);
-void nestedsvm_vmexit_defer(struct vcpu *v,
-    uint64_t exitcode, uint64_t exitinfo1, uint64_t exitinfo2);
-enum nestedhvm_vmexits
-nestedsvm_vmexit_n2n1(struct vcpu *v, struct cpu_user_regs *regs);
-enum nestedhvm_vmexits
-nestedsvm_check_intercepts(struct vcpu *v, struct cpu_user_regs *regs,
-    uint64_t exitcode);
-void svm_nested_features_on_efer_update(struct vcpu *v);
-
-/* Interface methods */
-void cf_check nsvm_vcpu_destroy(struct vcpu *v);
-int cf_check nsvm_vcpu_initialise(struct vcpu *v);
-int cf_check nsvm_vcpu_reset(struct vcpu *v);
-int nsvm_vcpu_vmrun(struct vcpu *v, struct cpu_user_regs *regs);
-int cf_check nsvm_vcpu_vmexit_event(struct vcpu *v, const struct x86_event *event);
-uint64_t cf_check nsvm_vcpu_hostcr3(struct vcpu *v);
-bool cf_check nsvm_vmcb_guest_intercepts_event(
-    struct vcpu *v, unsigned int vector, int errcode);
-bool cf_check nsvm_vmcb_hap_enabled(struct vcpu *v);
-enum hvm_intblk cf_check nsvm_intr_blocked(struct vcpu *v);
-
-/* Interrupts, vGIF */
-void svm_vmexit_do_clgi(struct cpu_user_regs *regs, struct vcpu *v);
-void svm_vmexit_do_stgi(struct cpu_user_regs *regs, struct vcpu *v);
-bool_t nestedsvm_gif_isset(struct vcpu *v);
-int cf_check nsvm_hap_walk_L1_p2m(
-    struct vcpu *v, paddr_t L2_gpa, paddr_t *L1_gpa, unsigned int *page_order,
-    uint8_t *p2m_acc, struct npfec npfec);
-
-#define NSVM_INTR_NOTHANDLED     3
-#define NSVM_INTR_NOTINTERCEPTED 2
-#define NSVM_INTR_FORCEVMEXIT    1
-#define NSVM_INTR_MASKED         0
-int nestedsvm_vcpu_interrupt(struct vcpu *v, const struct hvm_intack intack);
-
 #endif /* ASM_X86_HVM_SVM_NESTEDSVM_H__ */
 
 /*
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Feb 25 22:22:07 2023
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 25 Feb 2023 22:22:07 +0000
Received: from list by lists.xenproject.org with outflank-mailman.501917.773737 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pW2vb-0000jp-AO; Sat, 25 Feb 2023 22:22:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 501917.773737; Sat, 25 Feb 2023 22:22:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1pW2vb-0000jh-7h; Sat, 25 Feb 2023 22:22:03 +0000
Received: by outflank-mailman (input) for mailman id 501917;
 Sat, 25 Feb 2023 22: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 1pW2vZ-0000jb-Vx
 for xen-changelog@lists.xenproject.org; Sat, 25 Feb 2023 22:22:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pW2vZ-0003d0-Uv
 for xen-changelog@lists.xenproject.org; Sat, 25 Feb 2023 22:22:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1pW2vZ-0004uL-T2
 for xen-changelog@lists.xenproject.org; Sat, 25 Feb 2023 22:22:01 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=3h82VzbEwry6+wvxWffkFMcj8CM4VyXUHtX5vhEU6ro=; b=NuOteaaVxDh6gBb5pAga1kJkpx
	NXJGeVJUozcyYzpNxhoUQoJMkUTRJv6tsVN5PQYAWGdB1JIYs6g1EZ23JWRu53Unluc+D7yY48Zw/
	vXFoayftEfFWgAoN15WQ/3MpCmpQkP96xUtAcYmB3MTn07sZAaoHQoWQYLNc5u08NtPk=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.16] automation: Remove clang-8 from Debian unstable container
Message-Id: <E1pW2vZ-0004uL-T2@xenbits.xenproject.org>
Date: Sat, 25 Feb 2023 22:22:01 +0000

commit 0802504627453a54b1ab408b6e9dc8b5c561172d
Author:     Anthony PERARD <anthony.perard@citrix.com>
AuthorDate: Tue Feb 21 16:55:38 2023 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Wed Feb 22 14:14:34 2023 +0000

    automation: Remove clang-8 from Debian unstable container
    
    First, apt complain that it isn't the right way to add keys anymore,
    but hopefully that's just a warning.
    
    Second, we can't install clang-8:
    The following packages have unmet dependencies:
     clang-8 : Depends: libstdc++-8-dev but it is not installable
               Depends: libgcc-8-dev but it is not installable
               Depends: libobjc-8-dev but it is not installable
               Recommends: llvm-8-dev but it is not going to be installed
               Recommends: libomp-8-dev but it is not going to be installed
     libllvm8 : Depends: libffi7 (>= 3.3~20180313) but it is not installable
    E: Unable to correct problems, you have held broken packages.
    
    clang on Debian unstable is now version 14.0.6.
    
    Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
    (cherry picked from commit a6b1e2b80fe2053b1c9c9843fb086a668513ea36)
---
 automation/build/debian/unstable-llvm-8.list |  3 ---
 automation/build/debian/unstable.dockerfile  | 12 ------------
 automation/gitlab-ci/build.yaml              | 10 ----------
 3 files changed, 25 deletions(-)

diff --git a/automation/build/debian/unstable-llvm-8.list b/automation/build/debian/unstable-llvm-8.list
deleted file mode 100644
index dc119fa0b4..0000000000
--- a/automation/build/debian/unstable-llvm-8.list
+++ /dev/null
@@ -1,3 +0,0 @@
-# Unstable LLVM 8 repos
-deb http://apt.llvm.org/unstable/ llvm-toolchain-8 main
-deb-src http://apt.llvm.org/unstable/ llvm-toolchain-8 main
diff --git a/automation/build/debian/unstable.dockerfile b/automation/build/debian/unstable.dockerfile
index bd61cd12c2..828afa2e1e 100644
--- a/automation/build/debian/unstable.dockerfile
+++ b/automation/build/debian/unstable.dockerfile
@@ -52,15 +52,3 @@ RUN apt-get update && \
         apt-get autoremove -y && \
         apt-get clean && \
         rm -rf /var/lib/apt/lists* /tmp/* /var/tmp/*
-
-RUN wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key|apt-key add -
-COPY unstable-llvm-8.list /etc/apt/sources.list.d/
-
-RUN apt-get update && \
-    apt-get --quiet --yes install \
-        clang-8 \
-        lld-8 \
-        && \
-        apt-get autoremove -y && \
-        apt-get clean && \
-        rm -rf /var/lib/apt/lists* /tmp/* /var/tmp/*
diff --git a/automation/gitlab-ci/build.yaml b/automation/gitlab-ci/build.yaml
index fdd5c76582..06a75a8c5a 100644
--- a/automation/gitlab-ci/build.yaml
+++ b/automation/gitlab-ci/build.yaml
@@ -304,16 +304,6 @@ debian-unstable-clang-debug:
   variables:
     CONTAINER: debian:unstable
 
-debian-unstable-clang-8:
-  extends: .clang-8-x86-64-build
-  variables:
-    CONTAINER: debian:unstable
-
-debian-unstable-clang-8-debug:
-  extends: .clang-8-x86-64-build-debug
-  variables:
-    CONTAINER: debian:unstable
-
 debian-unstable-gcc:
   extends: .gcc-x86-64-build
   variables:
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.16


