summaryrefslogtreecommitdiff
path: root/drivers/acpi
AgeCommit message (Collapse)Author
2017-04-28Merge branches 'acpi-processor', 'acpi-cppc' and 'acpi-pmic'Rafael J. Wysocki
* acpi-processor: ACPI / Processor: Drop setup_max_cpus check from acpi_processor_add() * acpi-cppc: ACPI / CPPC: add sysfs entries for CPPC perf capabilities ACPI / CPPC: Read lowest nonlinear perf in cppc_get_perf_caps() * acpi-pmic: ACPI / PMIC: Stop xpower OPRegion handler relying on IIO ACPI / PMIC: Add opregion driver for Intel CHT Whiskey Cove PMIC
2017-04-28Merge branches 'acpi-scan', 'acpi-tables' and 'acpi-platform'Rafael J. Wysocki
* acpi-scan: ACPI / scan: Avoid enumerating devices more than once ACPI / scan: Apply default enumeration to devices with ACPI drivers ACPI / scan: Drop support for force_remove * acpi-tables: ACPI / tables: Drop acpi_parse_entries() which is not used * acpi-platform: ACPI / platform: Update platform device NUMA node based on _PXM method
2017-04-28ACPICA: iasl: add ASL conversion toolBob Moore
ACPICA commit c04d310039d3e0ed1cb62876fe7e596fbc75ab01 ACPICA commit a65c1df7e6b4bad8e37df822018c40c6c446add9 The key feature of this utility is that the original comments within the input ASL files are preserved during the conversion process, and included within the converted ASL+ file -- thus creating a transparent conversion of existing ASL files to ASL+ (ASL 2.0) This patch is an automatic generation of the ASL converter commit, Linux kernel isn't affected by the functionality provided in this commit, but requires the linuxized changes to support future ACPICA release automation. Link: https://github.com/acpica/acpica/commit/c04d3100 Link: https://github.com/acpica/acpica/commit/a65c1df7 Signed-off-by: Bob Moore <robert.moore@intel.com> Signed-off-by: Jung-uk Kim <jkim@FreeBSD.org> Signed-off-by: Lv Zheng <lv.zheng@intel.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2017-04-27mfd: intel_soc_pmic: Fix a mess with compilation unitsAndy Shevchenko
Crystal Cove and Whiskey Cove are two different PMICs which are installed on Intel Atom SoC based platforms. Moreover there are two independent drivers that by some reason were supposed (*) to get into one kernel module. Fix the mess by clarifying Kconfig option for Crystal Cove and split Whiskey Cove out of it. (*) It looks like the configuration was never tested with INTEL_SOC_PMIC=n. The line in Makefile is actually wrong. Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net> (supporter:ACPI) Acked-by: Linus Walleij <linus.walleij@linaro.org> Acked-by: Zhang Rui <rui.zhang@intel.com> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Lee Jones <lee.jones@linaro.org>
2017-04-27ACPICA: Local cache support: Allow small cache objectsBob Moore
ACPICA commit 9c54b8bbd483421ef2fef5225c00f1655b4a491c Remove apparently arbitrary restriction on the size of the cache objects to 16 (in acpi_os_create_cache). Now, the input object size must be simply non-zero. Link: https://github.com/acpica/acpica/commit/9c54b8bb Signed-off-by: Bob Moore <robert.moore@intel.com> Signed-off-by: Lv Zheng <lv.zheng@intel.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2017-04-27ACPICA: Disassembler: Do not unconditionally remove temporary namesDavid E. Box
ACPICA commit c46f496df41e53a368f877f88b70bdfc9bd6fdbe Change the Switch disassembly code to check if the conversion can be done before removing temporary (_T_x) names. Prevents invalid disassembly of AML created by older compilers (circa 2005). Link: https://github.com/acpica/acpica/commit/c46f496d Link: https://bugs.acpica.org/show_bug.cgi?id=1358 Link: https://bugs.acpica.org/show_bug.cgi?id=1360 Reported-by: racerrehabman@gmail.com Signed-off-by: David E. Box <david.e.box@linux.intel.com> Signed-off-by: Bob Moore <robert.moore@intel.com> Signed-off-by: Lv Zheng <lv.zheng@intel.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2017-04-27ACPICA: Cleanup AML opcode definitions, no functional changeBob Moore
ACPICA commit ec969d38fef3be95358e65f0dd071b5f2c045b6b This change is a cleanup and further standardization of the AML opcode defines in amlcode.h Improves the readability and maintainability of the source code. Link: https://github.com/acpica/acpica/commit/ec969d38 Signed-off-by: Bob Moore <robert.moore@intel.com> Signed-off-by: Lv Zheng <lv.zheng@intel.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2017-04-27ACPICA: Debugger: Add interpreter blocking mark for single-step modeLv Zheng
ACPICA commit 91af5d18cd40b35f9d5568fb95fc403ff12474e5 When the single-step mode is used, evaluation is actually split by the single-step command prompts, so this patch correctly marks the evaluation segment with interpreter lock release/acquire. This in return fixes an issue that in the single-step command prompt, commands requiring to hold the namespace lock (ex. namespace) cannot be executed. ACPICA BZ 1362, fixed by Lv Zheng. Link: https://github.com/acpica/acpica/commit/91af5d18 Link: https://bugs.acpica.org/show_bug.cgi?id=1362 Signed-off-by: Lv Zheng <lv.zheng@intel.com> Signed-off-by: Bob Moore <robert.moore@intel.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2017-04-27ACPICA: debugger: fix memory leak on PathnameColin Ian King
ACPICA commit 1db14dc88f308119634d77ab9dcb6586b9fe4777 On the error return path when acpi_get_object_info fails the allocated pathname is not free'd leading to a memory leak. Free pathname to fix this. Link: https://github.com/acpica/acpica/commit/1db14dc8 Signed-off-by: Colin Ian King <colin.king@canonical.com> Signed-off-by: Bob Moore <robert.moore@intel.com> Signed-off-by: Lv Zheng <lv.zheng@intel.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2017-04-27ACPICA: Update for automatic repair code for objects returned by evaluate_objectBob Moore
ACPICA commit 6b58810b9aad7358fbf1a0f4057fefa8d29838d3 This change fixes two instances where the repair code made an incorrect assumption about how reference counts are assigned to package objects. Resolves issues where a warning was issued about a "large reference count" -- which usually indicates an attempt to delete an object that has previously been poisoned and released into the object cache. Link: https://github.com/acpica/acpica/commit/6b58810b Signed-off-by: Bob Moore <robert.moore@intel.com> Signed-off-by: Lv Zheng <lv.zheng@intel.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2017-04-27ACPICA: Namespace: fix operand cache leakSeunghun Han
ACPICA commit a23325b2e583556eae88ed3f764e457786bf4df6 I found some ACPI operand cache leaks in ACPI early abort cases. Boot log of ACPI operand cache leak is as follows: >[ 0.174332] ACPI: Added _OSI(Module Device) >[ 0.175504] ACPI: Added _OSI(Processor Device) >[ 0.176010] ACPI: Added _OSI(3.0 _SCP Extensions) >[ 0.177032] ACPI: Added _OSI(Processor Aggregator Device) >[ 0.178284] ACPI: SCI (IRQ16705) allocation failed >[ 0.179352] ACPI Exception: AE_NOT_ACQUIRED, Unable to install System Control Interrupt handler (20160930/evevent-131) >[ 0.180008] ACPI: Unable to start the ACPI Interpreter >[ 0.181125] ACPI Error: Could not remove SCI handler (20160930/evmisc-281) >[ 0.184068] kmem_cache_destroy Acpi-Operand: Slab cache still has objects >[ 0.185358] CPU: 0 PID: 1 Comm: swapper/0 Not tainted 4.10.0-rc3 #2 >[ 0.186820] Hardware name: innotek gmb_h virtual_box/virtual_box, BIOS virtual_box 12/01/2006 >[ 0.188000] Call Trace: >[ 0.188000] ? dump_stack+0x5c/0x7d >[ 0.188000] ? kmem_cache_destroy+0x224/0x230 >[ 0.188000] ? acpi_sleep_proc_init+0x22/0x22 >[ 0.188000] ? acpi_os_delete_cache+0xa/0xd >[ 0.188000] ? acpi_ut_delete_caches+0x3f/0x7b >[ 0.188000] ? acpi_terminate+0x5/0xf >[ 0.188000] ? acpi_init+0x288/0x32e >[ 0.188000] ? __class_create+0x4c/0x80 >[ 0.188000] ? video_setup+0x7a/0x7a >[ 0.188000] ? do_one_initcall+0x4e/0x1b0 >[ 0.188000] ? kernel_init_freeable+0x194/0x21a >[ 0.188000] ? rest_init+0x80/0x80 >[ 0.188000] ? kernel_init+0xa/0x100 >[ 0.188000] ? ret_from_fork+0x25/0x30 When early abort is occurred due to invalid ACPI information, Linux kernel terminates ACPI by calling acpi_terminate() function. The function calls acpi_ns_terminate() function to delete namespace data and ACPI operand cache (acpi_gbl_module_code_list). But the deletion code in acpi_ns_terminate() function is wrapped in ACPI_EXEC_APP definition, therefore the code is only executed when the definition exists. If the define doesn't exist, ACPI operand cache (acpi_gbl_module_code_list) is leaked, and stack dump is shown in kernel log. This causes a security threat because the old kernel (<= 4.9) shows memory locations of kernel functions in stack dump, therefore kernel ASLR can be neutralized. To fix ACPI operand leak for enhancing security, I made a patch which removes the ACPI_EXEC_APP define in acpi_ns_terminate() function for executing the deletion code unconditionally. Link: https://github.com/acpica/acpica/commit/a23325b2 Signed-off-by: Seunghun Han <kkamagui@gmail.com> Signed-off-by: Lv Zheng <lv.zheng@intel.com> Signed-off-by: Bob Moore <robert.moore@intel.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2017-04-27ACPICA: Fix several incorrect invocations of ACPICA return macroBob Moore
ACPICA commit 521bedc49b42e59116de1b54dcd95d30d36cac90 Not needed since there is no function tracing for the validation function in hwvalid.c Link: https://github.com/acpica/acpica/commit/521bedc4 Signed-off-by: Bob Moore <robert.moore@intel.com> Signed-off-by: Lv Zheng <lv.zheng@intel.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2017-04-27ACPICA: Fix a module for excessive debug outputBob Moore
ACPICA commit 5ecc479f62a57ab1e9d25ec3b0b84682fdf8a543 hwvalid.c - no trace needed for validate I/O function. Link: https://github.com/acpica/acpica/commit/5ecc479f Signed-off-by: Bob Moore <robert.moore@intel.com> Signed-off-by: Lv Zheng <lv.zheng@intel.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2017-04-27ACPICA: Update some function headers, no funtional changeBob Moore
ACPICA commit 57c1b2d3e2f9ff7f465b0f08bfb38294101fe0b3 utxferror, update function headers. Link: https://github.com/acpica/acpica/commit/57c1b2d3 Signed-off-by: Bob Moore <robert.moore@intel.com> Signed-off-by: Lv Zheng <lv.zheng@intel.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2017-04-27ACPICA: Disassembler: Enhance resource descriptor detectionBob Moore
ACPICA commit ba5020b2dbe1538e4ccd7ac2dfd8843a690c007f This change enhances the detection of resource descriptors within a buffer object. For the end_tag opcode, the second byte is defined to be either a checksum or zero. All known ASL compilers insert a zero for this byte. The disassembler now ensures this byte is zero before deciding that a buffer should be disassembled to a resource descriptor. This helps eliminate incorrect decisions when attempting to disassemble a buffer to a resource descriptor. Link: https://github.com/acpica/acpica/commit/ba5020b2 Signed-off-by: Bob Moore <robert.moore@intel.com> Signed-off-by: Lv Zheng <lv.zheng@intel.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2017-04-27ACPI / sysfs: fix acpi_get_table() leak / acpi-sysfs denial of serviceDan Williams
Reading an ACPI table through the /sys/firmware/acpi/tables interface more than 65,536 times leads to the following log message: ACPI Error: Table ffff88033595eaa8, Validation count is zero after increment (20170119/tbutils-423) ...and the table being unavailable until the next reboot. Add the missing acpi_put_table() so the table ->validation_count is decremented after each read. Reported-by: Anush Seetharaman <anush.seetharaman@intel.com> Fixes: 174cc7187e6f "ACPICA: Tables: Back port acpi_get_table_with_size() ..." Signed-off-by: Dan Williams <dan.j.williams@intel.com> Cc: 4.10+ <stable@vger.kernel.org> # 4.10+ Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2017-04-27ACPI / APD: Add clock frequency for Hisilicon Hip07/08 I2C controllerHanjun Guo
I2C clock frequency of Designware ip for Hisilicon Hip07 is 200M, but 250M for Hip08, use two ACPI IDs to differentiate them. Signed-off-by: Hanjun Guo <hanjun.guo@linaro.org> Reviewed-by: Kefeng Wang <wangkefeng.wang@huawei.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2017-04-27ACPI / bus: Add INT0002 to list of always-present devicesHans de Goede
The INT0002 device is necessary to clear wakeup interrupt sources on Cherry Trail devices, without it we get nobody cared IRQ msgs and some systems don't properly resume at all without it. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2017-04-27ACPI / bus: Introduce a list of ids for "always present" devicesHans de Goede
Several Bay / Cherry Trail devices (all of which ship with Windows 10) hide the LPSS PWM controller in ACPI, typically the _STA method looks like this: Method (_STA, 0, NotSerialized) // _STA: Status { If (OSID == One) { Return (Zero) } Return (0x0F) } Where OSID is some dark magic seen in all Cherry Trail ACPI tables making the machine behave differently depending on which OS it *thinks* it is booting, this gets set in a number of ways which we cannot control, on some newer machines it simple hardcoded to "One" aka win10. This causes the PWM controller to get hidden, which means Linux cannot control the backlight level on cht based tablets / laptops. Since loading the driver for this does no harm (the only in kernel user of it is the i915 driver, which will only uses it when it needs it), this commit makes acpi_bus_get_status() always set status to ACPI_STA_DEFAULT for the LPSS PWM device, fixing the lack of backlight control. Signed-off-by: Hans de Goede <hdegoede@redhat.com> [ rjw: Rename the new file to utils.c ] Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2017-04-26Merge remote-tracking branches 'spi/topic/ti-qspi' and 'spi/topic/xlp' into ↵Mark Brown
spi-next
2017-04-25x86, dax, pmem: remove indirection around memcpy_from_pmem()Dan Williams
memcpy_from_pmem() maps directly to memcpy_mcsafe(). The wrapper serves no real benefit aside from affording a more generic function name than the x86-specific 'mcsafe'. However this would not be the first time that x86 terminology leaked into the global namespace. For lack of better name, just use memcpy_mcsafe() directly. This conversion also catches a place where we should have been using plain memcpy, acpi_nfit_blk_single_io(). Cc: <x86@kernel.org> Cc: Jan Kara <jack@suse.cz> Cc: Jeff Moyer <jmoyer@redhat.com> Cc: Ingo Molnar <mingo@redhat.com> Cc: Christoph Hellwig <hch@lst.de> Cc: "H. Peter Anvin" <hpa@zytor.com> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: Matthew Wilcox <mawilcox@microsoft.com> Cc: Ross Zwisler <ross.zwisler@linux.intel.com> Acked-by: Tony Luck <tony.luck@intel.com> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2017-04-24PCI/ACPI: Add ThunderX pass2.x 2nd node MCFG quirkTomasz Nowicki
Currently SoCs pass2.x do not emulate EA headers for ACPI boot method at all. However, for pass2.x some devices (like EDAC) advertise incorrect base addresses in their BARs which results in driver probe failure during resource request. Since all problematic blocks are on 2nd NUMA node under domain 10 add necessary quirk entry to obtain BAR addresses correction using EA header emulation. Fixes: 44f22bd91e88 ("PCI: Add MCFG quirks for Cavium ThunderX pass2.x host controller") Signed-off-by: Tomasz Nowicki <tn@semihalf.com> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com> Acked-by: Robert Richter <rrichter@cavium.com> CC: stable@vger.kernel.org # v4.10+
2017-04-21Merge back power-related ACPI material for v4.12.Rafael J. Wysocki
2017-04-21PCI/ACPI: Tidy up MCFG quirk whitespaceBjorn Helgaas
With no blank lines, it's not obvious where the macro definitions end and the uses begin. Add some blank lines and reorder the ThunderX definitions. No functional change intended. Signed-off-by: Bjorn Helgaas <bhelgaas@google.com> CC: stable@vger.kernel.org # v4.10+
2017-04-20ACPI/IORT: Remove linker section for IORT entries probingLorenzo Pieralisi
The IORT linker section introduced by commit 34ceea275f62 ("ACPI/IORT: Introduce linker section for IORT entries probing") was needed to make sure SMMU drivers are registered (and therefore probed) in the kernel before devices using the SMMU have a chance to probe in turn. Through the introduction of deferred IOMMU configuration the linker section based IORT probing infrastructure is not needed any longer, in that device/SMMU probe dependencies are managed through the probe deferral mechanism, making the IORT linker section infrastructure unused, so that it can be removed. Remove the unused IORT linker section probing infrastructure from the kernel to complete the ACPI IORT IOMMU configure probe deferral mechanism implementation. Tested-by: Hanjun Guo <hanjun.guo@linaro.org> Reviewed-by: Robin Murphy <robin.murphy@arm.com> Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com> Cc: Sricharan R <sricharan@codeaurora.org> Signed-off-by: Joerg Roedel <jroedel@suse.de>
2017-04-20drivers: acpi: Handle IOMMU lookup failure with deferred probing or errorSricharan R
This is an equivalent to the DT's handling of the iommu master's probe with deferred probing when the corrsponding iommu is not probed yet. The lack of a registered IOMMU can be caused by the lack of a driver for the IOMMU, the IOMMU device probe not having been performed yet, having been deferred, or having failed. The first case occurs when the firmware describes the bus master and IOMMU topology correctly but no device driver exists for the IOMMU yet or the device driver has not been compiled in. Return NULL, the caller will configure the device without an IOMMU. The second and third cases are handled by deferring the probe of the bus master device which will eventually get reprobed after the IOMMU. The last case is currently handled by deferring the probe of the bus master device as well. A mechanism to either configure the bus master device without an IOMMU or to fail the bus master device probe depending on whether the IOMMU is optional or mandatory would be a good enhancement. Tested-by: Hanjun Guo <hanjun.guo@linaro.org> Reviewed-by: Robin Murphy <robin.murphy@arm.com> [Lorenzo: Added fixes for dma_coherent_mask overflow, acpi_dma_configure called multiple times for same device] Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com> Signed-off-by: Sricharan R <sricharan@codeaurora.org> Signed-off-by: Joerg Roedel <jroedel@suse.de>
2017-04-20of/acpi: Configure dma operations at probe time for platform/amba/pci bus ↵Sricharan R
devices Configuring DMA ops at probe time will allow deferring device probe when the IOMMU isn't available yet. The dma_configure for the device is now called from the generic device_attach callback just before the bus/driver probe is called. This way, configuring the DMA ops for the device would be called at the same place for all bus_types, hence the deferred probing mechanism should work for all buses as well. pci_bus_add_devices (platform/amba)(_device_create/driver_register) | | pci_bus_add_device (device_add/driver_register) | | device_attach device_initial_probe | | __device_attach_driver __device_attach_driver | driver_probe_device | really_probe | dma_configure Similarly on the device/driver_unregister path __device_release_driver is called which inturn calls dma_deconfigure. This patch changes the dma ops configuration to probe time for both OF and ACPI based platform/amba/pci bus devices. Tested-by: Marek Szyprowski <m.szyprowski@samsung.com> Tested-by: Hanjun Guo <hanjun.guo@linaro.org> Reviewed-by: Robin Murphy <robin.murphy@arm.com> Acked-by: Rob Herring <robh@kernel.org> Acked-by: Bjorn Helgaas <bhelgaas@google.com> (drivers/pci part) Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Signed-off-by: Sricharan R <sricharan@codeaurora.org> Signed-off-by: Joerg Roedel <jroedel@suse.de>
2017-04-20ACPI/IORT: Add function to check SMMUs drivers presenceLorenzo Pieralisi
The IOMMU probe deferral implementation requires a mechanism to detect if drivers for SMMU components are built-in in the kernel to detect whether IOMMU configuration for a given device should be deferred (ie SMMU drivers present but still not probed) or not (drivers not present). Add a simple function to IORT to detect if SMMU drivers for SMMU components managed by IORT are built-in in the kernel. Tested-by: Hanjun Guo <hanjun.guo@linaro.org> Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com> Reviewed-by: Robin Murphy <robin.murphy@arm.com> Cc: Sricharan R <sricharan@codeaurora.org> Signed-off-by: Joerg Roedel <jroedel@suse.de>
2017-04-20ACPI / PMIC: Stop xpower OPRegion handler relying on IIOHans de Goede
The intel_pmic_xpower code provides an OPRegion handler, which must be available before other drivers using it are loaded, which can only be ensured if both the mfd and opregion drivers are built in, which is why the Kconfig option for intel_pmic_xpower is a bool. The use of IIO is causing trouble for generic distro configs here as distros will typically want to build IIO drivers as modules and there really is no reason to use IIO here. The reading of the ADC value is a single regmap_bulk_read, which is already protected against races by the regmap-lock. This commit removes the use of IIO, allowing distros to enable the driver without needing to built IIO in and also actually simplifies the code. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2017-04-20ACPI / PMIC: Add opregion driver for Intel CHT Whiskey Cove PMICHans de Goede
Add opregion driver for Intel CHT Whiskey Cove PMIC, based on various non upstreamed CHT Whiskey Cove PMIC patches. This does not include support for the Thermal opregion (DPTF) due to lacking documentation. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2017-04-19ACPI / scan: Avoid enumerating devices more than onceRafael J. Wysocki
acpi_bus_attach() does not check the visited flag for devices that have been enumerated already and some of them may be enumerated for multiple times as a result, because some callers of acpi_bus_scan() don't check the visited flag either. For this reason, modify acpi_bus_attach() to check the visited flag and avoid enumerating devices that have already been enumerated. Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Reviewed-by: Mika Westerberg <mika.westerberg@linux.intel.com> Reviewed-by: Joey Lee <jlee@suse.com>
2017-04-19ACPI / scan: Apply default enumeration to devices with ACPI driversRafael J. Wysocki
The current code in acpi_bus_attach() is inconsistent with respect to device objects with ACPI drivers bound to them, as it allows ACPI drivers to bind to device objects with existing "physical" device companions, but it doesn't allow "physical" device objects to be created for ACPI device objects with ACPI drivers bound to them. Thus, in some cases, the outcome depends on the ordering of events which is confusing at best. For this reason, modify acpi_bus_attach() to call acpi_default_enumeration() for device objects with the pnp.type.platform_id flag set regardless of whether or not any ACPI drivers are bound to them. Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Reviewed-by: Mika Westerberg <mika.westerberg@linux.intel.com> Reviewed-by: Joey Lee <jlee@suse.com>
2017-04-19ACPI / AC: Add a blacklist with PMIC ACPI HIDs with a native charger driverHans de Goede
On some systems we have a native PMIC driver which provides Mains monitoring, while the ACPI ac driver is broken on these systems due to bad DSTDs or because we do not support the proprietary and undocumented ACPI opregions these ACPI battery devices rely on (e.g. BMOP opregion). This leads for example to a ADP1 power_supply which reports itself as always online even if no mains are connected. This commit adds a blacklist with PMIC ACPI HIDs for which we've a native charger or extcon driver and makes the ACPI ac driver not register itself when a PMIC on this list is present. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2017-04-19ACPI / battery: Add a blacklist with PMIC ACPI HIDs with a native battery driverHans de Goede
On some systems we have a native PMIC driver which provides battery monitoring, while the ACPI battery driver is broken on these systems due to bad DSDTs or because we do not support the proprietary and undocumented ACPI opregions these ACPI battery devices rely on (e.g. BMOP opregion). This leads to there being 2 battery power_supply-s registed like this: ~$ acpi Battery 0: Charging, 84%, 00:49:39 until charged Battery 1: Unknown, 0%, rate information unavailable Even if the ACPI battery where to function fine (which on systems where we have a native PMIC driver it often doesn't) we still do not want to export the same battery to userspace twice. This commit adds a blacklist with PMIC ACPI HIDs for which we've a native battery driver and makes the ACPI battery driver not register itself when a PMIC on this list is present. Link: https://bugzilla.kernel.org/show_bug.cgi?id=194811 Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2017-04-19ACPI / battery: Fix acpi_battery_exit on acpi_battery_init_async errorsHans de Goede
The acpi_lock_battery_dir() / acpi_bus_register_driver() calls in acpi_battery_init_async() may fail. Check that they succeeded before undoing them. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2017-04-19ACPI / utils: Add new acpi_dev_present helperHans de Goede
acpi_dev_found just iterates over all ACPI-ids and sees if one matches. This means that it will return true for devices which are in the DSDT but disabled (their _STA method returns 0). For some drivers it is useful to be able to check if a certain HID is not only present in the namespace, but also actually present as in acpi_device_is_present() will return true for the device. For example because if a certain device is present then the driver will want to use an extcon or IIO ADC channel provided by that device. This commit adds a new acpi_dev_present helper which drivers can use to this end. Like acpi_dev_found, acpi_dev_present take a HID as argument, but it also has 2 extra optional arguments to only check for an ACPI device with a specific UID and/or HRV value. This makes it more generic and allows it to replace custom code doing similar checks in several places. Arguably acpi_dev_present is what acpi_dev_found should have been, but there are too many users to just change acpi_dev_found without the risk of breaking something. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Reviewed-by: Lukas Wunner <lukas@wunner.de> Reviewed-by: Mika Westerberg <mika.westerberg@linux.intel.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2017-04-19ACPI / video: add comments about subtle casesDmitry Frank
The comment for acpi_video_bqc_quirk is by Felipe Contreras, taken from the git history. Signed-off-by: Dmitry Frank <mail@dmitryfrank.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2017-04-19ACPI / power: Avoid maybe-uninitialized warningArnd Bergmann
gcc -O2 cannot always prove that the loop in acpi_power_get_inferred_state() is enterered at least once, so it assumes that cur_state might not get initialized: drivers/acpi/power.c: In function 'acpi_power_get_inferred_state': drivers/acpi/power.c:222:9: error: 'cur_state' may be used uninitialized in this function [-Werror=maybe-uninitialized] This sets the variable to zero at the start of the loop, to ensure that there is well-defined behavior even for an empty list. This gets rid of the warning. The warning first showed up when the -Os flag got removed in a bug fix patch in linux-4.11-rc5. I would suggest merging this addon patch on top of that bug fix to avoid introducing a new warning in the stable kernels. Fixes: 61b79e16c68d (ACPI: Fix incompatibility with mcount-based function graph tracing) Cc: All applicable <stable@vger.kernel.org> Signed-off-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2017-04-19acpi/arm64: Add SBSA Generic Watchdog support in GTDT driverFu Wei
This driver adds support for parsing SBSA Generic Watchdog timer in GTDT, parse all info in SBSA Generic Watchdog Structure in GTDT, and creating a platform device with that information. This allows the operating system to obtain device data from the resource of platform device. The platform device named "sbsa-gwdt" can be used by the ARM SBSA Generic Watchdog driver. Signed-off-by: Fu Wei <fu.wei@linaro.org> Signed-off-by: Hanjun Guo <hanjun.guo@linaro.org> Tested-by: Xiongfeng Wang <wangxiongfeng2@huawei.com> Reviewed-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com> Signed-off-by: Mark Rutland <mark.rutland@arm.com>
2017-04-19acpi/arm64: Add memory-mapped timer support in GTDT driverFu Wei
On platforms booting with ACPI, architected memory-mapped timers' configuration data is provided by firmware through the ACPI GTDT static table. The clocksource architected timer kernel driver requires a firmware interface to collect timer configuration and configure its driver. this infrastructure is present for device tree systems, but it is missing on systems booting with ACPI. Implement the kernel infrastructure required to parse the static ACPI GTDT table so that the architected timer clocksource driver can make use of it on systems booting with ACPI, therefore enabling the corresponding timers configuration. Signed-off-by: Fu Wei <fu.wei@linaro.org> Signed-off-by: Hanjun Guo <hanjun.guo@linaro.org> Acked-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com> [Mark: restructure error handling] Signed-off-by: Mark Rutland <mark.rutland@arm.com>
2017-04-19acpi/arm64: Add GTDT table parse driverFu Wei
This patch adds support for parsing arch timer info in GTDT, provides some kernel APIs to parse all the PPIs and always-on info in GTDT and export them. By this driver, we can simplify arm_arch_timer drivers, and separate the ACPI GTDT knowledge from it. Signed-off-by: Fu Wei <fu.wei@linaro.org> Signed-off-by: Hanjun Guo <hanjun.guo@linaro.org> Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Tested-by: Xiongfeng Wang <wangxiongfeng2@huawei.com> Reviewed-by: Hanjun Guo <hanjun.guo@linaro.org> Tested-by: Hanjun Guo <hanjun.guo@linaro.org> Acked-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com> Signed-off-by: Mark Rutland <mark.rutland@arm.com>
2017-04-19ACPI / video: get rid of magic numbers and use enum insteadDmitry Frank
The first two items in the _BCL method response are special: - Level when machine has full power - Level when machine is on batteries - .... actual supported levels go there .... So this commits adds an enum and uses its descriptive elements throughout the code, instead of magic numbers. Signed-off-by: Dmitry Frank <mail@dmitryfrank.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2017-04-19ACPI/APEI: Use setup_deferrable_timer()Geliang Tang
Use setup_deferrable_timer() instead of init_timer_deferrable() to simplify the code. Signed-off-by: Geliang Tang <geliangtang@gmail.com> Tested-by: Tyler Baicar <tbaicar@codeaurora.org> Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net> Cc: Len Brown <lenb@kernel.org> Cc: linux-acpi@vger.kernel.org Link: http://lkml.kernel.org/r/3afa5498142ef68256023257dad37b9f8352e65e.1489060803.git.geliangtang@gmail.com Signed-off-by: Borislav Petkov <bp@suse.de> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
2017-04-19ACPI / blacklist: add _REV quirk for Dell Inspiron 7537Kai Heng Feng
The battery can only be detected after AC power adapter event. Adding the machine to acpi_rev_dmi_table[] can work around this issue. Link: https://bugs.launchpad.net/bugs/1678590 Link: https://bugzilla.kernel.org/show_bug.cgi?id=105721 Signed-off-by: Kai-Heng Feng <kai.heng.feng@canonical.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2017-04-19ACPI / tables: Drop acpi_parse_entries() which is not usedBaoquan He
Function acpi_parse_entries() is not used any more and if necessary, acpi_table_parse_entries() can be used instead of it, so drop it. Signed-off-by: Baoquan He <bhe@redhat.com> [ rjw: Subject / changelog ] Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2017-04-18ACPI / CPPC: add sysfs entries for CPPC perf capabilitiesPrakash, Prashanth
Computed delivered performance using CPPC feedback counters are in the CPPC abstract scale, whereas cppc_cpufreq driver operates in KHz scale. Exposing the CPPC performance capabilities (highest,lowest, nominal, lowest non-linear) will allow userspace to figure out the conversion factor from CPPC abstract scale to KHz. Also rename ctr_wrap_time to wraparound_time so that show_cppc_data() macro will work with it. Signed-off-by: Prashanth Prakash <pprakash@codeaurora.org> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2017-04-18ACPI / CPPC: Read lowest nonlinear perf in cppc_get_perf_caps()Prakash, Prashanth
Read lowest non linear perf in cppc_get_perf_caps so that it can be exposed via sysfs to the usespace. Lowest non linear perf is the lowest performance level at which nonlinear power savings are achieved. Signed-off-by: Prashanth Prakash <pprakash@codeaurora.org> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2017-04-18acpi, nfit: fix module unload vs workqueue shutdown raceDan Williams
The workqueue may still be running when the devres callbacks start firing to deallocate an acpi_nfit_desc instance. Stop and flush the workqueue before letting any other devres de-allocations proceed. Reported-by: Linda Knippers <linda.knippers@hpe.com> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2017-04-18ACPI / platform: Update platform device NUMA node based on _PXM methodShanker Donthineni
The optional _PXM method evaluates to an integer that identifies the proximity domain of a device object. On ACPI based kernel boot, the field numa_node in 'struct device' is always set to -1 irrespective of _PXM value that is specified in the ACPI device object. But in case of device-tree based kernel boot the numa_node field is populated and reflects to a DT property that is specified in DTS according to the below document. https://www.kernel.org/doc/Documentation/devicetree/bindings/numa.txt http://lxr.free-electrons.com/source/drivers/of/device.c#L54 Without this patch dev_to_node() always returns -1 for all platform devices. This patch adds support for the ACPI _PXM method and updates the platform device NUMA node id using acpi_get_node() which provides the PXM-to-NUMA mapping information. The individual platform device drivers should be able to use the NUMA-aware memory allocation functions kmalloc_node() and alloc_pages_node() to improve performance. Signed-off-by: Shanker Donthineni <shankerd@codeaurora.org> Reviewed-by: Hanjun Guo <hanjun.guo@linaro.org> Tested-by: Jiandi An <anjiandi@codeaurora.org> [ rjw: Subject / changelog ] Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2017-04-18ACPI / Processor: Drop setup_max_cpus check from acpi_processor_add()Prakash, Prashanth
When maxcpus=X kernel argument is used, we parse the ACPI tables only for the first X cpus. The per-cpu ACPI data include the _PSD tables which gives information about related cpus. cppc_cpufreq and acpi-cpufreq parses the table once during init to deduce the related cpus. If a user brings a new cpu online after boot the related cpu data becomes incorrect. acpi_get_psd_map() in acpi_cppc.c returns error if it fails to find the parsed ACPI data for possible CPU resulting in cppc_cpufreq initialization failure. With this change we will probe all possible CPUs prior to cpufreq initialization, but will bring only setup_max_cpus online. nr_cpus kernel parameter can be used to restict even parsing per-cpu ACPI tables. Signed-off-by: Prashanth Prakash <pprakash@codeaurora.org> [ rjw: Subject ] Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>