From 842df741a4e464f65cf1a2056cd51e9a86a68a20 Mon Sep 17 00:00:00 2001 From: Marco Crivellari Date: Thu, 6 Nov 2025 16:58:30 +0100 Subject: [PATCH 01/10] xen/events: replace use of system_wq with system_percpu_wq Currently if a user enqueues a work item using schedule_delayed_work() the used wq is "system_wq" (per-cpu wq) while queue_delayed_work() use WORK_CPU_UNBOUND (used when a cpu is not specified). The same applies to schedule_work() that is using system_wq and queue_work(), that makes use again of WORK_CPU_UNBOUND. This lack of consistency cannot be addressed without refactoring the API. This continues the effort to refactor workqueue APIs, which began with the introduction of new workqueues and a new alloc_workqueue flag in: commit 128ea9f6ccfb ("workqueue: Add system_percpu_wq and system_dfl_wq") commit 930c2ea566af ("workqueue: Add new WQ_PERCPU flag") Switch to using system_percpu_wq because system_wq is going away as part of a workqueue restructuring. Suggested-by: Tejun Heo Signed-off-by: Marco Crivellari Reviewed-by: Juergen Gross Signed-off-by: Juergen Gross Message-ID: <20251106155831.306248-2-marco.crivellari@suse.com> --- drivers/xen/events/events_base.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/xen/events/events_base.c b/drivers/xen/events/events_base.c index 9478fae014e5..663df17776fd 100644 --- a/drivers/xen/events/events_base.c +++ b/drivers/xen/events/events_base.c @@ -581,7 +581,7 @@ static void lateeoi_list_add(struct irq_info *info) eoi_list); if (!elem || info->eoi_time < elem->eoi_time) { list_add(&info->eoi_list, &eoi->eoi_list); - mod_delayed_work_on(info->eoi_cpu, system_wq, + mod_delayed_work_on(info->eoi_cpu, system_percpu_wq, &eoi->delayed, delay); } else { list_for_each_entry_reverse(elem, &eoi->eoi_list, eoi_list) { @@ -666,7 +666,7 @@ static void xen_irq_lateeoi_worker(struct work_struct *work) break; if (now < info->eoi_time) { - mod_delayed_work_on(info->eoi_cpu, system_wq, + mod_delayed_work_on(info->eoi_cpu, system_percpu_wq, &eoi->delayed, info->eoi_time - now); break; @@ -782,7 +782,7 @@ static void xen_free_irq(struct irq_info *info) WARN_ON(info->refcnt > 0); - queue_rcu_work(system_wq, &info->rwork); + queue_rcu_work(system_percpu_wq, &info->rwork); } /* Not called for lateeoi events. */ From 378f1dc3d6472f9bd437f564daf5a1a2f32505e7 Mon Sep 17 00:00:00 2001 From: Marco Crivellari Date: Thu, 6 Nov 2025 16:58:31 +0100 Subject: [PATCH 02/10] xen: privcmd: WQ_PERCPU added to alloc_workqueue users MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Currently if a user enqueue a work item using schedule_delayed_work() the used wq is "system_wq" (per-cpu wq) while queue_delayed_work() use WORK_CPU_UNBOUND (used when a cpu is not specified). The same applies to schedule_work() that is using system_wq and queue_work(), that makes use again of WORK_CPU_UNBOUND. This lack of consistentcy cannot be addressed without refactoring the API. alloc_workqueue() treats all queues as per-CPU by default, while unbound workqueues must opt-in via WQ_UNBOUND. This default is suboptimal: most workloads benefit from unbound queues, allowing the scheduler to place worker threads where they’re needed and reducing noise when CPUs are isolated. This continues the effort to refactor workqueue APIs, which began with the introduction of new workqueues and a new alloc_workqueue flag in: commit 128ea9f6ccfb ("workqueue: Add system_percpu_wq and system_dfl_wq") commit 930c2ea566af ("workqueue: Add new WQ_PERCPU flag") This change adds a new WQ_PERCPU flag to explicitly request alloc_workqueue() to be per-cpu when WQ_UNBOUND has not been specified. With the introduction of the WQ_PERCPU flag (equivalent to !WQ_UNBOUND), any alloc_workqueue() caller that doesn’t explicitly specify WQ_UNBOUND must now use WQ_PERCPU. Once migration is complete, WQ_UNBOUND can be removed and unbound will become the implicit default. Suggested-by: Tejun Heo Signed-off-by: Marco Crivellari Reviewed-by: Juergen Gross Signed-off-by: Juergen Gross Message-ID: <20251106155831.306248-3-marco.crivellari@suse.com> --- drivers/xen/privcmd.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/xen/privcmd.c b/drivers/xen/privcmd.c index f52a457b302d..402be080ad2c 100644 --- a/drivers/xen/privcmd.c +++ b/drivers/xen/privcmd.c @@ -1091,7 +1091,8 @@ static long privcmd_ioctl_irqfd(struct file *file, void __user *udata) static int privcmd_irqfd_init(void) { - irqfd_cleanup_wq = alloc_workqueue("privcmd-irqfd-cleanup", 0, 0); + irqfd_cleanup_wq = alloc_workqueue("privcmd-irqfd-cleanup", WQ_PERCPU, + 0); if (!irqfd_cleanup_wq) return -ENOMEM; From db9aded979b491a24871e1621cd4e8822dbca859 Mon Sep 17 00:00:00 2001 From: Hou Wenlong Date: Sat, 10 Jan 2026 12:00:08 +0800 Subject: [PATCH 03/10] x86/xen/pvh: Enable PAE mode for 32-bit guest only when CONFIG_X86_PAE is set The PVH entry is available for 32-bit KVM guests, and 32-bit KVM guests do not depend on CONFIG_X86_PAE. However, mk_early_pgtbl_32() builds different pagetables depending on whether CONFIG_X86_PAE is set. Therefore, enabling PAE mode for 32-bit KVM guests without CONFIG_X86_PAE being set would result in a boot failure during CR3 loading. Signed-off-by: Hou Wenlong Reviewed-by: Juergen Gross Signed-off-by: Juergen Gross Message-ID: --- arch/x86/platform/pvh/head.S | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/x86/platform/pvh/head.S b/arch/x86/platform/pvh/head.S index 344030c1a81d..53ee2d53fcf8 100644 --- a/arch/x86/platform/pvh/head.S +++ b/arch/x86/platform/pvh/head.S @@ -91,10 +91,12 @@ SYM_CODE_START(pvh_start_xen) leal rva(early_stack_end)(%ebp), %esp +#if defined(CONFIG_X86_64) || defined(CONFIG_X86_PAE) /* Enable PAE mode. */ mov %cr4, %eax orl $X86_CR4_PAE, %eax mov %eax, %cr4 +#endif #ifdef CONFIG_X86_64 /* Enable Long mode. */ From dc8ea8714311e549ee93a2b0bdd5487d20bfadbf Mon Sep 17 00:00:00 2001 From: Teddy Astie Date: Tue, 6 Jan 2026 17:36:50 +0000 Subject: [PATCH 04/10] xen/virtio: Don't use grant-dma-ops when running as Dom0 Dom0 inherit devices from the machine and is usually in PV mode. If we are running in a virtual that has virtio devices, these devices would be considered as using grants with Dom0 as backend, while being the said Dom0 itself, while we want to use these devices like regular PCI devices. Fix this by preventing grant-dma-ops from being used when running as Dom0 (initial domain). We still keep the device-tree logic as-is. Signed-off-by: Teddy Astie Fixes: 61367688f1fb0 ("xen/virtio: enable grant based virtio on x86") Reviewed-by: Juergen Gross Signed-off-by: Juergen Gross Message-ID: <6698564dd2270a9f7377b78ebfb20cb425cabbe8.1767720955.git.teddy.astie@vates.tech> --- drivers/xen/grant-dma-ops.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/xen/grant-dma-ops.c b/drivers/xen/grant-dma-ops.c index 14077d23f2a1..c2603e700178 100644 --- a/drivers/xen/grant-dma-ops.c +++ b/drivers/xen/grant-dma-ops.c @@ -366,7 +366,8 @@ static int xen_grant_init_backend_domid(struct device *dev, if (np) { ret = xen_dt_grant_init_backend_domid(dev, np, backend_domid); of_node_put(np); - } else if (IS_ENABLED(CONFIG_XEN_VIRTIO_FORCE_GRANT) || xen_pv_domain()) { + } else if (!xen_initial_domain() && + (IS_ENABLED(CONFIG_XEN_VIRTIO_FORCE_GRANT) || xen_pv_domain())) { dev_info(dev, "Using dom0 as backend\n"); *backend_domid = 0; ret = 0; From 763baca7bf8b36b8ff0e1ec6eb30dbfe99b18fd8 Mon Sep 17 00:00:00 2001 From: Stefano Stabellini Date: Tue, 13 Jan 2026 15:24:20 -0800 Subject: [PATCH 05/10] xen: introduce xen_console_io option Xen can support console_io hypercalls for any domains, not just dom0, depending on DEBUG and XSM policies. These hypercalls can be very useful for development and debugging. Introduce a kernel command line option xen_console_io to enable the usage of console_io hypercalls for any domain upon request. When xen_console_io is not specified, the current behavior is retained. Signed-off-by: Stefano Stabellini Reviewed-by: Juergen Gross Signed-off-by: Juergen Gross Message-ID: --- .../admin-guide/kernel-parameters.txt | 5 ++++ drivers/tty/hvc/hvc_xen.c | 29 +++++++++++++++---- 2 files changed, 29 insertions(+), 5 deletions(-) diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt index a8d0afde7f85..68ab6fa72b68 100644 --- a/Documentation/admin-guide/kernel-parameters.txt +++ b/Documentation/admin-guide/kernel-parameters.txt @@ -8414,6 +8414,11 @@ Kernel parameters save/restore/migration must be enabled to handle larger domains. + xen_console_io [XEN,EARLY] + Boolean option to enable/disable the usage of the Xen + console_io hypercalls to read and write to the console. + Mostly useful for debugging and development. + xen_emul_unplug= [HW,X86,XEN,EARLY] Unplug Xen emulated devices Format: [unplug0,][unplug1] diff --git a/drivers/tty/hvc/hvc_xen.c b/drivers/tty/hvc/hvc_xen.c index 388a71afd6ef..95ec01b1aacf 100644 --- a/drivers/tty/hvc/hvc_xen.c +++ b/drivers/tty/hvc/hvc_xen.c @@ -51,6 +51,22 @@ static DEFINE_SPINLOCK(xencons_lock); /* ------------------------------------------------------------------ */ +static bool xen_console_io = false; +static int __initdata opt_console_io = -1; + +static int __init parse_xen_console_io(char *arg) +{ + bool val; + int ret; + + ret = kstrtobool(arg, &val); + if (ret == 0) + opt_console_io = (int)val; + + return ret; +} +early_param("xen_console_io", parse_xen_console_io); + static struct xencons_info *vtermno_to_xencons(int vtermno) { struct xencons_info *entry, *ret = NULL; @@ -331,7 +347,7 @@ static int xen_initial_domain_console_init(void) struct xencons_info *info; unsigned long flags; - if (!xen_initial_domain()) + if (!xen_console_io) return -ENODEV; info = vtermno_to_xencons(HVC_COOKIE); @@ -369,7 +385,7 @@ void xen_console_resume(void) { struct xencons_info *info = vtermno_to_xencons(HVC_COOKIE); if (info != NULL && info->irq) { - if (!xen_initial_domain()) + if (!xen_console_io) xen_console_update_evtchn(info); rebind_evtchn_irq(info->evtchn, info->irq); } @@ -601,7 +617,7 @@ static int __init xen_hvc_init(void) if (!xen_domain()) return -ENODEV; - if (xen_initial_domain()) { + if (xen_console_io) { ops = &dom0_hvc_ops; r = xen_initial_domain_console_init(); if (r < 0) @@ -647,14 +663,17 @@ static int __init xen_hvc_init(void) } device_initcall(xen_hvc_init); -static int xen_cons_init(void) +static int __init xen_cons_init(void) { const struct hv_ops *ops; + xen_console_io = opt_console_io >= 0 ? opt_console_io : + xen_initial_domain(); + if (!xen_domain()) return 0; - if (xen_initial_domain()) + if (xen_console_io) ops = &dom0_hvc_ops; else { int r; From 0949c646d64697428ff6257d52efa5093566868d Mon Sep 17 00:00:00 2001 From: Roger Pau Monne Date: Wed, 28 Jan 2026 12:05:08 +0100 Subject: [PATCH 06/10] Partial revert "x86/xen: fix balloon target initialization for PVH dom0" MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This partially reverts commit 87af633689ce16ddb166c80f32b120e50b1295de so the current memory target for PV guests is still fetched from start_info->nr_pages, which matches exactly what the toolstack sets the initial memory target to. Using get_num_physpages() is possible on PV also, but needs adjusting to take into account the ISA hole and the PFN at 0 not considered usable memory despite being populated, and hence would need extra adjustments. Instead of carrying those extra adjustments switch back to the previous code. That leaves Linux with a difference in how current memory target is obtained for HVM vs PV, but that's better than adding extra logic just for PV. However if switching to start_info->nr_pages for PV domains we need to differentiate between released pages (freed back to the hypervisor) as opposed to pages in the physmap which are not populated to start with. Introduce a new xen_unpopulated_pages to account for papges that have never been populated, and hence in the PV case don't need subtracting. Fixes: 87af633689ce ("x86/xen: fix balloon target initialization for PVH dom0") Reported-by: James Dingwall Signed-off-by: Roger Pau Monné Reviewed-by: Juergen Gross Signed-off-by: Juergen Gross Message-ID: <20260128110510.46425-2-roger.pau@citrix.com> --- arch/x86/xen/enlighten.c | 2 +- drivers/xen/balloon.c | 19 +++++++++++++++---- drivers/xen/unpopulated-alloc.c | 3 +++ include/xen/xen.h | 2 ++ 4 files changed, 21 insertions(+), 5 deletions(-) diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c index 53282dc7d5ac..23b91bf9b663 100644 --- a/arch/x86/xen/enlighten.c +++ b/arch/x86/xen/enlighten.c @@ -470,7 +470,7 @@ int __init arch_xen_unpopulated_init(struct resource **res) * driver to know how much of the physmap is unpopulated and * set an accurate initial memory target. */ - xen_released_pages += xen_extra_mem[i].n_pfns; + xen_unpopulated_pages += xen_extra_mem[i].n_pfns; /* Zero so region is not also added to the balloon driver. */ xen_extra_mem[i].n_pfns = 0; } diff --git a/drivers/xen/balloon.c b/drivers/xen/balloon.c index 49c3f9926394..8c44a25a7d2b 100644 --- a/drivers/xen/balloon.c +++ b/drivers/xen/balloon.c @@ -724,6 +724,7 @@ static int __init balloon_add_regions(void) static int __init balloon_init(void) { struct task_struct *task; + unsigned long current_pages; int rc; if (!xen_domain()) @@ -731,12 +732,18 @@ static int __init balloon_init(void) pr_info("Initialising balloon driver\n"); - if (xen_released_pages >= get_num_physpages()) { - WARN(1, "Released pages underflow current target"); - return -ERANGE; + if (xen_pv_domain()) { + if (xen_released_pages >= xen_start_info->nr_pages) + goto underflow; + current_pages = min(xen_start_info->nr_pages - + xen_released_pages, max_pfn); + } else { + if (xen_unpopulated_pages >= get_num_physpages()) + goto underflow; + current_pages = get_num_physpages() - xen_unpopulated_pages; } - balloon_stats.current_pages = get_num_physpages() - xen_released_pages; + balloon_stats.current_pages = current_pages; balloon_stats.target_pages = balloon_stats.current_pages; balloon_stats.balloon_low = 0; balloon_stats.balloon_high = 0; @@ -767,6 +774,10 @@ static int __init balloon_init(void) xen_balloon_init(); return 0; + + underflow: + WARN(1, "Released pages underflow current target"); + return -ERANGE; } subsys_initcall(balloon_init); diff --git a/drivers/xen/unpopulated-alloc.c b/drivers/xen/unpopulated-alloc.c index d6fc2aefe264..1dc0b495c8e5 100644 --- a/drivers/xen/unpopulated-alloc.c +++ b/drivers/xen/unpopulated-alloc.c @@ -18,6 +18,9 @@ static unsigned int list_count; static struct resource *target_resource; +/* Pages to subtract from the memory count when setting balloon target. */ +unsigned long xen_unpopulated_pages __initdata; + /* * If arch is not happy with system "iomem_resource" being used for * the region allocation it can provide it's own view by creating specific diff --git a/include/xen/xen.h b/include/xen/xen.h index 61854e3f2837..f280c5dcf923 100644 --- a/include/xen/xen.h +++ b/include/xen/xen.h @@ -69,11 +69,13 @@ extern u64 xen_saved_max_mem_size; #endif #ifdef CONFIG_XEN_UNPOPULATED_ALLOC +extern unsigned long xen_unpopulated_pages; int xen_alloc_unpopulated_pages(unsigned int nr_pages, struct page **pages); void xen_free_unpopulated_pages(unsigned int nr_pages, struct page **pages); #include int arch_xen_unpopulated_init(struct resource **res); #else +#define xen_unpopulated_pages 0UL #include static inline int xen_alloc_unpopulated_pages(unsigned int nr_pages, struct page **pages) From b13cd24c15d74f6dfcddf0d53ae6efb58d3f0461 Mon Sep 17 00:00:00 2001 From: Roger Pau Monne Date: Wed, 28 Jan 2026 12:05:09 +0100 Subject: [PATCH 07/10] xen/balloon: improve accuracy of initial balloon target for dom0 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The dom0 balloon target set by the toolstack is the value returned by XENMEM_current_reservation. Do the same in the kernel balloon driver and set the current allocation to the value returned by XENMEM_current_reservation. On my test system this causes the kernel balloon driver target to exactly match the value set by the toolstack in xenstore. Note this approach can be used by both PV and PVH dom0s, as the toolstack always uses XENMEM_current_reservation to set the initial target regardless of the dom0 type. Signed-off-by: Roger Pau Monné Reviewed-by: Juergen Gross Signed-off-by: Juergen Gross Message-ID: <20260128110510.46425-3-roger.pau@citrix.com> --- drivers/xen/balloon.c | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/drivers/xen/balloon.c b/drivers/xen/balloon.c index 8c44a25a7d2b..9b6531eb28b6 100644 --- a/drivers/xen/balloon.c +++ b/drivers/xen/balloon.c @@ -724,7 +724,8 @@ static int __init balloon_add_regions(void) static int __init balloon_init(void) { struct task_struct *task; - unsigned long current_pages; + long current_pages = 0; + domid_t domid = DOMID_SELF; int rc; if (!xen_domain()) @@ -732,15 +733,21 @@ static int __init balloon_init(void) pr_info("Initialising balloon driver\n"); - if (xen_pv_domain()) { - if (xen_released_pages >= xen_start_info->nr_pages) - goto underflow; - current_pages = min(xen_start_info->nr_pages - - xen_released_pages, max_pfn); - } else { - if (xen_unpopulated_pages >= get_num_physpages()) - goto underflow; - current_pages = get_num_physpages() - xen_unpopulated_pages; + if (xen_initial_domain()) + current_pages = HYPERVISOR_memory_op(XENMEM_current_reservation, + &domid); + if (current_pages <= 0) { + if (xen_pv_domain()) { + if (xen_released_pages >= xen_start_info->nr_pages) + goto underflow; + current_pages = min(xen_start_info->nr_pages - + xen_released_pages, max_pfn); + } else { + if (xen_unpopulated_pages >= get_num_physpages()) + goto underflow; + current_pages = get_num_physpages() - + xen_unpopulated_pages; + } } balloon_stats.current_pages = current_pages; From c74a1a68a990e940b798000a7ec30db191c039ec Mon Sep 17 00:00:00 2001 From: Uros Bizjak Date: Thu, 22 Jan 2026 15:17:07 +0100 Subject: [PATCH 08/10] xen/mcelog: simplify MCE_GETCLEAR_FLAGS using xchg() The MCE_GETCLEAR_FLAGS ioctl retrieves xen_mcelog.flags while atomically clearing it. This was previously implemented using a cmpxchg() loop. Replace the cmpxchg() loop with a single xchg(), which provides the same atomic get-and-clear semantics, avoids retry spinning under contention, and simplifies the code. The code on x86_64 improves from: 186: 8b 15 00 00 00 00 mov 0x0(%rip),%edx 18c: 89 d0 mov %edx,%eax 18e: f0 0f b1 0d 00 00 00 lock cmpxchg %ecx,0x0(%rip) 195: 00 196: 39 c2 cmp %eax,%edx 198: 75 ec jne 186 <...> to just: 186: 87 05 00 00 00 00 xchg %eax,0x0(%rip) No functional change intended. Signed-off-by: Uros Bizjak Cc: Juergen Gross Cc: Stefano Stabellini Cc: Oleksandr Tyshchenko Reviewed-by: Andrew Cooper Reviewed-by: Jan Beulich Signed-off-by: Juergen Gross Message-ID: <20260122141754.116129-1-ubizjak@gmail.com> --- drivers/xen/mcelog.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/xen/mcelog.c b/drivers/xen/mcelog.c index 4f65b641c054..abe658c73b7b 100644 --- a/drivers/xen/mcelog.c +++ b/drivers/xen/mcelog.c @@ -165,9 +165,7 @@ static long xen_mce_chrdev_ioctl(struct file *f, unsigned int cmd, case MCE_GETCLEAR_FLAGS: { unsigned flags; - do { - flags = xen_mcelog.flags; - } while (cmpxchg(&xen_mcelog.flags, flags, 0) != flags); + flags = xchg(&xen_mcelog.flags, 0); return put_user(flags, p); } From e08dd1ee49838750a514e83c0aa60cd12ba6ecbb Mon Sep 17 00:00:00 2001 From: Jason Andryuk Date: Wed, 19 Nov 2025 17:47:29 -0500 Subject: [PATCH 09/10] xenbus: Use .freeze/.thaw to handle xenbus devices The goal is to fix s2idle and S3 for Xen PV devices. A domain resuming from s3 or s2idle disconnects its PV devices during resume. The backends are not expecting this and do not reconnect. b3e96c0c7562 ("xen: use freeze/restore/thaw PM events for suspend/ resume/chkpt") changed xen_suspend()/do_suspend() from PMSG_SUSPEND/PMSG_RESUME to PMSG_FREEZE/PMSG_THAW/PMSG_RESTORE, but the suspend/resume callbacks remained. .freeze/restore are used with hiberation where Linux restarts in a new place in the future. .suspend/resume are useful for runtime power management for the duration of a boot. The current behavior of the callbacks works for an xl save/restore or live migration where the domain is restored/migrated to a new location and connecting to a not-already-connected backend. Change xenbus_pm_ops to use .freeze/thaw/restore and drop the .suspend/resume hook. This matches the use in drivers/xen/manage.c for save/restore and live migration. With .suspend/resume empty, PV devices are left connected during s2idle and s3, so PV devices are not changed and work after resume. Signed-off-by: Jason Andryuk Acked-by: Juergen Gross Signed-off-by: Juergen Gross Message-ID: <20251119224731.61497-2-jason.andryuk@amd.com> --- drivers/xen/xenbus/xenbus_probe_frontend.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/xen/xenbus/xenbus_probe_frontend.c b/drivers/xen/xenbus/xenbus_probe_frontend.c index 6d1819269cbe..199917b6f77c 100644 --- a/drivers/xen/xenbus/xenbus_probe_frontend.c +++ b/drivers/xen/xenbus/xenbus_probe_frontend.c @@ -148,11 +148,9 @@ static void xenbus_frontend_dev_shutdown(struct device *_dev) } static const struct dev_pm_ops xenbus_pm_ops = { - .suspend = xenbus_dev_suspend, - .resume = xenbus_frontend_dev_resume, .freeze = xenbus_dev_suspend, .thaw = xenbus_dev_cancel, - .restore = xenbus_dev_resume, + .restore = xenbus_frontend_dev_resume, }; static struct xen_bus_type xenbus_frontend = { From c307b6dc9c4f68d00524ec10899cdf21466b5c1e Mon Sep 17 00:00:00 2001 From: Jason Andryuk Date: Wed, 19 Nov 2025 17:47:30 -0500 Subject: [PATCH 10/10] xenbus: Rename helpers to freeze/thaw/restore Rename the xenbus helpers called from the .freeze, .thaw, and .restore pm ops to have matching names. Signed-off-by: Jason Andryuk Reviewed-by: Juergen Gross Signed-off-by: Juergen Gross Message-ID: <20251119224731.61497-3-jason.andryuk@amd.com> --- drivers/xen/xenbus/xenbus.h | 6 +++--- drivers/xen/xenbus/xenbus_probe.c | 22 +++++++++++----------- drivers/xen/xenbus/xenbus_probe_frontend.c | 16 ++++++++-------- 3 files changed, 22 insertions(+), 22 deletions(-) diff --git a/drivers/xen/xenbus/xenbus.h b/drivers/xen/xenbus/xenbus.h index 9ac0427724a3..daba7f5e05c4 100644 --- a/drivers/xen/xenbus/xenbus.h +++ b/drivers/xen/xenbus/xenbus.h @@ -120,9 +120,9 @@ int xenbus_probe_devices(struct xen_bus_type *bus); void xenbus_dev_changed(const char *node, struct xen_bus_type *bus); -int xenbus_dev_suspend(struct device *dev); -int xenbus_dev_resume(struct device *dev); -int xenbus_dev_cancel(struct device *dev); +int xenbus_dev_freeze(struct device *dev); +int xenbus_dev_restore(struct device *dev); +int xenbus_dev_thaw(struct device *dev); void xenbus_otherend_changed(struct xenbus_watch *watch, const char *path, const char *token, diff --git a/drivers/xen/xenbus/xenbus_probe.c b/drivers/xen/xenbus/xenbus_probe.c index 86fe6e779056..9f9011cd7447 100644 --- a/drivers/xen/xenbus/xenbus_probe.c +++ b/drivers/xen/xenbus/xenbus_probe.c @@ -668,7 +668,7 @@ void xenbus_dev_changed(const char *node, struct xen_bus_type *bus) } EXPORT_SYMBOL_GPL(xenbus_dev_changed); -int xenbus_dev_suspend(struct device *dev) +int xenbus_dev_freeze(struct device *dev) { int err = 0; struct xenbus_driver *drv; @@ -683,12 +683,12 @@ int xenbus_dev_suspend(struct device *dev) if (drv->suspend) err = drv->suspend(xdev); if (err) - dev_warn(dev, "suspend failed: %i\n", err); + dev_warn(dev, "freeze failed: %i\n", err); return 0; } -EXPORT_SYMBOL_GPL(xenbus_dev_suspend); +EXPORT_SYMBOL_GPL(xenbus_dev_freeze); -int xenbus_dev_resume(struct device *dev) +int xenbus_dev_restore(struct device *dev) { int err; struct xenbus_driver *drv; @@ -702,7 +702,7 @@ int xenbus_dev_resume(struct device *dev) drv = to_xenbus_driver(dev->driver); err = talk_to_otherend(xdev); if (err) { - dev_warn(dev, "resume (talk_to_otherend) failed: %i\n", err); + dev_warn(dev, "restore (talk_to_otherend) failed: %i\n", err); return err; } @@ -711,28 +711,28 @@ int xenbus_dev_resume(struct device *dev) if (drv->resume) { err = drv->resume(xdev); if (err) { - dev_warn(dev, "resume failed: %i\n", err); + dev_warn(dev, "restore failed: %i\n", err); return err; } } err = watch_otherend(xdev); if (err) { - dev_warn(dev, "resume (watch_otherend) failed: %d\n", err); + dev_warn(dev, "restore (watch_otherend) failed: %d\n", err); return err; } return 0; } -EXPORT_SYMBOL_GPL(xenbus_dev_resume); +EXPORT_SYMBOL_GPL(xenbus_dev_restore); -int xenbus_dev_cancel(struct device *dev) +int xenbus_dev_thaw(struct device *dev) { /* Do nothing */ - DPRINTK("cancel"); + DPRINTK("thaw"); return 0; } -EXPORT_SYMBOL_GPL(xenbus_dev_cancel); +EXPORT_SYMBOL_GPL(xenbus_dev_thaw); /* A flag to determine if xenstored is 'ready' (i.e. has started) */ int xenstored_ready; diff --git a/drivers/xen/xenbus/xenbus_probe_frontend.c b/drivers/xen/xenbus/xenbus_probe_frontend.c index 199917b6f77c..f04707d1f667 100644 --- a/drivers/xen/xenbus/xenbus_probe_frontend.c +++ b/drivers/xen/xenbus/xenbus_probe_frontend.c @@ -91,14 +91,14 @@ static void backend_changed(struct xenbus_watch *watch, xenbus_otherend_changed(watch, path, token, 1); } -static void xenbus_frontend_delayed_resume(struct work_struct *w) +static void xenbus_frontend_delayed_restore(struct work_struct *w) { struct xenbus_device *xdev = container_of(w, struct xenbus_device, work); - xenbus_dev_resume(&xdev->dev); + xenbus_dev_restore(&xdev->dev); } -static int xenbus_frontend_dev_resume(struct device *dev) +static int xenbus_frontend_dev_restore(struct device *dev) { /* * If xenstored is running in this domain, we cannot access the backend @@ -112,14 +112,14 @@ static int xenbus_frontend_dev_resume(struct device *dev) return 0; } - return xenbus_dev_resume(dev); + return xenbus_dev_restore(dev); } static int xenbus_frontend_dev_probe(struct device *dev) { if (xen_store_domain_type == XS_LOCAL) { struct xenbus_device *xdev = to_xenbus_device(dev); - INIT_WORK(&xdev->work, xenbus_frontend_delayed_resume); + INIT_WORK(&xdev->work, xenbus_frontend_delayed_restore); } return xenbus_dev_probe(dev); @@ -148,9 +148,9 @@ static void xenbus_frontend_dev_shutdown(struct device *_dev) } static const struct dev_pm_ops xenbus_pm_ops = { - .freeze = xenbus_dev_suspend, - .thaw = xenbus_dev_cancel, - .restore = xenbus_frontend_dev_resume, + .freeze = xenbus_dev_freeze, + .thaw = xenbus_dev_thaw, + .restore = xenbus_frontend_dev_restore, }; static struct xen_bus_type xenbus_frontend = {