Commit b2ffa16a authored by Rafael J. Wysocki's avatar Rafael J. Wysocki

Merge branches 'acpi-x86', 'acpi-resources', 'acpi-scan' and 'acpi-misc'

Merge x86-specific ACPI updates, ACPI resources management updates,
one ACPI device enumeration update and miscellaneous ACPI updates for
5.16-rc1:

 - Avoid flushing caches before entering C3 type of idle states on
   AMD processors (Deepak Sharma).

 - Avoid enumerating CPUs that are not present and not online-capable
   according to the platform firmware (Mario Limonciello).

 - Add DMI-based mechanism to quirk IRQ overrides and use it for two
   platforms (Hui Wang).

 - Change the configuration of unused ACPI device objects to reflect
   the D3cold power state after enumerating devices (Rafael Wysocki).

 - Update MAINTAINERS information regarding ACPI (Rafael Wysocki).

 - Fix typo in ACPI Kconfig (Masanari Iid).

 - Use sysfs_emit() instead of snprintf() in some places (Qing Wang).

* acpi-x86:
  x86: ACPI: cstate: Optimize C3 entry on AMD CPUs
  x86/ACPI: Don't add CPUs that are not online capable
  ACPICA: Add support for MADT online enabled bit

* acpi-resources:
  ACPI: resources: Add one more Medion model in IRQ override quirk
  ACPI: resources: Add DMI-based legacy IRQ override quirk

* acpi-scan:
  ACPI: scan: Release PM resources blocked by unused objects

* acpi-misc:
  ACPI: replace snprintf() in "show" functions with sysfs_emit()
  ACPI: Update information in MAINTAINERS
  ACPI: Kconfig: Fix a typo in Kconfig
...@@ -334,7 +334,7 @@ F: drivers/platform/x86/acer-wmi.c ...@@ -334,7 +334,7 @@ F: drivers/platform/x86/acer-wmi.c
ACPI ACPI
M: "Rafael J. Wysocki" <rafael@kernel.org> M: "Rafael J. Wysocki" <rafael@kernel.org>
M: Len Brown <lenb@kernel.org> R: Len Brown <lenb@kernel.org>
L: linux-acpi@vger.kernel.org L: linux-acpi@vger.kernel.org
S: Supported S: Supported
W: https://01.org/linux-acpi W: https://01.org/linux-acpi
...@@ -355,7 +355,7 @@ F: tools/power/acpi/ ...@@ -355,7 +355,7 @@ F: tools/power/acpi/
ACPI APEI ACPI APEI
M: "Rafael J. Wysocki" <rafael@kernel.org> M: "Rafael J. Wysocki" <rafael@kernel.org>
M: Len Brown <lenb@kernel.org> R: Len Brown <lenb@kernel.org>
R: James Morse <james.morse@arm.com> R: James Morse <james.morse@arm.com>
R: Tony Luck <tony.luck@intel.com> R: Tony Luck <tony.luck@intel.com>
R: Borislav Petkov <bp@alien8.de> R: Borislav Petkov <bp@alien8.de>
...@@ -378,14 +378,6 @@ F: drivers/acpi/acpica/ ...@@ -378,14 +378,6 @@ F: drivers/acpi/acpica/
F: include/acpi/ F: include/acpi/
F: tools/power/acpi/ F: tools/power/acpi/
ACPI FAN DRIVER
M: Zhang Rui <rui.zhang@intel.com>
L: linux-acpi@vger.kernel.org
S: Supported
W: https://01.org/linux-acpi
B: https://bugzilla.kernel.org
F: drivers/acpi/fan.c
ACPI FOR ARM64 (ACPI/arm64) ACPI FOR ARM64 (ACPI/arm64)
M: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com> M: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
M: Hanjun Guo <guohanjun@huawei.com> M: Hanjun Guo <guohanjun@huawei.com>
...@@ -422,14 +414,6 @@ W: https://01.org/linux-acpi ...@@ -422,14 +414,6 @@ W: https://01.org/linux-acpi
B: https://bugzilla.kernel.org B: https://bugzilla.kernel.org
F: drivers/acpi/*thermal* F: drivers/acpi/*thermal*
ACPI VIDEO DRIVER
M: Zhang Rui <rui.zhang@intel.com>
L: linux-acpi@vger.kernel.org
S: Supported
W: https://01.org/linux-acpi
B: https://bugzilla.kernel.org
F: drivers/acpi/acpi_video.c
ACPI VIOT DRIVER ACPI VIOT DRIVER
M: Jean-Philippe Brucker <jean-philippe@linaro.org> M: Jean-Philippe Brucker <jean-philippe@linaro.org>
L: linux-acpi@vger.kernel.org L: linux-acpi@vger.kernel.org
......
...@@ -62,6 +62,7 @@ int acpi_fix_pin2_polarity __initdata; ...@@ -62,6 +62,7 @@ int acpi_fix_pin2_polarity __initdata;
#ifdef CONFIG_X86_LOCAL_APIC #ifdef CONFIG_X86_LOCAL_APIC
static u64 acpi_lapic_addr __initdata = APIC_DEFAULT_PHYS_BASE; static u64 acpi_lapic_addr __initdata = APIC_DEFAULT_PHYS_BASE;
static bool acpi_support_online_capable;
#endif #endif
#ifdef CONFIG_X86_IO_APIC #ifdef CONFIG_X86_IO_APIC
...@@ -138,6 +139,8 @@ static int __init acpi_parse_madt(struct acpi_table_header *table) ...@@ -138,6 +139,8 @@ static int __init acpi_parse_madt(struct acpi_table_header *table)
pr_debug("Local APIC address 0x%08x\n", madt->address); pr_debug("Local APIC address 0x%08x\n", madt->address);
} }
if (madt->header.revision >= 5)
acpi_support_online_capable = true;
default_acpi_madt_oem_check(madt->header.oem_id, default_acpi_madt_oem_check(madt->header.oem_id,
madt->header.oem_table_id); madt->header.oem_table_id);
...@@ -239,6 +242,12 @@ acpi_parse_lapic(union acpi_subtable_headers * header, const unsigned long end) ...@@ -239,6 +242,12 @@ acpi_parse_lapic(union acpi_subtable_headers * header, const unsigned long end)
if (processor->id == 0xff) if (processor->id == 0xff)
return 0; return 0;
/* don't register processors that can not be onlined */
if (acpi_support_online_capable &&
!(processor->lapic_flags & ACPI_MADT_ENABLED) &&
!(processor->lapic_flags & ACPI_MADT_ONLINE_CAPABLE))
return 0;
/* /*
* We need to register disabled CPU as well to permit * We need to register disabled CPU as well to permit
* counting disabled CPUs. This allows us to size * counting disabled CPUs. This allows us to size
......
...@@ -79,6 +79,21 @@ void acpi_processor_power_init_bm_check(struct acpi_processor_flags *flags, ...@@ -79,6 +79,21 @@ void acpi_processor_power_init_bm_check(struct acpi_processor_flags *flags,
*/ */
flags->bm_control = 0; flags->bm_control = 0;
} }
if (c->x86_vendor == X86_VENDOR_AMD && c->x86 >= 0x17) {
/*
* For all AMD Zen or newer CPUs that support C3, caches
* should not be flushed by software while entering C3
* type state. Set bm->check to 1 so that kernel doesn't
* need to execute cache flush operation.
*/
flags->bm_check = 1;
/*
* In current AMD C state implementation ARB_DIS is no longer
* used. So set bm_control to zero to indicate ARB_DIS is not
* required while entering C3 type state.
*/
flags->bm_control = 0;
}
} }
EXPORT_SYMBOL(acpi_processor_power_init_bm_check); EXPORT_SYMBOL(acpi_processor_power_init_bm_check);
......
...@@ -71,7 +71,7 @@ config ACPI_DEBUGGER ...@@ -71,7 +71,7 @@ config ACPI_DEBUGGER
if ACPI_DEBUGGER if ACPI_DEBUGGER
config ACPI_DEBUGGER_USER config ACPI_DEBUGGER_USER
tristate "Userspace debugger accessiblity" tristate "Userspace debugger accessibility"
depends on DEBUG_FS depends on DEBUG_FS
help help
Export /sys/kernel/debug/acpi/acpidbg for userspace utilities Export /sys/kernel/debug/acpi/acpidbg for userspace utilities
......
...@@ -750,7 +750,7 @@ static ssize_t lpss_ltr_show(struct device *dev, struct device_attribute *attr, ...@@ -750,7 +750,7 @@ static ssize_t lpss_ltr_show(struct device *dev, struct device_attribute *attr,
if (ret) if (ret)
return ret; return ret;
return snprintf(buf, PAGE_SIZE, "%08x\n", ltr_value); return sysfs_emit(buf, "%08x\n", ltr_value);
} }
static ssize_t lpss_ltr_mode_show(struct device *dev, static ssize_t lpss_ltr_mode_show(struct device *dev,
......
...@@ -492,7 +492,7 @@ static ssize_t docked_show(struct device *dev, ...@@ -492,7 +492,7 @@ static ssize_t docked_show(struct device *dev,
struct acpi_device *adev = NULL; struct acpi_device *adev = NULL;
acpi_bus_get_device(dock_station->handle, &adev); acpi_bus_get_device(dock_station->handle, &adev);
return snprintf(buf, PAGE_SIZE, "%u\n", acpi_device_enumerated(adev)); return sysfs_emit(buf, "%u\n", acpi_device_enumerated(adev));
} }
static DEVICE_ATTR_RO(docked); static DEVICE_ATTR_RO(docked);
...@@ -504,7 +504,7 @@ static ssize_t flags_show(struct device *dev, ...@@ -504,7 +504,7 @@ static ssize_t flags_show(struct device *dev,
{ {
struct dock_station *dock_station = dev->platform_data; struct dock_station *dock_station = dev->platform_data;
return snprintf(buf, PAGE_SIZE, "%d\n", dock_station->flags); return sysfs_emit(buf, "%d\n", dock_station->flags);
} }
static DEVICE_ATTR_RO(flags); static DEVICE_ATTR_RO(flags);
...@@ -543,7 +543,7 @@ static ssize_t uid_show(struct device *dev, ...@@ -543,7 +543,7 @@ static ssize_t uid_show(struct device *dev,
if (ACPI_FAILURE(status)) if (ACPI_FAILURE(status))
return 0; return 0;
return snprintf(buf, PAGE_SIZE, "%llx\n", lbuf); return sysfs_emit(buf, "%llx\n", lbuf);
} }
static DEVICE_ATTR_RO(uid); static DEVICE_ATTR_RO(uid);
...@@ -562,7 +562,7 @@ static ssize_t type_show(struct device *dev, ...@@ -562,7 +562,7 @@ static ssize_t type_show(struct device *dev,
else else
type = "unknown"; type = "unknown";
return snprintf(buf, PAGE_SIZE, "%s\n", type); return sysfs_emit(buf, "%s\n", type);
} }
static DEVICE_ATTR_RO(type); static DEVICE_ATTR_RO(type);
......
...@@ -340,3 +340,28 @@ void acpi_device_notify_remove(struct device *dev) ...@@ -340,3 +340,28 @@ void acpi_device_notify_remove(struct device *dev)
acpi_unbind_one(dev); acpi_unbind_one(dev);
} }
int acpi_dev_turn_off_if_unused(struct device *dev, void *not_used)
{
struct acpi_device *adev = to_acpi_device(dev);
/*
* Skip device objects with device IDs, because they may be in use even
* if they are not companions of any physical device objects.
*/
if (adev->pnp.type.hardware_id)
return 0;
mutex_lock(&adev->physical_node_lock);
/*
* Device objects without device IDs are not in use if they have no
* corresponding physical device objects.
*/
if (list_empty(&adev->physical_node_list))
acpi_device_set_power(adev, ACPI_STATE_D3_COLD);
mutex_unlock(&adev->physical_node_lock);
return 0;
}
...@@ -117,6 +117,7 @@ bool acpi_device_is_battery(struct acpi_device *adev); ...@@ -117,6 +117,7 @@ bool acpi_device_is_battery(struct acpi_device *adev);
bool acpi_device_is_first_physical_node(struct acpi_device *adev, bool acpi_device_is_first_physical_node(struct acpi_device *adev,
const struct device *dev); const struct device *dev);
int acpi_bus_register_early_device(int type); int acpi_bus_register_early_device(int type);
int acpi_dev_turn_off_if_unused(struct device *dev, void *not_used);
/* -------------------------------------------------------------------------- /* --------------------------------------------------------------------------
Device Matching and Notification Device Matching and Notification
......
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
#include <linux/ioport.h> #include <linux/ioport.h>
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/irq.h> #include <linux/irq.h>
#include <linux/dmi.h>
#ifdef CONFIG_X86 #ifdef CONFIG_X86
#define valid_IRQ(i) (((i) != 0) && ((i) != 2)) #define valid_IRQ(i) (((i) != 0) && ((i) != 2))
...@@ -380,9 +381,58 @@ unsigned int acpi_dev_get_irq_type(int triggering, int polarity) ...@@ -380,9 +381,58 @@ unsigned int acpi_dev_get_irq_type(int triggering, int polarity)
} }
EXPORT_SYMBOL_GPL(acpi_dev_get_irq_type); EXPORT_SYMBOL_GPL(acpi_dev_get_irq_type);
static const struct dmi_system_id medion_laptop[] = {
{
.ident = "MEDION P15651",
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "MEDION"),
DMI_MATCH(DMI_BOARD_NAME, "M15T"),
},
},
{
.ident = "MEDION S17405",
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "MEDION"),
DMI_MATCH(DMI_BOARD_NAME, "M17T"),
},
},
{ }
};
struct irq_override_cmp {
const struct dmi_system_id *system;
unsigned char irq;
unsigned char triggering;
unsigned char polarity;
unsigned char shareable;
};
static const struct irq_override_cmp skip_override_table[] = {
{ medion_laptop, 1, ACPI_LEVEL_SENSITIVE, ACPI_ACTIVE_LOW, 0 },
};
static bool acpi_dev_irq_override(u32 gsi, u8 triggering, u8 polarity,
u8 shareable)
{
int i;
for (i = 0; i < ARRAY_SIZE(skip_override_table); i++) {
const struct irq_override_cmp *entry = &skip_override_table[i];
if (dmi_check_system(entry->system) &&
entry->irq == gsi &&
entry->triggering == triggering &&
entry->polarity == polarity &&
entry->shareable == shareable)
return false;
}
return true;
}
static void acpi_dev_get_irqresource(struct resource *res, u32 gsi, static void acpi_dev_get_irqresource(struct resource *res, u32 gsi,
u8 triggering, u8 polarity, u8 shareable, u8 triggering, u8 polarity, u8 shareable,
bool legacy) bool check_override)
{ {
int irq, p, t; int irq, p, t;
...@@ -401,7 +451,9 @@ static void acpi_dev_get_irqresource(struct resource *res, u32 gsi, ...@@ -401,7 +451,9 @@ static void acpi_dev_get_irqresource(struct resource *res, u32 gsi,
* using extended IRQ descriptors we take the IRQ configuration * using extended IRQ descriptors we take the IRQ configuration
* from _CRS directly. * from _CRS directly.
*/ */
if (legacy && !acpi_get_override_irq(gsi, &t, &p)) { if (check_override &&
acpi_dev_irq_override(gsi, triggering, polarity, shareable) &&
!acpi_get_override_irq(gsi, &t, &p)) {
u8 trig = t ? ACPI_LEVEL_SENSITIVE : ACPI_EDGE_SENSITIVE; u8 trig = t ? ACPI_LEVEL_SENSITIVE : ACPI_EDGE_SENSITIVE;
u8 pol = p ? ACPI_ACTIVE_LOW : ACPI_ACTIVE_HIGH; u8 pol = p ? ACPI_ACTIVE_LOW : ACPI_ACTIVE_HIGH;
......
...@@ -2559,6 +2559,12 @@ int __init acpi_scan_init(void) ...@@ -2559,6 +2559,12 @@ int __init acpi_scan_init(void)
} }
} }
/*
* Make sure that power management resources are not blocked by ACPI
* device objects with no users.
*/
bus_for_each_dev(&acpi_bus_type, NULL, NULL, acpi_dev_turn_off_if_unused);
acpi_turn_off_unused_power_resources(); acpi_turn_off_unused_power_resources();
acpi_scan_initialized = true; acpi_scan_initialized = true;
......
...@@ -978,6 +978,7 @@ struct acpi_madt_multiproc_wakeup_mailbox { ...@@ -978,6 +978,7 @@ struct acpi_madt_multiproc_wakeup_mailbox {
/* MADT Local APIC flags */ /* MADT Local APIC flags */
#define ACPI_MADT_ENABLED (1) /* 00: Processor is usable if set */ #define ACPI_MADT_ENABLED (1) /* 00: Processor is usable if set */
#define ACPI_MADT_ONLINE_CAPABLE (2) /* 01: System HW supports enabling processor at runtime */
/* MADT MPS INTI flags (inti_flags) */ /* MADT MPS INTI flags (inti_flags) */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment