[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v2 05/17] xen/dom0less: Workaround XSM for evtchn_alloc_unbound
- To: <xen-devel@xxxxxxxxxxxxxxxxxxxx>
- From: Jason Andryuk <jason.andryuk@xxxxxxx>
- Date: Wed, 16 Jul 2025 17:14:52 -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=flbFdc0ODgOl/ffFodWP5kfJpi5M4Vh460vEQRALjBE=; b=xv2CGAka7OvWhw+hnK4eEU0Jv/rVnY6yOP4t1j419z8Fa8j06u/Ouu+fNkIoEQHzHzPx/+vqfFyDLg8+MnsLyG1GyjCvuELxMynAafUSDtIKU6VtJAi6v4dHwf8xEms68R5WyuRVHGmbJA/kiWeyKyXoTYFPcrFyGHXkGHdP6RA7BX5rPsw8Ax6oRGKYzjfFVN9dxaRvierK1ua05tU/a1zlz/8Sgo6mI9WgSQRXP2rsFBGjdEeEt2YSWa9CDb9hSgITXQCgfLLNKhYosugI+kZogdVbgBifOiSJaw0VKZE412QcbGeKayunNE/klAGxx4CB7eRFM8Wyuacm4fI5dw==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=NAzuXxw9ukkiGgpUpJwKnOgtwnp5pmGd3Y42MAyrjrgMKjVIC+MhwQvCkx7yI+ufWQh2TpzftCu4vNEDWJ13cZ/ULV+T/2h/YNRJ0NnONEAzFABa68BA+PEbtQUv63EoT6jU9KsCX2JWzZry4Hyg5U56tPGhyC1ODaw8ty1I0PAdWDGORN18NmV49ltaqYrBrFAwWFQGuFpHCZAGo6CaUD9Njwf3r+gBZxGMr9Bk8EfcFQc1PInolq7u+eVpMaxeF6byATe28bKt2ELVo1tFE+poBPoGaYzYS1xji+/F/NQ5UkEe+cjM9vBlToOvkhM+EAkDMi3I5m6gW8LV6hFmvQ==
- Cc: Jason Andryuk <jason.andryuk@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Bertrand Marquis <bertrand.marquis@xxxxxxx>, Michal Orzel <michal.orzel@xxxxxxx>, "Daniel P. Smith" <dpsmith@xxxxxxxxxxxxxxxxxxxx>
- Delivery-date: Wed, 16 Jul 2025 21:22:32 +0000
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
When used with an untargetable domain, xsm_evtchn_unbound fails even
though the idle domain has is_privileged = true. Switch current to the
domain under construction so that event channel creation is allowed as
XSM_TARGET.
Signed-off-by: Jason Andryuk <jason.andryuk@xxxxxxx>
---
v2:
New
This was Jan's suggestion when dom0less originally had trouble with
evtchn_alloc_unbound() and xsm_set_system_active() was introduced. As
noted, is_privileged is insufficient for operating on an untargetable
domain.
---
xen/common/device-tree/dom0less-build.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/xen/common/device-tree/dom0less-build.c
b/xen/common/device-tree/dom0less-build.c
index 22af043aa5..a2789e3bdf 100644
--- a/xen/common/device-tree/dom0less-build.c
+++ b/xen/common/device-tree/dom0less-build.c
@@ -77,11 +77,20 @@ bool __init is_dom0less_mode(void)
static int __init alloc_xenstore_evtchn(struct domain *d)
{
evtchn_alloc_unbound_t alloc;
+ struct vcpu *old_current;
int rc;
alloc.dom = d->domain_id;
alloc.remote_dom = xs_domid;
+ /*
+ * Switch current from the Xen idle vcpu to the domain's vcpu. This is to
+ * pass the xsm_evtchn_unbound() check for an untargetable domain.
+ */
+ old_current = current;
+ set_current(d->vcpu[0]);
rc = evtchn_alloc_unbound(&alloc, 0);
+ /* Restore Xen idle vcpu. */
+ set_current(old_current);
if ( rc )
{
printk("Failed allocating event channel for domain\n");
--
2.50.0
|