xen: branch for v6.15-rc2

-----BEGIN PGP SIGNATURE-----
 
 iHUEABYKAB0WIQRTLbB6QfY48x44uB6AXGG7T9hjvgUCZ/eJDgAKCRCAXGG7T9hj
 vrq5AQD0H1br5/vq0LIYrf22CwHIp/o7zfSPjpoEccwLRDRVZQEA9KW+pnFTYBpL
 d29PeC2oGPjNsS9sL0b0DgYBD/JStQ0=
 =c9Cv
 -----END PGP SIGNATURE-----

Merge tag 'for-linus-6.15a-rc2-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/xen/tip

Pull xen fixes from Juergen Gross:

 - A simple fix adding the module description of the Xenbus frontend
   module

 - A fix correcting the xen-acpi-processor Kconfig dependency for PVH
   Dom0 support

 - A fix for the Xen balloon driver when running as Xen Dom0 in PVH mode

 - A fix for PVH Dom0 in order to avoid problems with CPU idle and
   frequency drivers conflicting with Xen

* tag 'for-linus-6.15a-rc2-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/xen/tip:
  x86/xen: disable CPU idle and frequency drivers for PVH dom0
  x86/xen: fix balloon target initialization for PVH dom0
  xen: Change xen-acpi-processor dom0 dependency
  xenbus: add module description
This commit is contained in:
Linus Torvalds 2025-04-10 07:04:23 -07:00
commit 2eb959eeec
6 changed files with 54 additions and 15 deletions

View file

@ -70,6 +70,9 @@ EXPORT_SYMBOL(xen_start_flags);
*/
struct shared_info *HYPERVISOR_shared_info = &xen_dummy_shared_info;
/* Number of pages released from the initial allocation. */
unsigned long xen_released_pages;
static __ref void xen_get_vendor(void)
{
init_cpu_devs();
@ -466,6 +469,13 @@ int __init arch_xen_unpopulated_init(struct resource **res)
xen_free_unpopulated_pages(1, &pg);
}
/*
* Account for the region being in the physmap but unpopulated.
* The value in xen_released_pages is used by the balloon
* 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;
/* Zero so region is not also added to the balloon driver. */
xen_extra_mem[i].n_pfns = 0;
}

View file

@ -1,5 +1,7 @@
// SPDX-License-Identifier: GPL-2.0
#include <linux/acpi.h>
#include <linux/cpufreq.h>
#include <linux/cpuidle.h>
#include <linux/export.h>
#include <linux/mm.h>
@ -123,8 +125,23 @@ static void __init pvh_arch_setup(void)
{
pvh_reserve_extra_memory();
if (xen_initial_domain())
if (xen_initial_domain()) {
xen_add_preferred_consoles();
/*
* Disable usage of CPU idle and frequency drivers: when
* running as hardware domain the exposed native ACPI tables
* causes idle and/or frequency drivers to attach and
* malfunction. It's Xen the entity that controls the idle and
* frequency states.
*
* For unprivileged domains the exposed ACPI tables are
* fabricated and don't contain such data.
*/
disable_cpuidle();
disable_cpufreq();
WARN_ON(xen_set_default_idle());
}
}
void __init xen_pvh_init(struct boot_params *boot_params)

View file

@ -37,9 +37,6 @@
#define GB(x) ((uint64_t)(x) * 1024 * 1024 * 1024)
/* Number of pages released from the initial allocation. */
unsigned long xen_released_pages;
/* Memory map would allow PCI passthrough. */
bool xen_pv_pci_possible;

View file

@ -278,7 +278,7 @@ config XEN_PRIVCMD_EVENTFD
config XEN_ACPI_PROCESSOR
tristate "Xen ACPI processor"
depends on XEN && XEN_PV_DOM0 && X86 && ACPI_PROCESSOR && CPU_FREQ
depends on XEN && XEN_DOM0 && X86 && ACPI_PROCESSOR && CPU_FREQ
default m
help
This ACPI processor uploads Power Management information to the Xen

View file

@ -679,7 +679,7 @@ void xen_free_ballooned_pages(unsigned int nr_pages, struct page **pages)
}
EXPORT_SYMBOL(xen_free_ballooned_pages);
static void __init balloon_add_regions(void)
static int __init balloon_add_regions(void)
{
unsigned long start_pfn, pages;
unsigned long pfn, extra_pfn_end;
@ -702,26 +702,38 @@ static void __init balloon_add_regions(void)
for (pfn = start_pfn; pfn < extra_pfn_end; pfn++)
balloon_append(pfn_to_page(pfn));
balloon_stats.total_pages += extra_pfn_end - start_pfn;
/*
* Extra regions are accounted for in the physmap, but need
* decreasing from current_pages to balloon down the initial
* allocation, because they are already accounted for in
* total_pages.
*/
if (extra_pfn_end - start_pfn >= balloon_stats.current_pages) {
WARN(1, "Extra pages underflow current target");
return -ERANGE;
}
balloon_stats.current_pages -= extra_pfn_end - start_pfn;
}
return 0;
}
static int __init balloon_init(void)
{
struct task_struct *task;
int rc;
if (!xen_domain())
return -ENODEV;
pr_info("Initialising balloon driver\n");
#ifdef CONFIG_XEN_PV
balloon_stats.current_pages = xen_pv_domain()
? min(xen_start_info->nr_pages - xen_released_pages, max_pfn)
: get_num_physpages();
#else
balloon_stats.current_pages = get_num_physpages();
#endif
if (xen_released_pages >= get_num_physpages()) {
WARN(1, "Released pages underflow current target");
return -ERANGE;
}
balloon_stats.current_pages = get_num_physpages() - xen_released_pages;
balloon_stats.target_pages = balloon_stats.current_pages;
balloon_stats.balloon_low = 0;
balloon_stats.balloon_high = 0;
@ -738,7 +750,9 @@ static int __init balloon_init(void)
register_sysctl_init("xen/balloon", balloon_table);
#endif
balloon_add_regions();
rc = balloon_add_regions();
if (rc)
return rc;
task = kthread_run(balloon_thread, NULL, "xen-balloon");
if (IS_ERR(task)) {

View file

@ -513,4 +513,5 @@ static int __init boot_wait_for_devices(void)
late_initcall(boot_wait_for_devices);
#endif
MODULE_DESCRIPTION("Xen PV-device frontend support");
MODULE_LICENSE("GPL");