aboutsummaryrefslogtreecommitdiff
path: root/drivers/acpi
AgeCommit message (Collapse)AuthorFilesLines
2020-05-28ACPI: sysfs: Fix reference count leak in acpi_sysfs_add_hotplug_profile()Qiushi Wu1-1/+3
kobject_init_and_add() takes reference even when it fails. Thus, when kobject_init_and_add() returns an error, kobject_put() must be called to properly clean up the kobject. Fixes: 3f8055c35836 ("ACPI / hotplug: Introduce user space interface for hotplug profiles") Signed-off-by: Qiushi Wu <[email protected]> Cc: 3.10+ <[email protected]> # 3.10+ Signed-off-by: Rafael J. Wysocki <[email protected]>
2020-05-27PCI: Rename _DSM constants to align with specKrzysztof Wilczyński1-1/+1
Rename PCI-related _DSM constants to align them with the PCI Firmware Spec, r3.2, sec 4.6. No functional change intended. Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Krzysztof Wilczyński <[email protected]> Signed-off-by: Bjorn Helgaas <[email protected]>
2020-05-27ACPI: GED: use correct trigger type field in _Exx / _Lxx handlingArd Biesheuvel1-1/+1
Commit ea6f3af4c5e63f69 ("ACPI: GED: add support for _Exx / _Lxx handler methods") added a reference to the 'triggering' field of either the normal or the extended ACPI IRQ resource struct, but inadvertently used the wrong pointer in the latter case. Note that both pointers refer to the same union, and the 'triggering' field appears at the same offset in both struct types, so it currently happens to work by accident. But let's fix it nonetheless Fixes: ea6f3af4c5e63f69 ("ACPI: GED: add support for _Exx / _Lxx handler methods") Signed-off-by: Ard Biesheuvel <[email protected]> Signed-off-by: Rafael J. Wysocki <[email protected]>
2020-05-26ACPI/IORT: Remove the unused __get_pci_rid()Zenghui Yu1-9/+0
Since commit bc8648d49a95 ("ACPI/IORT: Handle PCI aliases properly for IOMMUs"), __get_pci_rid() has become actually unused and can be removed. Signed-off-by: Zenghui Yu <[email protected]> Acked-by: Lorenzo Pieralisi <[email protected]> Acked-by: Hanjun Guo <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Will Deacon <[email protected]>
2020-05-25ACPI: EC: PM: s2idle: Extend GPE dispatching debug messageRafael J. Wysocki1-1/+1
Add the "ACPI" string to the "EC GPE dispatched" message as it is ACPI-related. Signed-off-by: Rafael J. Wysocki <[email protected]>
2020-05-25ACPI: PM: s2idle: Print type of wakeup debug messagesRafael J. Wysocki1-5/+15
Since acpi_s2idle_wake() knows the category of wakeup causing the system to resume from suspend-to-idle, make it print a unique message for each of them to help diagnose wakeup issues. Signed-off-by: Rafael J. Wysocki <[email protected]>
2020-05-25ACPI: DPTF: Add battery participant driverSrinivas Pandruvada1-10/+72
This driver adds support for Dynamic Platform and Thermal Framework battery participant device support. These attributes are presented via sysfs interface under the platform device for the battery participant: $ls /sys/bus/platform/devices/INT3532:00/dptf_battery current_discharge_capbility_ma max_platform_power_mw no_load_voltage_mv high_freq_impedance_mohm max_steady_state_power_mw Refer to the documentation at Documentation/ABI/testing/sysfs-platform-dptf for details. Here the implementation reuses existing dptf-power.c as the motivation and processing is same. It also shares one ACPI method. Here this change is using participant type, "PTYP" method to identify and do different processing. By using participant type, create/delete either "dptf_power" or "dptf_battery" attribute group and send notifications. The particpant type for for the battery participant is 0x0C. ACPI methods description: PMAX (Intel(R) Dynamic Tuning Platform Max Power Supplied by Battery): This object evaluates to the maximum platform power that can be supported by the battery in milli watts. PBSS (Intel(R) Dynamic Tuning Power Battery Steady State): This object returns the max sustained power for battery in milli watts. RBHF (Intel(R) Dynamic Tuning High Frequency Impedance): This object returns high frequency impedance value that can be obtained from battery fuel gauge. VBNL (Intel(R) Dynamic Tuning No-Load Voltage) This object returns battery instantaneous no-load voltage that can be obtained from battery fuel gauge in milli volts CMPP (Intel(R) Dynamic Tuning Current Discharge Capability) This object returns battery discharge current capability obtained from battery fuel gauge milli amps. Notifications: 0x80: PMAX change. Used to notify Intel(R)Dynamic Tuning Battery participant driver when the PMAX has changed by 250mw. 0x83: PBSS change. Used to notify Intel(R) Dynamic Tuning Battery participant driver when the power source has changed. 0x85: RBHF change. Used to notify Intel(R)Dynamic Tuning Battery participant driver when the RBHF has changed over a threshold by 5mOhm. 0x86: Battery Capability change. Used to notify Intel(R)Dynamic Tuning Battery participant driver when the battery capability has changed. Signed-off-by: Srinivas Pandruvada <[email protected]> [ rjw: Subject ] Signed-off-by: Rafael J. Wysocki <[email protected]>
2020-05-25ACPI: DPTF: Additional sysfs attributes for power participant driverSrinivas Pandruvada1-1/+68
Add two additional attributes to the existing power participant driver: rest_of_platform_power_mw: (RO) Shows the rest of worst case platform power in mW outside of S0C. This will help in power distribution to SoC and rest of the system. For example on a test system, this value is 2.5W with a 15W TDP SoC. Based on the adapter rating (adapter_rating_mw), user space software can decide on proper power allocation to SoC to improve short term performance via powercap/RAPL interface. prochot_confirm: (WO) Confirm EC about a prochot notification. Also userspace is notified via sysfs_notify(), whenever power source or rest of the platform power is changed. So user space can use poll() system call on those attributes. The ACPI methods used in this patch are as follows: PROP This object evaluates to the rest of worst case platform power in mW. Bits: 23:0 Worst case rest of platform power in mW. PBOK PBOK is a method designed to provide a mechanism for OSPM to change power setting before EC can de-assert a PROCHOT from a device. The EC may receive several PROCHOTs, so it has a sequence number attached to PSRC (read via existing attribute "platform_power_source"). Once OSPM takes action for a PSRC change notification, it can call PBOK method to confirm with the sequence number. Bits: 3:0 Power Delivery State Change Sequence number 30 Reserved 31 0 – Not OK to de-assert PROCHOT 1 – OK to de-assert PROCHOT PSRC (Platform Power Source): Not new in this patch but for documentation for new bits This object evaluates to an integer that represents the system power source as well as the power delivery state change sequence number. Bits: 3:0 The current power source as an integer for AC, DC, USB, Wireless. 0 = DC, 1 = AC, 2 = USB, 3 = Wireless Charging 7:4 Power Delivery State Change Sequence Number. Default value is 0 Notifications: 0x81: (Power State Change) Used to notify when the power source has changed. 0x84: (PROP change) Used to notify when the platform rest of power has changed. Signed-off-by: Srinivas Pandruvada <[email protected]> [ rjw: Subject, minor ABI documentation edit ] Signed-off-by: Rafael J. Wysocki <[email protected]>
2020-05-25ACPI: video: Use native backlight on Acer TravelMate 5735ZPaul Menzel1-0/+10
Currently, changing the brightness of the internal display of the Acer TravelMate 5735Z does not work. Pressing the function keys or changing the slider, GNOME Shell 3.36.2 displays the OSD (five steps), but the brightness does not change. The Acer TravelMate 5735Z shipped with Windows 7 and as such does not trigger our "win8 ready" heuristic for preferring the native backlight interface. Still ACPI backlight control doesn't work on this model, where as the native (intel_video) backlight interface does work by adding `acpi_backlight=native` or `acpi_backlight=none` to Linux’ command line. So, add a quirk to force using native backlight control on this model. Link: https://bugzilla.kernel.org/show_bug.cgi?id=207835 Reviewed-by: Hans de Goede <[email protected]> Signed-off-by: Paul Menzel <[email protected]> Signed-off-by: Rafael J. Wysocki <[email protected]>
2020-05-20ACPI/IORT: Fix PMCG node single ID mapping handlingTuan Phan1-0/+5
An IORT PMCG node can have no ID mapping if its overflow interrupt is wire based therefore the code that parses the PMCG node can not assume the node will always have a single mapping present at index 0. Fix iort_get_id_mapping_index() by checking for an overflow interrupt and mapping count. Fixes: 24e516049360 ("ACPI/IORT: Add support for PMCG") Signed-off-by: Tuan Phan <[email protected]> Reviewed-by: Hanjun Guo <[email protected]> Acked-by: Lorenzo Pieralisi <[email protected]> Link: https://lore.kernel.org/r/1589994787-28637-1-git-send-email-tuanphan@os.amperecomputing.com Signed-off-by: Will Deacon <[email protected]>
2020-05-19ACPI: APEI: Kick the memory_failure() queue for synchronous errorsJames Morse1-11/+56
memory_failure() offlines or repairs pages of memory that have been discovered to be corrupt. These may be detected by an external component, (e.g. the memory controller), and notified via an IRQ. In this case the work is queued as not all of memory_failure()s work can happen in IRQ context. If the error was detected as a result of user-space accessing a corrupt memory location the CPU may take an abort instead. On arm64 this is a 'synchronous external abort', and on a firmware first system it is replayed using NOTIFY_SEA. This notification has NMI like properties, (it can interrupt IRQ-masked code), so the memory_failure() work is queued. If we return to user-space before the queued memory_failure() work is processed, we will take the fault again. This loop may cause platform firmware to exceed some threshold and reboot when Linux could have recovered from this error. For NMIlike notifications keep track of whether memory_failure() work was queued, and make task_work pending to flush out the queue. To save memory allocations, the task_work is allocated as part of the ghes_estatus_node, and free()ing it back to the pool is deferred. Signed-off-by: James Morse <[email protected]> Tested-by: Tyler Baicar <[email protected]> Signed-off-by: Rafael J. Wysocki <[email protected]>
2020-05-18ACPI: IORT: Add comments for not calling acpi_put_table()Hanjun Guo1-0/+4
The iort_table will be used at runtime after acpi_iort_init(), so add some comments to clarify this to make it less confusing. Signed-off-by: Hanjun Guo <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Will Deacon <[email protected]>
2020-05-18ACPI: GTDT: Put GTDT table after parsingHanjun Guo1-1/+3
The mapped GTDT table needs to be released after the driver init. Signed-off-by: Hanjun Guo <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Will Deacon <[email protected]>
2020-05-18ACPI: EC: PM: Avoid flushing EC work when EC GPE is inactiveRafael J. Wysocki2-12/+9
Flushing the EC work while suspended to idle when the EC GPE status is not set causes some EC wakeup events (notably power button and lid ones) to be missed after a series of spurious wakeups on the Dell XPS13 9360 in my office. If that happens, the machine cannot be woken up from suspend-to-idle by the power button or lid status change and it needs to be woken up in some other way (eg. by a key press). Flushing the EC work only after successful dispatching the EC GPE, which means that its status has been set, avoids the issue, so change the code in question accordingly. Fixes: 7b301750f7f8 ("ACPI: EC: PM: Avoid premature returns from acpi_s2idle_wake()") Cc: 5.4+ <[email protected]> # 5.4+ Signed-off-by: Rafael J. Wysocki <[email protected]> Tested-by: Chris Chiu <[email protected]>
2020-05-18ACPI / PMIC: Add i2c address for thermal controlMauro Carvalho Chehab1-0/+1
On Asus T101HA, we keep receiving those error messages: i915 0000:00:02.0: [drm] *ERROR* mipi_exec_pmic failed, error: -95 intel_soc_pmic_exec_mipi_pmic_seq_element: Not implemented intel_soc_pmic_exec_mipi_pmic_seq_element: i2c-addr: 0x5e reg-addr 0x4b value 0x59 mask 0xff Because the opregion is missing the I2C address. Suggested-by: Hans de Goede <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]> Reviewed-by: Hans de Goede <[email protected]> Reviewed-by: Mika Westerberg <[email protected]> Reviewed-by: Andy Shevchenko <[email protected]> Signed-off-by: Rafael J. Wysocki <[email protected]>
2020-05-15ACPI: GED: add support for _Exx / _Lxx handler methodsArd Biesheuvel1-3/+19
Per the ACPI spec, interrupts in the range [0, 255] may be handled in AML using individual methods whose naming is based on the format _Exx or _Lxx, where xx is the hex representation of the interrupt index. Add support for this missing feature to our ACPI GED driver. Cc: v4.9+ <[email protected]> # v4.9+ Signed-off-by: Ard Biesheuvel <[email protected]> Signed-off-by: Rafael J. Wysocki <[email protected]>
2020-05-14ACPI: Delete unused proc filename macrosPascal Terjan5-9/+0
Those were used to create files in /proc/acpi long ago and were missed when that code was deleted. Signed-off-by: Pascal Terjan <[email protected]> Signed-off-by: Rafael J. Wysocki <[email protected]>
2020-05-11ACPI: IORT: Add extra message "applying workaround" for off-by-1 issueHanjun Guo1-0/+2
As we already applied a workaround for the off-by-1 issue, it's good to add extra message "applying workaround" to make people less uneasy to see FW_BUG message in the boot log. Signed-off-by: Hanjun Guo <[email protected]> Acked-by: Ard Biesheuvel <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Will Deacon <[email protected]>
2020-05-11ACPI: EC: PM: Avoid premature returns from acpi_s2idle_wake()Rafael J. Wysocki3-21/+18
If the EC GPE status is not set after checking all of the other GPEs, acpi_s2idle_wake() returns 'false', to indicate that the SCI event that has just triggered is not a system wakeup one, but it does that without canceling the pending wakeup and re-arming the SCI for system wakeup which is a mistake, because it may cause s2idle_loop() to busy spin until the next valid wakeup event. [If that happens, the first spurious wakeup is still pending after acpi_s2idle_wake() has returned, so s2idle_enter() does nothing, acpi_s2idle_wake() is called again and it sees that the SCI has triggered, but no GPEs are active, so 'false' is returned again, and so on.] Fix that by moving all of the GPE checking logic from acpi_s2idle_wake() to acpi_ec_dispatch_gpe() and making the latter return 'true' only if a non-EC GPE has triggered and 'false' otherwise, which will cause acpi_s2idle_wake() to cancel the pending SCI wakeup and re-arm the SCI for system wakeup regardless of the EC GPE status. This also addresses a lockup observed on an Elitegroup EF20EA laptop after attempting to wake it up from suspend-to-idle by a key press. Fixes: d5406284ff80 ("ACPI: PM: s2idle: Refine active GPEs check") Link: https://bugzilla.kernel.org/show_bug.cgi?id=207603 Reported-by: Todd Brandt <[email protected]> Fixes: fdde0ff8590b ("ACPI: PM: s2idle: Prevent spurious SCIs from waking up the system") Link: https://lore.kernel.org/linux-acpi/CAB4CAwdqo7=MvyG_PE+PGVfeA17AHF5i5JucgaKqqMX6mjArbQ@mail.gmail.com/ Reported-by: Chris Chiu <[email protected]> Tested-by: Chris Chiu <[email protected]> Cc: 5.4+ <[email protected]> # 5.4+ Signed-off-by: Rafael J. Wysocki <[email protected]>
2020-05-09ACPI: utils: Add acpi_evaluate_reg() helperHans de Goede1-0/+25
With a recent fix to the pinctrl-cherryview driver we now have 2 drivers open-coding the parameter building / passing for calling _REG on an ACPI handle. Add a helper for this, so that these 2 drivers can be converted to this helper. Suggested-by: Andy Shevchenko <[email protected]> Reviewed-by: Andy Shevchenko <[email protected]> Signed-off-by: Hans de Goede <[email protected]> Signed-off-by: Rafael J. Wysocki <[email protected]>
2020-05-09ACPI: debug: Make two functions staticZheng Zengkai1-2/+2
Fix sparse warnings: drivers/acpi/acpi_dbg.c:748:12: warning: symbol 'acpi_aml_init' was not declared. Should it be static? drivers/acpi/acpi_dbg.c:774:13: warning: symbol 'acpi_aml_exit' was not declared. Should it be static? Reported-by: Hulk Robot <[email protected]> Signed-off-by: Zheng Zengkai <[email protected]> Signed-off-by: Rafael J. Wysocki <[email protected]>
2020-05-09ACPI: sleep: Put the FACS table after using itHanjun Guo1-1/+3
Put the FACS table after using it to release the table mapping. Signed-off-by: Hanjun Guo <[email protected]> Signed-off-by: Rafael J. Wysocki <[email protected]>
2020-05-09ACPI: scan: Put SPCR and STAO table after using itHanjun Guo1-5/+10
The SPCR and STAO table needs to be released after using it. Signed-off-by: Hanjun Guo <[email protected]> Signed-off-by: Rafael J. Wysocki <[email protected]>
2020-05-09ACPI: EC: Put the ACPI table after using itHanjun Guo1-8/+12
The embedded controller boot resources table needs to be released after using it. Signed-off-by: Hanjun Guo <[email protected]> [ rjw: avoid adding a label in acpi_ec_ecdt_start() ] Signed-off-by: Rafael J. Wysocki <[email protected]>
2020-05-09ACPI: APEI: Put the HEST table for error pathHanjun Guo1-2/+3
hest_tab will be used after hest_init(), but we need to release it for error path. Signed-off-by: Hanjun Guo <[email protected]> Signed-off-by: Rafael J. Wysocki <[email protected]>
2020-05-09ACPI: APEI: Put the error record serialization table for error pathHanjun Guo1-1/+3
The mapped error record serialization table needs to be released for error path of erst_init(). Signed-off-by: Hanjun Guo <[email protected]> Signed-off-by: Rafael J. Wysocki <[email protected]>
2020-05-09ACPI: APEI: Put the error injection table for error path and module exitHanjun Guo1-1/+4
The mapped error injection table will be used after einj_init() for debugfs, but it should be released for module exit and error path of einj_init(). Signed-off-by: Hanjun Guo <[email protected]> Signed-off-by: Rafael J. Wysocki <[email protected]>
2020-05-09ACPI: APEI: Put the boot error record table after parsingHanjun Guo1-2/+4
The mapped boot error record table is not used after bert_init(), release it. Signed-off-by: Hanjun Guo <[email protected]> Signed-off-by: Rafael J. Wysocki <[email protected]>
2020-05-09ACPI: watchdog: Put the watchdog action table after parsingHanjun Guo1-2/+5
The mapped watchdog action table should be released after the successfully parsing, and the failure path in the driver initialization. Signed-off-by: Hanjun Guo <[email protected]> Signed-off-by: Rafael J. Wysocki <[email protected]>
2020-05-09ACPI: LPIT: Put the low power idle table after using itHanjun Guo1-1/+2
The mapped LPIT table is not used for runtime after init, put the ACPI table to release the table mapping. Signed-off-by: Hanjun Guo <[email protected]> Signed-off-by: Rafael J. Wysocki <[email protected]>
2020-05-09ACPICA: Fix required parameters for _NIG and _NIHErik Kaneda1-2/+2
ACPICA commit 4b0e043386c7e698bea9e862f60a388647f56622 Previously, there was a mixup where _NIG required one parameter and _NIH required zero parameters. This changes swaps these parameter requirements. Now this change requires _NIH to be called with one parameter and _NIG requires zero. Link: https://github.com/acpica/acpica/commit/4b0e0433 Reported-by: Paul A Lohr <[email protected]> Signed-off-by: Erik Kaneda <[email protected]> Signed-off-by: Bob Moore <[email protected]> Signed-off-by: Rafael J. Wysocki <[email protected]>
2020-05-09ACPICA: Dispatcher: add status checksErik Kaneda1-5/+12
ACPICA commit 3244c1eeba9f9fb9ccedb875f7923a3d85e0c6aa The status chekcs are used to to avoid NULL pointer dereference on field objects Link: https://github.com/acpica/acpica/commit/3244c1ee Reported-by: Kurt Kennett <[email protected]> Signed-off-by: Erik Kaneda <[email protected]> Signed-off-by: Bob Moore <[email protected]> Signed-off-by: Rafael J. Wysocki <[email protected]>
2020-05-09ACPICA: Disassembler: ignore AE_ALREADY_EXISTS status when parsing create ↵Erik Kaneda1-1/+4
operators ACPICA commit cd66d0a50fdc9cc4dcd998e08e7aa3c4154bea2d Disassembler is intended to emit existing ASL code as-is. Therefore, error messages emitted during disassembly should be ignored or handled in a way such that the disassembler can continue to parse the AML. This change ignores AE_ALREADY_EXISTS errors during the deferred Op parsing for create operators in order to complete parsing ASL termlists. Link: https://github.com/acpica/acpica/commit/cd66d0a5 Signed-off-by: Erik Kaneda <[email protected]> Signed-off-by: Bob Moore <[email protected]> Signed-off-by: Rafael J. Wysocki <[email protected]>
2020-05-09ACPICA: Move acpi_gbl_next_cmd_num definition to acglobal.hErik Kaneda2-1/+1
ACPICA commit 8296a24f33984c26a61103c590b049de3c9b61ff This commit cleans up the code by moving the global definition out of dbhistry.c to acglobal.h. Link: https://github.com/acpica/acpica/commit/8296a24f Reported-by: Hulk Robot <[email protected]> Suggested-by: Jason Yan <[email protected]> Signed-off-by: Erik Kaneda <[email protected]> Signed-off-by: Bob Moore <[email protected]> Signed-off-by: Rafael J. Wysocki <[email protected]>
2020-05-09ACPICA: Make acpi_protocol_lengths staticYue Haibing1-1/+1
ACPICA commit 0ebacf12b8ca66ce6d3fce4d349b3f2448da18cb A linux-based static analyzer (sparse) caught this as a warning. Making this variable static will result in better optimizations and ensure that this variable does not get used outside of this file. Signed-off-by: Yue Haibing <[email protected]> [ek: commit message] Link: https://github.com/acpica/acpica/commit/0ebacf12 Signed-off-by: Erik Kaneda <[email protected]> Signed-off-by: Yue Haibing <[email protected]> Signed-off-by: Bob Moore <[email protected]> Signed-off-by: Rafael J. Wysocki <[email protected]>
2020-05-04ACPI/IORT: work around num_ids ambiguityArd Biesheuvel1-6/+34
The ID mapping table structure of the IORT table describes the size of a range using a num_ids field carrying the number of IDs in the region minus one. This has been misinterpreted in the past in the parsing code, and firmware is known to have shipped where this results in an ambiguity, where regions that should be adjacent have an overlap of one value. So let's work around this by detecting this case specifically: when resolving an ID translation, allow one that matches right at the end of a multi-ID region to be superseded by a subsequent one. To prevent potential regressions on broken firmware that happened to work before, only take the subsequent match into account if it occurs at the start of a mapping region. Signed-off-by: Ard Biesheuvel <[email protected]> Reviewed-by: Lorenzo Pieralisi <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Will Deacon <[email protected]>
2020-05-04Revert "ACPI/IORT: Fix 'Number of IDs' handling in iort_id_map()"Ard Biesheuvel1-55/+2
This reverts commit 3c23b83a88d00383e1d498cfa515249aa2fe0238. Signed-off-by: Ard Biesheuvel <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Will Deacon <[email protected]>
2020-05-02Merge back system-wide PM material for v5.8.Rafael J. Wysocki3-26/+21
2020-05-01PCI: Constify struct pci_ecam_opsRob Herring1-4/+4
struct pci_ecam_ops is typically DT match table data which is defined to be const. It's also best practice for ops structs to be const. Ideally, we'd make struct pci_ops const as well, but that becomes pretty invasive, so for now we just cast it where needed. Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Rob Herring <[email protected]> Signed-off-by: Lorenzo Pieralisi <[email protected]> Acked-by: Bjorn Helgaas <[email protected]> Acked-by: Catalin Marinas <[email protected]> Cc: Catalin Marinas <[email protected]> Cc: Will Deacon <[email protected]> Cc: Lorenzo Pieralisi <[email protected]> Cc: Andrew Murray <[email protected]> Cc: Bjorn Helgaas <[email protected]> Cc: "Rafael J. Wysocki" <[email protected]> Cc: Len Brown <[email protected]> Cc: Jonathan Chocron <[email protected]> Cc: Zhou Wang <[email protected]> Cc: Robert Richter <[email protected]> Cc: Toan Le <[email protected]> Cc: Marc Gonzalez <[email protected]> Cc: Mans Rullgard <[email protected]> Cc: [email protected]
2020-04-30PCI/AER: Use only _OSC to determine AER ownershipAlexandru Gagniuc1-7/+2
Per the PCI Firmware spec, r3.2, sec 4.5.1, the OS can request control of AER via bit 3 of the _OSC Control Field. In the returned value of the Control Field: The firmware sets [bit 3] to 1 to grant control over PCI Express Advanced Error Reporting. ... after control is transferred to the operating system, firmware must not modify the Advanced Error Reporting Capability. If control of this feature was requested and denied or was not requested, firmware returns this bit set to 0. Previously the pci_root driver looked at the HEST FIRMWARE_FIRST bit to determine whether to request ownership of the AER Capability. This was based on ACPI spec v6.3, sec 18.3.2.4, and similar sections, which say things like: Bit [0] - FIRMWARE_FIRST: If set, indicates that system firmware will handle errors from this source first. Bit [1] - GLOBAL: If set, indicates that the settings contained in this structure apply globally to all PCI Express Devices. These ACPI references don't say anything about ownership of the AER Capability. Remove use of the FIRMWARE_FIRST bit and rely only on the _OSC bit to determine whether we have control of the AER Capability. Link: https://lore.kernel.org/r/[email protected]/ v1 Link: https://lore.kernel.org/r/[email protected]/ v2 Link: https://lore.kernel.org/r/67af2931705bed9a588b5a39d369cb70b9942190.1587925636.git.sathyanarayanan.kuppuswamy@linux.intel.com [bhelgaas: commit log, note: Alex posted this identical patch 18 months ago, and I failed to apply it then, so I made him the author, added links to his postings, and added his Signed-off-by] Signed-off-by: Alexandru Gagniuc <[email protected]> Signed-off-by: Kuppuswamy Sathyanarayanan <[email protected]> Signed-off-by: Bjorn Helgaas <[email protected]> Reviewed-by: Jon Derrick <[email protected]>
2020-04-28ACPI/IORT: take _DMA methods into account for named componentsArd Biesheuvel1-7/+4
Where IORT nodes for named components can describe simple DMA limits expressed as the number of address bits a device can drive, _DMA methods in AML can express more complex topologies, involving DMA translation in particular. Currently, we only take this _DMA method into account if it appears on a ACPI device node describing a PCIe root complex, but it is perfectly acceptable to use them for named components as well, so let's ensure we take them into account in those cases too. Note that such named components are expected to reside under a pseudo-bus node such as the ACPI0004 container device, which should be providing the _DMA method as well as a _CRS (as mandated by the ACPI spec). This is not enforced by the code however. Reported-by: Andrei Warkentin <[email protected]> Signed-off-by: Ard Biesheuvel <[email protected]> Acked-by: Lorenzo Pieralisi <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Will Deacon <[email protected]>
2020-04-27PM: ACPI: Output correct message on target power stateKai-Heng Feng1-2/+2
Transitioned power state logged at the end of setting ACPI power. However, D3cold won't be in the message because state can only be D3hot at most. Use target_state to corretly report when power state is D3cold. Cc: All applicable <[email protected]> Signed-off-by: Kai-Heng Feng <[email protected]> Signed-off-by: Rafael J. Wysocki <[email protected]>
2020-04-27ACPI: CPPC: Make some symbols staticZou Wei1-2/+2
Fix the following sparse warnings: drivers/acpi/cppc_acpi.c:353:20: warning: symbol 'cppc_mbox_cl' was not declared. Should it be static? drivers/acpi/cppc_acpi.c:600:5: warning: symbol 'pcc_data_alloc' was not declared. Should it be static? Reported-by: Hulk Robot <[email protected]> Signed-off-by: Zou Wei <[email protected]> Signed-off-by: Rafael J. Wysocki <[email protected]>
2020-04-27ACPI: processor: idle: Allow probing on platforms with one ACPI C-stateZhang Rui1-7/+2
It is possible for ACPI _CST to return only one ACPI C-state, for example, when deep cstate disabled in the BIOS. And it is better for the acpi_idle driver to probe succesfully in this case as well for consistency. Signed-off-by: Zhang Rui <[email protected]> Signed-off-by: Rafael J. Wysocki <[email protected]>
2020-04-24PM: sleep: core: Rename DPM_FLAG_LEAVE_SUSPENDEDRafael J. Wysocki1-1/+1
Rename DPM_FLAG_LEAVE_SUSPENDED to DPM_FLAG_MAY_SKIP_RESUME which matches its purpose more closely. No functional impact. Suggested-by: Alan Stern <[email protected]> Signed-off-by: Rafael J. Wysocki <[email protected]> Acked-by: Wolfram Sang <[email protected]> # for I2C Acked-by: Alan Stern <[email protected]> Acked-by: Bjorn Helgaas <[email protected]>
2020-04-24PM: sleep: core: Rename dev_pm_smart_suspend_and_suspended()Rafael J. Wysocki2-7/+7
Because all callers of dev_pm_smart_suspend_and_suspended use it only for checking whether or not to skip driver suspend callbacks for a device, rename it to dev_pm_skip_suspend() in analogy with dev_pm_skip_resume(). No functional impact. Suggested-by: Alan Stern <[email protected]> Signed-off-by: Rafael J. Wysocki <[email protected]> Acked-by: Alan Stern <[email protected]> Acked-by: Bjorn Helgaas <[email protected]>
2020-04-24PM: sleep: core: Rename dev_pm_may_skip_resume()Rafael J. Wysocki2-4/+4
The name of dev_pm_may_skip_resume() may be easily confused with the power.may_skip_resume flag which is not checked by that function, so rename the former as dev_pm_skip_resume(). No functional impact. Suggested-by: Alan Stern <[email protected]> Signed-off-by: Rafael J. Wysocki <[email protected]> Acked-by: Alan Stern <[email protected]> Acked-by: Bjorn Helgaas <[email protected]>
2020-04-24PM: sleep: core: Rework the power.may_skip_resume handlingRafael J. Wysocki1-5/+3
Because the power.may_skip_resume device status bit is taken into account in combination with the DPM_FLAG_LEAVE_SUSPENDED driver flag, it can be set to 'true' for all devices in the "suspend" phase of a suspend-resume cycle, so do that. Then, neither the PM core nor the middle-layer (sybsystem) code handling it needs to set it to 'true' any more and it just has to be cleared if there is a reason to avoid skipping the "noirq" and "early" resume callbacks provided by the driver, so update the code in question accordingly. Suggested-by: Alan Stern <[email protected]> Signed-off-by: Rafael J. Wysocki <[email protected]> Acked-by: Alan Stern <[email protected]> Acked-by: Bjorn Helgaas <[email protected]>
2020-04-24PM: sleep: core: Do not skip callbacks in the resume phaseRafael J. Wysocki2-12/+9
The current code in device_resume_noirq() causes the entire early resume and resume phases of device suspend to be skipped for devices for which the noirq resume phase have been skipped (due to the LEAVE_SUSPENDED flag being set) on the premise that those devices should stay in runtime-suspend after system-wide resume. However, that may not be correct in two situations. First, the middle layer (subsystem) noirq resume callback may be missing for a given device, but its early resume callback may be present and it may need to do something even if it decides to skip the driver callback. Second, if the device's wakeup settings were adjusted in the suspend phase without resuming the device (that was in runtime suspend at that time), they most likely need to be adjusted again in the resume phase and so the driver callback in that phase needs to be run. For the above reason, modify the core to allow the middle layer ->resume_late callback to run even if its ->resume_noirq callback is missing (and the core has skipped the driver-level callback in that phase) and to allow all device callbacks to run in the resume phase. Also make the core set the PM-runtime status of devices with SMART_SUSPEND set whose resume callbacks are not skipped to "active" in the "noirq" resume phase and update the affected subsystems (PCI and ACPI) accordingly. After this change, middle-layer (subsystem) callbacks will always be invoked in all phases of system suspend and resume and driver callbacks will always run in the prepare, suspend, resume, and complete phases for all devices. For devices with SMART_SUSPEND set, driver callbacks will be skipped in the late and noirq phases of system suspend if those devices remain in runtime suspend in __device_suspend_late(). Driver callbacks will also be skipped for them during the noirq and early phases of the "thaw" transition related to hibernation in that case. Setting LEAVE_SUSPENDED means that the driver allows its callbacks to be skipped in the noirq and early phases of system resume, but some additional conditions need to be met for that to happen (among other things, the power.may_skip_resume flag needs to be set for the device during system suspend for the driver callbacks to be skipped during the subsequent resume transition). For all devices with SMART_SUSPEND set whose driver callbacks are invoked during system resume, the PM-runtime status will be set to "active" (by the core). Signed-off-by: Rafael J. Wysocki <[email protected]> Acked-by: Alan Stern <[email protected]> Acked-by: Bjorn Helgaas <[email protected]>
2020-04-24Merge branch 'acpi-pci'Rafael J. Wysocki1-2/+2
* acpi-pci: ACPI/PCI: pci_link: use extended_irq union member when setting ext-irq shareable