[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH v3 8/8] xen/dom0less: store xenstore event channel in page


  • To: <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Jason Andryuk <jason.andryuk@xxxxxxx>
  • Date: Tue, 26 Aug 2025 17:08:47 -0400
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=lists.xenproject.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0)
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=9F+/mzfDnNswEGDX88fLVWONwAPU8XRv8UZTYl3/UxQ=; b=gmOk9YNNE4SNi4RCszvsIP18gXxIKEHIocbibauifWIqJcoBJYrJ7Is8P9oycsTwSPF/bC+a5w2Mcs0OcqfqQrL2kG3F1LdxP4TfzdY2wiMJBHlT92RavwALGokW8LCQ9+FCN6ogA3X3erHRGcp+UY1KqigA1n4rF9WM4orPVk5n+tcxrvZlx28YYF4QVhMcHP0njjxoaUgq1AouHhB9qTQSzrIIRPSpJQtnu/FWk5tavJI6usRUdLispUG69E9y2kdCxQNV2SM7FvOR05is5JBXFG3TCBLu5drbgB1WWr71qKaDFYXoxA86kZa4CaBlH7xfLxzZmHfa8zTs0RVpeA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=iVhBjMxN8i8evB/4Nb9TiqtUcWwOAB+5AM9lk0MkC0iJhI2NwPvIaKvXYH/tSrRMy8ubdZNNbKU2GvT11M/F6K8T62Ykon04rLiOoZbDnTQieFY9HqvAhpGOa2Wz31XxdkU35CowP92gFyZn2jpM2zm0qUq2yT2211r5nSqx+6QTQgvW1YolTb2E/0cB/kZQs0oAO8cVvMttxqXa+zQAJRO+3lSuwe3LP6mKzrGJMELji/D7ZrJKQ3q8gANiuABX671562Bt2Cz5bfrdUaunEB5Yna47oHOkRcBS5f8+C3ehClk2ISC3ozO/eEqb3wtqUQVyKGJvvMHuGPc+Qm44Cw==
  • Cc: Jason Andryuk <jason.andryuk@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Bertrand Marquis <bertrand.marquis@xxxxxxx>, Michal Orzel <michal.orzel@xxxxxxx>
  • Delivery-date: Tue, 26 Aug 2025 21:09:21 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

Write the associated event channel into the xenstore page so xenstored
can read it.  xenstored can map the grant by the reserved grant table
entry, and then read out the event channel and bind it.  This eliminates
the need for an additional mechanism to discover the event channel.

Signed-off-by: Jason Andryuk <jason.andryuk@xxxxxxx>
---
v2:
No change

This should go in after the init-dom0less changes so init-dom0less is
ready for xenstored automatically introducing domains.

I'm looking for feedback.  This is ARM-only for the time being, but that
is the only in-tree user of this code.  From the perspective, it is okay
to go in.

If we want a cross-arch approach, a common function to write to guest
physical addresses would be needed for additional arches, but they
aren't available yet.

Oleksii added a function pointer to dtb_load() and initrd_load() when
moving dom0less to common, but I think that isn't necessary.  Just
having a common helper would be sufficient.

copy_to_guest_phys() or something_copy_to_guest_phys() could be defined
or a wrapper for ARM's copy_to_guest_phys_flush_dcache().  Other arches
could need to implement it when using dom0less.

I'm not an ARM expert, but Stefano said
copy_to_guest_phys_flush_dcache() is not necessary since this xenstore
page isn't expected to be accessed without caches enabled.
---
 xen/common/device-tree/dom0less-build.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/xen/common/device-tree/dom0less-build.c 
b/xen/common/device-tree/dom0less-build.c
index badc227031..1a40f68837 100644
--- a/xen/common/device-tree/dom0less-build.c
+++ b/xen/common/device-tree/dom0less-build.c
@@ -26,6 +26,7 @@
 #include <public/event_channel.h>
 #include <public/io/xs_wire.h>
 
+#include <asm/guest_access.h>
 #include <asm/setup.h>
 
 #include <xen/static-memory.h>
@@ -120,8 +121,14 @@ static void __init initialize_domU_xenstore(void)
 
         if ( gfn != XENSTORE_PFN_LATE_ALLOC && IS_ENABLED(CONFIG_GRANT_TABLE) )
         {
+            evtchn_port_t port = d->arch.hvm.params[HVM_PARAM_STORE_EVTCHN];
+            paddr_t evtchn_gaddr = gfn_to_gaddr(_gfn(gfn)) +
+                offsetof(struct xenstore_domain_interface, evtchn_port);
+
             ASSERT(gfn < UINT32_MAX);
             gnttab_seed_entry(d, GNTTAB_RESERVED_XENSTORE, xs_domid, gfn);
+            access_guest_memory_by_gpa(d, evtchn_gaddr, &port, sizeof(port),
+                                       true /* is_write */);
         }
     }
 }
-- 
2.50.1




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.