Commit 0e838286 authored by Rafael J. Wysocki's avatar Rafael J. Wysocki
Browse files

Merge branches 'acpi-processor', 'acpi-pm', 'acpi-tables' and 'acpi-sysfs'

Merge ACPI processor driver changes, ACPI power management updates,
changes related to parsing ACPI tables and an ACPI sysfs interface
update for 6.4-rc1:

 - Fix evaluating the _PDC ACPI control method when running as Xen
   dom0 (Roger Pau Monne).

 - Use platform devices to load ACPI PPC and PCC drivers (Petr Pavlu).

 - Check for null return of devm_kzalloc() in fch_misc_setup() (Kang
   Chen).

 - Log a message if enable_irq_wake() fails for the ACPI SCI (Simon
   Gaiser).

 - Initialize the correct IOMMU fwspec while parsing ACPI VIOT
   (Jean-Philippe Brucker).

 - Amend indentation and prefix error messages with FW_BUG in the ACPI
   SPCR parsing code (Andy Shevchenko).

 - Enable ACPI sysfs support for CCEL records (Kuppuswamy
   Sathyanarayanan).

* acpi-processor:
  ACPI: processor: Fix evaluating _PDC method when running as Xen dom0
  ACPI: cpufreq: Use platform devices to load ACPI PPC and PCC drivers
  ACPI: processor: Check for null return of devm_kzalloc() in fch_misc_setup()

* acpi-pm:
  ACPI: s2idle: Log when enabling wakeup IRQ fails

* acpi-tables:
  ACPI: VIOT: Initialize the correct IOMMU fwspec
  ACPI: SPCR: Amend indentation
  ACPI: SPCR: Prefix error messages with FW_BUG

* acpi-sysfs:
  ACPI: sysfs: Enable ACPI sysfs support for CCEL records
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -83,6 +83,8 @@ static int fch_misc_setup(struct apd_private_data *pdata)
	if (!acpi_dev_get_property(adev, "clk-name", ACPI_TYPE_STRING, &obj)) {
		clk_data->name = devm_kzalloc(&adev->dev, obj->string.length,
					      GFP_KERNEL);
		if (!clk_data->name)
			return -ENOMEM;

		strcpy(clk_data->name, obj->string.pointer);
	} else {
+40 −2
Original line number Diff line number Diff line
@@ -15,6 +15,7 @@
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/pci.h>
#include <linux/platform_device.h>

#include <acpi/processor.h>

@@ -148,6 +149,34 @@ static int acpi_processor_errata(void)
	return result;
}

/* Create a platform device to represent a CPU frequency control mechanism. */
static void cpufreq_add_device(const char *name)
{
	struct platform_device *pdev;

	pdev = platform_device_register_simple(name, PLATFORM_DEVID_NONE, NULL, 0);
	if (IS_ERR(pdev))
		pr_info("%s device creation failed: %ld\n", name, PTR_ERR(pdev));
}

#ifdef CONFIG_X86
/* Check presence of Processor Clocking Control by searching for \_SB.PCCH. */
static void __init acpi_pcc_cpufreq_init(void)
{
	acpi_status status;
	acpi_handle handle;

	status = acpi_get_handle(NULL, "\\_SB", &handle);
	if (ACPI_FAILURE(status))
		return;

	if (acpi_has_method(handle, "PCCH"))
		cpufreq_add_device("pcc-cpufreq");
}
#else
static void __init acpi_pcc_cpufreq_init(void) {}
#endif /* CONFIG_X86 */

/* Initialization */
#ifdef CONFIG_ACPI_HOTPLUG_CPU
int __weak acpi_map_cpu(acpi_handle handle,
@@ -280,14 +309,22 @@ static int acpi_processor_get_info(struct acpi_device *device)
		dev_dbg(&device->dev, "Failed to get CPU physical ID.\n");

	pr->id = acpi_map_cpuid(pr->phys_id, pr->acpi_id);
	if (!cpu0_initialized && !acpi_has_cpu_in_madt()) {
	if (!cpu0_initialized) {
		cpu0_initialized = 1;
		/*
		 * Handle UP system running SMP kernel, with no CPU
		 * entry in MADT
		 */
		if (invalid_logical_cpuid(pr->id) && (num_online_cpus() == 1))
		if (!acpi_has_cpu_in_madt() && invalid_logical_cpuid(pr->id) &&
		    (num_online_cpus() == 1))
			pr->id = 0;
		/*
		 * Check availability of Processor Performance Control by
		 * looking at the presence of the _PCT object under the first
		 * processor definition.
		 */
		if (acpi_has_method(pr->handle, "_PCT"))
			cpufreq_add_device("acpi-cpufreq");
	}

	/*
@@ -686,6 +723,7 @@ void __init acpi_processor_init(void)
	acpi_processor_check_duplicates();
	acpi_scan_add_handler_with_hotplug(&processor_handler, "processor");
	acpi_scan_add_handler(&processor_container_handler);
	acpi_pcc_cpufreq_init();
}

#ifdef CONFIG_ACPI_PROCESSOR_CSTATE
+11 −0
Original line number Diff line number Diff line
@@ -14,6 +14,8 @@
#include <linux/acpi.h>
#include <acpi/processor.h>

#include <xen/xen.h>

#include "internal.h"

static bool __init processor_physically_present(acpi_handle handle)
@@ -47,6 +49,15 @@ static bool __init processor_physically_present(acpi_handle handle)
		return false;
	}

	if (xen_initial_domain())
		/*
		 * When running as a Xen dom0 the number of processors Linux
		 * sees can be different from the real number of processors on
		 * the system, and we still need to execute _PDC for all of
		 * them.
		 */
		return xen_processor_present(acpi_id);

	type = (acpi_type == ACPI_TYPE_DEVICE) ? 1 : 0;
	cpuid = acpi_get_cpuid(handle, type, acpi_id);

+7 −1
Original line number Diff line number Diff line
@@ -714,7 +714,13 @@ int acpi_s2idle_begin(void)
int acpi_s2idle_prepare(void)
{
	if (acpi_sci_irq_valid()) {
		enable_irq_wake(acpi_sci_irq);
		int error;

		error = enable_irq_wake(acpi_sci_irq);
		if (error)
			pr_warn("Warning: Failed to enable wakeup from IRQ %d: %d\n",
				acpi_sci_irq, error);

		acpi_ec_set_gpe_wake_mask(ACPI_GPE_ENABLE);
	}

+5 −8
Original line number Diff line number Diff line
@@ -71,7 +71,6 @@ static bool xgene_8250_erratum_present(struct acpi_table_spcr *tb)

/**
 * acpi_parse_spcr() - parse ACPI SPCR table and add preferred console
 *
 * @enable_earlycon: set up earlycon for the console specified by the table
 * @enable_console: setup the console specified by the table.
 *
@@ -82,7 +81,6 @@ static bool xgene_8250_erratum_present(struct acpi_table_spcr *tb)
 *
 * When CONFIG_ACPI_SPCR_TABLE is defined, this function should be called
 * from arch initialization code as soon as the DT/ACPI decision is made.
 *
 */
int __init acpi_parse_spcr(bool enable_earlycon, bool enable_console)
{
@@ -97,9 +95,7 @@ int __init acpi_parse_spcr(bool enable_earlycon, bool enable_console)
	if (acpi_disabled)
		return -ENODEV;

	status = acpi_get_table(ACPI_SIG_SPCR, 0,
				(struct acpi_table_header **)&table);

	status = acpi_get_table(ACPI_SIG_SPCR, 0, (struct acpi_table_header **)&table);
	if (ACPI_FAILURE(status))
		return -ENOENT;

@@ -110,12 +106,12 @@ int __init acpi_parse_spcr(bool enable_earlycon, bool enable_console)
		u32 bit_width = table->serial_port.access_width;

		if (bit_width > ACPI_ACCESS_BIT_MAX) {
			pr_err("Unacceptable wide SPCR Access Width.  Defaulting to byte size\n");
			pr_err(FW_BUG "Unacceptable wide SPCR Access Width. Defaulting to byte size\n");
			bit_width = ACPI_ACCESS_BIT_DEFAULT;
		}
		switch (ACPI_ACCESS_BIT_WIDTH((bit_width))) {
		default:
			pr_err("Unexpected SPCR Access Width.  Defaulting to byte size\n");
			pr_err(FW_BUG "Unexpected SPCR Access Width. Defaulting to byte size\n");
			fallthrough;
		case 8:
			iotype = "mmio";
@@ -202,7 +198,8 @@ int __init acpi_parse_spcr(bool enable_earlycon, bool enable_console)
	if (xgene_8250_erratum_present(table)) {
		iotype = "mmio32";

		/* for xgene v1 and v2 we don't know the clock rate of the
		/*
		 * For xgene v1 and v2 we don't know the clock rate of the
		 * UART so don't attempt to change to the baud rate state
		 * in the table because driver cannot calculate the dividers
		 */
Loading