git: 049a2dcbdb12 - main - {emulators,sysutils}/xen-{kernel,tools}: update to 4.19.1.20250217

From: Roger Pau Monné <royger_at_FreeBSD.org>
Date: Tue, 18 Feb 2025 14:31:58 UTC
The branch main has been updated by royger:

URL: https://cgit.FreeBSD.org/ports/commit/?id=049a2dcbdb1253e13a13e02a3c216ac4484aa2ca

commit 049a2dcbdb1253e13a13e02a3c216ac4484aa2ca
Author:     Roger Pau Monné <royger@FreeBSD.org>
AuthorDate: 2025-02-18 10:56:21 +0000
Commit:     Roger Pau Monné <royger@FreeBSD.org>
CommitDate: 2025-02-18 14:29:31 +0000

    {emulators,sysutils}/xen-{kernel,tools}: update to 4.19.1.20250217
    
    Update Xen packages, include QEMU fix to avoid using %ms scanf directive
    which is not supported by FreeBSD libc.
    
    Link: https://lore.kernel.org/xen-devel/20250107093140.86180-1-roger.pau@citrix.com/
    Link: https://lists.freebsd.org/archives/freebsd-xen/2025-February/000227.html
    Approved by: bapt (implicit)
    Sponsored by: Cloud Software Group
---
 emulators/xen-kernel/Makefile                      |  4 +-
 emulators/xen-kernel/distinfo                      |  6 +-
 sysutils/xen-tools/Makefile                        |  4 +-
 sysutils/xen-tools/distinfo                        |  6 +-
 ...1-hw-xen-Add-xs_node_read-helper-function.patch | 91 ++++++++++++++++++++++
 ...uu-0002-xen-do-not-use-ms-scanf-specifier.patch | 88 +++++++++++++++++++++
 6 files changed, 189 insertions(+), 10 deletions(-)

diff --git a/emulators/xen-kernel/Makefile b/emulators/xen-kernel/Makefile
index 4740b91ac09c..ef67d3cb7b6f 100644
--- a/emulators/xen-kernel/Makefile
+++ b/emulators/xen-kernel/Makefile
@@ -1,11 +1,11 @@
 PORTNAME=	xen
 PKGNAMESUFFIX=	-kernel
-DISTVERSION=	4.19.0.20241112
+DISTVERSION=	4.19.1.20250217
 CATEGORIES=	emulators
 
 USE_GITLAB=	yes
 GL_ACCOUNT=	xen-project
-GL_TAGNAME=	251a9496485a86f302980a3f8d3c656831b5a62f
+GL_TAGNAME=	93302bb88855c5f308f1e67ac2cd84271aa2d73a
 
 MAINTAINER=	royger@FreeBSD.org
 COMMENT=	Hypervisor using a microkernel design
diff --git a/emulators/xen-kernel/distinfo b/emulators/xen-kernel/distinfo
index 11217aed8731..a19d269e7bc7 100644
--- a/emulators/xen-kernel/distinfo
+++ b/emulators/xen-kernel/distinfo
@@ -1,3 +1,3 @@
-TIMESTAMP = 1731419133
-SHA256 (xen-project-xen-251a9496485a86f302980a3f8d3c656831b5a62f_GL0.tar.gz) = fc0f502af1741e0d5bf9b3ab8576c4874271c63a3ad79892b78cd244fab52f21
-SIZE (xen-project-xen-251a9496485a86f302980a3f8d3c656831b5a62f_GL0.tar.gz) = 6932160
+TIMESTAMP = 1739878271
+SHA256 (xen-project-xen-93302bb88855c5f308f1e67ac2cd84271aa2d73a_GL0.tar.gz) = fb74e9c8b78a22d427507ee9ae52bdc9d78ee7c46dd58ae3d6d12670b6c6c2a8
+SIZE (xen-project-xen-93302bb88855c5f308f1e67ac2cd84271aa2d73a_GL0.tar.gz) = 6938735
diff --git a/sysutils/xen-tools/Makefile b/sysutils/xen-tools/Makefile
index 5c4a15aafb60..75084bdc0e9a 100644
--- a/sysutils/xen-tools/Makefile
+++ b/sysutils/xen-tools/Makefile
@@ -1,11 +1,11 @@
 PORTNAME=	xen
 PKGNAMESUFFIX=	-tools
-DISTVERSION=	4.19.0.20241112
+DISTVERSION=	4.19.1.20250217
 CATEGORIES=	sysutils emulators
 
 USE_GITLAB=	yes
 GL_ACCOUNT=	xen-project
-GL_TAGNAME=	251a9496485a86f302980a3f8d3c656831b5a62f
+GL_TAGNAME=	93302bb88855c5f308f1e67ac2cd84271aa2d73a
 GL_TUPLE=	qemu-project:qemu:v8.0.4:qemu \
 		qemu-project:dtc:b6910bec:dtc \
 		qemu-project:meson:3a9b285a:meson \
diff --git a/sysutils/xen-tools/distinfo b/sysutils/xen-tools/distinfo
index 480318d2449f..f8d2cd648c8b 100644
--- a/sysutils/xen-tools/distinfo
+++ b/sysutils/xen-tools/distinfo
@@ -1,6 +1,6 @@
-TIMESTAMP = 1731419084
-SHA256 (xen-project-xen-251a9496485a86f302980a3f8d3c656831b5a62f_GL0.tar.gz) = fc0f502af1741e0d5bf9b3ab8576c4874271c63a3ad79892b78cd244fab52f21
-SIZE (xen-project-xen-251a9496485a86f302980a3f8d3c656831b5a62f_GL0.tar.gz) = 6932160
+TIMESTAMP = 1739878294
+SHA256 (xen-project-xen-93302bb88855c5f308f1e67ac2cd84271aa2d73a_GL0.tar.gz) = fb74e9c8b78a22d427507ee9ae52bdc9d78ee7c46dd58ae3d6d12670b6c6c2a8
+SIZE (xen-project-xen-93302bb88855c5f308f1e67ac2cd84271aa2d73a_GL0.tar.gz) = 6938735
 SHA256 (qemu-v8.0.4.tar.bz2) = 958eae6b32046bb512b5b968f66e896258fa8c4ec5c7fdf2d780fd206c677774
 SIZE (qemu-v8.0.4.tar.bz2) = 31468222
 SHA256 (dtc-b6910bec.tar.bz2) = f180420b105bdd35cfee9977d6ee2ee5d6601aa2a84693c048a985a604bd2c1c
diff --git a/sysutils/xen-tools/files/qemuu-0001-hw-xen-Add-xs_node_read-helper-function.patch b/sysutils/xen-tools/files/qemuu-0001-hw-xen-Add-xs_node_read-helper-function.patch
new file mode 100644
index 000000000000..81367e1bf544
--- /dev/null
+++ b/sysutils/xen-tools/files/qemuu-0001-hw-xen-Add-xs_node_read-helper-function.patch
@@ -0,0 +1,91 @@
+From db2e99cab015e03711542f8d97b6cd9654aa1b0a Mon Sep 17 00:00:00 2001
+From: David Woodhouse <dwmw@amazon.co.uk>
+Date: Fri, 10 Jan 2025 10:35:30 +0100
+Subject: [PATCH 1/2] hw/xen: Add xs_node_read() helper function
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+This returns the full contents of the node, having created the node path
+from the printf-style format string provided in its arguments.
+
+This will save various callers from having to do so for themselves (and
+from using xs_node_scanf() with the non-portable %ms format string.
+
+Signed-off-by: David Woodhouse <dwmw@amazon.co.uk>
+[remove double newline and constify trace parameters]
+Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
+Reviewed-by: Anthony PERARD <anthony.perard@vates.tech>
+---
+ hw/xen/trace-events             |  1 +
+ hw/xen/xen-bus-helper.c         | 22 ++++++++++++++++++++++
+ include/hw/xen/xen-bus-helper.h |  9 +++++++++
+ 3 files changed, 32 insertions(+)
+
+diff --git a/hw/xen/trace-events b/hw/xen/trace-events
+index 55c9e1df680b..53df1b9ba968 100644
+--- a/hw/xen/trace-events
++++ b/hw/xen/trace-events
+@@ -39,5 +39,6 @@ xs_node_create(const char *node) "%s"
+ xs_node_destroy(const char *node) "%s"
+ xs_node_vprintf(char *path, char *value) "%s %s"
+ xs_node_vscanf(char *path, char *value) "%s %s"
++xs_node_read(const char *path, const char *value) "%s %s"
+ xs_node_watch(char *path) "%s"
+ xs_node_unwatch(char *path) "%s"
+diff --git a/hw/xen/xen-bus-helper.c b/hw/xen/xen-bus-helper.c
+index b2b2cc9c5d5e..22fd2f6c1ac5 100644
+--- a/hw/xen/xen-bus-helper.c
++++ b/hw/xen/xen-bus-helper.c
+@@ -142,6 +142,28 @@ int xs_node_scanf(struct qemu_xs_handle *h,  xs_transaction_t tid,
+     return rc;
+ }
+ 
++char *xs_node_read(struct qemu_xs_handle *h, xs_transaction_t tid,
++                   unsigned int *len, Error **errp,
++                   const char *path_fmt, ...)
++{
++    char *path, *value;
++    va_list ap;
++
++    va_start(ap, path_fmt);
++    path = g_strdup_vprintf(path_fmt, ap);
++    va_end(ap);
++
++    value = qemu_xen_xs_read(h, tid, path, len);
++    trace_xs_node_read(path, value);
++    if (!value) {
++        error_setg_errno(errp, errno, "failed to read from '%s'", path);
++    }
++
++    g_free(path);
++
++    return value;
++}
++
+ struct qemu_xs_watch *xs_node_watch(struct qemu_xs_handle *h, const char *node,
+                                     const char *key, xs_watch_fn fn,
+                                     void *opaque, Error **errp)
+diff --git a/include/hw/xen/xen-bus-helper.h b/include/hw/xen/xen-bus-helper.h
+index d8dcc2f0107d..e9911115b326 100644
+--- a/include/hw/xen/xen-bus-helper.h
++++ b/include/hw/xen/xen-bus-helper.h
+@@ -38,6 +38,15 @@ int xs_node_scanf(struct qemu_xs_handle *h,  xs_transaction_t tid,
+                   const char *fmt, ...)
+     G_GNUC_SCANF(6, 7);
+ 
++/*
++ * Unlike other functions here, the printf-formatted path_fmt is for
++ * the XenStore path, not the contents of the node.
++ */
++char *xs_node_read(struct qemu_xs_handle *h, xs_transaction_t tid,
++                   unsigned int *len, Error **errp,
++                   const char *path_fmt, ...)
++    G_GNUC_PRINTF(5, 6);
++
+ /* Watch node/key unless node is empty, in which case watch key */
+ struct qemu_xs_watch *xs_node_watch(struct qemu_xs_handle *h, const char *node,
+                                     const char *key, xs_watch_fn fn,
+-- 
+2.46.0
+
diff --git a/sysutils/xen-tools/files/qemuu-0002-xen-do-not-use-ms-scanf-specifier.patch b/sysutils/xen-tools/files/qemuu-0002-xen-do-not-use-ms-scanf-specifier.patch
new file mode 100644
index 000000000000..2be76c0443ad
--- /dev/null
+++ b/sysutils/xen-tools/files/qemuu-0002-xen-do-not-use-ms-scanf-specifier.patch
@@ -0,0 +1,88 @@
+From 677a577b625045c6d02210ac91ff452f54812513 Mon Sep 17 00:00:00 2001
+From: Roger Pau Monne <roger.pau@citrix.com>
+Date: Fri, 10 Jan 2025 10:35:31 +0100
+Subject: [PATCH 2/2] xen: do not use '%ms' scanf specifier
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+The 'm' parameter used to request auto-allocation of the destination variable
+is not supported on FreeBSD, and as such leads to failures to parse.
+
+What's more, the current usage of '%ms' with xs_node_scanf() is pointless, as
+it just leads to a double allocation of the same string.  Instead use
+xs_node_read() to read the whole xenstore node.
+
+Fixes: a783f8ad4ec9 ('xen: add a mechanism to automatically create XenDevice-s...')
+Fixes: 9b7737469080 ('hw/xen: update Xen console to XenDevice model')
+Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
+Signed-off-by: David Woodhouse <dwmw@amazon.co.uk>
+Reviewed-by: Anthony PERARD <anthony.perard@vates.tech>
+---
+ hw/block/xen-block.c     |  4 ++--
+ hw/xen/xen-bus.c         | 14 ++++++++++++--
+ include/hw/xen/xen-bus.h |  1 +
+ 3 files changed, 15 insertions(+), 4 deletions(-)
+
+diff --git a/hw/block/xen-block.c b/hw/block/xen-block.c
+index 6ccb8a4a3219..dc389578f454 100644
+--- a/hw/block/xen-block.c
++++ b/hw/block/xen-block.c
+@@ -115,8 +115,8 @@ static void xen_block_connect(XenDevice *xendev, Error **errp)
+         return;
+     }
+ 
+-    if (xen_device_frontend_scanf(xendev, "protocol", "%ms",
+-                                  &str) != 1) {
++    str = xen_device_frontend_read(xendev, "protocol");
++    if (!str) {
+         protocol = BLKIF_PROTOCOL_NATIVE;
+     } else {
+         if (strcmp(str, XEN_IO_PROTO_ABI_X86_32) == 0) {
+diff --git a/hw/xen/xen-bus.c b/hw/xen/xen-bus.c
+index c59850b1dee7..8ff083167f47 100644
+--- a/hw/xen/xen-bus.c
++++ b/hw/xen/xen-bus.c
+@@ -154,8 +154,8 @@ again:
+             !strcmp(key[i], "hotplug-status"))
+             continue;
+ 
+-        if (xs_node_scanf(xenbus->xsh, tid, path, key[i], NULL, "%ms",
+-                          &val) == 1) {
++        val = xs_node_read(xenbus->xsh, tid, NULL, NULL, "%s/%s", path, key[i]);
++        if (val) {
+             qdict_put_str(opts, key[i], val);
+             free(val);
+         }
+@@ -644,6 +644,16 @@ int xen_device_frontend_scanf(XenDevice *xendev, const char *key,
+     return rc;
+ }
+ 
++char *xen_device_frontend_read(XenDevice *xendev, const char *key)
++{
++    XenBus *xenbus = XEN_BUS(qdev_get_parent_bus(DEVICE(xendev)));
++
++    g_assert(xenbus->xsh);
++
++    return xs_node_read(xenbus->xsh, XBT_NULL, NULL, NULL, "%s/%s",
++                        xendev->frontend_path, key);
++}
++
+ static void xen_device_frontend_set_state(XenDevice *xendev,
+                                           enum xenbus_state state,
+                                           bool publish)
+diff --git a/include/hw/xen/xen-bus.h b/include/hw/xen/xen-bus.h
+index f43589816495..6bb199704440 100644
+--- a/include/hw/xen/xen-bus.h
++++ b/include/hw/xen/xen-bus.h
+@@ -89,6 +89,7 @@ void xen_device_frontend_printf(XenDevice *xendev, const char *key,
+ int xen_device_frontend_scanf(XenDevice *xendev, const char *key,
+                               const char *fmt, ...)
+     G_GNUC_SCANF(3, 4);
++char *xen_device_frontend_read(XenDevice *xendev, const char *key);
+ 
+ void xen_device_set_max_grant_refs(XenDevice *xendev, unsigned int nr_refs,
+                                    Error **errp);
+-- 
+2.46.0
+