Merge tag 'for-linus-7.1-rc1-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/xen/tip

Pull xen updates from Juergen Gross:

 - fix an error path in drivers/xen/manage.c

 - fix the Xen console driver solving a boot hangup when the console
   backend isn't yet running

 - comment fix in the Xen swiotlb driver

 - hardening for Xen on Arm adding a more thorough validation

 - cleanup of the Xen grant table code hiding suspend/resume code for
   the case if CONFIG_HIBERNATE_CALLBACKS isn't defined

* tag 'for-linus-7.1-rc1-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/xen/tip:
  xen/grant-table: guard gnttab_suspend/resume with CONFIG_HIBERNATE_CALLBACKS
  hvc/xen: Check console connection flag
  xen/swiotlb: fix stale reference to swiotlb_unmap_page()
  xen/manage: unwind partial shutdown watcher setup on error
  ARM: xen: validate hypervisor compatible before parsing its version
This commit is contained in:
Linus Torvalds
2026-04-15 15:16:39 -07:00
7 changed files with 54 additions and 9 deletions

View File

@@ -218,8 +218,9 @@ static __initdata struct {
static int __init fdt_find_hyper_node(unsigned long node, const char *uname,
int depth, void *data)
{
const void *s = NULL;
const char *s = NULL;
int len;
size_t prefix_len = strlen(hyper_node.prefix);
if (depth != 1 || strcmp(uname, "hypervisor") != 0)
return 0;
@@ -228,9 +229,10 @@ static int __init fdt_find_hyper_node(unsigned long node, const char *uname,
hyper_node.found = true;
s = of_get_flat_dt_prop(node, "compatible", &len);
if (strlen(hyper_node.prefix) + 3 < len &&
!strncmp(hyper_node.prefix, s, strlen(hyper_node.prefix)))
hyper_node.version = s + strlen(hyper_node.prefix);
if (s && len > 0 && strnlen(s, len) < len &&
len > prefix_len + 3 &&
!strncmp(hyper_node.prefix, s, prefix_len))
hyper_node.version = s + prefix_len;
/*
* Check if Xen supports EFI by checking whether there is the

View File

@@ -139,6 +139,9 @@ static ssize_t domU_write_console(uint32_t vtermno, const u8 *data, size_t len)
if (cons == NULL)
return -EINVAL;
if (cons->intf->connection == XENCONSOLE_DISCONNECTED)
return -ENOTCONN;
/*
* Make sure the whole buffer is emitted, polling if
* necessary. We don't ever want to rely on the hvc daemon

View File

@@ -1579,7 +1579,7 @@ static int gnttab_setup(void)
}
return gnttab_map(0, nr_grant_frames - 1);
}
#ifdef CONFIG_HIBERNATE_CALLBACKS
int gnttab_resume(void)
{
gnttab_request_version();
@@ -1592,6 +1592,7 @@ int gnttab_suspend(void)
gnttab_interface->unmap_frames();
return 0;
}
#endif
static int gnttab_expand(unsigned int req_entries)
{

View File

@@ -343,12 +343,11 @@ static int setup_shutdown_watcher(void)
return err;
}
#ifdef CONFIG_MAGIC_SYSRQ
err = register_xenbus_watch(&sysrq_watch);
if (err) {
pr_err("Failed to set sysrq watcher\n");
return err;
goto err_unregister_shutdown;
}
#endif
@@ -361,11 +360,26 @@ static int setup_shutdown_watcher(void)
if (err) {
pr_err("%s: Error %d writing %s\n", __func__,
err, node);
return err;
goto err_remove_features;
}
}
return 0;
err_remove_features:
while (--idx >= 0) {
if (!shutdown_handlers[idx].flag)
continue;
snprintf(node, FEATURE_PATH_SIZE, "feature-%s",
shutdown_handlers[idx].command);
xenbus_rm(XBT_NIL, "control", node);
}
#ifdef CONFIG_MAGIC_SYSRQ
unregister_xenbus_watch(&sysrq_watch);
err_unregister_shutdown:
#endif
unregister_xenbus_watch(&shutdown_watch);
return err;
}
static int shutdown_event(struct notifier_block *notifier,

View File

@@ -340,7 +340,7 @@ xen_swiotlb_sync_single_for_device(struct device *dev, dma_addr_t dma_addr,
/*
* Unmap a set of streaming mode DMA translations. Again, cpu read rules
* concerning calls here are the same as for swiotlb_unmap_phys() above.
* concerning calls here are the same as for xen_swiotlb_unmap_phys() above.
*/
static void
xen_swiotlb_unmap_sg(struct device *hwdev, struct scatterlist *sgl, int nelems,

View File

@@ -84,8 +84,20 @@ struct gntab_unmap_queue_data
};
int gnttab_init(void);
#ifdef CONFIG_HIBERNATE_CALLBACKS
int gnttab_suspend(void);
int gnttab_resume(void);
#else
static inline int gnttab_suspend(void)
{
return 0;
}
static inline int gnttab_resume(void)
{
return 0;
}
#endif
int gnttab_grant_foreign_access(domid_t domid, unsigned long frame,
int readonly);

View File

@@ -19,6 +19,19 @@ struct xencons_interface {
char out[2048];
XENCONS_RING_IDX in_cons, in_prod;
XENCONS_RING_IDX out_cons, out_prod;
/*
* Flag values signaling from backend to frontend whether the console is
* connected. i.e. Whether it will be serviced and emptied.
*
* The flag starts as disconnected.
*/
#define XENCONSOLE_DISCONNECTED 1
/*
* The flag is set to connected when the backend connects and the console
* will be serviced.
*/
#define XENCONSOLE_CONNECTED 0
uint8_t connection;
};
#endif /* __XEN_PUBLIC_IO_CONSOLE_H__ */