Changes in 4.4.124: (98 commits)
tpm: fix potential buffer overruns caused by bit glitches on the bus
tpm_tis: fix potential buffer overruns caused by bit glitches on the bus
SMB3: Validate negotiate request must always be signed
CIFS: Enable encryption during session setup phase
staging: android: ashmem: Fix possible deadlock in ashmem_ioctl
platform/x86: asus-nb-wmi: Add wapf4 quirk for the X302UA
regulator: anatop: set default voltage selector for pcie
x86: i8259: export legacy_pic symbol
rtc: cmos: Do not assume irq 8 for rtc when there are no legacy irqs
Input: ar1021_i2c - fix too long name in driver's device table
time: Change posix clocks ops interfaces to use timespec64
ACPI/processor: Fix error handling in __acpi_processor_start()
ACPI/processor: Replace racy task affinity logic
cpufreq/sh: Replace racy task affinity logic
genirq: Use irqd_get_trigger_type to compare the trigger type for shared IRQs
i2c: i2c-scmi: add a MS HID
net: ipv6: send unsolicited NA on admin up
media/dvb-core: Race condition when writing to CAM
spi: dw: Disable clock after unregistering the host
ath: Fix updating radar flags for coutry code India
clk: ns2: Correct SDIO bits
scsi: virtio_scsi: Always try to read VPD pages
KVM: PPC: Book3S PR: Exit KVM on failed mapping
ARM: 8668/1: ftrace: Fix dynamic ftrace with DEBUG_RODATA and !FRAME_POINTER
iommu/omap: Register driver before setting IOMMU ops
md/raid10: wait up frozen array in handle_write_completed
NFS: Fix missing pg_cleanup after nfs_pageio_cond_complete()
tcp: remove poll() flakes with FastOpen
e1000e: fix timing for 82579 Gigabit Ethernet controller
ALSA: hda - Fix headset microphone detection for ASUS N551 and N751
IB/ipoib: Fix deadlock between ipoib_stop and mcast join flow
IB/ipoib: Update broadcast object if PKey value was changed in index 0
HSI: ssi_protocol: double free in ssip_pn_xmit()
IB/mlx4: Take write semaphore when changing the vma struct
IB/mlx4: Change vma from shared to private
ASoC: Intel: Skylake: Uninitialized variable in probe_codec()
Fix driver usage of 128B WQEs when WQ_CREATE is V1.
netfilter: xt_CT: fix refcnt leak on error path
openvswitch: Delete conntrack entry clashing with an expectation.
mmc: host: omap_hsmmc: checking for NULL instead of IS_ERR()
wan: pc300too: abort path on failure
qlcnic: fix unchecked return value
scsi: mac_esp: Replace bogus memory barrier with spinlock
infiniband/uverbs: Fix integer overflows
NFS: don't try to cross a mountpount when there isn't one there.
iio: st_pressure: st_accel: Initialise sensor platform data properly
mt7601u: check return value of alloc_skb
rndis_wlan: add return value validation
Btrfs: send, fix file hole not being preserved due to inline extent
mac80211: don't parse encrypted management frames in ieee80211_frame_acked
mfd: palmas: Reset the POWERHOLD mux during power off
mtip32xx: use runtime tag to initialize command header
staging: unisys: visorhba: fix s-Par to boot with option CONFIG_VMAP_STACK set to y
staging: wilc1000: fix unchecked return value
mmc: sdhci-of-esdhc: limit SD clock for ls1012a/ls1046a
ARM: DRA7: clockdomain: Change the CLKTRCTRL of CM_PCIE_CLKSTCTRL to SW_WKUP
ipmi/watchdog: fix wdog hang on panic waiting for ipmi response
ACPI / PMIC: xpower: Fix power_table addresses
drm/nouveau/kms: Increase max retries in scanout position queries.
bnx2x: Align RX buffers
power: supply: pda_power: move from timer to delayed_work
Input: twl4030-pwrbutton - use correct device for irq request
md/raid10: skip spare disk as 'first' disk
ia64: fix module loading for gcc-5.4
tcm_fileio: Prevent information leak for short reads
video: fbdev: udlfb: Fix buffer on stack
sm501fb: don't return zero on failure path in sm501fb_start()
net: hns: fix ethtool_get_strings overflow in hns driver
cifs: small underflow in cnvrtDosUnixTm()
rtc: ds1374: wdt: Fix issue with timeout scaling from secs to wdt ticks
rtc: ds1374: wdt: Fix stop/start ioctl always returning -EINVAL
perf tests kmod-path: Don't fail if compressed modules aren't supported
Bluetooth: hci_qca: Avoid setup failure on missing rampatch
media: c8sectpfe: fix potential NULL pointer dereference in c8sectpfe_timer_interrupt
drm/msm: fix leak in failed get_pages
RDMA/iwpm: Fix uninitialized error code in iwpm_send_mapinfo()
rtlwifi: rtl_pci: Fix the bug when inactiveps is enabled.
media: bt8xx: Fix err 'bt878_probe()'
media: [RESEND] media: dvb-frontends: Add delay to Si2168 restart
cros_ec: fix nul-termination for firmware build info
platform/chrome: Use proper protocol transfer function
mmc: avoid removing non-removable hosts during suspend
IB/ipoib: Avoid memory leak if the SA returns a different DGID
RDMA/cma: Use correct size when writing netlink stats
IB/umem: Fix use of npages/nmap fields
vgacon: Set VGA struct resource types
drm/omap: DMM: Check for DMM readiness after successful transaction commit
pty: cancel pty slave port buf's work in tty_release
coresight: Fix disabling of CoreSight TPIU
pinctrl: Really force states during suspend/resume
iommu/vt-d: clean up pr_irq if request_threaded_irq fails
ip6_vti: adjust vti mtu according to mtu of lower device
RDMA/ocrdma: Fix permissions for OCRDMA_RESET_STATS
nfsd4: permit layoutget of executable-only files
clk: si5351: Rename internal plls to avoid name collisions
dmaengine: ti-dma-crossbar: Fix event mapping for TPCC_EVT_MUX_60_63
RDMA/ucma: Fix access to non-initialized CM_ID object
Linux 4.4.124
Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
Conflicts:
drivers/gpu/drm/msm/msm_gem.c
349 lines
8.7 KiB
C
349 lines
8.7 KiB
C
/*
|
|
* processor_driver.c - ACPI Processor Driver
|
|
*
|
|
* Copyright (C) 2001, 2002 Andy Grover <andrew.grover@intel.com>
|
|
* Copyright (C) 2001, 2002 Paul Diefenbaugh <paul.s.diefenbaugh@intel.com>
|
|
* Copyright (C) 2004 Dominik Brodowski <linux@brodo.de>
|
|
* Copyright (C) 2004 Anil S Keshavamurthy <anil.s.keshavamurthy@intel.com>
|
|
* - Added processor hotplug support
|
|
* Copyright (C) 2013, Intel Corporation
|
|
* Rafael J. Wysocki <rafael.j.wysocki@intel.com>
|
|
*
|
|
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
*
|
|
* This program is free software; you can redistribute it and/or modify
|
|
* it under the terms of the GNU General Public License as published by
|
|
* the Free Software Foundation; either version 2 of the License, or (at
|
|
* your option) any later version.
|
|
*
|
|
* This program is distributed in the hope that it will be useful, but
|
|
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
* General Public License for more details.
|
|
*
|
|
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
*/
|
|
|
|
#include <linux/kernel.h>
|
|
#include <linux/module.h>
|
|
#include <linux/init.h>
|
|
#include <linux/cpufreq.h>
|
|
#include <linux/cpu.h>
|
|
#include <linux/cpuidle.h>
|
|
#include <linux/slab.h>
|
|
#include <linux/acpi.h>
|
|
|
|
#include <acpi/processor.h>
|
|
|
|
#include "internal.h"
|
|
|
|
#define ACPI_PROCESSOR_NOTIFY_PERFORMANCE 0x80
|
|
#define ACPI_PROCESSOR_NOTIFY_POWER 0x81
|
|
#define ACPI_PROCESSOR_NOTIFY_THROTTLING 0x82
|
|
|
|
#define _COMPONENT ACPI_PROCESSOR_COMPONENT
|
|
ACPI_MODULE_NAME("processor_driver");
|
|
|
|
MODULE_AUTHOR("Paul Diefenbaugh");
|
|
MODULE_DESCRIPTION("ACPI Processor Driver");
|
|
MODULE_LICENSE("GPL");
|
|
|
|
static int acpi_processor_start(struct device *dev);
|
|
static int acpi_processor_stop(struct device *dev);
|
|
|
|
static const struct acpi_device_id processor_device_ids[] = {
|
|
{ACPI_PROCESSOR_OBJECT_HID, 0},
|
|
{ACPI_PROCESSOR_DEVICE_HID, 0},
|
|
{"", 0},
|
|
};
|
|
MODULE_DEVICE_TABLE(acpi, processor_device_ids);
|
|
|
|
static struct device_driver acpi_processor_driver = {
|
|
.name = "processor",
|
|
.bus = &cpu_subsys,
|
|
.acpi_match_table = processor_device_ids,
|
|
.probe = acpi_processor_start,
|
|
.remove = acpi_processor_stop,
|
|
};
|
|
|
|
static void acpi_processor_notify(acpi_handle handle, u32 event, void *data)
|
|
{
|
|
struct acpi_device *device = data;
|
|
struct acpi_processor *pr;
|
|
int saved;
|
|
|
|
if (device->handle != handle)
|
|
return;
|
|
|
|
pr = acpi_driver_data(device);
|
|
if (!pr)
|
|
return;
|
|
|
|
switch (event) {
|
|
case ACPI_PROCESSOR_NOTIFY_PERFORMANCE:
|
|
saved = pr->performance_platform_limit;
|
|
acpi_processor_ppc_has_changed(pr, 1);
|
|
if (saved == pr->performance_platform_limit)
|
|
break;
|
|
acpi_bus_generate_netlink_event(device->pnp.device_class,
|
|
dev_name(&device->dev), event,
|
|
pr->performance_platform_limit);
|
|
break;
|
|
case ACPI_PROCESSOR_NOTIFY_POWER:
|
|
acpi_processor_cst_has_changed(pr);
|
|
acpi_bus_generate_netlink_event(device->pnp.device_class,
|
|
dev_name(&device->dev), event, 0);
|
|
break;
|
|
case ACPI_PROCESSOR_NOTIFY_THROTTLING:
|
|
acpi_processor_tstate_has_changed(pr);
|
|
acpi_bus_generate_netlink_event(device->pnp.device_class,
|
|
dev_name(&device->dev), event, 0);
|
|
break;
|
|
default:
|
|
ACPI_DEBUG_PRINT((ACPI_DB_INFO,
|
|
"Unsupported event [0x%x]\n", event));
|
|
break;
|
|
}
|
|
|
|
return;
|
|
}
|
|
|
|
static int __acpi_processor_start(struct acpi_device *device);
|
|
|
|
static int acpi_cpu_soft_notify(struct notifier_block *nfb,
|
|
unsigned long action, void *hcpu)
|
|
{
|
|
unsigned int cpu = (unsigned long)hcpu;
|
|
struct acpi_processor *pr = per_cpu(processors, cpu);
|
|
struct acpi_device *device;
|
|
action &= ~CPU_TASKS_FROZEN;
|
|
|
|
/*
|
|
* CPU_STARTING and CPU_DYING must not sleep. Return here since
|
|
* acpi_bus_get_device() may sleep.
|
|
*/
|
|
if (action == CPU_STARTING || action == CPU_DYING)
|
|
return NOTIFY_DONE;
|
|
|
|
if (!pr || acpi_bus_get_device(pr->handle, &device))
|
|
return NOTIFY_DONE;
|
|
|
|
if (action == CPU_ONLINE) {
|
|
/*
|
|
* CPU got physically hotplugged and onlined for the first time:
|
|
* Initialize missing things.
|
|
*/
|
|
if (pr->flags.need_hotplug_init) {
|
|
int ret;
|
|
|
|
pr_info("Will online and init hotplugged CPU: %d\n",
|
|
pr->id);
|
|
pr->flags.need_hotplug_init = 0;
|
|
ret = __acpi_processor_start(device);
|
|
WARN(ret, "Failed to start CPU: %d\n", pr->id);
|
|
} else {
|
|
/* Normal CPU soft online event. */
|
|
acpi_processor_ppc_has_changed(pr, 0);
|
|
acpi_processor_hotplug(pr);
|
|
acpi_processor_reevaluate_tstate(pr, action);
|
|
acpi_processor_tstate_has_changed(pr);
|
|
}
|
|
} else if (action == CPU_DEAD) {
|
|
/* Invalidate flag.throttling after the CPU is offline. */
|
|
acpi_processor_reevaluate_tstate(pr, action);
|
|
}
|
|
return NOTIFY_OK;
|
|
}
|
|
|
|
static struct notifier_block acpi_cpu_notifier = {
|
|
.notifier_call = acpi_cpu_soft_notify,
|
|
};
|
|
|
|
#ifdef CONFIG_ACPI_CPU_FREQ_PSS
|
|
static int acpi_pss_perf_init(struct acpi_processor *pr,
|
|
struct acpi_device *device)
|
|
{
|
|
int result = 0;
|
|
|
|
acpi_processor_ppc_has_changed(pr, 0);
|
|
|
|
acpi_processor_get_throttling_info(pr);
|
|
|
|
if (pr->flags.throttling)
|
|
pr->flags.limit = 1;
|
|
|
|
pr->cdev = thermal_cooling_device_register("Processor", device,
|
|
&processor_cooling_ops);
|
|
if (IS_ERR(pr->cdev)) {
|
|
result = PTR_ERR(pr->cdev);
|
|
return result;
|
|
}
|
|
|
|
dev_dbg(&device->dev, "registered as cooling_device%d\n",
|
|
pr->cdev->id);
|
|
|
|
result = sysfs_create_link(&device->dev.kobj,
|
|
&pr->cdev->device.kobj,
|
|
"thermal_cooling");
|
|
if (result) {
|
|
dev_err(&device->dev,
|
|
"Failed to create sysfs link 'thermal_cooling'\n");
|
|
goto err_thermal_unregister;
|
|
}
|
|
|
|
result = sysfs_create_link(&pr->cdev->device.kobj,
|
|
&device->dev.kobj,
|
|
"device");
|
|
if (result) {
|
|
dev_err(&pr->cdev->device,
|
|
"Failed to create sysfs link 'device'\n");
|
|
goto err_remove_sysfs_thermal;
|
|
}
|
|
|
|
return 0;
|
|
|
|
err_remove_sysfs_thermal:
|
|
sysfs_remove_link(&device->dev.kobj, "thermal_cooling");
|
|
err_thermal_unregister:
|
|
thermal_cooling_device_unregister(pr->cdev);
|
|
|
|
return result;
|
|
}
|
|
|
|
static void acpi_pss_perf_exit(struct acpi_processor *pr,
|
|
struct acpi_device *device)
|
|
{
|
|
if (pr->cdev) {
|
|
sysfs_remove_link(&device->dev.kobj, "thermal_cooling");
|
|
sysfs_remove_link(&pr->cdev->device.kobj, "device");
|
|
thermal_cooling_device_unregister(pr->cdev);
|
|
pr->cdev = NULL;
|
|
}
|
|
}
|
|
#else
|
|
static inline int acpi_pss_perf_init(struct acpi_processor *pr,
|
|
struct acpi_device *device)
|
|
{
|
|
return 0;
|
|
}
|
|
|
|
static inline void acpi_pss_perf_exit(struct acpi_processor *pr,
|
|
struct acpi_device *device) {}
|
|
#endif /* CONFIG_ACPI_CPU_FREQ_PSS */
|
|
|
|
static int __acpi_processor_start(struct acpi_device *device)
|
|
{
|
|
struct acpi_processor *pr = acpi_driver_data(device);
|
|
acpi_status status;
|
|
int result = 0;
|
|
|
|
if (!pr)
|
|
return -ENODEV;
|
|
|
|
if (pr->flags.need_hotplug_init)
|
|
return 0;
|
|
|
|
result = acpi_cppc_processor_probe(pr);
|
|
if (result)
|
|
return -ENODEV;
|
|
|
|
if (!cpuidle_get_driver() || acpi_processor_using_idle_driver())
|
|
acpi_processor_power_init(pr);
|
|
|
|
result = acpi_pss_perf_init(pr, device);
|
|
if (result)
|
|
goto err_power_exit;
|
|
|
|
status = acpi_install_notify_handler(device->handle, ACPI_DEVICE_NOTIFY,
|
|
acpi_processor_notify, device);
|
|
if (ACPI_SUCCESS(status))
|
|
return 0;
|
|
|
|
result = -ENODEV;
|
|
acpi_pss_perf_exit(pr, device);
|
|
|
|
err_power_exit:
|
|
acpi_processor_power_exit(pr);
|
|
return result;
|
|
}
|
|
|
|
static int acpi_processor_start(struct device *dev)
|
|
{
|
|
struct acpi_device *device = ACPI_COMPANION(dev);
|
|
int ret;
|
|
|
|
if (!device)
|
|
return -ENODEV;
|
|
|
|
/* Protect against concurrent CPU hotplug operations */
|
|
get_online_cpus();
|
|
ret = __acpi_processor_start(device);
|
|
put_online_cpus();
|
|
return ret;
|
|
}
|
|
|
|
static int acpi_processor_stop(struct device *dev)
|
|
{
|
|
struct acpi_device *device = ACPI_COMPANION(dev);
|
|
struct acpi_processor *pr;
|
|
|
|
if (!device)
|
|
return 0;
|
|
|
|
acpi_remove_notify_handler(device->handle, ACPI_DEVICE_NOTIFY,
|
|
acpi_processor_notify);
|
|
|
|
pr = acpi_driver_data(device);
|
|
if (!pr)
|
|
return 0;
|
|
acpi_processor_power_exit(pr);
|
|
|
|
acpi_pss_perf_exit(pr, device);
|
|
|
|
acpi_cppc_processor_exit(pr);
|
|
|
|
return 0;
|
|
}
|
|
|
|
/*
|
|
* We keep the driver loaded even when ACPI is not running.
|
|
* This is needed for the powernow-k8 driver, that works even without
|
|
* ACPI, but needs symbols from this driver
|
|
*/
|
|
|
|
static int __init acpi_processor_driver_init(void)
|
|
{
|
|
int result = 0;
|
|
|
|
if (acpi_disabled)
|
|
return 0;
|
|
|
|
result = driver_register(&acpi_processor_driver);
|
|
if (result < 0)
|
|
return result;
|
|
|
|
acpi_processor_syscore_init();
|
|
register_hotcpu_notifier(&acpi_cpu_notifier);
|
|
acpi_thermal_cpufreq_init();
|
|
acpi_processor_ppc_init();
|
|
acpi_processor_throttling_init();
|
|
return 0;
|
|
}
|
|
|
|
static void __exit acpi_processor_driver_exit(void)
|
|
{
|
|
if (acpi_disabled)
|
|
return;
|
|
|
|
acpi_processor_ppc_exit();
|
|
acpi_thermal_cpufreq_exit();
|
|
unregister_hotcpu_notifier(&acpi_cpu_notifier);
|
|
acpi_processor_syscore_exit();
|
|
driver_unregister(&acpi_processor_driver);
|
|
}
|
|
|
|
module_init(acpi_processor_driver_init);
|
|
module_exit(acpi_processor_driver_exit);
|
|
|
|
MODULE_ALIAS("processor");
|