Skip to content

Commit

Permalink
Merge branches 'acpi-pm', 'acpi-soc', 'acpi-tables' and 'acpi-resource'
Browse files Browse the repository at this point in the history
Merge ACPI power management changes, ACPI LPSS driver changes, ACPI
table parsing code changes and ACPI resource handling changes for
v5.20-rc1:

 - Save NVS memory during transitions into S3 on Lenovo G40-45 (Manyi
   Li).

 - Add support for upcoming AMD uPEP device ID AMDI008 to the ACPI
   suspend-to-idle driver for x86 platforms (Shyam Sundar S K).

 - Clean up checks related to the ACPI_FADT_LOW_POWER_S0 platform flag
   in the LPIT table driver and the suspend-to-idle driver for x86
   platforms (Rafael Wysocki).

 - Print information messages regarding declared LPS0 idle support in
   the platform firmware (Rafael Wysocki).

 - Fix missing check in register_device_clock() in the ACPI driver for
   Intel SoCs (huhai).

 - Fix ACS setup in the VIOT table parser (Eric Auger).

 - Skip IRQ override on AMD Zen platforms where it's harmful (Chuanhong
   Guo).

* acpi-pm:
  ACPI: PM: x86: Print messages regarding LPS0 idle support
  ACPI: PM: s2idle: Use LPS0 idle if ACPI_FADT_LOW_POWER_S0 is unset
  Revert "ACPI / PM: LPIT: Register sysfs attributes based on FADT"
  ACPI: PM: s2idle: Add support for upcoming AMD uPEP HID AMDI008
  ACPI: PM: save NVS memory for Lenovo G40-45

* acpi-soc:
  ACPI: LPSS: Fix missing check in register_device_clock()

* acpi-tables:
  ACPI: VIOT: Fix ACS setup

* acpi-resource:
  ACPI: resource: skip IRQ override on AMD Zen platforms
  • Loading branch information
Rafael J. Wysocki committed Jul 29, 2022
5 parents 198c414 + ec6c050 + b4f1f61 + 3dcb861 + 9946e39 commit 59fa06c
Showing 8 changed files with 57 additions and 19 deletions.
6 changes: 0 additions & 6 deletions drivers/acpi/acpi_lpit.c
Original file line number Diff line number Diff line change
@@ -109,17 +109,11 @@ static void lpit_update_residency(struct lpit_residency_info *info,
if (!info->iomem_addr)
return;

if (!(acpi_gbl_FADT.flags & ACPI_FADT_LOW_POWER_S0))
return;

/* Silently fail, if cpuidle attribute group is not present */
sysfs_add_file_to_group(&cpu_subsys.dev_root->kobj,
&dev_attr_low_power_idle_system_residency_us.attr,
"cpuidle");
} else if (info->gaddr.space_id == ACPI_ADR_SPACE_FIXED_HARDWARE) {
if (!(acpi_gbl_FADT.flags & ACPI_FADT_LOW_POWER_S0))
return;

/* Silently fail, if cpuidle attribute group is not present */
sysfs_add_file_to_group(&cpu_subsys.dev_root->kobj,
&dev_attr_low_power_idle_cpu_residency_us.attr,
3 changes: 3 additions & 0 deletions drivers/acpi/acpi_lpss.c
Original file line number Diff line number Diff line change
@@ -422,6 +422,9 @@ static int register_device_clock(struct acpi_device *adev,
if (!lpss_clk_dev)
lpt_register_clock_device();

if (IS_ERR(lpss_clk_dev))
return PTR_ERR(lpss_clk_dev);

clk_data = platform_get_drvdata(lpss_clk_dev);
if (!clk_data)
return -ENODEV;
1 change: 1 addition & 0 deletions drivers/acpi/bus.c
Original file line number Diff line number Diff line change
@@ -1411,6 +1411,7 @@ static int __init acpi_init(void)

pci_mmcfg_late_init();
acpi_iort_init();
acpi_viot_early_init();
acpi_hest_init();
acpi_ghes_init();
acpi_scan_init();
10 changes: 10 additions & 0 deletions drivers/acpi/resource.c
Original file line number Diff line number Diff line change
@@ -416,6 +416,16 @@ static bool acpi_dev_irq_override(u32 gsi, u8 triggering, u8 polarity,
{
int i;

#ifdef CONFIG_X86
/*
* IRQ override isn't needed on modern AMD Zen systems and
* this override breaks active low IRQs on AMD Ryzen 6000 and
* newer systems. Skip it.
*/
if (boot_cpu_has(X86_FEATURE_ZEN))
return false;
#endif

for (i = 0; i < ARRAY_SIZE(skip_override_table); i++) {
const struct irq_override_cmp *entry = &skip_override_table[i];

11 changes: 11 additions & 0 deletions drivers/acpi/sleep.c
Original file line number Diff line number Diff line change
@@ -360,6 +360,14 @@ static const struct dmi_system_id acpisleep_dmi_table[] __initconst = {
DMI_MATCH(DMI_PRODUCT_NAME, "80E3"),
},
},
{
.callback = init_nvs_save_s3,
.ident = "Lenovo G40-45",
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
DMI_MATCH(DMI_PRODUCT_NAME, "80E1"),
},
},
/*
* ThinkPad X1 Tablet(2016) cannot do suspend-to-idle using
* the Low Power S0 Idle firmware interface (see
@@ -816,6 +824,9 @@ static const struct platform_s2idle_ops acpi_s2idle_ops = {

void __weak acpi_s2idle_setup(void)
{
if (acpi_gbl_FADT.flags & ACPI_FADT_LOW_POWER_S0)
pr_info("Efficient low-power S0 idle declared\n");

s2idle_set_ops(&acpi_s2idle_ops);
}

26 changes: 20 additions & 6 deletions drivers/acpi/viot.c
Original file line number Diff line number Diff line change
@@ -248,6 +248,26 @@ static int __init viot_parse_node(const struct acpi_viot_header *hdr)
return ret;
}

/**
* acpi_viot_early_init - Test the presence of VIOT and enable ACS
*
* If the VIOT does exist, ACS must be enabled. This cannot be
* done in acpi_viot_init() which is called after the bus scan
*/
void __init acpi_viot_early_init(void)
{
#ifdef CONFIG_PCI
acpi_status status;
struct acpi_table_header *hdr;

status = acpi_get_table(ACPI_SIG_VIOT, 0, &hdr);
if (ACPI_FAILURE(status))
return;
pci_request_acs();
acpi_put_table(hdr);
#endif
}

/**
* acpi_viot_init - Parse the VIOT table
*
@@ -319,12 +339,6 @@ static int viot_pci_dev_iommu_init(struct pci_dev *pdev, u16 dev_id, void *data)
epid = ((domain_nr - ep->segment_start) << 16) +
dev_id - ep->bdf_start + ep->endpoint_id;

/*
* If we found a PCI range managed by the viommu, we're
* the one that has to request ACS.
*/
pci_request_acs();

return viot_dev_iommu_init(&pdev->dev, ep->viommu,
epid);
}
17 changes: 10 additions & 7 deletions drivers/acpi/x86/s2idle.c
Original file line number Diff line number Diff line change
@@ -369,9 +369,6 @@ static int lps0_device_attach(struct acpi_device *adev,
if (lps0_device_handle)
return 0;

if (!(acpi_gbl_FADT.flags & ACPI_FADT_LOW_POWER_S0))
return 0;

if (acpi_s2idle_vendor_amd()) {
/* AMD0004, AMD0005, AMDI0005:
* - Should use rev_id 0x0
@@ -397,7 +394,9 @@ static int lps0_device_attach(struct acpi_device *adev,
lps0_dsm_func_mask = (lps0_dsm_func_mask << 1) | 0x1;
acpi_handle_debug(adev->handle, "_DSM UUID %s: Adjusted function mask: 0x%x\n",
ACPI_LPS0_DSM_UUID_AMD, lps0_dsm_func_mask);
} else if (lps0_dsm_func_mask_microsoft > 0 && !strcmp(hid, "AMDI0007")) {
} else if (lps0_dsm_func_mask_microsoft > 0 &&
(!strcmp(hid, "AMDI0007") ||
!strcmp(hid, "AMDI0008"))) {
lps0_dsm_func_mask_microsoft = -EINVAL;
acpi_handle_debug(adev->handle, "_DSM Using AMD method\n");
}
@@ -419,11 +418,15 @@ static int lps0_device_attach(struct acpi_device *adev,
lpi_device_get_constraints();

/*
* Use suspend-to-idle by default if the default suspend mode was not
* set from the command line.
* Use suspend-to-idle by default if ACPI_FADT_LOW_POWER_S0 is set in
* the FADT and the default suspend mode was not set from the command
* line.
*/
if (mem_sleep_default > PM_SUSPEND_MEM && !acpi_sleep_default_s3)
if ((acpi_gbl_FADT.flags & ACPI_FADT_LOW_POWER_S0) &&
mem_sleep_default > PM_SUSPEND_MEM && !acpi_sleep_default_s3) {
mem_sleep_current = PM_SUSPEND_TO_IDLE;
pr_info("Low-power S0 idle used by default for system suspend\n");
}

/*
* Some LPS0 systems, like ASUS Zenbook UX430UNR/i7-8550U, require the
2 changes: 2 additions & 0 deletions include/linux/acpi_viot.h
Original file line number Diff line number Diff line change
@@ -6,9 +6,11 @@
#include <linux/acpi.h>

#ifdef CONFIG_ACPI_VIOT
void __init acpi_viot_early_init(void);
void __init acpi_viot_init(void);
int viot_iommu_configure(struct device *dev);
#else
static inline void acpi_viot_early_init(void) {}
static inline void acpi_viot_init(void) {}
static inline int viot_iommu_configure(struct device *dev)
{

0 comments on commit 59fa06c

Please sign in to comment.