Changes in 4.9.168 arm64: debug: Don't propagate UNKNOWN FAR into si_code for debug signals arm64: debug: Ensure debug handlers check triggering exception level ext4: cleanup bh release code in ext4_ind_remove_space() lib/int_sqrt: optimize initial value compute tty/serial: atmel: Add is_half_duplex helper tty/serial: atmel: RS485 HD w/DMA: enable RX after TX is stopped mm: mempolicy: make mbind() return -EIO when MPOL_MF_STRICT is specified i2c: core-smbus: prevent stack corruption on read I2C_BLOCK_DATA CIFS: fix POSIX lock leak and invalid ptr deref h8300: use cc-cross-prefix instead of hardcoding h8300-unknown-linux- tracing: kdb: Fix ftdump to not sleep gpio: gpio-omap: fix level interrupt idling include/linux/relay.h: fix percpu annotation in struct rchan sysctl: handle overflow for file-max enic: fix build warning without CONFIG_CPUMASK_OFFSTACK scsi: hisi_sas: Set PHY linkrate when disconnected mm/cma.c: cma_declare_contiguous: correct err handling mm/page_ext.c: fix an imbalance with kmemleak mm/vmalloc.c: fix kernel BUG at mm/vmalloc.c:512! mm/slab.c: kmemleak no scan alien caches ocfs2: fix a panic problem caused by o2cb_ctl f2fs: do not use mutex lock in atomic context fs/file.c: initialize init_files.resize_wait cifs: use correct format characters dm thin: add sanity checks to thin-pool and external snapshot creation cifs: Fix NULL pointer dereference of devname jbd2: fix invalid descriptor block checksum fs: fix guard_bio_eod to check for real EOD errors tools lib traceevent: Fix buffer overflow in arg_eval wil6210: check null pointer in _wil_cfg80211_merge_extra_ies crypto: crypto4xx - add missing of_node_put after of_device_is_available usb: chipidea: Grab the (legacy) USB PHY by phandle first scsi: core: replace GFP_ATOMIC with GFP_KERNEL in scsi_scan.c coresight: etm4x: Add support to enable ETMv4.2 ARM: 8840/1: use a raw_spinlock_t in unwind iommu/io-pgtable-arm-v7s: Only kmemleak_ignore L2 tables mmc: omap: fix the maximum timeout setting e1000e: Fix -Wformat-truncation warnings mlxsw: spectrum: Avoid -Wformat-truncation warnings IB/mlx4: Increase the timeout for CM cache scsi: megaraid_sas: return error when create DMA pool failed perf test: Fix failure of 'evsel-tp-sched' test on s390 SoC: imx-sgtl5000: add missing put_device() media: sh_veu: Correct return type for mem2mem buffer helpers media: s5p-jpeg: Correct return type for mem2mem buffer helpers media: s5p-g2d: Correct return type for mem2mem buffer helpers media: mx2_emmaprp: Correct return type for mem2mem buffer helpers vfs: fix preadv64v2 and pwritev64v2 compat syscalls with offset == -1 HID: intel-ish-hid: avoid binding wrong ishtp_cl_device leds: lp55xx: fix null deref on firmware load failure iwlwifi: pcie: fix emergency path ACPI / video: Refactor and fix dmi_is_desktop() kprobes: Prohibit probing on bsearch() ARM: 8833/1: Ensure that NEON code always compiles with Clang ALSA: PCM: check if ops are defined before suspending PCM usb: f_fs: Avoid crash due to out-of-scope stack ptr access bcache: fix input overflow to cache set sysfs file io_error_halflife bcache: fix input overflow to sequential_cutoff bcache: improve sysfs_strtoul_clamp() genirq: Avoid summation loops for /proc/stat iw_cxgb4: fix srqidx leak during connection abort fbdev: fbmem: fix memory access if logo is bigger than the screen cdrom: Fix race condition in cdrom_sysctl_register e1000e: fix cyclic resets at link up with active tx ASoC: fsl-asoc-card: fix object reference leaks in fsl_asoc_card_probe efi/memattr: Don't bail on zero VA if it equals the region's PA ARM: dts: lpc32xx: Remove leading 0x and 0s from bindings notation soc: qcom: gsbi: Fix error handling in gsbi_probe() mt7601u: bump supported EEPROM version ARM: avoid Cortex-A9 livelock on tight dmb loops tty: increase the default flip buffer limit to 2*640K powerpc/pseries: Perform full re-add of CPU for topology update post-migration media: mt9m111: set initial frame size other than 0x0 hwrng: virtio - Avoid repeated init of completion soc/tegra: fuse: Fix illegal free of IO base address HID: intel-ish: ipc: handle PIMR before ish_wakeup also clear PISR busy_clear bit hpet: Fix missing '=' character in the __setup() code of hpet_mmap_enable dmaengine: imx-dma: fix warning comparison of distinct pointer types dmaengine: qcom_hidma: assign channel cookie correctly netfilter: physdev: relax br_netfilter dependency media: s5p-jpeg: Check for fmt_ver_flag when doing fmt enumeration regulator: act8865: Fix act8600_sudcdc_voltage_ranges setting drm/nouveau: Stop using drm_crtc_force_disable x86/build: Specify elf_i386 linker emulation explicitly for i386 objects selinux: do not override context on context mounts wlcore: Fix memory leak in case wl12xx_fetch_firmware failure x86/build: Mark per-CPU symbols as absolute explicitly for LLD dmaengine: tegra: avoid overflow of byte tracking drm/dp/mst: Configure no_stop_bit correctly for remote i2c xfers ACPI / video: Extend chassis-type detection with a "Lunch Box" check Linux 4.9.168 Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
235 lines
7.1 KiB
C
235 lines
7.1 KiB
C
/*
|
|
* IRQ subsystem internal functions and variables:
|
|
*
|
|
* Do not ever include this file from anything else than
|
|
* kernel/irq/. Do not even think about using any information outside
|
|
* of this file for your non core code.
|
|
*/
|
|
#include <linux/irqdesc.h>
|
|
#include <linux/kernel_stat.h>
|
|
#include <linux/pm_runtime.h>
|
|
|
|
#ifdef CONFIG_SPARSE_IRQ
|
|
# define IRQ_BITMAP_BITS (NR_IRQS + 8196)
|
|
#else
|
|
# define IRQ_BITMAP_BITS NR_IRQS
|
|
#endif
|
|
|
|
#define istate core_internal_state__do_not_mess_with_it
|
|
|
|
extern bool noirqdebug;
|
|
|
|
extern struct irqaction chained_action;
|
|
|
|
/*
|
|
* Bits used by threaded handlers:
|
|
* IRQTF_RUNTHREAD - signals that the interrupt handler thread should run
|
|
* IRQTF_WARNED - warning "IRQ_WAKE_THREAD w/o thread_fn" has been printed
|
|
* IRQTF_AFFINITY - irq thread is requested to adjust affinity
|
|
* IRQTF_FORCED_THREAD - irq action is force threaded
|
|
*/
|
|
enum {
|
|
IRQTF_RUNTHREAD,
|
|
IRQTF_WARNED,
|
|
IRQTF_AFFINITY,
|
|
IRQTF_FORCED_THREAD,
|
|
};
|
|
|
|
/*
|
|
* Bit masks for desc->core_internal_state__do_not_mess_with_it
|
|
*
|
|
* IRQS_AUTODETECT - autodetection in progress
|
|
* IRQS_SPURIOUS_DISABLED - was disabled due to spurious interrupt
|
|
* detection
|
|
* IRQS_POLL_INPROGRESS - polling in progress
|
|
* IRQS_ONESHOT - irq is not unmasked in primary handler
|
|
* IRQS_REPLAY - irq is replayed
|
|
* IRQS_WAITING - irq is waiting
|
|
* IRQS_PENDING - irq is pending and replayed later
|
|
* IRQS_SUSPENDED - irq is suspended
|
|
*/
|
|
enum {
|
|
IRQS_AUTODETECT = 0x00000001,
|
|
IRQS_SPURIOUS_DISABLED = 0x00000002,
|
|
IRQS_POLL_INPROGRESS = 0x00000008,
|
|
IRQS_ONESHOT = 0x00000020,
|
|
IRQS_REPLAY = 0x00000040,
|
|
IRQS_WAITING = 0x00000080,
|
|
IRQS_PENDING = 0x00000200,
|
|
IRQS_SUSPENDED = 0x00000800,
|
|
};
|
|
|
|
#include "debug.h"
|
|
#include "settings.h"
|
|
|
|
extern int __irq_set_trigger(struct irq_desc *desc, unsigned long flags);
|
|
extern void __disable_irq(struct irq_desc *desc);
|
|
extern void __enable_irq(struct irq_desc *desc);
|
|
|
|
extern int irq_startup(struct irq_desc *desc, bool resend);
|
|
extern void irq_shutdown(struct irq_desc *desc);
|
|
extern void irq_enable(struct irq_desc *desc);
|
|
extern void irq_disable(struct irq_desc *desc);
|
|
extern void irq_percpu_enable(struct irq_desc *desc, unsigned int cpu);
|
|
extern void irq_percpu_disable(struct irq_desc *desc, unsigned int cpu);
|
|
extern void mask_irq(struct irq_desc *desc);
|
|
extern void unmask_irq(struct irq_desc *desc);
|
|
extern void unmask_threaded_irq(struct irq_desc *desc);
|
|
|
|
#ifdef CONFIG_SPARSE_IRQ
|
|
static inline void irq_mark_irq(unsigned int irq) { }
|
|
#else
|
|
extern void irq_mark_irq(unsigned int irq);
|
|
#endif
|
|
|
|
extern void init_kstat_irqs(struct irq_desc *desc, int node, int nr);
|
|
|
|
irqreturn_t __handle_irq_event_percpu(struct irq_desc *desc, unsigned int *flags);
|
|
irqreturn_t handle_irq_event_percpu(struct irq_desc *desc);
|
|
irqreturn_t handle_irq_event(struct irq_desc *desc);
|
|
|
|
/* Resending of interrupts :*/
|
|
void check_irq_resend(struct irq_desc *desc);
|
|
bool irq_wait_for_poll(struct irq_desc *desc);
|
|
void __irq_wake_thread(struct irq_desc *desc, struct irqaction *action);
|
|
|
|
#ifdef CONFIG_PROC_FS
|
|
extern void register_irq_proc(unsigned int irq, struct irq_desc *desc);
|
|
extern void unregister_irq_proc(unsigned int irq, struct irq_desc *desc);
|
|
extern void register_handler_proc(unsigned int irq, struct irqaction *action);
|
|
extern void unregister_handler_proc(unsigned int irq, struct irqaction *action);
|
|
#else
|
|
static inline void register_irq_proc(unsigned int irq, struct irq_desc *desc) { }
|
|
static inline void unregister_irq_proc(unsigned int irq, struct irq_desc *desc) { }
|
|
static inline void register_handler_proc(unsigned int irq,
|
|
struct irqaction *action) { }
|
|
static inline void unregister_handler_proc(unsigned int irq,
|
|
struct irqaction *action) { }
|
|
#endif
|
|
|
|
extern bool irq_can_set_affinity_usr(unsigned int irq);
|
|
|
|
extern int irq_select_affinity_usr(unsigned int irq, struct cpumask *mask);
|
|
|
|
extern void irq_set_thread_affinity(struct irq_desc *desc);
|
|
|
|
extern int irq_do_set_affinity(struct irq_data *data,
|
|
const struct cpumask *dest, bool force);
|
|
|
|
/* Inline functions for support of irq chips on slow busses */
|
|
static inline void chip_bus_lock(struct irq_desc *desc)
|
|
{
|
|
if (unlikely(desc->irq_data.chip->irq_bus_lock))
|
|
desc->irq_data.chip->irq_bus_lock(&desc->irq_data);
|
|
}
|
|
|
|
static inline void chip_bus_sync_unlock(struct irq_desc *desc)
|
|
{
|
|
if (unlikely(desc->irq_data.chip->irq_bus_sync_unlock))
|
|
desc->irq_data.chip->irq_bus_sync_unlock(&desc->irq_data);
|
|
}
|
|
|
|
#define _IRQ_DESC_CHECK (1 << 0)
|
|
#define _IRQ_DESC_PERCPU (1 << 1)
|
|
|
|
#define IRQ_GET_DESC_CHECK_GLOBAL (_IRQ_DESC_CHECK)
|
|
#define IRQ_GET_DESC_CHECK_PERCPU (_IRQ_DESC_CHECK | _IRQ_DESC_PERCPU)
|
|
|
|
#define for_each_action_of_desc(desc, act) \
|
|
for (act = desc->act; act; act = act->next)
|
|
|
|
struct irq_desc *
|
|
__irq_get_desc_lock(unsigned int irq, unsigned long *flags, bool bus,
|
|
unsigned int check);
|
|
void __irq_put_desc_unlock(struct irq_desc *desc, unsigned long flags, bool bus);
|
|
|
|
static inline struct irq_desc *
|
|
irq_get_desc_buslock(unsigned int irq, unsigned long *flags, unsigned int check)
|
|
{
|
|
return __irq_get_desc_lock(irq, flags, true, check);
|
|
}
|
|
|
|
static inline void
|
|
irq_put_desc_busunlock(struct irq_desc *desc, unsigned long flags)
|
|
{
|
|
__irq_put_desc_unlock(desc, flags, true);
|
|
}
|
|
|
|
static inline struct irq_desc *
|
|
irq_get_desc_lock(unsigned int irq, unsigned long *flags, unsigned int check)
|
|
{
|
|
return __irq_get_desc_lock(irq, flags, false, check);
|
|
}
|
|
|
|
static inline void
|
|
irq_put_desc_unlock(struct irq_desc *desc, unsigned long flags)
|
|
{
|
|
__irq_put_desc_unlock(desc, flags, false);
|
|
}
|
|
|
|
#define __irqd_to_state(d) ACCESS_PRIVATE((d)->common, state_use_accessors)
|
|
|
|
/*
|
|
* Manipulation functions for irq_data.state
|
|
*/
|
|
static inline void irqd_set_move_pending(struct irq_data *d)
|
|
{
|
|
__irqd_to_state(d) |= IRQD_SETAFFINITY_PENDING;
|
|
}
|
|
|
|
static inline void irqd_clr_move_pending(struct irq_data *d)
|
|
{
|
|
__irqd_to_state(d) &= ~IRQD_SETAFFINITY_PENDING;
|
|
}
|
|
|
|
static inline void irqd_clear(struct irq_data *d, unsigned int mask)
|
|
{
|
|
__irqd_to_state(d) &= ~mask;
|
|
}
|
|
|
|
static inline void irqd_set(struct irq_data *d, unsigned int mask)
|
|
{
|
|
__irqd_to_state(d) |= mask;
|
|
}
|
|
|
|
static inline bool irqd_has_set(struct irq_data *d, unsigned int mask)
|
|
{
|
|
return __irqd_to_state(d) & mask;
|
|
}
|
|
|
|
#undef __irqd_to_state
|
|
|
|
static inline void __kstat_incr_irqs_this_cpu(struct irq_desc *desc)
|
|
{
|
|
__this_cpu_inc(*desc->kstat_irqs);
|
|
__this_cpu_inc(kstat.irqs_sum);
|
|
}
|
|
|
|
static inline void kstat_incr_irqs_this_cpu(struct irq_desc *desc)
|
|
{
|
|
__kstat_incr_irqs_this_cpu(desc);
|
|
desc->tot_count++;
|
|
}
|
|
|
|
static inline int irq_desc_get_node(struct irq_desc *desc)
|
|
{
|
|
return irq_common_data_get_node(&desc->irq_common_data);
|
|
}
|
|
|
|
static inline int irq_desc_is_chained(struct irq_desc *desc)
|
|
{
|
|
return (desc->action && desc->action == &chained_action);
|
|
}
|
|
|
|
#ifdef CONFIG_PM_SLEEP
|
|
bool irq_pm_check_wakeup(struct irq_desc *desc);
|
|
void irq_pm_install_action(struct irq_desc *desc, struct irqaction *action);
|
|
void irq_pm_remove_action(struct irq_desc *desc, struct irqaction *action);
|
|
#else
|
|
static inline bool irq_pm_check_wakeup(struct irq_desc *desc) { return false; }
|
|
static inline void
|
|
irq_pm_install_action(struct irq_desc *desc, struct irqaction *action) { }
|
|
static inline void
|
|
irq_pm_remove_action(struct irq_desc *desc, struct irqaction *action) { }
|
|
#endif
|