Commit 2eb959ee authored by Linus Torvalds's avatar Linus Torvalds
Browse files

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
parents e4742a89 64a66e2c
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -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;
	}
+18 −1
Original line number Diff line number Diff line
// 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)
+0 −3
Original line number Diff line number Diff line
@@ -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;

+1 −1
Original line number Diff line number Diff line
@@ -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
+24 −10
Original line number Diff line number Diff line
@@ -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)) {
Loading