Skip to content

Commit 8988855

Browse files
committed
xen/dom0: Add xen_domctl_deassign_dt_device support
Add wrapper function for XEN_DOMCTL_deassign_device hypercall to support deassigning device tree devices from guest domains. Signed-off-by: Damjan Belavic <[email protected]>
1 parent d02cdc7 commit 8988855

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed

drivers/xen/dom0/domctl.c

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,21 @@ int xen_domctl_assign_dt_device(int domid, char *dtdev_path)
240240

241241
}
242242

243+
int xen_domctl_deassign_dt_device(int domid, char *dtdev_path)
244+
{
245+
xen_domctl_t domctl = {
246+
.domain = domid,
247+
.cmd = XEN_DOMCTL_deassign_device,
248+
.u.assign_device.flags = 0,
249+
.u.assign_device.dev = XEN_DOMCTL_DEV_DT,
250+
.u.assign_device.u.dt.size = strlen(dtdev_path),
251+
};
252+
253+
set_xen_guest_handle(domctl.u.assign_device.u.dt.path, dtdev_path);
254+
255+
return do_domctl(&domctl);
256+
}
257+
243258
int xen_domctl_bind_pt_irq(int domid, uint32_t machine_irq, uint8_t irq_type,
244259
uint8_t bus, uint8_t device, uint8_t intx, uint8_t isa_irq,
245260
uint16_t spi)

include/zephyr/xen/dom0/domctl.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,15 @@ int xen_domctl_memory_mapping(int domid, uint64_t first_gfn, uint64_t first_mfn,
175175
*/
176176
int xen_domctl_assign_dt_device(int domid, char *dtdev_path);
177177

178+
/**
179+
* @brief Deassign a device from a guest domain.
180+
*
181+
* @param domid The ID of the domain from which the device should be deassigned.
182+
* @param dtdev_path The path of the device tree device to be deassigned.
183+
* @return 0 on success, or a negative error code on failure.
184+
*/
185+
int xen_domctl_deassign_dt_device(int domid, char *dtdev_path);
186+
178187
/**
179188
* @brief Binds a physical IRQ to a specified domain.
180189
*

0 commit comments

Comments
 (0)