summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* tasks, sched/core: Ensure tasks are available for a grace period after ↵Eric W. Biederman2019-09-252-5/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | leaving the runqueue In the ordinary case today the RCU grace period for a task_struct is triggered when another process wait's for it's zombine and causes the kernel to call release_task(). As the waiting task has to receive a signal and then act upon it before this happens, typically this will occur after the original task as been removed from the runqueue. Unfortunaty in some cases such as self reaping tasks it can be shown that release_task() will be called starting the grace period for task_struct long before the task leaves the runqueue. Therefore use put_task_struct_rcu_user() in finish_task_switch() to guarantee that the there is a RCU lifetime after the task leaves the runqueue. Besides the change in the start of the RCU grace period for the task_struct this change may cause perf_event_delayed_put and trace_sched_process_free. The function perf_event_delayed_put boils down to just a WARN_ON for cases that I assume never show happen. So I don't see any problem with delaying it. The function trace_sched_process_free is a trace point and thus visible to user space. Occassionally userspace has the strangest dependencies so this has a miniscule chance of causing a regression. This change only changes the timing of when the tracepoint is called. The change in timing arguably gives userspace a more accurate picture of what is going on. So I don't expect there to be a regression. In the case where a task self reaps we are pretty much guaranteed that the RCU grace period is delayed. So we should get quite a bit of coverage in of this worst case for the change in a normal threaded workload. So I expect any issues to turn up quickly or not at all. I have lightly tested this change and everything appears to work fine. Inspired-by: Linus Torvalds <torvalds@linux-foundation.org> Inspired-by: Oleg Nesterov <oleg@redhat.com> Signed-off-by: Eric W. Biederman <ebiederm@xmission.com> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Cc: Chris Metcalf <cmetcalf@ezchip.com> Cc: Christoph Lameter <cl@linux.com> Cc: Davidlohr Bueso <dave@stgolabs.net> Cc: Kirill Tkhai <tkhai@yandex.ru> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Mike Galbraith <efault@gmx.de> Cc: Paul E. McKenney <paulmck@kernel.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Russell King - ARM Linux admin <linux@armlinux.org.uk> Cc: Thomas Gleixner <tglx@linutronix.de> Link: https://lkml.kernel.org/r/87r24jdpl5.fsf_-_@x220.int.ebiederm.org Signed-off-by: Ingo Molnar <mingo@kernel.org>
* tasks: Add a count of task RCU usersEric W. Biederman2019-09-254-6/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | Add a count of the number of RCU users (currently 1) of the task struct so that we can later add the scheduler case and get rid of the very subtle task_rcu_dereference(), and just use rcu_dereference(). As suggested by Oleg have the count overlap rcu_head so that no additional space in task_struct is required. Inspired-by: Linus Torvalds <torvalds@linux-foundation.org> Inspired-by: Oleg Nesterov <oleg@redhat.com> Signed-off-by: Eric W. Biederman <ebiederm@xmission.com> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Cc: Chris Metcalf <cmetcalf@ezchip.com> Cc: Christoph Lameter <cl@linux.com> Cc: Davidlohr Bueso <dave@stgolabs.net> Cc: Kirill Tkhai <tkhai@yandex.ru> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Mike Galbraith <efault@gmx.de> Cc: Paul E. McKenney <paulmck@kernel.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Russell King - ARM Linux admin <linux@armlinux.org.uk> Cc: Thomas Gleixner <tglx@linutronix.de> Link: https://lkml.kernel.org/r/87woebdplt.fsf_-_@x220.int.ebiederm.org Signed-off-by: Ingo Molnar <mingo@kernel.org>
* sched/core: Convert vcpu_is_preempted() from macro to an inline functionQian Cai2019-09-181-1/+4
| | | | | | | | | | | | | | | | | | | | | | | Clang reports this warning: kernel/locking/osq_lock.c:25:19: warning: unused function 'node_cpu' [-Wunused-function] due to osq_lock() calling vcpu_is_preempted(node_cpu(node->prev))), but vcpu_is_preempted() is compiled away. Fix it by converting the dummy vcpu_is_preempted() from a macro to a proper static inline function. Signed-off-by: Qian Cai <cai@lca.pw> Acked-by: Mel Gorman <mgorman@suse.de> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: bsegall@google.com Cc: dietmar.eggemann@arm.com Cc: juri.lelli@redhat.com Cc: rostedt@goodmis.org Cc: vincent.guittot@linaro.org Link: https://lkml.kernel.org/r/1568730894-10483-1-git-send-email-cai@lca.pw Signed-off-by: Ingo Molnar <mingo@kernel.org>
* sched/fair: Remove unused cfs_rq_clock_task() functionQian Cai2019-09-171-16/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | cfs_rq_clock_task() was first introduced and used in: f1b17280efbd ("sched: Maintain runnable averages across throttled periods") Over time its use has been graduately removed by the following commits: d31b1a66cbe0 ("sched/fair: Factorize PELT update") 23127296889f ("sched/fair: Update scale invariance of PELT") Today, there is no single user left, so it can be safely removed. Found via the -Wunused-function build warning. Signed-off-by: Qian Cai <cai@lca.pw> Cc: Ben Segall <bsegall@google.com> Cc: Dietmar Eggemann <dietmar.eggemann@arm.com> Cc: Juri Lelli <juri.lelli@redhat.com> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Mel Gorman <mgorman@suse.de> Cc: Mike Galbraith <efault@gmx.de> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Steven Rostedt <rostedt@goodmis.org> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: Vincent Guittot <vincent.guittot@linaro.org> Link: https://lkml.kernel.org/r/1568668775-2127-1-git-send-email-cai@lca.pw [ Rewrote the changelog. ] Signed-off-by: Ingo Molnar <mingo@kernel.org>
* Merge tag 'platform-drivers-x86-v5.4-1' of ↵Linus Torvalds2019-09-1627-349/+728
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | git://git.infradead.org/linux-platform-drivers-x86 Pull x86 platform-drivers updates from Andy Shevchenko: - ASUS WMI driver got a couple of updates, i.e. support of FAN is fixed for recent products and the charge threshold support has been added - Two uknown key events for Dell laptops are being ignored now to avoid spamming users with harmless messages - HP ZBook 17 G5 and ASUS Zenbook UX430UNR got accelerometer support. - Intel CherryTrail platforms had a regression with wake up. Now it's fixed - Intel PMC driver got fixed in order to work nicely in Xen environment - Intel Speed Select driver provides bucket vs core count relationship. Besides that the tools has been updated for better output - The PrivacyGuard is enabled on Lenovo ThinkPad laptops - Three tablets - Trekstor Primebook C11B 2-in-1, Irbis TW90 and Chuwi Surbook Mini - got touchscreen support * tag 'platform-drivers-x86-v5.4-1' of git://git.infradead.org/linux-platform-drivers-x86: (53 commits) MAINTAINERS: Switch PDx86 subsystem status to Odd Fixes platform/x86: asus-wmi: Refactor charge threshold to use the battery hooking API platform/x86: asus-wmi: Rename CHARGE_THRESHOLD to RSOC platform/x86: asus-wmi: Reorder ASUS_WMI_CHARGE_THRESHOLD tools/power/x86/intel-speed-select: Display core count for bucket platform/x86: ISST: Allow additional TRL MSRs tools/power/x86/intel-speed-select: Fix memory leak tools/power/x86/intel-speed-select: Output success/failed for command output tools/power/x86/intel-speed-select: Output human readable CPU list tools/power/x86/intel-speed-select: Change turbo ratio output to maximum turbo frequency tools/power/x86/intel-speed-select: Switch output to MHz tools/power/x86/intel-speed-select: Simplify output for turbo-freq and base-freq tools/power/x86/intel-speed-select: Fix cpu-count output tools/power/x86/intel-speed-select: Fix help option typo tools/power/x86/intel-speed-select: Fix package typo tools/power/x86/intel-speed-select: Fix a read overflow in isst_set_tdp_level_msr() platform/x86: intel_int0002_vgpio: Use device_init_wakeup platform/x86: intel_int0002_vgpio: Fix wakeups not working on Cherry Trail platform/x86: compal-laptop: Initialize "value" in ec_read_u8() platform/x86: touchscreen_dmi: Add info for the Trekstor Primebook C11B 2-in-1 ...
| * MAINTAINERS: Switch PDx86 subsystem status to Odd FixesAndy Shevchenko2019-09-121-1/+1
| | | | | | | | | | | | Due to shift of priorities the actual status of the subsystem is Odd Fixes. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
| * platform/x86: asus-wmi: Refactor charge threshold to use the battery hooking APIKristian Klausen2019-09-101-49/+99
| | | | | | | | | | | | | | | | | | At the same time use the official naming for the knobs. Tested on a Zenbook UX430UNR. Signed-off-by: Kristian Klausen <kristian@klausen.dk> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
| * platform/x86: asus-wmi: Rename CHARGE_THRESHOLD to RSOCKristian Klausen2019-09-092-4/+4
| | | | | | | | | | | | | | | | The device is officially called "Relative state of charge" (RSOC). At the same time add the missing DEVID from the name. Signed-off-by: Kristian Klausen <kristian@klausen.dk> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
| * platform/x86: asus-wmi: Reorder ASUS_WMI_CHARGE_THRESHOLDKristian Klausen2019-09-091-1/+3
| | | | | | | | | | | | | | At the same time add a comment explaining what it is used for. Signed-off-by: Kristian Klausen <kristian@klausen.dk> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
| * tools/power/x86/intel-speed-select: Display core count for bucketSrinivas Pandruvada2019-09-093-3/+26
| | | | | | | | | | | | | | | | Read the bucket and core count relationship via MSR and display when displaying turbo ratio limits. Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
| * platform/x86: ISST: Allow additional TRL MSRsSrinivas Pandruvada2019-09-091-0/+2
| | | | | | | | | | | | | | | | Additional Turbo Ratio Limit (TRL) MSRs are required to get bucket vs core count relationship. So add them to the list of allowed MSRs. Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
| * tools/power/x86/intel-speed-select: Fix memory leakPrarit Bhargava2019-09-071-5/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | cpumasks are allocated by calling the alloc_cpu_mask() function and are never free'd. They should be free'd after the commands have run. Fix the memory leaks by calling free_cpu_set(). Signed-off-by: Prarit Bhargava <prarit@redhat.com> Acked-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> Cc: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> Cc: David Arcari <darcari@redhat.com> Cc: linux-kernel@vger.kernel.org Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
| * tools/power/x86/intel-speed-select: Output success/failed for command outputPrarit Bhargava2019-09-072-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Command output has confusing data, returning "0" on success. For example |# ./intel-speed-select -c 14 turbo-freq enable Intel(R) Speed Select Technology Executing on CPU model:106[0x6a] package-1 die-0 cpu-14 turbo-freq enable:0 To avoid confusion change the command output to 'success' or 'failed'. v2: Remove help output line. Signed-off-by: Prarit Bhargava <prarit@redhat.com> Acked-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> Cc: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> Cc: David Arcari <darcari@redhat.com> Cc: linux-kernel@vger.kernel.org Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
| * tools/power/x86/intel-speed-select: Output human readable CPU listPrarit Bhargava2019-09-071-0/+39
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The intel-speed-select tool currently only outputs a hexidecimal CPU mask, which requires translation for use with kernel parameters such as isolcpus. Along with the CPU mask, output a human readable CPU list. Signed-off-by: Prarit Bhargava <prarit@redhat.com> Acked-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> Cc: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> Cc: David Arcari <darcari@redhat.com> Cc: linux-kernel@vger.kernel.org Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
| * tools/power/x86/intel-speed-select: Change turbo ratio output to maximum ↵Prarit Bhargava2019-09-071-6/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | turbo frequency The intel-speed-select tool currently outputs the turbo ratio for every bucket. Make the output more user-friendly by changing the output to the maximum turbo frequency. Signed-off-by: Prarit Bhargava <prarit@redhat.com> Acked-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> Cc: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> Cc: David Arcari <darcari@redhat.com> Cc: linux-kernel@vger.kernel.org Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
| * tools/power/x86/intel-speed-select: Switch output to MHzPrarit Bhargava2019-09-071-10/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | These features are introduced on new processors that will never operate in the KHz range. Save some zeros and switch the output to MHz. Signed-off-by: Prarit Bhargava <prarit@redhat.com> Acked-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> Cc: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> Cc: David Arcari <darcari@redhat.com> Cc: linux-kernel@vger.kernel.org Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
| * tools/power/x86/intel-speed-select: Simplify output for turbo-freq and base-freqPrarit Bhargava2019-09-071-14/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The current output of 'intel-speed-select -c 53 perf-profile info -l 0' shows speed-select-turbo-freq-support:1 speed-select-base-freq-support:1 speed-select-base-freq-enabled:0 speed-select-turbo-freq-enabled:0 Simplify the output to single lines displaying status of disabled, enabled, and unsupported. Signed-off-by: Prarit Bhargava <prarit@redhat.com> Acked-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> Cc: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> Cc: David Arcari <darcari@redhat.com> Cc: linux-kernel@vger.kernel.org Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
| * tools/power/x86/intel-speed-select: Fix cpu-count outputPrarit Bhargava2019-09-071-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | I have a system with 28 threads/socket but intel-speed-select reports a cpu-count of 29. Fix an off-by-one error in the cpu_count() function. Signed-off-by: Prarit Bhargava <prarit@redhat.com> Acked-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> Cc: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> Cc: David Arcari <darcari@redhat.com> Cc: linux-kernel@vger.kernel.org Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
| * tools/power/x86/intel-speed-select: Fix help option typoPrarit Bhargava2019-09-071-1/+1
| | | | | | | | | | | | | | | | | | | | | | Help is -h, not --h. Signed-off-by: Prarit Bhargava <prarit@redhat.com> Acked-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> Cc: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> Cc: David Arcari <darcari@redhat.com> Cc: linux-kernel@vger.kernel.org Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
| * tools/power/x86/intel-speed-select: Fix package typoPrarit Bhargava2019-09-071-4/+4
| | | | | | | | | | | | | | | | | | | | | | packag_ should be package_. Signed-off-by: Prarit Bhargava <prarit@redhat.com> Acked-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> Cc: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> Cc: David Arcari <darcari@redhat.com> Cc: linux-kernel@vger.kernel.org Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
| * tools/power/x86/intel-speed-select: Fix a read overflow in ↵Dan Carpenter2019-09-071-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | isst_set_tdp_level_msr() The isst_send_msr_command() function will read 8 bytes but we are passing an address to an int (4 bytes) so it results in a read overflow. Fixes: 3fb4f7cd472c ("tools/power/x86: A tool to validate Intel Speed Select commands") Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Acked-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
| * platform/x86: intel_int0002_vgpio: Use device_init_wakeupHans de Goede2019-09-071-1/+9
| | | | | | | | | | | | | | | | | | | | Use device_init_wakeup and pm_wakeup_hard_event instead of directly calling pm_system_wakeup(). This is the preferred way to do this and this will allow the user to disable wakeup through INT0002 events through sysfs. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
| * platform/x86: intel_int0002_vgpio: Fix wakeups not working on Cherry TrailHans de Goede2019-09-071-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Commit 871f1f2bcb01 ("platform/x86: intel_int0002_vgpio: Only implement irq_set_wake on Bay Trail") removed the irq_set_wake method from the struct irq_chip used on Cherry Trail, but it did not set IRQCHIP_SKIP_SET_WAKE causing kernel/irq/manage.c: set_irq_wake_real() to return -ENXIO. This causes the kernel to no longer see PME events reported through the INT0002 device as wakeup events. Which e.g. breaks wakeup by the (USB) keyboard on many Cherry Trail 2-in-1 devices. Cc: stable@vger.kernel.org Fixes: 871f1f2bcb01 ("platform/x86: intel_int0002_vgpio: Only implement irq_set_wake on Bay Trail") Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
| * platform/x86: compal-laptop: Initialize "value" in ec_read_u8()Yizhuo2019-09-071-1/+1
| | | | | | | | | | | | | | | | | | In function ec_read_u8(), variable "value" could be uninitialized if ec_read() fails. However, "value" is returned directly and used in its callers. This is potentially unsafe. Signed-off-by: Yizhuo <yzhai003@ucr.edu> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
| * platform/x86: touchscreen_dmi: Add info for the Trekstor Primebook C11B 2-in-1Hans de Goede2019-09-071-0/+8
| | | | | | | | | | | | | | | | | | | | | | Add touchscreen info for the Trekstor Primebook C11B 2-in-1, note the C11B used the same touchscreen as the regular C11, so we only add a new DMI match. Cc: Thomas Hiller <thomas.hiller@gmx.de> Reported-and-tested-by: Thomas Hiller <thomas.hiller@gmx.de> Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
| * platform/x86: thinkpad_acpi: Add ThinkPad PrivacyGuardAlexander Schremmer2019-09-072-0/+128
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This feature is found optionally in T480s, T490, T490s. The feature is called lcdshadow and visible via /proc/acpi/ibm/lcdshadow. The ACPI methods \_SB.PCI0.LPCB.EC.HKEY.{GSSS,SSSS,TSSS,CSSS} are available in these machines. They get, set, toggle or change the state apparently. The patch was tested on a 5.0 series kernel on a T480s. Signed-off-by: Alexander Schremmer <alex@alexanderweb.de> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
| * platform/x86: pmc_atom: Add Siemens SIMATIC IPC227E to critclk_systems DMI tableJan Kiszka2019-09-071-0/+7
| | | | | | | | | | | | | | | | | | | | The SIMATIC IPC227E uses the PMC clock for on-board components and gets stuck during boot if the clock is disabled. Therefore, add this device to the critical systems list. Fixes: 648e921888ad ("clk: x86: Stop marking clocks as CLK_IS_CRITICAL") Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
| * platform/x86: intel_pmc_core_pltdrv: Module removal warning fixM. Vefa Bicakci2019-09-071-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | Prior to this commit, removing the intel_pmc_core_pltdrv module would cause the following warning: Device 'intel_pmc_core.0' does not have a release() function, it is broken and must be fixed. See Documentation/kobject.txt. WARNING: CPU: 0 PID: 2202 at drivers/base/core.c:1238 device_release+0x6f/0x80 This commit hence adds an empty release function for the driver. Signed-off-by: M. Vefa Bicakci <m.v.b@runbox.com> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
| * platform/x86: intel_pmc_core: Do not ioremap RAMM. Vefa Bicakci2019-09-071-2/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | On a Xen-based PVH virtual machine with more than 4 GiB of RAM, intel_pmc_core fails initialization with the following warning message from the kernel, indicating that the driver is attempting to ioremap RAM: ioremap on RAM at 0x00000000fe000000 - 0x00000000fe001fff WARNING: CPU: 1 PID: 434 at arch/x86/mm/ioremap.c:186 __ioremap_caller.constprop.0+0x2aa/0x2c0 ... Call Trace: ? pmc_core_probe+0x87/0x2d0 [intel_pmc_core] pmc_core_probe+0x87/0x2d0 [intel_pmc_core] This issue appears to manifest itself because of the following fallback mechanism in the driver: if (lpit_read_residency_count_address(&slp_s0_addr)) pmcdev->base_addr = PMC_BASE_ADDR_DEFAULT; The validity of address PMC_BASE_ADDR_DEFAULT (i.e., 0xFE000000) is not verified by the driver, which is what this patch introduces. With this patch, if address PMC_BASE_ADDR_DEFAULT is in RAM, then the driver will not attempt to ioremap the aforementioned address. Signed-off-by: M. Vefa Bicakci <m.v.b@runbox.com> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
| * platform/x86: asus-wmi: Fix condition in charge_threshold_store()Dan Carpenter2019-09-071-1/+1
| | | | | | | | | | | | | | | | This error handling is reversed so we return early. Fixes: 84d8e80b0a36 ("platform/x86: asus-wmi: Refactor charge_threshold_store()") Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
| * platform/x86: asus-wmi: Remove unnecessary blank linesAndy Shevchenko2019-08-161-13/+1
| | | | | | | | | | | | Remove blank lines where they are not needed. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
| * platform/x86: asus-wmi: Drop indentation level by inverting conditionalsAndy Shevchenko2019-08-161-24/+19
| | | | | | | | | | | | | | | | | | We have extra indentation level where it can be avoided by changing conditional to the inverted one. Do it here for three such locations in the driver. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
| * platform/x86: asus-wmi: Use clamp_val() instead of open coded variantAndy Shevchenko2019-08-161-6/+1
| | | | | | | | | | | | | | There is no need to open code clamp_val() macro implementation. Replace the corresponding lines with direct call to clamp_val(). Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
| * platform/x86: asus-wmi: Replace sscanf() with kstrtoint()Andy Shevchenko2019-08-161-15/+10
| | | | | | | | | | | | | | | | | | The use of sscanf() is an overkill here. Moreover, there is no need to check for count to be 0, since it's guaranteed by sysfs not to be. Taking above into account, replace sscanf() with kstrtoint() calls. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
| * platform/x86: asus-wmi: Refactor charge_threshold_store()Andy Shevchenko2019-08-161-3/+5
| | | | | | | | | | | | | | | | | | | | | | There are few issues with the current code: - the error code from kstrtouint() is shadowed - the error code from asus_wmi_set_devstate() is ignored - the extra check against 0 for count (this is guaranteed by sysfs) Fix these issues by doing a slight refactoring of charge_threshold_store(). Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
| * platform/x86: asus-wmi: Add support for charge thresholdKristian Klausen2019-08-162-0/+49
| | | | | | | | | | | | | | | | | | | | Most newer ASUS laptops supports limiting the battery charge level, which help prolonging the battery life. Tested on a Zenbook UX430UNR. Signed-off-by: Kristian Klausen <kristian@klausen.dk> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
| * platform/x86: asus-nb-wmi: Support ALS on the Zenbook UX430UNRKristian Klausen2019-08-161-0/+9
| | | | | | | | | | | | | | | | This patch adds support for ALS on the Zenbook UX430UNR to the asus_nb_wmi driver. Signed-off-by: Kristian Klausen <kristian@klausen.dk> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
| * platform/x86: touchscreen_dmi: Add info for the Irbis TW90 tabletHans de Goede2019-08-161-0/+26
| | | | | | | | | | | | | | | | Add touchscreen info for the Irbis TW90 tablet. Reported-by: russianneuromancer@ya.ru Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
| * platform/x86: touchscreen_dmi: Add info for the Chuwi Surbook Mini tabletGiang Le2019-08-161-0/+24
| | | | | | | | | | | | | | | | Add touchscreen platform data for the Chuwi Surbook Mini tablet. Signed-off-by: Giang Le <ohaibuzzle@gmail.com> Reviewed-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
| * platform/x86: intel_int0002_vgpio: Remove dev_err() usage after ↵Stephen Boyd2019-08-011-3/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | platform_get_irq() We don't need dev_err() messages when platform_get_irq() fails now that platform_get_irq() prints an error message itself when something goes wrong. Let's remove these prints with a simple semantic patch. // <smpl> @@ expression ret; struct platform_device *E; @@ ret = ( platform_get_irq(E, ...) | platform_get_irq_byname(E, ...) ); if ( \( ret < 0 \| ret <= 0 \) ) { ( -if (ret != -EPROBE_DEFER) -{ ... -dev_err(...); -... } | ... -dev_err(...); ) ... } // </smpl> While we're here, remove braces on if statements that only have one statement (manually). Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Cc: Enric Balletbo i Serra <enric.balletbo@collabora.com> Cc: Hans de Goede <hdegoede@redhat.com> Cc: "Darren Hart (VMware)" <dvhart@infradead.org> Cc: Roman Kiryanov <rkir@google.com> Cc: Vadim Pasternak <vadimp@mellanox.com> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Stephen Boyd <swboyd@chromium.org> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
| * platform/x86: intel_bxtwc_tmu: Remove dev_err() usage after platform_get_irq()Stephen Boyd2019-08-011-4/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We don't need dev_err() messages when platform_get_irq() fails now that platform_get_irq() prints an error message itself when something goes wrong. Let's remove these prints with a simple semantic patch. // <smpl> @@ expression ret; struct platform_device *E; @@ ret = ( platform_get_irq(E, ...) | platform_get_irq_byname(E, ...) ); if ( \( ret < 0 \| ret <= 0 \) ) { ( -if (ret != -EPROBE_DEFER) -{ ... -dev_err(...); -... } | ... -dev_err(...); ) ... } // </smpl> While we're here, remove braces on if statements that only have one statement (manually). Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Cc: Enric Balletbo i Serra <enric.balletbo@collabora.com> Cc: Hans de Goede <hdegoede@redhat.com> Cc: "Darren Hart (VMware)" <dvhart@infradead.org> Cc: Roman Kiryanov <rkir@google.com> Cc: Vadim Pasternak <vadimp@mellanox.com> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Stephen Boyd <swboyd@chromium.org> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
| * platform/mellanox: mlxreg-hotplug: Remove dev_err() usage after ↵Stephen Boyd2019-08-011-4/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | platform_get_irq() We don't need dev_err() messages when platform_get_irq() fails now that platform_get_irq() prints an error message itself when something goes wrong. Let's remove these prints with a simple semantic patch. // <smpl> @@ expression ret; struct platform_device *E; @@ ret = ( platform_get_irq(E, ...) | platform_get_irq_byname(E, ...) ); if ( \( ret < 0 \| ret <= 0 \) ) { ( -if (ret != -EPROBE_DEFER) -{ ... -dev_err(...); -... } | ... -dev_err(...); ) ... } // </smpl> While we're here, remove braces on if statements that only have one statement (manually). Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Cc: Enric Balletbo i Serra <enric.balletbo@collabora.com> Cc: Hans de Goede <hdegoede@redhat.com> Cc: "Darren Hart (VMware)" <dvhart@infradead.org> Cc: Roman Kiryanov <rkir@google.com> Cc: Vadim Pasternak <vadimp@mellanox.com> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Stephen Boyd <swboyd@chromium.org> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
| * platform/x86: intel_pmc_ipc: Remove dev_err() usage after platform_get_irq()Stephen Boyd2019-08-011-3/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We don't need dev_err() messages when platform_get_irq() fails now that platform_get_irq() prints an error message itself when something goes wrong. Let's remove these prints with a simple semantic patch. // <smpl> @@ expression ret; struct platform_device *E; @@ ret = ( platform_get_irq(E, ...) | platform_get_irq_byname(E, ...) ); if ( \( ret < 0 \| ret <= 0 \) ) { ( -if (ret != -EPROBE_DEFER) -{ ... -dev_err(...); -... } | ... -dev_err(...); ) ... } // </smpl> While we're here, remove braces on if statements that only have one statement (manually). Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Cc: Enric Balletbo i Serra <enric.balletbo@collabora.com> Cc: Hans de Goede <hdegoede@redhat.com> Cc: "Darren Hart (VMware)" <dvhart@infradead.org> Cc: Roman Kiryanov <rkir@google.com> Cc: Vadim Pasternak <vadimp@mellanox.com> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Stephen Boyd <swboyd@chromium.org> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
| * platform/x86: asus-wmi: fix CPU fan control on recent productsDaniel Drake2019-07-302-25/+101
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously, asus-wmi was using the AGFN interface and FAN_CTRL device for CPU fan control. However, this code has been found to be not fully working on some recent products, and having checked the spec, these interfaces are marked as being removed from future products currently in development. The replacement appears to be the CPU_FAN device, added in spec version 8.3 (March 2014) and present on many modern Asus laptops. Add support for this device, and use it whenever it is detected. The older approach based on AGFN and FAN_CTRL is used as a fallback on products that do not have such device. Other than switching between automatic and full speed, there is no fan speed control through this new interface. Signed-off-by: Daniel Drake <drake@endlessm.com> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
| * platform/x86: asus-wmi: add a helper for device presenceDaniel Drake2019-07-301-20/+11
| | | | | | | | | | | | | | | | | | Factor out the WLAN LED and lightbar LED presence checks into a helper function, which will also be used by the upcoming CPU fan device support. Signed-off-by: Daniel Drake <drake@endlessm.com> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
| * platform/x86: asus-wmi: cleanup AGFN fan handlingDaniel Drake2019-07-302-133/+109
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The asus-wmi driver currently uses the "AGFN" interface and the FAN_CTRL device for fan control. According to the spec, this interface is very dated and marked as pending removal from products currently in development. Clean up the way that the AGFN fan is detected and handled, also preparing the driver for the introduction of an alternate fan control method needed to support recent Asus products. Not anticipating further development of this interface, simplify the code by dropping any notion of being able to control multiple AGFN fans (this was already limited to just a single fan through only exposing a single fan in sysfs). Check for the presence of AGFN fans at probe time, simplifying the code flow in asus_hwmon_sysfs_is_visible(). Signed-off-by: Daniel Drake <drake@endlessm.com> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
| * platform/x86: pcengines-apuv2: wire up simswitch gpio as ledEnrico Weigelt2019-07-301-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | The APU3+ boards have two SIM sockets, while only one of them can be routed to the mpcie slots at a time. Selection is done via simswap gpio. We currently don't have a fitting subsystem for those cases yet, so just wire it up to a LED for the time being. While this isn't really semantically correct, it's a good compromise. Signed-off-by: Enrico Weigelt <info@metux.net> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
| * platform/x86: pcengines-apuv2: add mpcie reset gpio exportFlorian Eckert2019-07-301-0/+8
| | | | | | | | | | | | | | | | | | | | | | On APUx we have also mpcie2/mpcie3 reset pins. To make it possible to reset the ports from the userspace, add the definition to this platform device. The gpio can then be exported by the legancy gpio subsystem to toggle the mpcie reset pin. Signed-off-by: Florian Eckert <fe@dev.tdt.de> Acked-by: Enrico Weigelt <info@metux.net> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
| * platform/x86: i2c-multi-instantiate: Use struct_size() helperAndy Shevchenko2019-07-301-3/+1
| | | | | | | | | | | | | | | | | | | | | | | | One of the more common cases of allocation size calculations is finding the size of a structure that has a zero-sized array at the end, along with memory for some number of elements for that array. Make use of the struct_size() helper instead of an open-coded version in order to avoid any potential type mistakes. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Reviewed-by: Hans de Goede <hdegoede@redhat.com>
| * platform/x86: dell-wmi: Use existing defined KBD_LED_* magic valuesRhys Kidd2019-07-301-7/+7
| | | | | | | | | | | | | | These values have already been defined in platform/x86/dell-smbios.h Signed-off-by: Rhys Kidd <rhyskidd@gmail.com> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>