mirror of
https://github.com/rd-stuffs/msm-4.14.git
synced 2025-02-20 11:45:48 +08:00
* remotes/origin/tmp-474d3c4: Linux 4.14.21 ovl: hash directory inodes for fsnotify ASoC: acpi: fix machine driver selection based on quirk mmc: sdhci-of-esdhc: fix the mmc error after sleep on ls1046ardb mmc: sdhci-of-esdhc: fix eMMC couldn't work after kexec mmc: sdhci-of-esdhc: disable SD clock for clock value 0 media: r820t: fix r820t_write_reg for KASAN ARM: dts: Delete bogus reference to the charlcd arm: dts: mt2701: Add reset-cells arm: dts: mt7623: Update ethsys binding ARM: dts: s5pv210: add interrupt-parent for ohci arm64: dts: msm8916: Add missing #phy-cells ARM: pxa/tosa-bt: add MODULE_LICENSE tag ARM: dts: exynos: fix RTC interrupt for exynos5410 Bluetooth: BT_HCIUART now depends on SERIAL_DEV_BUS scsi: core: check for device state in __scsi_remove_target() x86/mm, mm/hwpoison: Don't unconditionally unmap kernel 1:1 pages usb: Move USB_UHCI_BIG_ENDIAN_* out of USB_SUPPORT mvpp2: fix multicast address filter ALSA: seq: Fix racy pool initializations ALSA: usb: add more device quirks for USB DSD devices ALSA: usb-audio: add implicit fb quirk for Behringer UFX1204 ALSA: hda/realtek: PCI quirk for Fujitsu U7x7 ALSA: hda/realtek - Enable Thinkpad Dock device for ALC298 platform ALSA: hda/realtek - Add headset mode support for Dell laptop ALSA: usb-audio: Fix UAC2 get_ctl request with a RANGE attribute ALSA: hda - Fix headset mic detection problem for two Dell machines mtd: nand: vf610: set correct ooblayout 9p/trans_virtio: discard zero-length reply Btrfs: fix unexpected -EEXIST when creating new inode Btrfs: fix use-after-free on root->orphan_block_rsv Btrfs: fix btrfs_evict_inode to handle abnormal inodes correctly Btrfs: fix extent state leak from tree log Btrfs: fix crash due to not cleaning up tree log block's dirty bits Btrfs: fix deadlock in run_delalloc_nocow dm: correctly handle chained bios in dec_pending() iscsi-target: make sure to wake up sleeping login worker target/iscsi: avoid NULL dereference in CHAP auth error path blk-wbt: account flush requests correctly xprtrdma: Fix BUG after a device removal xprtrdma: Fix calculation of ri_max_send_sges drm/qxl: reapply cursor after resetting primary qxl: alloc & use shadow for dumb buffers arm64: proc: Set PTE_NG for table entries to avoid traversing them twice rtlwifi: rtl8821ae: Fix connection lost problem correctly mpls, nospec: Sanitize array index in mpls_label_ok() tracing: Fix parsing of globs with a wildcard at the beginning seq_file: fix incomplete reset on read from zero offset xenbus: track caller request id xen: Fix {set,clear}_foreign_p2m_mapping on autotranslating guests rbd: whitelist RBD_FEATURE_OPERATIONS feature bit console/dummy: leave .con_font_get set to NULL video: fbdev: atmel_lcdfb: fix display-timings lookup PCI: keystone: Fix interrupt-controller-node lookup PCI: iproc: Fix NULL pointer dereference for BCMA PCI: Disable MSI for HiSilicon Hip06/Hip07 only in Root Port mode MIPS: Fix incorrect mem=X@Y handling MIPS: Fix typo BIG_ENDIAN to CPU_BIG_ENDIAN mm: Fix memory size alignment in devm_memremap_pages_release() mm: hide a #warning for COMPILE_TEST ext4: correct documentation for grpid mount option ext4: save error to disk in __ext4_grp_locked_error() ext4: fix a race in the ext4 shutdown path jbd2: fix sphinx kernel-doc build warnings Revert "apple-gmux: lock iGP IO to protect from vgaarb changes" mlx5: fix mlx5_get_vector_affinity to start from completion vector 0 Revert "mmc: meson-gx: include tx phase in the tuning process" mmc: bcm2835: Don't overwrite max frequency unconditionally mmc: sdhci: Implement an SDHCI-specific bounce buffer mbcache: initialize entry->e_referenced in mb_cache_entry_create() rtc-opal: Fix handling of firmware error codes, prevent busy loops drm/radeon: adjust tested variable drm/radeon: Add dpm quirk for Jet PRO (v2) arm64: Add missing Falkor part number for branch predictor hardening drm/ast: Load lut in crtc_commit drm/amd/powerplay: Fix smu_table_entry.handle type drm/qxl: unref cursor bo when finished with it drm/ttm: Fix 'buf' pointer update in ttm_bo_vm_access_kmap() (v2) drm/ttm: Don't add swapped BOs to swap-LRU list x86/entry/64: Fix CR3 restore in paranoid_exit() x86/cpu: Change type of x86_cache_size variable to unsigned int x86/spectre: Fix an error message x86/cpu: Rename cpu_data.x86_mask to cpu_data.x86_stepping selftests/x86/mpx: Fix incorrect bounds with old _sigfault x86/mm: Rename flush_tlb_single() and flush_tlb_one() to __flush_tlb_one_[user|kernel]() kmemcheck: rip it out for real kmemcheck: rip it out kmemcheck: remove whats left of NOTRACK flags kmemcheck: stop using GFP_NOTRACK and SLAB_NOTRACK kmemcheck: remove annotations x86/speculation: Add <asm/msr-index.h> dependency nospec: Move array_index_nospec() parameter checking into separate macro x86/speculation: Fix up array_index_nospec_mask() asm constraint x86/debug: Use UD2 for WARN() x86/debug, objtool: Annotate WARN()-related UD2 as reachable objtool: Fix segfault in ignore_unreachable_insn() selftests/x86: Disable tests requiring 32-bit support on pure 64-bit systems selftests/x86: Do not rely on "int $0x80" in single_step_syscall.c selftests/x86: Do not rely on "int $0x80" in test_mremap_vdso.c selftests/x86/pkeys: Remove unused functions selftests/x86: Clean up and document sscanf() usage selftests/x86: Fix vDSO selftest segfault for vsyscall=none x86/entry/64: Remove the unused 'icebp' macro x86/entry/64: Fix paranoid_entry() frame pointer warning x86/entry/64: Indent PUSH_AND_CLEAR_REGS and POP_REGS properly x86/entry/64: Get rid of the ALLOC_PT_GPREGS_ON_STACK and SAVE_AND_CLEAR_REGS macros x86/entry/64: Use PUSH_AND_CLEAN_REGS in more cases x86/entry/64: Introduce the PUSH_AND_CLEAN_REGS macro x86/entry/64: Interleave XOR register clearing with PUSH instructions x86/entry/64: Merge the POP_C_REGS and POP_EXTRA_REGS macros into a single POP_REGS macro x86/entry/64: Merge SAVE_C_REGS and SAVE_EXTRA_REGS, remove unused extensions x86/entry/64: Clear registers for exceptions/interrupts, to reduce speculation attack surface PM: cpuidle: Fix cpuidle_poll_state_init() prototype PM / runtime: Update links_count also if !CONFIG_SRCU x86/speculation: Clean up various Spectre related details KVM/nVMX: Set the CPU_BASED_USE_MSR_BITMAPS if we have a valid L02 MSR bitmap X86/nVMX: Properly set spec_ctrl and pred_cmd before merging MSRs KVM/x86: Reduce retpoline performance impact in slot_handle_level_range(), by always inlining iterator helper methods Revert "x86/speculation: Simplify indirect_branch_prediction_barrier()" x86/speculation: Correct Speculation Control microcode blacklist again x86/speculation: Update Speculation Control microcode blacklist x86/mm/pti: Fix PTI comment in entry_SYSCALL_64() powerpc/mm/radix: Split linear mapping on hot-unplug crypto: sun4i_ss_prng - convert lock to _bh in sun4i_ss_prng_generate crypto: sun4i_ss_prng - fix return value of sun4i_ss_prng_generate compiler-gcc.h: __nostackprotector needs gcc-4.4 and up compiler-gcc.h: Introduce __optimize function attribute x86/entry/64/compat: Clear registers for compat syscalls, to reduce speculation attack surface x86/entry/64: Clear extra registers beyond syscall arguments, to reduce speculation attack surface x86: PM: Make APM idle driver initialize polling state x86/xen: init %gs very early to avoid page faults with stack protector x86/kexec: Make kexec (mostly) work in 5-level paging mode x86/gpu: add CFL to early quirks drm/i915/kbl: Change a KBL pci id to GT2 from GT1.5 drm/i915: add GT number to intel_device_info arm: spear13xx: Fix spics gpio controller's warning arm: spear13xx: Fix dmas cells arm: spear600: Add missing interrupt-parent of rtc arm: dts: mt7623: fix card detection issue on bananapi-r2 ARM: dts: nomadik: add interrupt-parent for clcd ARM: dts: STi: Add gpio polarity for "hdmi,hpd-gpio" property ARM: lpc3250: fix uda1380 gpio numbers arm64: dts: msm8916: Correct ipc references for smsm s390: fix handling of -1 in set{,fs}[gu]id16 syscalls dma-buf: fix reservation_object_wait_timeout_rcu once more v2 powerpc: Fix DABR match on hash based systems powerpc/xive: Use hw CPU ids when configuring the CPU queues powerpc/mm: Flush radix process translations when setting MMU type powerpc/numa: Invalidate numa_cpu_lookup_table on cpu remove powerpc/radix: Remove trace_tlbie call from radix__flush_tlb_all ocfs2: try a blocking lock before return AOP_TRUNCATED_PAGE mwifiex: resolve reset vs. remove()/shutdown() deadlocks PM / devfreq: Propagate error from devfreq_add_device() swiotlb: suppress warning when __GFP_NOWARN is set cpufreq: powernv: Dont assume distinct pstate values for nominal and pmin RDMA/rxe: Fix rxe_qp_cleanup() RDMA/rxe: Fix a race condition in rxe_requester() RDMA/rxe: Fix a race condition related to the QP error state kselftest: fix OOM in memory compaction test selftests: seccomp: fix compile error seccomp_bpf IB/core: Avoid a potential OOPs for an unused optional parameter IB/core: Fix ib_wc structure size to remain in 64 bytes boundary IB/core: Fix two kernel warnings triggered by rxe registration IB/mlx4: Fix incorrectly releasing steerable UD QPs when have only ETH ports IB/qib: Fix comparison error with qperf compare/swap test IB/umad: Fix use of unprotected device pointer scsi: smartpqi: allow static build ("built-in") tracing: Prevent PROFILE_ALL_BRANCHES when FORTIFY_SOURCE=y Change-Id: I351a603ea607d9c158727d60c8915981a555044f Signed-off-by: Isaac J. Manjarres <isaacm@codeaurora.org>
731 lines
21 KiB
C
731 lines
21 KiB
C
/* SPDX-License-Identifier: GPL-2.0 */
|
|
/* interrupt.h */
|
|
#ifndef _LINUX_INTERRUPT_H
|
|
#define _LINUX_INTERRUPT_H
|
|
|
|
#include <linux/kernel.h>
|
|
#include <linux/linkage.h>
|
|
#include <linux/bitops.h>
|
|
#include <linux/preempt.h>
|
|
#include <linux/cpumask.h>
|
|
#include <linux/irqreturn.h>
|
|
#include <linux/irqnr.h>
|
|
#include <linux/hardirq.h>
|
|
#include <linux/irqflags.h>
|
|
#include <linux/hrtimer.h>
|
|
#include <linux/kref.h>
|
|
#include <linux/workqueue.h>
|
|
|
|
#include <linux/atomic.h>
|
|
#include <asm/ptrace.h>
|
|
#include <asm/irq.h>
|
|
#include <asm/sections.h>
|
|
|
|
/*
|
|
* These correspond to the IORESOURCE_IRQ_* defines in
|
|
* linux/ioport.h to select the interrupt line behaviour. When
|
|
* requesting an interrupt without specifying a IRQF_TRIGGER, the
|
|
* setting should be assumed to be "as already configured", which
|
|
* may be as per machine or firmware initialisation.
|
|
*/
|
|
#define IRQF_TRIGGER_NONE 0x00000000
|
|
#define IRQF_TRIGGER_RISING 0x00000001
|
|
#define IRQF_TRIGGER_FALLING 0x00000002
|
|
#define IRQF_TRIGGER_HIGH 0x00000004
|
|
#define IRQF_TRIGGER_LOW 0x00000008
|
|
#define IRQF_TRIGGER_MASK (IRQF_TRIGGER_HIGH | IRQF_TRIGGER_LOW | \
|
|
IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING)
|
|
#define IRQF_TRIGGER_PROBE 0x00000010
|
|
|
|
/*
|
|
* These flags used only by the kernel as part of the
|
|
* irq handling routines.
|
|
*
|
|
* IRQF_SHARED - allow sharing the irq among several devices
|
|
* IRQF_PROBE_SHARED - set by callers when they expect sharing mismatches to occur
|
|
* IRQF_TIMER - Flag to mark this interrupt as timer interrupt
|
|
* IRQF_PERCPU - Interrupt is per cpu
|
|
* IRQF_NOBALANCING - Flag to exclude this interrupt from irq balancing
|
|
* IRQF_IRQPOLL - Interrupt is used for polling (only the interrupt that is
|
|
* registered first in an shared interrupt is considered for
|
|
* performance reasons)
|
|
* IRQF_ONESHOT - Interrupt is not reenabled after the hardirq handler finished.
|
|
* Used by threaded interrupts which need to keep the
|
|
* irq line disabled until the threaded handler has been run.
|
|
* IRQF_NO_SUSPEND - Do not disable this IRQ during suspend. Does not guarantee
|
|
* that this interrupt will wake the system from a suspended
|
|
* state. See Documentation/power/suspend-and-interrupts.txt
|
|
* IRQF_FORCE_RESUME - Force enable it on resume even if IRQF_NO_SUSPEND is set
|
|
* IRQF_NO_THREAD - Interrupt cannot be threaded
|
|
* IRQF_EARLY_RESUME - Resume IRQ early during syscore instead of at device
|
|
* resume time.
|
|
* IRQF_COND_SUSPEND - If the IRQ is shared with a NO_SUSPEND user, execute this
|
|
* interrupt handler after suspending interrupts. For system
|
|
* wakeup devices users need to implement wakeup detection in
|
|
* their interrupt handlers.
|
|
*/
|
|
#define IRQF_SHARED 0x00000080
|
|
#define IRQF_PROBE_SHARED 0x00000100
|
|
#define __IRQF_TIMER 0x00000200
|
|
#define IRQF_PERCPU 0x00000400
|
|
#define IRQF_NOBALANCING 0x00000800
|
|
#define IRQF_IRQPOLL 0x00001000
|
|
#define IRQF_ONESHOT 0x00002000
|
|
#define IRQF_NO_SUSPEND 0x00004000
|
|
#define IRQF_FORCE_RESUME 0x00008000
|
|
#define IRQF_NO_THREAD 0x00010000
|
|
#define IRQF_EARLY_RESUME 0x00020000
|
|
#define IRQF_COND_SUSPEND 0x00040000
|
|
|
|
#define IRQF_TIMER (__IRQF_TIMER | IRQF_NO_SUSPEND | IRQF_NO_THREAD)
|
|
|
|
/*
|
|
* These values can be returned by request_any_context_irq() and
|
|
* describe the context the interrupt will be run in.
|
|
*
|
|
* IRQC_IS_HARDIRQ - interrupt runs in hardirq context
|
|
* IRQC_IS_NESTED - interrupt runs in a nested threaded context
|
|
*/
|
|
enum {
|
|
IRQC_IS_HARDIRQ = 0,
|
|
IRQC_IS_NESTED,
|
|
};
|
|
|
|
typedef irqreturn_t (*irq_handler_t)(int, void *);
|
|
|
|
/**
|
|
* struct irqaction - per interrupt action descriptor
|
|
* @handler: interrupt handler function
|
|
* @name: name of the device
|
|
* @dev_id: cookie to identify the device
|
|
* @percpu_dev_id: cookie to identify the device
|
|
* @next: pointer to the next irqaction for shared interrupts
|
|
* @irq: interrupt number
|
|
* @flags: flags (see IRQF_* above)
|
|
* @thread_fn: interrupt handler function for threaded interrupts
|
|
* @thread: thread pointer for threaded interrupts
|
|
* @secondary: pointer to secondary irqaction (force threading)
|
|
* @thread_flags: flags related to @thread
|
|
* @thread_mask: bitmask for keeping track of @thread activity
|
|
* @dir: pointer to the proc/irq/NN/name entry
|
|
*/
|
|
struct irqaction {
|
|
irq_handler_t handler;
|
|
void *dev_id;
|
|
void __percpu *percpu_dev_id;
|
|
struct irqaction *next;
|
|
irq_handler_t thread_fn;
|
|
struct task_struct *thread;
|
|
struct irqaction *secondary;
|
|
unsigned int irq;
|
|
unsigned int flags;
|
|
unsigned long thread_flags;
|
|
unsigned long thread_mask;
|
|
const char *name;
|
|
struct proc_dir_entry *dir;
|
|
} ____cacheline_internodealigned_in_smp;
|
|
|
|
extern irqreturn_t no_action(int cpl, void *dev_id);
|
|
|
|
/*
|
|
* If a (PCI) device interrupt is not connected we set dev->irq to
|
|
* IRQ_NOTCONNECTED. This causes request_irq() to fail with -ENOTCONN, so we
|
|
* can distingiush that case from other error returns.
|
|
*
|
|
* 0x80000000 is guaranteed to be outside the available range of interrupts
|
|
* and easy to distinguish from other possible incorrect values.
|
|
*/
|
|
#define IRQ_NOTCONNECTED (1U << 31)
|
|
|
|
extern int __must_check
|
|
request_threaded_irq(unsigned int irq, irq_handler_t handler,
|
|
irq_handler_t thread_fn,
|
|
unsigned long flags, const char *name, void *dev);
|
|
|
|
static inline int __must_check
|
|
request_irq(unsigned int irq, irq_handler_t handler, unsigned long flags,
|
|
const char *name, void *dev)
|
|
{
|
|
return request_threaded_irq(irq, handler, NULL, flags, name, dev);
|
|
}
|
|
|
|
extern int __must_check
|
|
request_any_context_irq(unsigned int irq, irq_handler_t handler,
|
|
unsigned long flags, const char *name, void *dev_id);
|
|
|
|
extern int __must_check
|
|
__request_percpu_irq(unsigned int irq, irq_handler_t handler,
|
|
unsigned long flags, const char *devname,
|
|
void __percpu *percpu_dev_id);
|
|
|
|
static inline int __must_check
|
|
request_percpu_irq(unsigned int irq, irq_handler_t handler,
|
|
const char *devname, void __percpu *percpu_dev_id)
|
|
{
|
|
return __request_percpu_irq(irq, handler, 0,
|
|
devname, percpu_dev_id);
|
|
}
|
|
|
|
extern const void *free_irq(unsigned int, void *);
|
|
extern void free_percpu_irq(unsigned int, void __percpu *);
|
|
|
|
struct device;
|
|
|
|
extern int __must_check
|
|
devm_request_threaded_irq(struct device *dev, unsigned int irq,
|
|
irq_handler_t handler, irq_handler_t thread_fn,
|
|
unsigned long irqflags, const char *devname,
|
|
void *dev_id);
|
|
|
|
static inline int __must_check
|
|
devm_request_irq(struct device *dev, unsigned int irq, irq_handler_t handler,
|
|
unsigned long irqflags, const char *devname, void *dev_id)
|
|
{
|
|
return devm_request_threaded_irq(dev, irq, handler, NULL, irqflags,
|
|
devname, dev_id);
|
|
}
|
|
|
|
extern int __must_check
|
|
devm_request_any_context_irq(struct device *dev, unsigned int irq,
|
|
irq_handler_t handler, unsigned long irqflags,
|
|
const char *devname, void *dev_id);
|
|
|
|
extern void devm_free_irq(struct device *dev, unsigned int irq, void *dev_id);
|
|
|
|
/*
|
|
* On lockdep we dont want to enable hardirqs in hardirq
|
|
* context. Use local_irq_enable_in_hardirq() to annotate
|
|
* kernel code that has to do this nevertheless (pretty much
|
|
* the only valid case is for old/broken hardware that is
|
|
* insanely slow).
|
|
*
|
|
* NOTE: in theory this might break fragile code that relies
|
|
* on hardirq delivery - in practice we dont seem to have such
|
|
* places left. So the only effect should be slightly increased
|
|
* irqs-off latencies.
|
|
*/
|
|
#ifdef CONFIG_LOCKDEP
|
|
# define local_irq_enable_in_hardirq() do { } while (0)
|
|
#else
|
|
# define local_irq_enable_in_hardirq() local_irq_enable()
|
|
#endif
|
|
|
|
extern void disable_irq_nosync(unsigned int irq);
|
|
extern bool disable_hardirq(unsigned int irq);
|
|
extern void disable_irq(unsigned int irq);
|
|
extern void disable_percpu_irq(unsigned int irq);
|
|
extern void enable_irq(unsigned int irq);
|
|
extern void enable_percpu_irq(unsigned int irq, unsigned int type);
|
|
extern bool irq_percpu_is_enabled(unsigned int irq);
|
|
extern void irq_wake_thread(unsigned int irq, void *dev_id);
|
|
|
|
/* The following three functions are for the core kernel use only. */
|
|
extern void suspend_device_irqs(void);
|
|
extern void resume_device_irqs(void);
|
|
|
|
/**
|
|
* struct irq_affinity_notify - context for notification of IRQ affinity changes
|
|
* @irq: Interrupt to which notification applies
|
|
* @kref: Reference count, for internal use
|
|
* @work: Work item, for internal use
|
|
* @notify: Function to be called on change. This will be
|
|
* called in process context.
|
|
* @release: Function to be called on release. This will be
|
|
* called in process context. Once registered, the
|
|
* structure must only be freed when this function is
|
|
* called or later.
|
|
*/
|
|
struct irq_affinity_notify {
|
|
unsigned int irq;
|
|
struct kref kref;
|
|
struct work_struct work;
|
|
void (*notify)(struct irq_affinity_notify *, const cpumask_t *mask);
|
|
void (*release)(struct kref *ref);
|
|
};
|
|
|
|
/**
|
|
* struct irq_affinity - Description for automatic irq affinity assignements
|
|
* @pre_vectors: Don't apply affinity to @pre_vectors at beginning of
|
|
* the MSI(-X) vector space
|
|
* @post_vectors: Don't apply affinity to @post_vectors at end of
|
|
* the MSI(-X) vector space
|
|
*/
|
|
struct irq_affinity {
|
|
int pre_vectors;
|
|
int post_vectors;
|
|
};
|
|
|
|
#if defined(CONFIG_SMP)
|
|
|
|
extern cpumask_var_t irq_default_affinity;
|
|
|
|
/* Internal implementation. Use the helpers below */
|
|
extern int __irq_set_affinity(unsigned int irq, const struct cpumask *cpumask,
|
|
bool force);
|
|
|
|
/**
|
|
* irq_set_affinity - Set the irq affinity of a given irq
|
|
* @irq: Interrupt to set affinity
|
|
* @cpumask: cpumask
|
|
*
|
|
* Fails if cpumask does not contain an online CPU
|
|
*/
|
|
static inline int
|
|
irq_set_affinity(unsigned int irq, const struct cpumask *cpumask)
|
|
{
|
|
return __irq_set_affinity(irq, cpumask, false);
|
|
}
|
|
|
|
/**
|
|
* irq_force_affinity - Force the irq affinity of a given irq
|
|
* @irq: Interrupt to set affinity
|
|
* @cpumask: cpumask
|
|
*
|
|
* Same as irq_set_affinity, but without checking the mask against
|
|
* online cpus.
|
|
*
|
|
* Solely for low level cpu hotplug code, where we need to make per
|
|
* cpu interrupts affine before the cpu becomes online.
|
|
*/
|
|
static inline int
|
|
irq_force_affinity(unsigned int irq, const struct cpumask *cpumask)
|
|
{
|
|
return __irq_set_affinity(irq, cpumask, true);
|
|
}
|
|
|
|
extern int irq_can_set_affinity(unsigned int irq);
|
|
extern int irq_select_affinity(unsigned int irq);
|
|
|
|
extern int irq_set_affinity_hint(unsigned int irq, const struct cpumask *m);
|
|
|
|
extern int
|
|
irq_set_affinity_notifier(unsigned int irq, struct irq_affinity_notify *notify);
|
|
|
|
struct cpumask *irq_create_affinity_masks(int nvec, const struct irq_affinity *affd);
|
|
int irq_calc_affinity_vectors(int minvec, int maxvec, const struct irq_affinity *affd);
|
|
|
|
#else /* CONFIG_SMP */
|
|
|
|
static inline int irq_set_affinity(unsigned int irq, const struct cpumask *m)
|
|
{
|
|
return -EINVAL;
|
|
}
|
|
|
|
static inline int irq_force_affinity(unsigned int irq, const struct cpumask *cpumask)
|
|
{
|
|
return 0;
|
|
}
|
|
|
|
static inline int irq_can_set_affinity(unsigned int irq)
|
|
{
|
|
return 0;
|
|
}
|
|
|
|
static inline int irq_select_affinity(unsigned int irq) { return 0; }
|
|
|
|
static inline int irq_set_affinity_hint(unsigned int irq,
|
|
const struct cpumask *m)
|
|
{
|
|
return -EINVAL;
|
|
}
|
|
|
|
static inline int
|
|
irq_set_affinity_notifier(unsigned int irq, struct irq_affinity_notify *notify)
|
|
{
|
|
return 0;
|
|
}
|
|
|
|
static inline struct cpumask *
|
|
irq_create_affinity_masks(int nvec, const struct irq_affinity *affd)
|
|
{
|
|
return NULL;
|
|
}
|
|
|
|
static inline int
|
|
irq_calc_affinity_vectors(int minvec, int maxvec, const struct irq_affinity *affd)
|
|
{
|
|
return maxvec;
|
|
}
|
|
|
|
#endif /* CONFIG_SMP */
|
|
|
|
/*
|
|
* Special lockdep variants of irq disabling/enabling.
|
|
* These should be used for locking constructs that
|
|
* know that a particular irq context which is disabled,
|
|
* and which is the only irq-context user of a lock,
|
|
* that it's safe to take the lock in the irq-disabled
|
|
* section without disabling hardirqs.
|
|
*
|
|
* On !CONFIG_LOCKDEP they are equivalent to the normal
|
|
* irq disable/enable methods.
|
|
*/
|
|
static inline void disable_irq_nosync_lockdep(unsigned int irq)
|
|
{
|
|
disable_irq_nosync(irq);
|
|
#ifdef CONFIG_LOCKDEP
|
|
local_irq_disable();
|
|
#endif
|
|
}
|
|
|
|
static inline void disable_irq_nosync_lockdep_irqsave(unsigned int irq, unsigned long *flags)
|
|
{
|
|
disable_irq_nosync(irq);
|
|
#ifdef CONFIG_LOCKDEP
|
|
local_irq_save(*flags);
|
|
#endif
|
|
}
|
|
|
|
static inline void disable_irq_lockdep(unsigned int irq)
|
|
{
|
|
disable_irq(irq);
|
|
#ifdef CONFIG_LOCKDEP
|
|
local_irq_disable();
|
|
#endif
|
|
}
|
|
|
|
static inline void enable_irq_lockdep(unsigned int irq)
|
|
{
|
|
#ifdef CONFIG_LOCKDEP
|
|
local_irq_enable();
|
|
#endif
|
|
enable_irq(irq);
|
|
}
|
|
|
|
static inline void enable_irq_lockdep_irqrestore(unsigned int irq, unsigned long *flags)
|
|
{
|
|
#ifdef CONFIG_LOCKDEP
|
|
local_irq_restore(*flags);
|
|
#endif
|
|
enable_irq(irq);
|
|
}
|
|
|
|
/* IRQ wakeup (PM) control: */
|
|
extern int irq_set_irq_wake(unsigned int irq, unsigned int on);
|
|
|
|
static inline int enable_irq_wake(unsigned int irq)
|
|
{
|
|
return irq_set_irq_wake(irq, 1);
|
|
}
|
|
|
|
static inline int disable_irq_wake(unsigned int irq)
|
|
{
|
|
return irq_set_irq_wake(irq, 0);
|
|
}
|
|
|
|
/*
|
|
* irq_get_irqchip_state/irq_set_irqchip_state specific flags
|
|
*/
|
|
enum irqchip_irq_state {
|
|
IRQCHIP_STATE_PENDING, /* Is interrupt pending? */
|
|
IRQCHIP_STATE_ACTIVE, /* Is interrupt in progress? */
|
|
IRQCHIP_STATE_MASKED, /* Is interrupt masked? */
|
|
IRQCHIP_STATE_LINE_LEVEL, /* Is IRQ line high? */
|
|
};
|
|
|
|
extern int irq_get_irqchip_state(unsigned int irq, enum irqchip_irq_state which,
|
|
bool *state);
|
|
extern int irq_set_irqchip_state(unsigned int irq, enum irqchip_irq_state which,
|
|
bool state);
|
|
|
|
#ifdef CONFIG_IRQ_FORCED_THREADING
|
|
extern bool force_irqthreads;
|
|
#else
|
|
#define force_irqthreads (0)
|
|
#endif
|
|
|
|
#ifndef __ARCH_SET_SOFTIRQ_PENDING
|
|
#define set_softirq_pending(x) (local_softirq_pending() = (x))
|
|
#define or_softirq_pending(x) (local_softirq_pending() |= (x))
|
|
#endif
|
|
|
|
/* Some architectures might implement lazy enabling/disabling of
|
|
* interrupts. In some cases, such as stop_machine, we might want
|
|
* to ensure that after a local_irq_disable(), interrupts have
|
|
* really been disabled in hardware. Such architectures need to
|
|
* implement the following hook.
|
|
*/
|
|
#ifndef hard_irq_disable
|
|
#define hard_irq_disable() do { } while(0)
|
|
#endif
|
|
|
|
/* PLEASE, avoid to allocate new softirqs, if you need not _really_ high
|
|
frequency threaded job scheduling. For almost all the purposes
|
|
tasklets are more than enough. F.e. all serial device BHs et
|
|
al. should be converted to tasklets, not to softirqs.
|
|
*/
|
|
|
|
enum
|
|
{
|
|
HI_SOFTIRQ=0,
|
|
TIMER_SOFTIRQ,
|
|
NET_TX_SOFTIRQ,
|
|
NET_RX_SOFTIRQ,
|
|
BLOCK_SOFTIRQ,
|
|
IRQ_POLL_SOFTIRQ,
|
|
TASKLET_SOFTIRQ,
|
|
SCHED_SOFTIRQ,
|
|
HRTIMER_SOFTIRQ, /* Unused, but kept as tools rely on the
|
|
numbering. Sigh! */
|
|
RCU_SOFTIRQ, /* Preferable RCU should always be the last softirq */
|
|
|
|
NR_SOFTIRQS
|
|
};
|
|
|
|
#define SOFTIRQ_STOP_IDLE_MASK (~(1 << RCU_SOFTIRQ))
|
|
/* Softirq's where the handling might be long: */
|
|
#define LONG_SOFTIRQ_MASK ((1 << NET_TX_SOFTIRQ) | \
|
|
(1 << NET_RX_SOFTIRQ) | \
|
|
(1 << BLOCK_SOFTIRQ) | \
|
|
(1 << IRQ_POLL_SOFTIRQ) | \
|
|
(1 << TASKLET_SOFTIRQ))
|
|
|
|
/* map softirq index to softirq name. update 'softirq_to_name' in
|
|
* kernel/softirq.c when adding a new softirq.
|
|
*/
|
|
extern const char * const softirq_to_name[NR_SOFTIRQS];
|
|
|
|
/* softirq mask and active fields moved to irq_cpustat_t in
|
|
* asm/hardirq.h to get better cache usage. KAO
|
|
*/
|
|
|
|
struct softirq_action
|
|
{
|
|
void (*action)(struct softirq_action *);
|
|
};
|
|
|
|
asmlinkage void do_softirq(void);
|
|
asmlinkage void __do_softirq(void);
|
|
|
|
#ifdef __ARCH_HAS_DO_SOFTIRQ
|
|
void do_softirq_own_stack(void);
|
|
#else
|
|
static inline void do_softirq_own_stack(void)
|
|
{
|
|
__do_softirq();
|
|
}
|
|
#endif
|
|
|
|
extern void open_softirq(int nr, void (*action)(struct softirq_action *));
|
|
extern void softirq_init(void);
|
|
extern void __raise_softirq_irqoff(unsigned int nr);
|
|
|
|
extern void raise_softirq_irqoff(unsigned int nr);
|
|
extern void raise_softirq(unsigned int nr);
|
|
|
|
DECLARE_PER_CPU(struct task_struct *, ksoftirqd);
|
|
DECLARE_PER_CPU(__u32, active_softirqs);
|
|
|
|
static inline struct task_struct *this_cpu_ksoftirqd(void)
|
|
{
|
|
return this_cpu_read(ksoftirqd);
|
|
}
|
|
|
|
/* Tasklets --- multithreaded analogue of BHs.
|
|
|
|
Main feature differing them of generic softirqs: tasklet
|
|
is running only on one CPU simultaneously.
|
|
|
|
Main feature differing them of BHs: different tasklets
|
|
may be run simultaneously on different CPUs.
|
|
|
|
Properties:
|
|
* If tasklet_schedule() is called, then tasklet is guaranteed
|
|
to be executed on some cpu at least once after this.
|
|
* If the tasklet is already scheduled, but its execution is still not
|
|
started, it will be executed only once.
|
|
* If this tasklet is already running on another CPU (or schedule is called
|
|
from tasklet itself), it is rescheduled for later.
|
|
* Tasklet is strictly serialized wrt itself, but not
|
|
wrt another tasklets. If client needs some intertask synchronization,
|
|
he makes it with spinlocks.
|
|
*/
|
|
|
|
struct tasklet_struct
|
|
{
|
|
struct tasklet_struct *next;
|
|
unsigned long state;
|
|
atomic_t count;
|
|
void (*func)(unsigned long);
|
|
unsigned long data;
|
|
};
|
|
|
|
#define DECLARE_TASKLET(name, func, data) \
|
|
struct tasklet_struct name = { NULL, 0, ATOMIC_INIT(0), func, data }
|
|
|
|
#define DECLARE_TASKLET_DISABLED(name, func, data) \
|
|
struct tasklet_struct name = { NULL, 0, ATOMIC_INIT(1), func, data }
|
|
|
|
|
|
enum
|
|
{
|
|
TASKLET_STATE_SCHED, /* Tasklet is scheduled for execution */
|
|
TASKLET_STATE_RUN /* Tasklet is running (SMP only) */
|
|
};
|
|
|
|
#ifdef CONFIG_SMP
|
|
static inline int tasklet_trylock(struct tasklet_struct *t)
|
|
{
|
|
return !test_and_set_bit(TASKLET_STATE_RUN, &(t)->state);
|
|
}
|
|
|
|
static inline void tasklet_unlock(struct tasklet_struct *t)
|
|
{
|
|
smp_mb__before_atomic();
|
|
clear_bit(TASKLET_STATE_RUN, &(t)->state);
|
|
}
|
|
|
|
static inline void tasklet_unlock_wait(struct tasklet_struct *t)
|
|
{
|
|
while (test_bit(TASKLET_STATE_RUN, &(t)->state)) { barrier(); }
|
|
}
|
|
#else
|
|
#define tasklet_trylock(t) 1
|
|
#define tasklet_unlock_wait(t) do { } while (0)
|
|
#define tasklet_unlock(t) do { } while (0)
|
|
#endif
|
|
|
|
extern void __tasklet_schedule(struct tasklet_struct *t);
|
|
|
|
static inline void tasklet_schedule(struct tasklet_struct *t)
|
|
{
|
|
if (!test_and_set_bit(TASKLET_STATE_SCHED, &t->state))
|
|
__tasklet_schedule(t);
|
|
}
|
|
|
|
extern void __tasklet_hi_schedule(struct tasklet_struct *t);
|
|
|
|
static inline void tasklet_hi_schedule(struct tasklet_struct *t)
|
|
{
|
|
if (!test_and_set_bit(TASKLET_STATE_SCHED, &t->state))
|
|
__tasklet_hi_schedule(t);
|
|
}
|
|
|
|
static inline void tasklet_disable_nosync(struct tasklet_struct *t)
|
|
{
|
|
atomic_inc(&t->count);
|
|
smp_mb__after_atomic();
|
|
}
|
|
|
|
static inline void tasklet_disable(struct tasklet_struct *t)
|
|
{
|
|
tasklet_disable_nosync(t);
|
|
tasklet_unlock_wait(t);
|
|
smp_mb();
|
|
}
|
|
|
|
static inline void tasklet_enable(struct tasklet_struct *t)
|
|
{
|
|
smp_mb__before_atomic();
|
|
atomic_dec(&t->count);
|
|
}
|
|
|
|
extern void tasklet_kill(struct tasklet_struct *t);
|
|
extern void tasklet_kill_immediate(struct tasklet_struct *t, unsigned int cpu);
|
|
extern void tasklet_init(struct tasklet_struct *t,
|
|
void (*func)(unsigned long), unsigned long data);
|
|
|
|
struct tasklet_hrtimer {
|
|
struct hrtimer timer;
|
|
struct tasklet_struct tasklet;
|
|
enum hrtimer_restart (*function)(struct hrtimer *);
|
|
};
|
|
|
|
extern void
|
|
tasklet_hrtimer_init(struct tasklet_hrtimer *ttimer,
|
|
enum hrtimer_restart (*function)(struct hrtimer *),
|
|
clockid_t which_clock, enum hrtimer_mode mode);
|
|
|
|
static inline
|
|
void tasklet_hrtimer_start(struct tasklet_hrtimer *ttimer, ktime_t time,
|
|
const enum hrtimer_mode mode)
|
|
{
|
|
hrtimer_start(&ttimer->timer, time, mode);
|
|
}
|
|
|
|
static inline
|
|
void tasklet_hrtimer_cancel(struct tasklet_hrtimer *ttimer)
|
|
{
|
|
hrtimer_cancel(&ttimer->timer);
|
|
tasklet_kill(&ttimer->tasklet);
|
|
}
|
|
|
|
/*
|
|
* Autoprobing for irqs:
|
|
*
|
|
* probe_irq_on() and probe_irq_off() provide robust primitives
|
|
* for accurate IRQ probing during kernel initialization. They are
|
|
* reasonably simple to use, are not "fooled" by spurious interrupts,
|
|
* and, unlike other attempts at IRQ probing, they do not get hung on
|
|
* stuck interrupts (such as unused PS2 mouse interfaces on ASUS boards).
|
|
*
|
|
* For reasonably foolproof probing, use them as follows:
|
|
*
|
|
* 1. clear and/or mask the device's internal interrupt.
|
|
* 2. sti();
|
|
* 3. irqs = probe_irq_on(); // "take over" all unassigned idle IRQs
|
|
* 4. enable the device and cause it to trigger an interrupt.
|
|
* 5. wait for the device to interrupt, using non-intrusive polling or a delay.
|
|
* 6. irq = probe_irq_off(irqs); // get IRQ number, 0=none, negative=multiple
|
|
* 7. service the device to clear its pending interrupt.
|
|
* 8. loop again if paranoia is required.
|
|
*
|
|
* probe_irq_on() returns a mask of allocated irq's.
|
|
*
|
|
* probe_irq_off() takes the mask as a parameter,
|
|
* and returns the irq number which occurred,
|
|
* or zero if none occurred, or a negative irq number
|
|
* if more than one irq occurred.
|
|
*/
|
|
|
|
#if !defined(CONFIG_GENERIC_IRQ_PROBE)
|
|
static inline unsigned long probe_irq_on(void)
|
|
{
|
|
return 0;
|
|
}
|
|
static inline int probe_irq_off(unsigned long val)
|
|
{
|
|
return 0;
|
|
}
|
|
static inline unsigned int probe_irq_mask(unsigned long val)
|
|
{
|
|
return 0;
|
|
}
|
|
#else
|
|
extern unsigned long probe_irq_on(void); /* returns 0 on failure */
|
|
extern int probe_irq_off(unsigned long); /* returns 0 or negative on failure */
|
|
extern unsigned int probe_irq_mask(unsigned long); /* returns mask of ISA interrupts */
|
|
#endif
|
|
|
|
#ifdef CONFIG_PROC_FS
|
|
/* Initialize /proc/irq/ */
|
|
extern void init_irq_proc(void);
|
|
#else
|
|
static inline void init_irq_proc(void)
|
|
{
|
|
}
|
|
#endif
|
|
|
|
#ifdef CONFIG_IRQ_TIMINGS
|
|
void irq_timings_enable(void);
|
|
void irq_timings_disable(void);
|
|
u64 irq_timings_next_event(u64 now);
|
|
#endif
|
|
|
|
struct seq_file;
|
|
int show_interrupts(struct seq_file *p, void *v);
|
|
int arch_show_interrupts(struct seq_file *p, int prec);
|
|
|
|
extern int early_irq_init(void);
|
|
extern int arch_probe_nr_irqs(void);
|
|
extern int arch_early_irq_init(void);
|
|
|
|
/*
|
|
* We want to know which function is an entrypoint of a hardirq or a softirq.
|
|
*/
|
|
#define __irq_entry __attribute__((__section__(".irqentry.text")))
|
|
#define __softirq_entry \
|
|
__attribute__((__section__(".softirqentry.text")))
|
|
|
|
#endif
|