aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux
diff options
context:
space:
mode:
authorJiri Kosina <jkosina@suse.cz>2013-09-04 04:49:39 -0400
committerJiri Kosina <jkosina@suse.cz>2013-09-04 04:49:57 -0400
commitefd15f5f4ff63f6ac5d80850686e3d2cc8c4481b (patch)
tree40024adbe77a3d660662e639fd765097133d648c /include/linux
parent6c2794a2984f4c17a58117a68703cc7640f01c5a (diff)
parent58c59bc997d86593f0bea41845885917cf304d22 (diff)
Merge branch 'master' into for-3.12/upstream
Sync with Linus' tree to be able to apply fixup patch on top of 9d9a04ee75 ("HID: apple: Add support for the 2013 Macbook Air") Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/alarmtimer.h4
-rw-r--r--include/linux/amba/pl08x.h8
-rw-r--r--include/linux/audit.h26
-rw-r--r--include/linux/bcma/bcma.h1
-rw-r--r--include/linux/bcma/bcma_driver_chipcommon.h55
-rw-r--r--include/linux/bio.h4
-rw-r--r--include/linux/can/platform/flexcan.h20
-rw-r--r--include/linux/ceph/decode.h5
-rw-r--r--include/linux/ceph/osd_client.h1
-rw-r--r--include/linux/cgroup.h5
-rw-r--r--include/linux/cgroup_subsys.h45
-rw-r--r--include/linux/clockchips.h5
-rw-r--r--include/linux/clocksource.h8
-rw-r--r--include/linux/cpu.h5
-rw-r--r--include/linux/cpu_cooling.h4
-rw-r--r--include/linux/cpufreq.h2
-rw-r--r--include/linux/dcache.h5
-rw-r--r--include/linux/decompress/unlz4.h10
-rw-r--r--include/linux/device-mapper.h6
-rw-r--r--include/linux/device.h37
-rw-r--r--include/linux/drbd.h6
-rw-r--r--include/linux/drbd_genl.h2
-rw-r--r--include/linux/drbd_limits.h9
-rw-r--r--include/linux/dw_apb_timer.h1
-rw-r--r--include/linux/edac.h7
-rw-r--r--include/linux/efi.h4
-rw-r--r--include/linux/elevator.h6
-rw-r--r--include/linux/fb.h2
-rw-r--r--include/linux/filter.h4
-rw-r--r--include/linux/firewire.h3
-rw-r--r--include/linux/fs.h7
-rw-r--r--include/linux/ftrace.h9
-rw-r--r--include/linux/ftrace_event.h12
-rw-r--r--include/linux/gfp.h2
-rw-r--r--include/linux/i2c/twl.h31
-rw-r--r--include/linux/ieee80211.h10
-rw-r--r--include/linux/if_link.h1
-rw-r--r--include/linux/if_macvlan.h12
-rw-r--r--include/linux/if_team.h11
-rw-r--r--include/linux/if_vlan.h5
-rw-r--r--include/linux/igmp.h1
-rw-r--r--include/linux/iio/iio.h4
-rw-r--r--include/linux/inetdevice.h5
-rw-r--r--include/linux/init.h19
-rw-r--r--include/linux/input/ti_am335x_tsc.h23
-rw-r--r--include/linux/input/tps6507x-ts.h1
-rw-r--r--include/linux/io.h25
-rw-r--r--include/linux/irqdomain.h142
-rw-r--r--include/linux/jiffies.h4
-rw-r--r--include/linux/kernel.h7
-rw-r--r--include/linux/ktime.h23
-rw-r--r--include/linux/list.h11
-rw-r--r--include/linux/llist.h19
-rw-r--r--include/linux/lz4.h87
-rw-r--r--include/linux/marvell_phy.h2
-rw-r--r--include/linux/mfd/88pm80x.h17
-rw-r--r--include/linux/mfd/abx500/ab8500.h2
-rw-r--r--include/linux/mfd/arizona/core.h2
-rw-r--r--include/linux/mfd/davinci_voicecodec.h4
-rw-r--r--include/linux/mfd/kempld.h125
-rw-r--r--include/linux/mfd/max8998-private.h7
-rw-r--r--include/linux/mfd/max8998.h20
-rw-r--r--include/linux/mfd/palmas.h14
-rw-r--r--include/linux/mfd/rtsx_pci.h1
-rw-r--r--include/linux/mfd/samsung/core.h6
-rw-r--r--include/linux/mfd/samsung/s2mps11.h1
-rw-r--r--include/linux/mfd/syscon/imx6q-iomuxc-gpr.h137
-rw-r--r--include/linux/mfd/ti_am335x_tscadc.h35
-rw-r--r--include/linux/mfd/tmio.h5
-rw-r--r--include/linux/mfd/tps6507x.h1
-rw-r--r--include/linux/mfd/wm8994/core.h2
-rw-r--r--include/linux/mfd/wm8994/pdata.h5
-rw-r--r--include/linux/mlx4/cmd.h3
-rw-r--r--include/linux/mlx4/device.h3
-rw-r--r--include/linux/mlx4/qp.h36
-rw-r--r--include/linux/mlx5/cmd.h51
-rw-r--r--include/linux/mlx5/cq.h165
-rw-r--r--include/linux/mlx5/device.h913
-rw-r--r--include/linux/mlx5/doorbell.h79
-rw-r--r--include/linux/mlx5/driver.h771
-rw-r--r--include/linux/mlx5/qp.h467
-rw-r--r--include/linux/mlx5/srq.h41
-rw-r--r--include/linux/mm.h6
-rw-r--r--include/linux/mm_types.h3
-rw-r--r--include/linux/mmc/card.h11
-rw-r--r--include/linux/mmc/core.h5
-rw-r--r--include/linux/mmc/host.h12
-rw-r--r--include/linux/mmc/sdhci.h6
-rw-r--r--include/linux/mmzone.h28
-rw-r--r--include/linux/mod_devicetable.h5
-rw-r--r--include/linux/moduleparam.h2
-rw-r--r--include/linux/mutex.h358
-rw-r--r--include/linux/mv643xx_eth.h2
-rw-r--r--include/linux/net.h6
-rw-r--r--include/linux/netdev_features.h4
-rw-r--r--include/linux/netdevice.h85
-rw-r--r--include/linux/netfilter.h2
-rw-r--r--include/linux/netlink.h27
-rw-r--r--include/linux/netpoll.h4
-rw-r--r--include/linux/nfs4.h22
-rw-r--r--include/linux/nfs_fs.h28
-rw-r--r--include/linux/nfs_fs_sb.h8
-rw-r--r--include/linux/nfs_xdr.h20
-rw-r--r--include/linux/nmi.h2
-rw-r--r--include/linux/of_device.h6
-rw-r--r--include/linux/of_dma.h1
-rw-r--r--include/linux/of_platform.h35
-rw-r--r--include/linux/perf_event.h2
-rw-r--r--include/linux/phy.h27
-rw-r--r--include/linux/platform_data/brcmfmac-sdio.h5
-rw-r--r--include/linux/platform_data/cyttsp4.h76
-rw-r--r--include/linux/platform_data/dma-atmel.h4
-rw-r--r--include/linux/platform_data/dma-imx.h6
-rw-r--r--include/linux/platform_data/keypad-pxa27x.h3
-rw-r--r--include/linux/platform_data/mmc-esdhc-imx.h1
-rw-r--r--include/linux/platform_data/mmc-pxamci.h2
-rw-r--r--include/linux/platform_data/net-cw1200.h81
-rw-r--r--include/linux/platform_data/pwm-renesas-tpu.h16
-rw-r--r--include/linux/platform_data/rcar-du.h54
-rw-r--r--include/linux/platform_data/remoteproc-omap.h2
-rw-r--r--include/linux/platform_data/ti_am335x_adc.h14
-rw-r--r--include/linux/platform_device.h3
-rw-r--r--include/linux/pm_wakeup.h4
-rw-r--r--include/linux/posix-timers.h16
-rw-r--r--include/linux/power_supply.h4
-rw-r--r--include/linux/ptrace.h10
-rw-r--r--include/linux/pvclock_gtod.h7
-rw-r--r--include/linux/pwm.h29
-rw-r--r--include/linux/reboot.h27
-rw-r--r--include/linux/regmap.h1
-rw-r--r--include/linux/reservation.h62
-rw-r--r--include/linux/scatterlist.h5
-rw-r--r--include/linux/sched.h15
-rw-r--r--include/linux/sched_clock.h21
-rw-r--r--include/linux/security.h57
-rw-r--r--include/linux/sem.h6
-rw-r--r--include/linux/seq_file.h6
-rw-r--r--include/linux/sh_dma.h2
-rw-r--r--include/linux/shdma-base.h7
-rw-r--r--include/linux/skbuff.h137
-rw-r--r--include/linux/slab.h57
-rw-r--r--include/linux/slob_def.h8
-rw-r--r--include/linux/socket.h2
-rw-r--r--include/linux/spinlock_api_smp.h2
-rw-r--r--include/linux/ssb/ssb_driver_mips.h15
-rw-r--r--include/linux/ssb/ssb_regs.h1
-rw-r--r--include/linux/stmmac.h4
-rw-r--r--include/linux/sunrpc/cache.h49
-rw-r--r--include/linux/sunrpc/gss_api.h2
-rw-r--r--include/linux/sunrpc/rpc_pipe_fs.h4
-rw-r--r--include/linux/sunrpc/sched.h20
-rw-r--r--include/linux/sunrpc/svcauth.h11
-rw-r--r--include/linux/sysfs.h64
-rw-r--r--include/linux/tcp.h1
-rw-r--r--include/linux/tick.h6
-rw-r--r--include/linux/usb.h11
-rw-r--r--include/linux/user_namespace.h1
-rw-r--r--include/linux/vexpress.h1
-rw-r--r--include/linux/virtio.h4
-rw-r--r--include/linux/virtio_ring.h1
-rw-r--r--include/linux/vmalloc.h12
-rw-r--r--include/linux/vmpressure.h3
-rw-r--r--include/linux/writeback.h8
-rw-r--r--include/linux/ww_mutex.h378
-rw-r--r--include/linux/zbud.h22
165 files changed, 4660 insertions, 1113 deletions
diff --git a/include/linux/alarmtimer.h b/include/linux/alarmtimer.h
index 9069694e70eb..a899402a5a0e 100644
--- a/include/linux/alarmtimer.h
+++ b/include/linux/alarmtimer.h
@@ -44,10 +44,14 @@ struct alarm {
44void alarm_init(struct alarm *alarm, enum alarmtimer_type type, 44void alarm_init(struct alarm *alarm, enum alarmtimer_type type,
45 enum alarmtimer_restart (*function)(struct alarm *, ktime_t)); 45 enum alarmtimer_restart (*function)(struct alarm *, ktime_t));
46int alarm_start(struct alarm *alarm, ktime_t start); 46int alarm_start(struct alarm *alarm, ktime_t start);
47int alarm_start_relative(struct alarm *alarm, ktime_t start);
48void alarm_restart(struct alarm *alarm);
47int alarm_try_to_cancel(struct alarm *alarm); 49int alarm_try_to_cancel(struct alarm *alarm);
48int alarm_cancel(struct alarm *alarm); 50int alarm_cancel(struct alarm *alarm);
49 51
50u64 alarm_forward(struct alarm *alarm, ktime_t now, ktime_t interval); 52u64 alarm_forward(struct alarm *alarm, ktime_t now, ktime_t interval);
53u64 alarm_forward_now(struct alarm *alarm, ktime_t interval);
54ktime_t alarm_expires_remaining(const struct alarm *alarm);
51 55
52/* Provide way to access the rtc device being used by alarmtimers */ 56/* Provide way to access the rtc device being used by alarmtimers */
53struct rtc_device *alarmtimer_get_rtcdev(void); 57struct rtc_device *alarmtimer_get_rtcdev(void);
diff --git a/include/linux/amba/pl08x.h b/include/linux/amba/pl08x.h
index 2a5f64a11b77..10fe2a211c2e 100644
--- a/include/linux/amba/pl08x.h
+++ b/include/linux/amba/pl08x.h
@@ -76,11 +76,11 @@ struct pl08x_channel_data {
76 * platform, all inclusive, including multiplexed channels. The available 76 * platform, all inclusive, including multiplexed channels. The available
77 * physical channels will be multiplexed around these signals as they are 77 * physical channels will be multiplexed around these signals as they are
78 * requested, just enumerate all possible channels. 78 * requested, just enumerate all possible channels.
79 * @get_signal: request a physical signal to be used for a DMA transfer 79 * @get_xfer_signal: request a physical signal to be used for a DMA transfer
80 * immediately: if there is some multiplexing or similar blocking the use 80 * immediately: if there is some multiplexing or similar blocking the use
81 * of the channel the transfer can be denied by returning less than zero, 81 * of the channel the transfer can be denied by returning less than zero,
82 * else it returns the allocated signal number 82 * else it returns the allocated signal number
83 * @put_signal: indicate to the platform that this physical signal is not 83 * @put_xfer_signal: indicate to the platform that this physical signal is not
84 * running any DMA transfer and multiplexing can be recycled 84 * running any DMA transfer and multiplexing can be recycled
85 * @lli_buses: buses which LLIs can be fetched from: PL08X_AHB1 | PL08X_AHB2 85 * @lli_buses: buses which LLIs can be fetched from: PL08X_AHB1 | PL08X_AHB2
86 * @mem_buses: buses which memory can be accessed from: PL08X_AHB1 | PL08X_AHB2 86 * @mem_buses: buses which memory can be accessed from: PL08X_AHB1 | PL08X_AHB2
@@ -89,8 +89,8 @@ struct pl08x_platform_data {
89 const struct pl08x_channel_data *slave_channels; 89 const struct pl08x_channel_data *slave_channels;
90 unsigned int num_slave_channels; 90 unsigned int num_slave_channels;
91 struct pl08x_channel_data memcpy_channel; 91 struct pl08x_channel_data memcpy_channel;
92 int (*get_signal)(const struct pl08x_channel_data *); 92 int (*get_xfer_signal)(const struct pl08x_channel_data *);
93 void (*put_signal)(const struct pl08x_channel_data *, int); 93 void (*put_xfer_signal)(const struct pl08x_channel_data *, int);
94 u8 lli_buses; 94 u8 lli_buses;
95 u8 mem_buses; 95 u8 mem_buses;
96}; 96};
diff --git a/include/linux/audit.h b/include/linux/audit.h
index b20b03852f21..729a4d165bcc 100644
--- a/include/linux/audit.h
+++ b/include/linux/audit.h
@@ -103,8 +103,11 @@ extern void __audit_syscall_exit(int ret_success, long ret_value);
103extern struct filename *__audit_reusename(const __user char *uptr); 103extern struct filename *__audit_reusename(const __user char *uptr);
104extern void __audit_getname(struct filename *name); 104extern void __audit_getname(struct filename *name);
105extern void audit_putname(struct filename *name); 105extern void audit_putname(struct filename *name);
106
107#define AUDIT_INODE_PARENT 1 /* dentry represents the parent */
108#define AUDIT_INODE_HIDDEN 2 /* audit record should be hidden */
106extern void __audit_inode(struct filename *name, const struct dentry *dentry, 109extern void __audit_inode(struct filename *name, const struct dentry *dentry,
107 unsigned int parent); 110 unsigned int flags);
108extern void __audit_inode_child(const struct inode *parent, 111extern void __audit_inode_child(const struct inode *parent,
109 const struct dentry *dentry, 112 const struct dentry *dentry,
110 const unsigned char type); 113 const unsigned char type);
@@ -148,10 +151,22 @@ static inline void audit_getname(struct filename *name)
148 if (unlikely(!audit_dummy_context())) 151 if (unlikely(!audit_dummy_context()))
149 __audit_getname(name); 152 __audit_getname(name);
150} 153}
151static inline void audit_inode(struct filename *name, const struct dentry *dentry, 154static inline void audit_inode(struct filename *name,
155 const struct dentry *dentry,
152 unsigned int parent) { 156 unsigned int parent) {
157 if (unlikely(!audit_dummy_context())) {
158 unsigned int flags = 0;
159 if (parent)
160 flags |= AUDIT_INODE_PARENT;
161 __audit_inode(name, dentry, flags);
162 }
163}
164static inline void audit_inode_parent_hidden(struct filename *name,
165 const struct dentry *dentry)
166{
153 if (unlikely(!audit_dummy_context())) 167 if (unlikely(!audit_dummy_context()))
154 __audit_inode(name, dentry, parent); 168 __audit_inode(name, dentry,
169 AUDIT_INODE_PARENT | AUDIT_INODE_HIDDEN);
155} 170}
156static inline void audit_inode_child(const struct inode *parent, 171static inline void audit_inode_child(const struct inode *parent,
157 const struct dentry *dentry, 172 const struct dentry *dentry,
@@ -311,7 +326,7 @@ static inline void audit_putname(struct filename *name)
311{ } 326{ }
312static inline void __audit_inode(struct filename *name, 327static inline void __audit_inode(struct filename *name,
313 const struct dentry *dentry, 328 const struct dentry *dentry,
314 unsigned int parent) 329 unsigned int flags)
315{ } 330{ }
316static inline void __audit_inode_child(const struct inode *parent, 331static inline void __audit_inode_child(const struct inode *parent,
317 const struct dentry *dentry, 332 const struct dentry *dentry,
@@ -321,6 +336,9 @@ static inline void audit_inode(struct filename *name,
321 const struct dentry *dentry, 336 const struct dentry *dentry,
322 unsigned int parent) 337 unsigned int parent)
323{ } 338{ }
339static inline void audit_inode_parent_hidden(struct filename *name,
340 const struct dentry *dentry)
341{ }
324static inline void audit_inode_child(const struct inode *parent, 342static inline void audit_inode_child(const struct inode *parent,
325 const struct dentry *dentry, 343 const struct dentry *dentry,
326 const unsigned char type) 344 const unsigned char type)
diff --git a/include/linux/bcma/bcma.h b/include/linux/bcma/bcma.h
index 2e34db82a643..622fc505d3e1 100644
--- a/include/linux/bcma/bcma.h
+++ b/include/linux/bcma/bcma.h
@@ -144,6 +144,7 @@ struct bcma_host_ops {
144 144
145/* Chip IDs of PCIe devices */ 145/* Chip IDs of PCIe devices */
146#define BCMA_CHIP_ID_BCM4313 0x4313 146#define BCMA_CHIP_ID_BCM4313 0x4313
147#define BCMA_CHIP_ID_BCM43142 43142
147#define BCMA_CHIP_ID_BCM43224 43224 148#define BCMA_CHIP_ID_BCM43224 43224
148#define BCMA_PKG_ID_BCM43224_FAB_CSM 0x8 149#define BCMA_PKG_ID_BCM43224_FAB_CSM 0x8
149#define BCMA_PKG_ID_BCM43224_FAB_SMIC 0xa 150#define BCMA_PKG_ID_BCM43224_FAB_SMIC 0xa
diff --git a/include/linux/bcma/bcma_driver_chipcommon.h b/include/linux/bcma/bcma_driver_chipcommon.h
index b8b09eac60a4..c49e1a159e6e 100644
--- a/include/linux/bcma/bcma_driver_chipcommon.h
+++ b/include/linux/bcma/bcma_driver_chipcommon.h
@@ -330,6 +330,8 @@
330#define BCMA_CC_PMU_CAP 0x0604 /* PMU capabilities */ 330#define BCMA_CC_PMU_CAP 0x0604 /* PMU capabilities */
331#define BCMA_CC_PMU_CAP_REVISION 0x000000FF /* Revision mask */ 331#define BCMA_CC_PMU_CAP_REVISION 0x000000FF /* Revision mask */
332#define BCMA_CC_PMU_STAT 0x0608 /* PMU status */ 332#define BCMA_CC_PMU_STAT 0x0608 /* PMU status */
333#define BCMA_CC_PMU_STAT_EXT_LPO_AVAIL 0x00000100
334#define BCMA_CC_PMU_STAT_WDRESET 0x00000080
333#define BCMA_CC_PMU_STAT_INTPEND 0x00000040 /* Interrupt pending */ 335#define BCMA_CC_PMU_STAT_INTPEND 0x00000040 /* Interrupt pending */
334#define BCMA_CC_PMU_STAT_SBCLKST 0x00000030 /* Backplane clock status? */ 336#define BCMA_CC_PMU_STAT_SBCLKST 0x00000030 /* Backplane clock status? */
335#define BCMA_CC_PMU_STAT_HAVEALP 0x00000008 /* ALP available */ 337#define BCMA_CC_PMU_STAT_HAVEALP 0x00000008 /* ALP available */
@@ -355,6 +357,11 @@
355#define BCMA_CC_REGCTL_DATA 0x065C 357#define BCMA_CC_REGCTL_DATA 0x065C
356#define BCMA_CC_PLLCTL_ADDR 0x0660 358#define BCMA_CC_PLLCTL_ADDR 0x0660
357#define BCMA_CC_PLLCTL_DATA 0x0664 359#define BCMA_CC_PLLCTL_DATA 0x0664
360#define BCMA_CC_PMU_STRAPOPT 0x0668 /* (corerev >= 28) */
361#define BCMA_CC_PMU_XTAL_FREQ 0x066C /* (pmurev >= 10) */
362#define BCMA_CC_PMU_XTAL_FREQ_ILPCTL_MASK 0x00001FFF
363#define BCMA_CC_PMU_XTAL_FREQ_MEASURE_MASK 0x80000000
364#define BCMA_CC_PMU_XTAL_FREQ_MEASURE_SHIFT 31
358#define BCMA_CC_SPROM 0x0800 /* SPROM beginning */ 365#define BCMA_CC_SPROM 0x0800 /* SPROM beginning */
359/* NAND flash MLC controller registers (corerev >= 38) */ 366/* NAND flash MLC controller registers (corerev >= 38) */
360#define BCMA_CC_NAND_REVISION 0x0C00 367#define BCMA_CC_NAND_REVISION 0x0C00
@@ -435,6 +442,23 @@
435#define BCMA_CC_PMU6_4706_PROC_NDIV_MODE_MASK 0x00000007 442#define BCMA_CC_PMU6_4706_PROC_NDIV_MODE_MASK 0x00000007
436#define BCMA_CC_PMU6_4706_PROC_NDIV_MODE_SHIFT 0 443#define BCMA_CC_PMU6_4706_PROC_NDIV_MODE_SHIFT 0
437 444
445/* PMU rev 15 */
446#define BCMA_CC_PMU15_PLL_PLLCTL0 0
447#define BCMA_CC_PMU15_PLL_PC0_CLKSEL_MASK 0x00000003
448#define BCMA_CC_PMU15_PLL_PC0_CLKSEL_SHIFT 0
449#define BCMA_CC_PMU15_PLL_PC0_FREQTGT_MASK 0x003FFFFC
450#define BCMA_CC_PMU15_PLL_PC0_FREQTGT_SHIFT 2
451#define BCMA_CC_PMU15_PLL_PC0_PRESCALE_MASK 0x00C00000
452#define BCMA_CC_PMU15_PLL_PC0_PRESCALE_SHIFT 22
453#define BCMA_CC_PMU15_PLL_PC0_KPCTRL_MASK 0x07000000
454#define BCMA_CC_PMU15_PLL_PC0_KPCTRL_SHIFT 24
455#define BCMA_CC_PMU15_PLL_PC0_FCNTCTRL_MASK 0x38000000
456#define BCMA_CC_PMU15_PLL_PC0_FCNTCTRL_SHIFT 27
457#define BCMA_CC_PMU15_PLL_PC0_FDCMODE_MASK 0x40000000
458#define BCMA_CC_PMU15_PLL_PC0_FDCMODE_SHIFT 30
459#define BCMA_CC_PMU15_PLL_PC0_CTRLBIAS_MASK 0x80000000
460#define BCMA_CC_PMU15_PLL_PC0_CTRLBIAS_SHIFT 31
461
438/* ALP clock on pre-PMU chips */ 462/* ALP clock on pre-PMU chips */
439#define BCMA_CC_PMU_ALP_CLOCK 20000000 463#define BCMA_CC_PMU_ALP_CLOCK 20000000
440/* HT clock for systems with PMU-enabled chipcommon */ 464/* HT clock for systems with PMU-enabled chipcommon */
@@ -507,6 +531,37 @@
507#define BCMA_CHIPCTL_5357_I2S_PINS_ENABLE BIT(18) 531#define BCMA_CHIPCTL_5357_I2S_PINS_ENABLE BIT(18)
508#define BCMA_CHIPCTL_5357_I2CSPI_PINS_ENABLE BIT(19) 532#define BCMA_CHIPCTL_5357_I2CSPI_PINS_ENABLE BIT(19)
509 533
534#define BCMA_RES_4314_LPLDO_PU BIT(0)
535#define BCMA_RES_4314_PMU_SLEEP_DIS BIT(1)
536#define BCMA_RES_4314_PMU_BG_PU BIT(2)
537#define BCMA_RES_4314_CBUCK_LPOM_PU BIT(3)
538#define BCMA_RES_4314_CBUCK_PFM_PU BIT(4)
539#define BCMA_RES_4314_CLDO_PU BIT(5)
540#define BCMA_RES_4314_LPLDO2_LVM BIT(6)
541#define BCMA_RES_4314_WL_PMU_PU BIT(7)
542#define BCMA_RES_4314_LNLDO_PU BIT(8)
543#define BCMA_RES_4314_LDO3P3_PU BIT(9)
544#define BCMA_RES_4314_OTP_PU BIT(10)
545#define BCMA_RES_4314_XTAL_PU BIT(11)
546#define BCMA_RES_4314_WL_PWRSW_PU BIT(12)
547#define BCMA_RES_4314_LQ_AVAIL BIT(13)
548#define BCMA_RES_4314_LOGIC_RET BIT(14)
549#define BCMA_RES_4314_MEM_SLEEP BIT(15)
550#define BCMA_RES_4314_MACPHY_RET BIT(16)
551#define BCMA_RES_4314_WL_CORE_READY BIT(17)
552#define BCMA_RES_4314_ILP_REQ BIT(18)
553#define BCMA_RES_4314_ALP_AVAIL BIT(19)
554#define BCMA_RES_4314_MISC_PWRSW_PU BIT(20)
555#define BCMA_RES_4314_SYNTH_PWRSW_PU BIT(21)
556#define BCMA_RES_4314_RX_PWRSW_PU BIT(22)
557#define BCMA_RES_4314_RADIO_PU BIT(23)
558#define BCMA_RES_4314_VCO_LDO_PU BIT(24)
559#define BCMA_RES_4314_AFE_LDO_PU BIT(25)
560#define BCMA_RES_4314_RX_LDO_PU BIT(26)
561#define BCMA_RES_4314_TX_LDO_PU BIT(27)
562#define BCMA_RES_4314_HT_AVAIL BIT(28)
563#define BCMA_RES_4314_MACPHY_CLK_AVAIL BIT(29)
564
510/* Data for the PMU, if available. 565/* Data for the PMU, if available.
511 * Check availability with ((struct bcma_chipcommon)->capabilities & BCMA_CC_CAP_PMU) 566 * Check availability with ((struct bcma_chipcommon)->capabilities & BCMA_CC_CAP_PMU)
512 */ 567 */
diff --git a/include/linux/bio.h b/include/linux/bio.h
index ef24466d8f82..ec48bac5b039 100644
--- a/include/linux/bio.h
+++ b/include/linux/bio.h
@@ -97,11 +97,11 @@ static inline void *bio_data(struct bio *bio)
97 * permanent PIO fall back, user is probably better off disabling highmem 97 * permanent PIO fall back, user is probably better off disabling highmem
98 * I/O completely on that queue (see ide-dma for example) 98 * I/O completely on that queue (see ide-dma for example)
99 */ 99 */
100#define __bio_kmap_atomic(bio, idx, kmtype) \ 100#define __bio_kmap_atomic(bio, idx) \
101 (kmap_atomic(bio_iovec_idx((bio), (idx))->bv_page) + \ 101 (kmap_atomic(bio_iovec_idx((bio), (idx))->bv_page) + \
102 bio_iovec_idx((bio), (idx))->bv_offset) 102 bio_iovec_idx((bio), (idx))->bv_offset)
103 103
104#define __bio_kunmap_atomic(addr, kmtype) kunmap_atomic(addr) 104#define __bio_kunmap_atomic(addr) kunmap_atomic(addr)
105 105
106/* 106/*
107 * merge helpers etc 107 * merge helpers etc
diff --git a/include/linux/can/platform/flexcan.h b/include/linux/can/platform/flexcan.h
deleted file mode 100644
index 72b713ab57e9..000000000000
--- a/include/linux/can/platform/flexcan.h
+++ /dev/null
@@ -1,20 +0,0 @@
1/*
2 * Copyright (C) 2010 Marc Kleine-Budde <kernel@pengutronix.de>
3 *
4 * This file is released under the GPLv2
5 *
6 */
7
8#ifndef __CAN_PLATFORM_FLEXCAN_H
9#define __CAN_PLATFORM_FLEXCAN_H
10
11/**
12 * struct flexcan_platform_data - flex CAN controller platform data
13 * @transceiver_enable: - called to power on/off the transceiver
14 *
15 */
16struct flexcan_platform_data {
17 void (*transceiver_switch)(int enable);
18};
19
20#endif /* __CAN_PLATFORM_FLEXCAN_H */
diff --git a/include/linux/ceph/decode.h b/include/linux/ceph/decode.h
index 379f71508995..0442c3d800f0 100644
--- a/include/linux/ceph/decode.h
+++ b/include/linux/ceph/decode.h
@@ -160,11 +160,6 @@ static inline void ceph_decode_timespec(struct timespec *ts,
160static inline void ceph_encode_timespec(struct ceph_timespec *tv, 160static inline void ceph_encode_timespec(struct ceph_timespec *tv,
161 const struct timespec *ts) 161 const struct timespec *ts)
162{ 162{
163 BUG_ON(ts->tv_sec < 0);
164 BUG_ON(ts->tv_sec > (__kernel_time_t)U32_MAX);
165 BUG_ON(ts->tv_nsec < 0);
166 BUG_ON(ts->tv_nsec > (long)U32_MAX);
167
168 tv->tv_sec = cpu_to_le32((u32)ts->tv_sec); 163 tv->tv_sec = cpu_to_le32((u32)ts->tv_sec);
169 tv->tv_nsec = cpu_to_le32((u32)ts->tv_nsec); 164 tv->tv_nsec = cpu_to_le32((u32)ts->tv_nsec);
170} 165}
diff --git a/include/linux/ceph/osd_client.h b/include/linux/ceph/osd_client.h
index 186db0bf4951..ce6df39f60ff 100644
--- a/include/linux/ceph/osd_client.h
+++ b/include/linux/ceph/osd_client.h
@@ -145,7 +145,6 @@ struct ceph_osd_request {
145 s32 r_reply_op_result[CEPH_OSD_MAX_OP]; 145 s32 r_reply_op_result[CEPH_OSD_MAX_OP];
146 int r_got_reply; 146 int r_got_reply;
147 int r_linger; 147 int r_linger;
148 int r_completed;
149 148
150 struct ceph_osd_client *r_osdc; 149 struct ceph_osd_client *r_osdc;
151 struct kref r_kref; 150 struct kref r_kref;
diff --git a/include/linux/cgroup.h b/include/linux/cgroup.h
index fd097ecfcd97..e9ac882868c0 100644
--- a/include/linux/cgroup.h
+++ b/include/linux/cgroup.h
@@ -278,6 +278,8 @@ enum {
278 * 278 *
279 * - memcg: use_hierarchy is on by default and the cgroup file for 279 * - memcg: use_hierarchy is on by default and the cgroup file for
280 * the flag is not created. 280 * the flag is not created.
281 *
282 * - blkcg: blk-throttle becomes properly hierarchical.
281 */ 283 */
282 CGRP_ROOT_SANE_BEHAVIOR = (1 << 0), 284 CGRP_ROOT_SANE_BEHAVIOR = (1 << 0),
283 285
@@ -540,8 +542,7 @@ int cgroup_rm_cftypes(struct cgroup_subsys *ss, struct cftype *cfts);
540bool cgroup_is_descendant(struct cgroup *cgrp, struct cgroup *ancestor); 542bool cgroup_is_descendant(struct cgroup *cgrp, struct cgroup *ancestor);
541 543
542int cgroup_path(const struct cgroup *cgrp, char *buf, int buflen); 544int cgroup_path(const struct cgroup *cgrp, char *buf, int buflen);
543int task_cgroup_path_from_hierarchy(struct task_struct *task, int hierarchy_id, 545int task_cgroup_path(struct task_struct *task, char *buf, size_t buflen);
544 char *buf, size_t buflen);
545 546
546int cgroup_task_count(const struct cgroup *cgrp); 547int cgroup_task_count(const struct cgroup *cgrp);
547 548
diff --git a/include/linux/cgroup_subsys.h b/include/linux/cgroup_subsys.h
index 6e7ec64b69ab..b613ffd402d1 100644
--- a/include/linux/cgroup_subsys.h
+++ b/include/linux/cgroup_subsys.h
@@ -1,86 +1,55 @@
1/* Add subsystem definitions of the form SUBSYS(<name>) in this 1/*
2 * file. Surround each one by a line of comment markers so that 2 * List of cgroup subsystems.
3 * patches don't collide 3 *
4 * DO NOT ADD ANY SUBSYSTEM WITHOUT EXPLICIT ACKS FROM CGROUP MAINTAINERS.
4 */ 5 */
5
6/* */
7
8/* */
9
10#if IS_SUBSYS_ENABLED(CONFIG_CPUSETS) 6#if IS_SUBSYS_ENABLED(CONFIG_CPUSETS)
11SUBSYS(cpuset) 7SUBSYS(cpuset)
12#endif 8#endif
13 9
14/* */
15
16#if IS_SUBSYS_ENABLED(CONFIG_CGROUP_DEBUG) 10#if IS_SUBSYS_ENABLED(CONFIG_CGROUP_DEBUG)
17SUBSYS(debug) 11SUBSYS(debug)
18#endif 12#endif
19 13
20/* */
21
22#if IS_SUBSYS_ENABLED(CONFIG_CGROUP_SCHED) 14#if IS_SUBSYS_ENABLED(CONFIG_CGROUP_SCHED)
23SUBSYS(cpu_cgroup) 15SUBSYS(cpu_cgroup)
24#endif 16#endif
25 17
26/* */
27
28#if IS_SUBSYS_ENABLED(CONFIG_CGROUP_CPUACCT) 18#if IS_SUBSYS_ENABLED(CONFIG_CGROUP_CPUACCT)
29SUBSYS(cpuacct) 19SUBSYS(cpuacct)
30#endif 20#endif
31 21
32/* */
33
34#if IS_SUBSYS_ENABLED(CONFIG_MEMCG) 22#if IS_SUBSYS_ENABLED(CONFIG_MEMCG)
35SUBSYS(mem_cgroup) 23SUBSYS(mem_cgroup)
36#endif 24#endif
37 25
38/* */
39
40#if IS_SUBSYS_ENABLED(CONFIG_CGROUP_DEVICE) 26#if IS_SUBSYS_ENABLED(CONFIG_CGROUP_DEVICE)
41SUBSYS(devices) 27SUBSYS(devices)
42#endif 28#endif
43 29
44/* */
45
46#if IS_SUBSYS_ENABLED(CONFIG_CGROUP_FREEZER) 30#if IS_SUBSYS_ENABLED(CONFIG_CGROUP_FREEZER)
47SUBSYS(freezer) 31SUBSYS(freezer)
48#endif 32#endif
49 33
50/* */
51
52#if IS_SUBSYS_ENABLED(CONFIG_NET_CLS_CGROUP) 34#if IS_SUBSYS_ENABLED(CONFIG_NET_CLS_CGROUP)
53SUBSYS(net_cls) 35SUBSYS(net_cls)
54#endif 36#endif
55 37
56/* */
57
58#if IS_SUBSYS_ENABLED(CONFIG_BLK_CGROUP) 38#if IS_SUBSYS_ENABLED(CONFIG_BLK_CGROUP)
59SUBSYS(blkio) 39SUBSYS(blkio)
60#endif 40#endif
61 41
62/* */
63
64#if IS_SUBSYS_ENABLED(CONFIG_CGROUP_PERF) 42#if IS_SUBSYS_ENABLED(CONFIG_CGROUP_PERF)
65SUBSYS(perf) 43SUBSYS(perf)
66#endif 44#endif
67 45
68/* */
69
70#if IS_SUBSYS_ENABLED(CONFIG_NETPRIO_CGROUP) 46#if IS_SUBSYS_ENABLED(CONFIG_NETPRIO_CGROUP)
71SUBSYS(net_prio) 47SUBSYS(net_prio)
72#endif 48#endif
73 49
74/* */
75
76#if IS_SUBSYS_ENABLED(CONFIG_CGROUP_HUGETLB) 50#if IS_SUBSYS_ENABLED(CONFIG_CGROUP_HUGETLB)
77SUBSYS(hugetlb) 51SUBSYS(hugetlb)
78#endif 52#endif
79 53/*
80/* */ 54 * DO NOT ADD ANY SUBSYSTEM WITHOUT EXPLICIT ACKS FROM CGROUP MAINTAINERS.
81 55 */
82#ifdef CONFIG_CGROUP_BCACHE
83SUBSYS(bcache)
84#endif
85
86/* */
diff --git a/include/linux/clockchips.h b/include/linux/clockchips.h
index 963d71431388..0857922e8ad0 100644
--- a/include/linux/clockchips.h
+++ b/include/linux/clockchips.h
@@ -30,6 +30,7 @@ enum clock_event_nofitiers {
30#include <linux/notifier.h> 30#include <linux/notifier.h>
31 31
32struct clock_event_device; 32struct clock_event_device;
33struct module;
33 34
34/* Clock event mode commands */ 35/* Clock event mode commands */
35enum clock_event_mode { 36enum clock_event_mode {
@@ -83,6 +84,7 @@ enum clock_event_mode {
83 * @irq: IRQ number (only for non CPU local devices) 84 * @irq: IRQ number (only for non CPU local devices)
84 * @cpumask: cpumask to indicate for which CPUs this device works 85 * @cpumask: cpumask to indicate for which CPUs this device works
85 * @list: list head for the management code 86 * @list: list head for the management code
87 * @owner: module reference
86 */ 88 */
87struct clock_event_device { 89struct clock_event_device {
88 void (*event_handler)(struct clock_event_device *); 90 void (*event_handler)(struct clock_event_device *);
@@ -112,6 +114,7 @@ struct clock_event_device {
112 int irq; 114 int irq;
113 const struct cpumask *cpumask; 115 const struct cpumask *cpumask;
114 struct list_head list; 116 struct list_head list;
117 struct module *owner;
115} ____cacheline_aligned; 118} ____cacheline_aligned;
116 119
117/* 120/*
@@ -138,6 +141,7 @@ static inline unsigned long div_sc(unsigned long ticks, unsigned long nsec,
138extern u64 clockevent_delta2ns(unsigned long latch, 141extern u64 clockevent_delta2ns(unsigned long latch,
139 struct clock_event_device *evt); 142 struct clock_event_device *evt);
140extern void clockevents_register_device(struct clock_event_device *dev); 143extern void clockevents_register_device(struct clock_event_device *dev);
144extern int clockevents_unbind_device(struct clock_event_device *ced, int cpu);
141 145
142extern void clockevents_config(struct clock_event_device *dev, u32 freq); 146extern void clockevents_config(struct clock_event_device *dev, u32 freq);
143extern void clockevents_config_and_register(struct clock_event_device *dev, 147extern void clockevents_config_and_register(struct clock_event_device *dev,
@@ -150,7 +154,6 @@ extern void clockevents_exchange_device(struct clock_event_device *old,
150 struct clock_event_device *new); 154 struct clock_event_device *new);
151extern void clockevents_set_mode(struct clock_event_device *dev, 155extern void clockevents_set_mode(struct clock_event_device *dev,
152 enum clock_event_mode mode); 156 enum clock_event_mode mode);
153extern int clockevents_register_notifier(struct notifier_block *nb);
154extern int clockevents_program_event(struct clock_event_device *dev, 157extern int clockevents_program_event(struct clock_event_device *dev,
155 ktime_t expires, bool force); 158 ktime_t expires, bool force);
156 159
diff --git a/include/linux/clocksource.h b/include/linux/clocksource.h
index 7279b94c01da..dbbf8aa7731b 100644
--- a/include/linux/clocksource.h
+++ b/include/linux/clocksource.h
@@ -21,6 +21,7 @@
21/* clocksource cycle base type */ 21/* clocksource cycle base type */
22typedef u64 cycle_t; 22typedef u64 cycle_t;
23struct clocksource; 23struct clocksource;
24struct module;
24 25
25#ifdef CONFIG_ARCH_CLOCKSOURCE_DATA 26#ifdef CONFIG_ARCH_CLOCKSOURCE_DATA
26#include <asm/clocksource.h> 27#include <asm/clocksource.h>
@@ -162,6 +163,7 @@ extern u64 timecounter_cyc2time(struct timecounter *tc,
162 * @suspend: suspend function for the clocksource, if necessary 163 * @suspend: suspend function for the clocksource, if necessary
163 * @resume: resume function for the clocksource, if necessary 164 * @resume: resume function for the clocksource, if necessary
164 * @cycle_last: most recent cycle counter value seen by ::read() 165 * @cycle_last: most recent cycle counter value seen by ::read()
166 * @owner: module reference, must be set by clocksource in modules
165 */ 167 */
166struct clocksource { 168struct clocksource {
167 /* 169 /*
@@ -195,6 +197,7 @@ struct clocksource {
195 cycle_t cs_last; 197 cycle_t cs_last;
196 cycle_t wd_last; 198 cycle_t wd_last;
197#endif 199#endif
200 struct module *owner;
198} ____cacheline_aligned; 201} ____cacheline_aligned;
199 202
200/* 203/*
@@ -207,6 +210,7 @@ struct clocksource {
207#define CLOCK_SOURCE_VALID_FOR_HRES 0x20 210#define CLOCK_SOURCE_VALID_FOR_HRES 0x20
208#define CLOCK_SOURCE_UNSTABLE 0x40 211#define CLOCK_SOURCE_UNSTABLE 0x40
209#define CLOCK_SOURCE_SUSPEND_NONSTOP 0x80 212#define CLOCK_SOURCE_SUSPEND_NONSTOP 0x80
213#define CLOCK_SOURCE_RESELECT 0x100
210 214
211/* simplify initialization of mask field */ 215/* simplify initialization of mask field */
212#define CLOCKSOURCE_MASK(bits) (cycle_t)((bits) < 64 ? ((1ULL<<(bits))-1) : -1) 216#define CLOCKSOURCE_MASK(bits) (cycle_t)((bits) < 64 ? ((1ULL<<(bits))-1) : -1)
@@ -279,7 +283,7 @@ static inline s64 clocksource_cyc2ns(cycle_t cycles, u32 mult, u32 shift)
279 283
280 284
281extern int clocksource_register(struct clocksource*); 285extern int clocksource_register(struct clocksource*);
282extern void clocksource_unregister(struct clocksource*); 286extern int clocksource_unregister(struct clocksource*);
283extern void clocksource_touch_watchdog(void); 287extern void clocksource_touch_watchdog(void);
284extern struct clocksource* clocksource_get_next(void); 288extern struct clocksource* clocksource_get_next(void);
285extern void clocksource_change_rating(struct clocksource *cs, int rating); 289extern void clocksource_change_rating(struct clocksource *cs, int rating);
@@ -321,7 +325,7 @@ static inline void __clocksource_updatefreq_khz(struct clocksource *cs, u32 khz)
321} 325}
322 326
323 327
324extern void timekeeping_notify(struct clocksource *clock); 328extern int timekeeping_notify(struct clocksource *clock);
325 329
326extern cycle_t clocksource_mmio_readl_up(struct clocksource *); 330extern cycle_t clocksource_mmio_readl_up(struct clocksource *);
327extern cycle_t clocksource_mmio_readl_down(struct clocksource *); 331extern cycle_t clocksource_mmio_readl_down(struct clocksource *);
diff --git a/include/linux/cpu.h b/include/linux/cpu.h
index 9f3c7e81270a..ab0eade73039 100644
--- a/include/linux/cpu.h
+++ b/include/linux/cpu.h
@@ -6,9 +6,8 @@
6 * definitions of processors. 6 * definitions of processors.
7 * 7 *
8 * Basic handling of the devices is done in drivers/base/cpu.c 8 * Basic handling of the devices is done in drivers/base/cpu.c
9 * and system devices are handled in drivers/base/sys.c.
10 * 9 *
11 * CPUs are exported via sysfs in the class/cpu/devices/ 10 * CPUs are exported via sysfs in the devices/system/cpu
12 * directory. 11 * directory.
13 */ 12 */
14#ifndef _LINUX_CPU_H_ 13#ifndef _LINUX_CPU_H_
@@ -115,7 +114,7 @@ enum {
115/* Need to know about CPUs going up/down? */ 114/* Need to know about CPUs going up/down? */
116#if defined(CONFIG_HOTPLUG_CPU) || !defined(MODULE) 115#if defined(CONFIG_HOTPLUG_CPU) || !defined(MODULE)
117#define cpu_notifier(fn, pri) { \ 116#define cpu_notifier(fn, pri) { \
118 static struct notifier_block fn##_nb __cpuinitdata = \ 117 static struct notifier_block fn##_nb = \
119 { .notifier_call = fn, .priority = pri }; \ 118 { .notifier_call = fn, .priority = pri }; \
120 register_cpu_notifier(&fn##_nb); \ 119 register_cpu_notifier(&fn##_nb); \
121} 120}
diff --git a/include/linux/cpu_cooling.h b/include/linux/cpu_cooling.h
index 282e27028418..a5d52eea8232 100644
--- a/include/linux/cpu_cooling.h
+++ b/include/linux/cpu_cooling.h
@@ -41,7 +41,7 @@ cpufreq_cooling_register(const struct cpumask *clip_cpus);
41 */ 41 */
42void cpufreq_cooling_unregister(struct thermal_cooling_device *cdev); 42void cpufreq_cooling_unregister(struct thermal_cooling_device *cdev);
43 43
44unsigned long cpufreq_cooling_get_level(unsigned int, unsigned int); 44unsigned long cpufreq_cooling_get_level(unsigned int cpu, unsigned int freq);
45#else /* !CONFIG_CPU_THERMAL */ 45#else /* !CONFIG_CPU_THERMAL */
46static inline struct thermal_cooling_device * 46static inline struct thermal_cooling_device *
47cpufreq_cooling_register(const struct cpumask *clip_cpus) 47cpufreq_cooling_register(const struct cpumask *clip_cpus)
@@ -54,7 +54,7 @@ void cpufreq_cooling_unregister(struct thermal_cooling_device *cdev)
54 return; 54 return;
55} 55}
56static inline 56static inline
57unsigned long cpufreq_cooling_get_level(unsigned int, unsigned int) 57unsigned long cpufreq_cooling_get_level(unsigned int cpu, unsigned int freq)
58{ 58{
59 return THERMAL_CSTATE_INVALID; 59 return THERMAL_CSTATE_INVALID;
60} 60}
diff --git a/include/linux/cpufreq.h b/include/linux/cpufreq.h
index 4d7390bc1727..90d5a15120d5 100644
--- a/include/linux/cpufreq.h
+++ b/include/linux/cpufreq.h
@@ -119,7 +119,7 @@ struct cpufreq_policy {
119 119
120 struct kobject kobj; 120 struct kobject kobj;
121 struct completion kobj_unregister; 121 struct completion kobj_unregister;
122 bool transition_ongoing; /* Tracks transition status */ 122 int transition_ongoing; /* Tracks transition status */
123}; 123};
124 124
125#define CPUFREQ_ADJUST (0) 125#define CPUFREQ_ADJUST (0)
diff --git a/include/linux/dcache.h b/include/linux/dcache.h
index f42dbe145479..b90337c9d468 100644
--- a/include/linux/dcache.h
+++ b/include/linux/dcache.h
@@ -324,6 +324,11 @@ static inline int __d_rcu_to_refcount(struct dentry *dentry, unsigned seq)
324 return ret; 324 return ret;
325} 325}
326 326
327static inline unsigned d_count(const struct dentry *dentry)
328{
329 return dentry->d_count;
330}
331
327/* validate "insecure" dentry pointer */ 332/* validate "insecure" dentry pointer */
328extern int d_validate(struct dentry *, struct dentry *); 333extern int d_validate(struct dentry *, struct dentry *);
329 334
diff --git a/include/linux/decompress/unlz4.h b/include/linux/decompress/unlz4.h
new file mode 100644
index 000000000000..d5b68bf3ec92
--- /dev/null
+++ b/include/linux/decompress/unlz4.h
@@ -0,0 +1,10 @@
1#ifndef DECOMPRESS_UNLZ4_H
2#define DECOMPRESS_UNLZ4_H
3
4int unlz4(unsigned char *inbuf, int len,
5 int(*fill)(void*, unsigned int),
6 int(*flush)(void*, unsigned int),
7 unsigned char *output,
8 int *pos,
9 void(*error)(char *x));
10#endif
diff --git a/include/linux/device-mapper.h b/include/linux/device-mapper.h
index 3cd32478f2fd..e151d4c9298d 100644
--- a/include/linux/device-mapper.h
+++ b/include/linux/device-mapper.h
@@ -446,9 +446,9 @@ int __must_check dm_set_target_max_io_len(struct dm_target *ti, sector_t len);
446/* 446/*
447 * Table reference counting. 447 * Table reference counting.
448 */ 448 */
449struct dm_table *dm_get_live_table(struct mapped_device *md); 449struct dm_table *dm_get_live_table(struct mapped_device *md, int *srcu_idx);
450void dm_table_get(struct dm_table *t); 450void dm_put_live_table(struct mapped_device *md, int srcu_idx);
451void dm_table_put(struct dm_table *t); 451void dm_sync_table(struct mapped_device *md);
452 452
453/* 453/*
454 * Queries 454 * Queries
diff --git a/include/linux/device.h b/include/linux/device.h
index bcf8c0d4cd98..22b546a58591 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -47,7 +47,11 @@ struct bus_attribute {
47}; 47};
48 48
49#define BUS_ATTR(_name, _mode, _show, _store) \ 49#define BUS_ATTR(_name, _mode, _show, _store) \
50struct bus_attribute bus_attr_##_name = __ATTR(_name, _mode, _show, _store) 50 struct bus_attribute bus_attr_##_name = __ATTR(_name, _mode, _show, _store)
51#define BUS_ATTR_RW(_name) \
52 struct bus_attribute bus_attr_##_name = __ATTR_RW(_name)
53#define BUS_ATTR_RO(_name) \
54 struct bus_attribute bus_attr_##_name = __ATTR_RO(_name)
51 55
52extern int __must_check bus_create_file(struct bus_type *, 56extern int __must_check bus_create_file(struct bus_type *,
53 struct bus_attribute *); 57 struct bus_attribute *);
@@ -261,9 +265,12 @@ struct driver_attribute {
261 size_t count); 265 size_t count);
262}; 266};
263 267
264#define DRIVER_ATTR(_name, _mode, _show, _store) \ 268#define DRIVER_ATTR(_name, _mode, _show, _store) \
265struct driver_attribute driver_attr_##_name = \ 269 struct driver_attribute driver_attr_##_name = __ATTR(_name, _mode, _show, _store)
266 __ATTR(_name, _mode, _show, _store) 270#define DRIVER_ATTR_RW(_name) \
271 struct driver_attribute driver_attr_##_name = __ATTR_RW(_name)
272#define DRIVER_ATTR_RO(_name) \
273 struct driver_attribute driver_attr_##_name = __ATTR_RO(_name)
267 274
268extern int __must_check driver_create_file(struct device_driver *driver, 275extern int __must_check driver_create_file(struct device_driver *driver,
269 const struct driver_attribute *attr); 276 const struct driver_attribute *attr);
@@ -313,6 +320,7 @@ int subsys_virtual_register(struct bus_type *subsys,
313 * @name: Name of the class. 320 * @name: Name of the class.
314 * @owner: The module owner. 321 * @owner: The module owner.
315 * @class_attrs: Default attributes of this class. 322 * @class_attrs: Default attributes of this class.
323 * @dev_groups: Default attributes of the devices that belong to the class.
316 * @dev_attrs: Default attributes of the devices belong to the class. 324 * @dev_attrs: Default attributes of the devices belong to the class.
317 * @dev_bin_attrs: Default binary attributes of the devices belong to the class. 325 * @dev_bin_attrs: Default binary attributes of the devices belong to the class.
318 * @dev_kobj: The kobject that represents this class and links it into the hierarchy. 326 * @dev_kobj: The kobject that represents this class and links it into the hierarchy.
@@ -342,7 +350,8 @@ struct class {
342 struct module *owner; 350 struct module *owner;
343 351
344 struct class_attribute *class_attrs; 352 struct class_attribute *class_attrs;
345 struct device_attribute *dev_attrs; 353 struct device_attribute *dev_attrs; /* use dev_groups instead */
354 const struct attribute_group **dev_groups;
346 struct bin_attribute *dev_bin_attrs; 355 struct bin_attribute *dev_bin_attrs;
347 struct kobject *dev_kobj; 356 struct kobject *dev_kobj;
348 357
@@ -414,8 +423,12 @@ struct class_attribute {
414 const struct class_attribute *attr); 423 const struct class_attribute *attr);
415}; 424};
416 425
417#define CLASS_ATTR(_name, _mode, _show, _store) \ 426#define CLASS_ATTR(_name, _mode, _show, _store) \
418struct class_attribute class_attr_##_name = __ATTR(_name, _mode, _show, _store) 427 struct class_attribute class_attr_##_name = __ATTR(_name, _mode, _show, _store)
428#define CLASS_ATTR_RW(_name) \
429 struct class_attribute class_attr_##_name = __ATTR_RW(_name)
430#define CLASS_ATTR_RO(_name) \
431 struct class_attribute class_attr_##_name = __ATTR_RO(_name)
419 432
420extern int __must_check class_create_file(struct class *class, 433extern int __must_check class_create_file(struct class *class,
421 const struct class_attribute *attr); 434 const struct class_attribute *attr);
@@ -423,7 +436,6 @@ extern void class_remove_file(struct class *class,
423 const struct class_attribute *attr); 436 const struct class_attribute *attr);
424 437
425/* Simple class attribute that is just a static string */ 438/* Simple class attribute that is just a static string */
426
427struct class_attribute_string { 439struct class_attribute_string {
428 struct class_attribute attr; 440 struct class_attribute attr;
429 char *str; 441 char *str;
@@ -512,6 +524,10 @@ ssize_t device_store_bool(struct device *dev, struct device_attribute *attr,
512 524
513#define DEVICE_ATTR(_name, _mode, _show, _store) \ 525#define DEVICE_ATTR(_name, _mode, _show, _store) \
514 struct device_attribute dev_attr_##_name = __ATTR(_name, _mode, _show, _store) 526 struct device_attribute dev_attr_##_name = __ATTR(_name, _mode, _show, _store)
527#define DEVICE_ATTR_RW(_name) \
528 struct device_attribute dev_attr_##_name = __ATTR_RW(_name)
529#define DEVICE_ATTR_RO(_name) \
530 struct device_attribute dev_attr_##_name = __ATTR_RO(_name)
515#define DEVICE_ULONG_ATTR(_name, _mode, _var) \ 531#define DEVICE_ULONG_ATTR(_name, _mode, _var) \
516 struct dev_ext_attribute dev_attr_##_name = \ 532 struct dev_ext_attribute dev_attr_##_name = \
517 { __ATTR(_name, _mode, device_show_ulong, device_store_ulong), &(_var) } 533 { __ATTR(_name, _mode, device_show_ulong, device_store_ulong), &(_var) }
@@ -924,6 +940,11 @@ extern __printf(5, 6)
924struct device *device_create(struct class *cls, struct device *parent, 940struct device *device_create(struct class *cls, struct device *parent,
925 dev_t devt, void *drvdata, 941 dev_t devt, void *drvdata,
926 const char *fmt, ...); 942 const char *fmt, ...);
943extern __printf(6, 7)
944struct device *device_create_with_groups(struct class *cls,
945 struct device *parent, dev_t devt, void *drvdata,
946 const struct attribute_group **groups,
947 const char *fmt, ...);
927extern void device_destroy(struct class *cls, dev_t devt); 948extern void device_destroy(struct class *cls, dev_t devt);
928 949
929/* 950/*
diff --git a/include/linux/drbd.h b/include/linux/drbd.h
index 1b4d4ee1168f..de7d74ab3de6 100644
--- a/include/linux/drbd.h
+++ b/include/linux/drbd.h
@@ -177,7 +177,11 @@ enum drbd_ret_code {
177 ERR_NEED_APV_100 = 163, 177 ERR_NEED_APV_100 = 163,
178 ERR_NEED_ALLOW_TWO_PRI = 164, 178 ERR_NEED_ALLOW_TWO_PRI = 164,
179 ERR_MD_UNCLEAN = 165, 179 ERR_MD_UNCLEAN = 165,
180 180 ERR_MD_LAYOUT_CONNECTED = 166,
181 ERR_MD_LAYOUT_TOO_BIG = 167,
182 ERR_MD_LAYOUT_TOO_SMALL = 168,
183 ERR_MD_LAYOUT_NO_FIT = 169,
184 ERR_IMPLICIT_SHRINK = 170,
181 /* insert new ones above this line */ 185 /* insert new ones above this line */
182 AFTER_LAST_ERR_CODE 186 AFTER_LAST_ERR_CODE
183}; 187};
diff --git a/include/linux/drbd_genl.h b/include/linux/drbd_genl.h
index d0d8fac8a6e4..e8c44572b8cb 100644
--- a/include/linux/drbd_genl.h
+++ b/include/linux/drbd_genl.h
@@ -181,6 +181,8 @@ GENL_struct(DRBD_NLA_RESIZE_PARMS, 7, resize_parms,
181 __u64_field(1, DRBD_GENLA_F_MANDATORY, resize_size) 181 __u64_field(1, DRBD_GENLA_F_MANDATORY, resize_size)
182 __flg_field(2, DRBD_GENLA_F_MANDATORY, resize_force) 182 __flg_field(2, DRBD_GENLA_F_MANDATORY, resize_force)
183 __flg_field(3, DRBD_GENLA_F_MANDATORY, no_resync) 183 __flg_field(3, DRBD_GENLA_F_MANDATORY, no_resync)
184 __u32_field_def(4, 0 /* OPTIONAL */, al_stripes, DRBD_AL_STRIPES_DEF)
185 __u32_field_def(5, 0 /* OPTIONAL */, al_stripe_size, DRBD_AL_STRIPE_SIZE_DEF)
184) 186)
185 187
186GENL_struct(DRBD_NLA_STATE_INFO, 8, state_info, 188GENL_struct(DRBD_NLA_STATE_INFO, 8, state_info,
diff --git a/include/linux/drbd_limits.h b/include/linux/drbd_limits.h
index 1fedf2b17cc8..17e50bb00521 100644
--- a/include/linux/drbd_limits.h
+++ b/include/linux/drbd_limits.h
@@ -215,4 +215,13 @@
215#define DRBD_ALWAYS_ASBP_DEF 0 215#define DRBD_ALWAYS_ASBP_DEF 0
216#define DRBD_USE_RLE_DEF 1 216#define DRBD_USE_RLE_DEF 1
217 217
218#define DRBD_AL_STRIPES_MIN 1
219#define DRBD_AL_STRIPES_MAX 1024
220#define DRBD_AL_STRIPES_DEF 1
221#define DRBD_AL_STRIPES_SCALE '1'
222
223#define DRBD_AL_STRIPE_SIZE_MIN 4
224#define DRBD_AL_STRIPE_SIZE_MAX 16777216
225#define DRBD_AL_STRIPE_SIZE_DEF 32
226#define DRBD_AL_STRIPE_SIZE_SCALE 'k' /* kilobytes */
218#endif 227#endif
diff --git a/include/linux/dw_apb_timer.h b/include/linux/dw_apb_timer.h
index 07261d52a6df..1f79b20918b1 100644
--- a/include/linux/dw_apb_timer.h
+++ b/include/linux/dw_apb_timer.h
@@ -51,6 +51,5 @@ dw_apb_clocksource_init(unsigned rating, const char *name, void __iomem *base,
51void dw_apb_clocksource_register(struct dw_apb_clocksource *dw_cs); 51void dw_apb_clocksource_register(struct dw_apb_clocksource *dw_cs);
52void dw_apb_clocksource_start(struct dw_apb_clocksource *dw_cs); 52void dw_apb_clocksource_start(struct dw_apb_clocksource *dw_cs);
53cycle_t dw_apb_clocksource_read(struct dw_apb_clocksource *dw_cs); 53cycle_t dw_apb_clocksource_read(struct dw_apb_clocksource *dw_cs);
54void dw_apb_clocksource_unregister(struct dw_apb_clocksource *dw_cs);
55 54
56#endif /* __DW_APB_TIMER_H__ */ 55#endif /* __DW_APB_TIMER_H__ */
diff --git a/include/linux/edac.h b/include/linux/edac.h
index 0b763276f619..5c6d7fbaf89e 100644
--- a/include/linux/edac.h
+++ b/include/linux/edac.h
@@ -622,7 +622,7 @@ struct edac_raw_error_desc {
622 */ 622 */
623struct mem_ctl_info { 623struct mem_ctl_info {
624 struct device dev; 624 struct device dev;
625 struct bus_type bus; 625 struct bus_type *bus;
626 626
627 struct list_head link; /* for global list of mem_ctl_info structs */ 627 struct list_head link; /* for global list of mem_ctl_info structs */
628 628
@@ -742,4 +742,9 @@ struct mem_ctl_info {
742#endif 742#endif
743}; 743};
744 744
745/*
746 * Maximum number of memory controllers in the coherent fabric.
747 */
748#define EDAC_MAX_MCS 16
749
745#endif 750#endif
diff --git a/include/linux/efi.h b/include/linux/efi.h
index 21ae6b3c0359..5f8f176154f7 100644
--- a/include/linux/efi.h
+++ b/include/linux/efi.h
@@ -594,8 +594,8 @@ extern u64 efi_mem_attribute (unsigned long phys_addr, unsigned long size);
594extern int __init efi_uart_console_only (void); 594extern int __init efi_uart_console_only (void);
595extern void efi_initialize_iomem_resources(struct resource *code_resource, 595extern void efi_initialize_iomem_resources(struct resource *code_resource,
596 struct resource *data_resource, struct resource *bss_resource); 596 struct resource *data_resource, struct resource *bss_resource);
597extern unsigned long efi_get_time(void); 597extern void efi_get_time(struct timespec *now);
598extern int efi_set_rtc_mmss(unsigned long nowtime); 598extern int efi_set_rtc_mmss(const struct timespec *now);
599extern void efi_reserve_boot_services(void); 599extern void efi_reserve_boot_services(void);
600extern struct efi_memory_map memmap; 600extern struct efi_memory_map memmap;
601 601
diff --git a/include/linux/elevator.h b/include/linux/elevator.h
index acd0312d46fb..306dd8cd0b6f 100644
--- a/include/linux/elevator.h
+++ b/include/linux/elevator.h
@@ -7,6 +7,7 @@
7#ifdef CONFIG_BLOCK 7#ifdef CONFIG_BLOCK
8 8
9struct io_cq; 9struct io_cq;
10struct elevator_type;
10 11
11typedef int (elevator_merge_fn) (struct request_queue *, struct request **, 12typedef int (elevator_merge_fn) (struct request_queue *, struct request **,
12 struct bio *); 13 struct bio *);
@@ -35,7 +36,8 @@ typedef void (elevator_put_req_fn) (struct request *);
35typedef void (elevator_activate_req_fn) (struct request_queue *, struct request *); 36typedef void (elevator_activate_req_fn) (struct request_queue *, struct request *);
36typedef void (elevator_deactivate_req_fn) (struct request_queue *, struct request *); 37typedef void (elevator_deactivate_req_fn) (struct request_queue *, struct request *);
37 38
38typedef int (elevator_init_fn) (struct request_queue *); 39typedef int (elevator_init_fn) (struct request_queue *,
40 struct elevator_type *e);
39typedef void (elevator_exit_fn) (struct elevator_queue *); 41typedef void (elevator_exit_fn) (struct elevator_queue *);
40 42
41struct elevator_ops 43struct elevator_ops
@@ -155,6 +157,8 @@ extern int elevator_init(struct request_queue *, char *);
155extern void elevator_exit(struct elevator_queue *); 157extern void elevator_exit(struct elevator_queue *);
156extern int elevator_change(struct request_queue *, const char *); 158extern int elevator_change(struct request_queue *, const char *);
157extern bool elv_rq_merge_ok(struct request *, struct bio *); 159extern bool elv_rq_merge_ok(struct request *, struct bio *);
160extern struct elevator_queue *elevator_alloc(struct request_queue *,
161 struct elevator_type *);
158 162
159/* 163/*
160 * Helper functions. 164 * Helper functions.
diff --git a/include/linux/fb.h b/include/linux/fb.h
index d49c60f5aa4c..ffac70aab3e9 100644
--- a/include/linux/fb.h
+++ b/include/linux/fb.h
@@ -624,7 +624,7 @@ extern void fb_pad_aligned_buffer(u8 *dst, u32 d_pitch, u8 *src, u32 s_pitch, u3
624extern void fb_set_suspend(struct fb_info *info, int state); 624extern void fb_set_suspend(struct fb_info *info, int state);
625extern int fb_get_color_depth(struct fb_var_screeninfo *var, 625extern int fb_get_color_depth(struct fb_var_screeninfo *var,
626 struct fb_fix_screeninfo *fix); 626 struct fb_fix_screeninfo *fix);
627extern int fb_get_options(char *name, char **option); 627extern int fb_get_options(const char *name, char **option);
628extern int fb_new_modelist(struct fb_info *info); 628extern int fb_new_modelist(struct fb_info *info);
629 629
630extern struct fb_info *registered_fb[FB_MAX]; 630extern struct fb_info *registered_fb[FB_MAX];
diff --git a/include/linux/filter.h b/include/linux/filter.h
index f65f5a69db8f..a6ac84871d6d 100644
--- a/include/linux/filter.h
+++ b/include/linux/filter.h
@@ -59,10 +59,10 @@ extern void bpf_jit_free(struct sk_filter *fp);
59static inline void bpf_jit_dump(unsigned int flen, unsigned int proglen, 59static inline void bpf_jit_dump(unsigned int flen, unsigned int proglen,
60 u32 pass, void *image) 60 u32 pass, void *image)
61{ 61{
62 pr_err("flen=%u proglen=%u pass=%u image=%p\n", 62 pr_err("flen=%u proglen=%u pass=%u image=%pK\n",
63 flen, proglen, pass, image); 63 flen, proglen, pass, image);
64 if (image) 64 if (image)
65 print_hex_dump(KERN_ERR, "JIT code: ", DUMP_PREFIX_ADDRESS, 65 print_hex_dump(KERN_ERR, "JIT code: ", DUMP_PREFIX_OFFSET,
66 16, 1, image, proglen, false); 66 16, 1, image, proglen, false);
67} 67}
68#define SK_RUN_FILTER(FILTER, SKB) (*FILTER->bpf_func)(SKB, FILTER->insns) 68#define SK_RUN_FILTER(FILTER, SKB) (*FILTER->bpf_func)(SKB, FILTER->insns)
diff --git a/include/linux/firewire.h b/include/linux/firewire.h
index 191501afd7fb..5d7782e42b8f 100644
--- a/include/linux/firewire.h
+++ b/include/linux/firewire.h
@@ -251,8 +251,10 @@ struct ieee1394_device_id;
251 251
252struct fw_driver { 252struct fw_driver {
253 struct device_driver driver; 253 struct device_driver driver;
254 int (*probe)(struct fw_unit *unit, const struct ieee1394_device_id *id);
254 /* Called when the parent device sits through a bus reset. */ 255 /* Called when the parent device sits through a bus reset. */
255 void (*update)(struct fw_unit *unit); 256 void (*update)(struct fw_unit *unit);
257 void (*remove)(struct fw_unit *unit);
256 const struct ieee1394_device_id *id_table; 258 const struct ieee1394_device_id *id_table;
257}; 259};
258 260
@@ -434,6 +436,7 @@ struct fw_iso_context {
434 int type; 436 int type;
435 int channel; 437 int channel;
436 int speed; 438 int speed;
439 bool drop_overflow_headers;
437 size_t header_size; 440 size_t header_size;
438 union { 441 union {
439 fw_iso_callback_t sc; 442 fw_iso_callback_t sc;
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 99be011e00de..981874773e85 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -10,6 +10,7 @@
10#include <linux/stat.h> 10#include <linux/stat.h>
11#include <linux/cache.h> 11#include <linux/cache.h>
12#include <linux/list.h> 12#include <linux/list.h>
13#include <linux/llist.h>
13#include <linux/radix-tree.h> 14#include <linux/radix-tree.h>
14#include <linux/rbtree.h> 15#include <linux/rbtree.h>
15#include <linux/init.h> 16#include <linux/init.h>
@@ -372,8 +373,8 @@ struct address_space_operations {
372 int (*get_xip_mem)(struct address_space *, pgoff_t, int, 373 int (*get_xip_mem)(struct address_space *, pgoff_t, int,
373 void **, unsigned long *); 374 void **, unsigned long *);
374 /* 375 /*
375 * migrate the contents of a page to the specified target. If sync 376 * migrate the contents of a page to the specified target. If
376 * is false, it must not block. 377 * migrate_mode is MIGRATE_ASYNC, it must not block.
377 */ 378 */
378 int (*migratepage) (struct address_space *, 379 int (*migratepage) (struct address_space *,
379 struct page *, struct page *, enum migrate_mode); 380 struct page *, struct page *, enum migrate_mode);
@@ -768,6 +769,7 @@ struct file {
768 */ 769 */
769 union { 770 union {
770 struct list_head fu_list; 771 struct list_head fu_list;
772 struct llist_node fu_llist;
771 struct rcu_head fu_rcuhead; 773 struct rcu_head fu_rcuhead;
772 } f_u; 774 } f_u;
773 struct path f_path; 775 struct path f_path;
@@ -954,6 +956,7 @@ struct file_lock {
954 unsigned int fl_flags; 956 unsigned int fl_flags;
955 unsigned char fl_type; 957 unsigned char fl_type;
956 unsigned int fl_pid; 958 unsigned int fl_pid;
959 int fl_link_cpu; /* what cpu's list is this on? */
957 struct pid *fl_nspid; 960 struct pid *fl_nspid;
958 wait_queue_head_t fl_wait; 961 wait_queue_head_t fl_wait;
959 struct file *fl_file; 962 struct file *fl_file;
diff --git a/include/linux/ftrace.h b/include/linux/ftrace.h
index 99d0fbcbaf79..9f15c0064c50 100644
--- a/include/linux/ftrace.h
+++ b/include/linux/ftrace.h
@@ -566,10 +566,6 @@ static inline ssize_t ftrace_filter_write(struct file *file, const char __user *
566 size_t cnt, loff_t *ppos) { return -ENODEV; } 566 size_t cnt, loff_t *ppos) { return -ENODEV; }
567static inline ssize_t ftrace_notrace_write(struct file *file, const char __user *ubuf, 567static inline ssize_t ftrace_notrace_write(struct file *file, const char __user *ubuf,
568 size_t cnt, loff_t *ppos) { return -ENODEV; } 568 size_t cnt, loff_t *ppos) { return -ENODEV; }
569static inline loff_t ftrace_regex_lseek(struct file *file, loff_t offset, int whence)
570{
571 return -ENODEV;
572}
573static inline int 569static inline int
574ftrace_regex_release(struct inode *inode, struct file *file) { return -ENODEV; } 570ftrace_regex_release(struct inode *inode, struct file *file) { return -ENODEV; }
575#endif /* CONFIG_DYNAMIC_FTRACE */ 571#endif /* CONFIG_DYNAMIC_FTRACE */
@@ -828,10 +824,15 @@ enum ftrace_dump_mode;
828 824
829extern enum ftrace_dump_mode ftrace_dump_on_oops; 825extern enum ftrace_dump_mode ftrace_dump_on_oops;
830 826
827extern void disable_trace_on_warning(void);
828extern int __disable_trace_on_warning;
829
831#ifdef CONFIG_PREEMPT 830#ifdef CONFIG_PREEMPT
832#define INIT_TRACE_RECURSION .trace_recursion = 0, 831#define INIT_TRACE_RECURSION .trace_recursion = 0,
833#endif 832#endif
834 833
834#else /* CONFIG_TRACING */
835static inline void disable_trace_on_warning(void) { }
835#endif /* CONFIG_TRACING */ 836#endif /* CONFIG_TRACING */
836 837
837#ifndef INIT_TRACE_RECURSION 838#ifndef INIT_TRACE_RECURSION
diff --git a/include/linux/ftrace_event.h b/include/linux/ftrace_event.h
index 4372658c73ae..120d57a1c3a5 100644
--- a/include/linux/ftrace_event.h
+++ b/include/linux/ftrace_event.h
@@ -78,6 +78,11 @@ struct trace_iterator {
78 /* trace_seq for __print_flags() and __print_symbolic() etc. */ 78 /* trace_seq for __print_flags() and __print_symbolic() etc. */
79 struct trace_seq tmp_seq; 79 struct trace_seq tmp_seq;
80 80
81 cpumask_var_t started;
82
83 /* it's true when current open file is snapshot */
84 bool snapshot;
85
81 /* The below is zeroed out in pipe_read */ 86 /* The below is zeroed out in pipe_read */
82 struct trace_seq seq; 87 struct trace_seq seq;
83 struct trace_entry *ent; 88 struct trace_entry *ent;
@@ -90,10 +95,7 @@ struct trace_iterator {
90 loff_t pos; 95 loff_t pos;
91 long idx; 96 long idx;
92 97
93 cpumask_var_t started; 98 /* All new field here will be zeroed out in pipe_read */
94
95 /* it's true when current open file is snapshot */
96 bool snapshot;
97}; 99};
98 100
99enum trace_iter_flags { 101enum trace_iter_flags {
@@ -332,7 +334,7 @@ extern int trace_define_field(struct ftrace_event_call *call, const char *type,
332 const char *name, int offset, int size, 334 const char *name, int offset, int size,
333 int is_signed, int filter_type); 335 int is_signed, int filter_type);
334extern int trace_add_event_call(struct ftrace_event_call *call); 336extern int trace_add_event_call(struct ftrace_event_call *call);
335extern void trace_remove_event_call(struct ftrace_event_call *call); 337extern int trace_remove_event_call(struct ftrace_event_call *call);
336 338
337#define is_signed_type(type) (((type)(-1)) < (type)1) 339#define is_signed_type(type) (((type)(-1)) < (type)1)
338 340
diff --git a/include/linux/gfp.h b/include/linux/gfp.h
index 0f615eb23d05..9b4dd491f7e8 100644
--- a/include/linux/gfp.h
+++ b/include/linux/gfp.h
@@ -209,7 +209,7 @@ static inline int allocflags_to_migratetype(gfp_t gfp_flags)
209 * 0x9 => DMA or NORMAL (MOVABLE+DMA) 209 * 0x9 => DMA or NORMAL (MOVABLE+DMA)
210 * 0xa => MOVABLE (Movable is valid only if HIGHMEM is set too) 210 * 0xa => MOVABLE (Movable is valid only if HIGHMEM is set too)
211 * 0xb => BAD (MOVABLE+HIGHMEM+DMA) 211 * 0xb => BAD (MOVABLE+HIGHMEM+DMA)
212 * 0xc => DMA32 (MOVABLE+HIGHMEM+DMA32) 212 * 0xc => DMA32 (MOVABLE+DMA32)
213 * 0xd => BAD (MOVABLE+DMA32+DMA) 213 * 0xd => BAD (MOVABLE+DMA32+DMA)
214 * 0xe => BAD (MOVABLE+DMA32+HIGHMEM) 214 * 0xe => BAD (MOVABLE+DMA32+HIGHMEM)
215 * 0xf => BAD (MOVABLE+DMA32+HIGHMEM+DMA) 215 * 0xf => BAD (MOVABLE+DMA32+HIGHMEM+DMA)
diff --git a/include/linux/i2c/twl.h b/include/linux/i2c/twl.h
index 488debbef895..81cbbdb96aae 100644
--- a/include/linux/i2c/twl.h
+++ b/include/linux/i2c/twl.h
@@ -658,7 +658,6 @@ struct twl4030_power_data {
658 bool use_poweroff; /* Board is wired for TWL poweroff */ 658 bool use_poweroff; /* Board is wired for TWL poweroff */
659}; 659};
660 660
661extern void twl4030_power_init(struct twl4030_power_data *triton2_scripts);
662extern int twl4030_remove_script(u8 flags); 661extern int twl4030_remove_script(u8 flags);
663extern void twl4030_power_off(void); 662extern void twl4030_power_off(void);
664 663
@@ -726,7 +725,7 @@ struct twl4030_platform_data {
726 struct regulator_init_data *clk32kg; 725 struct regulator_init_data *clk32kg;
727 struct regulator_init_data *v1v8; 726 struct regulator_init_data *v1v8;
728 struct regulator_init_data *v2v1; 727 struct regulator_init_data *v2v1;
729 /* TWL6025 LDO regulators */ 728 /* TWL6032 LDO regulators */
730 struct regulator_init_data *ldo1; 729 struct regulator_init_data *ldo1;
731 struct regulator_init_data *ldo2; 730 struct regulator_init_data *ldo2;
732 struct regulator_init_data *ldo3; 731 struct regulator_init_data *ldo3;
@@ -736,7 +735,7 @@ struct twl4030_platform_data {
736 struct regulator_init_data *ldo7; 735 struct regulator_init_data *ldo7;
737 struct regulator_init_data *ldoln; 736 struct regulator_init_data *ldoln;
738 struct regulator_init_data *ldousb; 737 struct regulator_init_data *ldousb;
739 /* TWL6025 DCDC regulators */ 738 /* TWL6032 DCDC regulators */
740 struct regulator_init_data *smps3; 739 struct regulator_init_data *smps3;
741 struct regulator_init_data *smps4; 740 struct regulator_init_data *smps4;
742 struct regulator_init_data *vio6025; 741 struct regulator_init_data *vio6025;
@@ -753,7 +752,7 @@ struct twl_regulator_driver_data {
753#define TPS_SUBSET BIT(1) /* tps659[23]0 have fewer LDOs */ 752#define TPS_SUBSET BIT(1) /* tps659[23]0 have fewer LDOs */
754#define TWL5031 BIT(2) /* twl5031 has different registers */ 753#define TWL5031 BIT(2) /* twl5031 has different registers */
755#define TWL6030_CLASS BIT(3) /* TWL6030 class */ 754#define TWL6030_CLASS BIT(3) /* TWL6030 class */
756#define TWL6025_SUBCLASS BIT(4) /* TWL6025 has changed registers */ 755#define TWL6032_SUBCLASS BIT(4) /* TWL6032 has changed registers */
757#define TWL4030_ALLOW_UNSUPPORTED BIT(5) /* Some voltages are possible 756#define TWL4030_ALLOW_UNSUPPORTED BIT(5) /* Some voltages are possible
758 * but not officially supported. 757 * but not officially supported.
759 * This flag is necessary to 758 * This flag is necessary to
@@ -840,20 +839,20 @@ static inline int twl4030charger_usb_en(int enable) { return 0; }
840#define TWL6030_REG_CLK32KG 48 839#define TWL6030_REG_CLK32KG 48
841 840
842/* LDOs on 6025 have different names */ 841/* LDOs on 6025 have different names */
843#define TWL6025_REG_LDO2 49 842#define TWL6032_REG_LDO2 49
844#define TWL6025_REG_LDO4 50 843#define TWL6032_REG_LDO4 50
845#define TWL6025_REG_LDO3 51 844#define TWL6032_REG_LDO3 51
846#define TWL6025_REG_LDO5 52 845#define TWL6032_REG_LDO5 52
847#define TWL6025_REG_LDO1 53 846#define TWL6032_REG_LDO1 53
848#define TWL6025_REG_LDO7 54 847#define TWL6032_REG_LDO7 54
849#define TWL6025_REG_LDO6 55 848#define TWL6032_REG_LDO6 55
850#define TWL6025_REG_LDOLN 56 849#define TWL6032_REG_LDOLN 56
851#define TWL6025_REG_LDOUSB 57 850#define TWL6032_REG_LDOUSB 57
852 851
853/* 6025 DCDC supplies */ 852/* 6025 DCDC supplies */
854#define TWL6025_REG_SMPS3 58 853#define TWL6032_REG_SMPS3 58
855#define TWL6025_REG_SMPS4 59 854#define TWL6032_REG_SMPS4 59
856#define TWL6025_REG_VIO 60 855#define TWL6032_REG_VIO 60
857 856
858 857
859#endif /* End of __TWL4030_H */ 858#endif /* End of __TWL4030_H */
diff --git a/include/linux/ieee80211.h b/include/linux/ieee80211.h
index 06b0ed0154a4..b0dc87a2a376 100644
--- a/include/linux/ieee80211.h
+++ b/include/linux/ieee80211.h
@@ -146,6 +146,7 @@ static inline u16 ieee80211_sn_sub(u16 sn1, u16 sn2)
146#define IEEE80211_MAX_RTS_THRESHOLD 2353 146#define IEEE80211_MAX_RTS_THRESHOLD 2353
147#define IEEE80211_MAX_AID 2007 147#define IEEE80211_MAX_AID 2007
148#define IEEE80211_MAX_TIM_LEN 251 148#define IEEE80211_MAX_TIM_LEN 251
149#define IEEE80211_MAX_MESH_PEERINGS 63
149/* Maximum size for the MA-UNITDATA primitive, 802.11 standard section 150/* Maximum size for the MA-UNITDATA primitive, 802.11 standard section
150 6.2.1.1.2. 151 6.2.1.1.2.
151 152
@@ -1829,6 +1830,15 @@ enum ieee80211_key_len {
1829 WLAN_KEY_LEN_AES_CMAC = 16, 1830 WLAN_KEY_LEN_AES_CMAC = 16,
1830}; 1831};
1831 1832
1833#define IEEE80211_WEP_IV_LEN 4
1834#define IEEE80211_WEP_ICV_LEN 4
1835#define IEEE80211_CCMP_HDR_LEN 8
1836#define IEEE80211_CCMP_MIC_LEN 8
1837#define IEEE80211_CCMP_PN_LEN 6
1838#define IEEE80211_TKIP_IV_LEN 8
1839#define IEEE80211_TKIP_ICV_LEN 4
1840#define IEEE80211_CMAC_PN_LEN 6
1841
1832/* Public action codes */ 1842/* Public action codes */
1833enum ieee80211_pub_actioncode { 1843enum ieee80211_pub_actioncode {
1834 WLAN_PUB_ACTION_EXT_CHANSW_ANN = 4, 1844 WLAN_PUB_ACTION_EXT_CHANSW_ANN = 4,
diff --git a/include/linux/if_link.h b/include/linux/if_link.h
index c3f817c3eb45..a86784dec3d3 100644
--- a/include/linux/if_link.h
+++ b/include/linux/if_link.h
@@ -12,5 +12,6 @@ struct ifla_vf_info {
12 __u32 qos; 12 __u32 qos;
13 __u32 tx_rate; 13 __u32 tx_rate;
14 __u32 spoofchk; 14 __u32 spoofchk;
15 __u32 linkstate;
15}; 16};
16#endif /* _LINUX_IF_LINK_H */ 17#endif /* _LINUX_IF_LINK_H */
diff --git a/include/linux/if_macvlan.h b/include/linux/if_macvlan.h
index 84dde1dd1da4..ddd33fd5904d 100644
--- a/include/linux/if_macvlan.h
+++ b/include/linux/if_macvlan.h
@@ -8,7 +8,7 @@
8#include <net/netlink.h> 8#include <net/netlink.h>
9#include <linux/u64_stats_sync.h> 9#include <linux/u64_stats_sync.h>
10 10
11#if defined(CONFIG_MACVTAP) || defined(CONFIG_MACVTAP_MODULE) 11#if IS_ENABLED(CONFIG_MACVTAP)
12struct socket *macvtap_get_socket(struct file *); 12struct socket *macvtap_get_socket(struct file *);
13#else 13#else
14#include <linux/err.h> 14#include <linux/err.h>
@@ -50,7 +50,7 @@ struct macvlan_pcpu_stats {
50 * Maximum times a macvtap device can be opened. This can be used to 50 * Maximum times a macvtap device can be opened. This can be used to
51 * configure the number of receive queue, e.g. for multiqueue virtio. 51 * configure the number of receive queue, e.g. for multiqueue virtio.
52 */ 52 */
53#define MAX_MACVTAP_QUEUES (NR_CPUS < 16 ? NR_CPUS : 16) 53#define MAX_MACVTAP_QUEUES 16
54 54
55#define MACVLAN_MC_FILTER_BITS 8 55#define MACVLAN_MC_FILTER_BITS 8
56#define MACVLAN_MC_FILTER_SZ (1 << MACVLAN_MC_FILTER_BITS) 56#define MACVLAN_MC_FILTER_SZ (1 << MACVLAN_MC_FILTER_BITS)
@@ -65,12 +65,18 @@ struct macvlan_dev {
65 65
66 DECLARE_BITMAP(mc_filter, MACVLAN_MC_FILTER_SZ); 66 DECLARE_BITMAP(mc_filter, MACVLAN_MC_FILTER_SZ);
67 67
68 netdev_features_t set_features;
68 enum macvlan_mode mode; 69 enum macvlan_mode mode;
69 u16 flags; 70 u16 flags;
70 int (*receive)(struct sk_buff *skb); 71 int (*receive)(struct sk_buff *skb);
71 int (*forward)(struct net_device *dev, struct sk_buff *skb); 72 int (*forward)(struct net_device *dev, struct sk_buff *skb);
72 struct macvtap_queue *taps[MAX_MACVTAP_QUEUES]; 73 /* This array tracks active taps. */
74 struct macvtap_queue __rcu *taps[MAX_MACVTAP_QUEUES];
75 /* This list tracks all taps (both enabled and disabled) */
76 struct list_head queue_list;
73 int numvtaps; 77 int numvtaps;
78 int numqueues;
79 netdev_features_t tap_features;
74 int minor; 80 int minor;
75}; 81};
76 82
diff --git a/include/linux/if_team.h b/include/linux/if_team.h
index 16fae6436d0e..f6156f91eb1c 100644
--- a/include/linux/if_team.h
+++ b/include/linux/if_team.h
@@ -69,6 +69,7 @@ struct team_port {
69 s32 priority; /* lower number ~ higher priority */ 69 s32 priority; /* lower number ~ higher priority */
70 u16 queue_id; 70 u16 queue_id;
71 struct list_head qom_list; /* node in queue override mapping list */ 71 struct list_head qom_list; /* node in queue override mapping list */
72 struct rcu_head rcu;
72 long mode_priv[0]; 73 long mode_priv[0];
73}; 74};
74 75
@@ -228,6 +229,16 @@ static inline struct team_port *team_get_port_by_index(struct team *team,
228 return port; 229 return port;
229 return NULL; 230 return NULL;
230} 231}
232
233static inline int team_num_to_port_index(struct team *team, int num)
234{
235 int en_port_count = ACCESS_ONCE(team->en_port_count);
236
237 if (unlikely(!en_port_count))
238 return 0;
239 return num % en_port_count;
240}
241
231static inline struct team_port *team_get_port_by_index_rcu(struct team *team, 242static inline struct team_port *team_get_port_by_index_rcu(struct team *team,
232 int port_index) 243 int port_index)
233{ 244{
diff --git a/include/linux/if_vlan.h b/include/linux/if_vlan.h
index 637fa71de0c7..715c343f7c00 100644
--- a/include/linux/if_vlan.h
+++ b/include/linux/if_vlan.h
@@ -79,9 +79,8 @@ static inline int is_vlan_dev(struct net_device *dev)
79} 79}
80 80
81#define vlan_tx_tag_present(__skb) ((__skb)->vlan_tci & VLAN_TAG_PRESENT) 81#define vlan_tx_tag_present(__skb) ((__skb)->vlan_tci & VLAN_TAG_PRESENT)
82#define vlan_tx_nonzero_tag_present(__skb) \
83 (vlan_tx_tag_present(__skb) && ((__skb)->vlan_tci & VLAN_VID_MASK))
84#define vlan_tx_tag_get(__skb) ((__skb)->vlan_tci & ~VLAN_TAG_PRESENT) 82#define vlan_tx_tag_get(__skb) ((__skb)->vlan_tci & ~VLAN_TAG_PRESENT)
83#define vlan_tx_tag_get_id(__skb) ((__skb)->vlan_tci & VLAN_VID_MASK)
85 84
86#if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE) 85#if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE)
87 86
@@ -243,8 +242,6 @@ static inline struct sk_buff *__vlan_hwaccel_put_tag(struct sk_buff *skb,
243 return skb; 242 return skb;
244} 243}
245 244
246#define HAVE_VLAN_PUT_TAG
247
248/** 245/**
249 * vlan_put_tag - inserts VLAN tag according to device features 246 * vlan_put_tag - inserts VLAN tag according to device features
250 * @skb: skbuff to tag 247 * @skb: skbuff to tag
diff --git a/include/linux/igmp.h b/include/linux/igmp.h
index 7f2bf1518480..e3362b5f13e8 100644
--- a/include/linux/igmp.h
+++ b/include/linux/igmp.h
@@ -84,6 +84,7 @@ struct ip_mc_list {
84 struct ip_mc_list *next; 84 struct ip_mc_list *next;
85 struct ip_mc_list __rcu *next_rcu; 85 struct ip_mc_list __rcu *next_rcu;
86 }; 86 };
87 struct ip_mc_list __rcu *next_hash;
87 struct timer_list timer; 88 struct timer_list timer;
88 int users; 89 int users;
89 atomic_t refcnt; 90 atomic_t refcnt;
diff --git a/include/linux/iio/iio.h b/include/linux/iio/iio.h
index 8d171f427632..3d35b7023591 100644
--- a/include/linux/iio/iio.h
+++ b/include/linux/iio/iio.h
@@ -211,8 +211,8 @@ struct iio_chan_spec {
211static inline bool iio_channel_has_info(const struct iio_chan_spec *chan, 211static inline bool iio_channel_has_info(const struct iio_chan_spec *chan,
212 enum iio_chan_info_enum type) 212 enum iio_chan_info_enum type)
213{ 213{
214 return (chan->info_mask_separate & type) | 214 return (chan->info_mask_separate & BIT(type)) |
215 (chan->info_mask_shared_by_type & type); 215 (chan->info_mask_shared_by_type & BIT(type));
216} 216}
217 217
218#define IIO_ST(si, rb, sb, sh) \ 218#define IIO_ST(si, rb, sb, sh) \
diff --git a/include/linux/inetdevice.h b/include/linux/inetdevice.h
index ea1e3b863890..b99cd23f3474 100644
--- a/include/linux/inetdevice.h
+++ b/include/linux/inetdevice.h
@@ -50,12 +50,17 @@ struct ipv4_devconf {
50 DECLARE_BITMAP(state, IPV4_DEVCONF_MAX); 50 DECLARE_BITMAP(state, IPV4_DEVCONF_MAX);
51}; 51};
52 52
53#define MC_HASH_SZ_LOG 9
54
53struct in_device { 55struct in_device {
54 struct net_device *dev; 56 struct net_device *dev;
55 atomic_t refcnt; 57 atomic_t refcnt;
56 int dead; 58 int dead;
57 struct in_ifaddr *ifa_list; /* IP ifaddr chain */ 59 struct in_ifaddr *ifa_list; /* IP ifaddr chain */
60
58 struct ip_mc_list __rcu *mc_list; /* IP multicast filter chain */ 61 struct ip_mc_list __rcu *mc_list; /* IP multicast filter chain */
62 struct ip_mc_list __rcu * __rcu *mc_hash;
63
59 int mc_count; /* Number of installed mcasts */ 64 int mc_count; /* Number of installed mcasts */
60 spinlock_t mc_tomb_lock; 65 spinlock_t mc_tomb_lock;
61 struct ip_mc_list *mc_tomb; 66 struct ip_mc_list *mc_tomb;
diff --git a/include/linux/init.h b/include/linux/init.h
index 861814710d52..e73f2b708525 100644
--- a/include/linux/init.h
+++ b/include/linux/init.h
@@ -93,13 +93,13 @@
93 93
94#define __exit __section(.exit.text) __exitused __cold notrace 94#define __exit __section(.exit.text) __exitused __cold notrace
95 95
96/* Used for HOTPLUG_CPU */ 96/* temporary, until all users are removed */
97#define __cpuinit __section(.cpuinit.text) __cold notrace 97#define __cpuinit
98#define __cpuinitdata __section(.cpuinit.data) 98#define __cpuinitdata
99#define __cpuinitconst __constsection(.cpuinit.rodata) 99#define __cpuinitconst
100#define __cpuexit __section(.cpuexit.text) __exitused __cold notrace 100#define __cpuexit
101#define __cpuexitdata __section(.cpuexit.data) 101#define __cpuexitdata
102#define __cpuexitconst __constsection(.cpuexit.rodata) 102#define __cpuexitconst
103 103
104/* Used for MEMORY_HOTPLUG */ 104/* Used for MEMORY_HOTPLUG */
105#define __meminit __section(.meminit.text) __cold notrace 105#define __meminit __section(.meminit.text) __cold notrace
@@ -118,9 +118,8 @@
118#define __INITRODATA .section ".init.rodata","a",%progbits 118#define __INITRODATA .section ".init.rodata","a",%progbits
119#define __FINITDATA .previous 119#define __FINITDATA .previous
120 120
121#define __CPUINIT .section ".cpuinit.text", "ax" 121/* temporary, until all users are removed */
122#define __CPUINITDATA .section ".cpuinit.data", "aw" 122#define __CPUINIT
123#define __CPUINITRODATA .section ".cpuinit.rodata", "a"
124 123
125#define __MEMINIT .section ".meminit.text", "ax" 124#define __MEMINIT .section ".meminit.text", "ax"
126#define __MEMINITDATA .section ".meminit.data", "aw" 125#define __MEMINITDATA .section ".meminit.data", "aw"
diff --git a/include/linux/input/ti_am335x_tsc.h b/include/linux/input/ti_am335x_tsc.h
deleted file mode 100644
index 49269a2aa329..000000000000
--- a/include/linux/input/ti_am335x_tsc.h
+++ /dev/null
@@ -1,23 +0,0 @@
1#ifndef __LINUX_TI_AM335X_TSC_H
2#define __LINUX_TI_AM335X_TSC_H
3
4/**
5 * struct tsc_data Touchscreen wire configuration
6 * @wires: Wires refer to application modes
7 * i.e. 4/5/8 wire touchscreen support
8 * on the platform.
9 * @x_plate_resistance: X plate resistance.
10 * @steps_to_configure: The sequencer supports a total of
11 * 16 programmable steps.
12 * A step configured to read a single
13 * co-ordinate value, can be applied
14 * more number of times for better results.
15 */
16
17struct tsc_data {
18 int wires;
19 int x_plate_resistance;
20 int steps_to_configure;
21};
22
23#endif
diff --git a/include/linux/input/tps6507x-ts.h b/include/linux/input/tps6507x-ts.h
index ab1440313924..b433df801d92 100644
--- a/include/linux/input/tps6507x-ts.h
+++ b/include/linux/input/tps6507x-ts.h
@@ -14,7 +14,6 @@
14/* Board specific touch screen initial values */ 14/* Board specific touch screen initial values */
15struct touchscreen_init_data { 15struct touchscreen_init_data {
16 int poll_period; /* ms */ 16 int poll_period; /* ms */
17 int vref; /* non-zero to leave vref on */
18 __u16 min_pressure; /* min reading to be treated as a touch */ 17 __u16 min_pressure; /* min reading to be treated as a touch */
19 __u16 vendor; 18 __u16 vendor;
20 __u16 product; 19 __u16 product;
diff --git a/include/linux/io.h b/include/linux/io.h
index 069e4075f872..f4f42faec686 100644
--- a/include/linux/io.h
+++ b/include/linux/io.h
@@ -76,4 +76,29 @@ void devm_ioremap_release(struct device *dev, void *res);
76#define arch_has_dev_port() (1) 76#define arch_has_dev_port() (1)
77#endif 77#endif
78 78
79/*
80 * Some systems (x86 without PAT) have a somewhat reliable way to mark a
81 * physical address range such that uncached mappings will actually
82 * end up write-combining. This facility should be used in conjunction
83 * with pgprot_writecombine, ioremap-wc, or set_memory_wc, since it has
84 * no effect if the per-page mechanisms are functional.
85 * (On x86 without PAT, these functions manipulate MTRRs.)
86 *
87 * arch_phys_del_wc(0) or arch_phys_del_wc(any error code) is guaranteed
88 * to have no effect.
89 */
90#ifndef arch_phys_wc_add
91static inline int __must_check arch_phys_wc_add(unsigned long base,
92 unsigned long size)
93{
94 return 0; /* It worked (i.e. did nothing). */
95}
96
97static inline void arch_phys_wc_del(int handle)
98{
99}
100
101#define arch_phys_wc_add arch_phys_wc_add
102#endif
103
79#endif /* _LINUX_IO_H */ 104#endif /* _LINUX_IO_H */
diff --git a/include/linux/irqdomain.h b/include/linux/irqdomain.h
index ba2c708adcff..c983ed18c332 100644
--- a/include/linux/irqdomain.h
+++ b/include/linux/irqdomain.h
@@ -73,57 +73,48 @@ struct irq_domain_chip_generic;
73/** 73/**
74 * struct irq_domain - Hardware interrupt number translation object 74 * struct irq_domain - Hardware interrupt number translation object
75 * @link: Element in global irq_domain list. 75 * @link: Element in global irq_domain list.
76 * @revmap_type: Method used for reverse mapping hwirq numbers to linux irq. This 76 * @name: Name of interrupt domain
77 * will be one of the IRQ_DOMAIN_MAP_* values.
78 * @revmap_data: Revmap method specific data.
79 * @ops: pointer to irq_domain methods 77 * @ops: pointer to irq_domain methods
80 * @host_data: private data pointer for use by owner. Not touched by irq_domain 78 * @host_data: private data pointer for use by owner. Not touched by irq_domain
81 * core code. 79 * core code.
82 * @irq_base: Start of irq_desc range assigned to the irq_domain. The creator 80 *
83 * of the irq_domain is responsible for allocating the array of 81 * Optional elements
84 * irq_desc structures. 82 * @of_node: Pointer to device tree nodes associated with the irq_domain. Used
85 * @nr_irq: Number of irqs managed by the irq domain 83 * when decoding device tree interrupt specifiers.
86 * @hwirq_base: Starting number for hwirqs managed by the irq domain 84 * @gc: Pointer to a list of generic chips. There is a helper function for
87 * @of_node: (optional) Pointer to device tree nodes associated with the 85 * setting up one or more generic chips for interrupt controllers
88 * irq_domain. Used when decoding device tree interrupt specifiers. 86 * drivers using the generic chip library which uses this pointer.
87 *
88 * Revmap data, used internally by irq_domain
89 * @revmap_direct_max_irq: The largest hwirq that can be set for controllers that
90 * support direct mapping
91 * @revmap_size: Size of the linear map table @linear_revmap[]
92 * @revmap_tree: Radix map tree for hwirqs that don't fit in the linear map
93 * @linear_revmap: Linear table of hwirq->virq reverse mappings
89 */ 94 */
90struct irq_domain { 95struct irq_domain {
91 struct list_head link; 96 struct list_head link;
92 97 const char *name;
93 /* type of reverse mapping_technique */
94 unsigned int revmap_type;
95 union {
96 struct {
97 unsigned int size;
98 unsigned int first_irq;
99 irq_hw_number_t first_hwirq;
100 } legacy;
101 struct {
102 unsigned int size;
103 unsigned int *revmap;
104 } linear;
105 struct {
106 unsigned int max_irq;
107 } nomap;
108 struct radix_tree_root tree;
109 } revmap_data;
110 const struct irq_domain_ops *ops; 98 const struct irq_domain_ops *ops;
111 void *host_data; 99 void *host_data;
112 irq_hw_number_t inval_irq;
113 100
114 /* Optional device node pointer */ 101 /* Optional data */
115 struct device_node *of_node; 102 struct device_node *of_node;
116 /* Optional pointer to generic interrupt chips */
117 struct irq_domain_chip_generic *gc; 103 struct irq_domain_chip_generic *gc;
118};
119 104
120#define IRQ_DOMAIN_MAP_LEGACY 0 /* driver allocated fixed range of irqs. 105 /* reverse map data. The linear map gets appended to the irq_domain */
121 * ie. legacy 8259, gets irqs 1..15 */ 106 irq_hw_number_t hwirq_max;
122#define IRQ_DOMAIN_MAP_NOMAP 1 /* no fast reverse mapping */ 107 unsigned int revmap_direct_max_irq;
123#define IRQ_DOMAIN_MAP_LINEAR 2 /* linear map of interrupts */ 108 unsigned int revmap_size;
124#define IRQ_DOMAIN_MAP_TREE 3 /* radix tree */ 109 struct radix_tree_root revmap_tree;
110 unsigned int linear_revmap[];
111};
125 112
126#ifdef CONFIG_IRQ_DOMAIN 113#ifdef CONFIG_IRQ_DOMAIN
114struct irq_domain *__irq_domain_add(struct device_node *of_node, int size,
115 irq_hw_number_t hwirq_max, int direct_max,
116 const struct irq_domain_ops *ops,
117 void *host_data);
127struct irq_domain *irq_domain_add_simple(struct device_node *of_node, 118struct irq_domain *irq_domain_add_simple(struct device_node *of_node,
128 unsigned int size, 119 unsigned int size,
129 unsigned int first_irq, 120 unsigned int first_irq,
@@ -135,21 +126,30 @@ struct irq_domain *irq_domain_add_legacy(struct device_node *of_node,
135 irq_hw_number_t first_hwirq, 126 irq_hw_number_t first_hwirq,
136 const struct irq_domain_ops *ops, 127 const struct irq_domain_ops *ops,
137 void *host_data); 128 void *host_data);
138struct irq_domain *irq_domain_add_linear(struct device_node *of_node, 129extern struct irq_domain *irq_find_host(struct device_node *node);
130extern void irq_set_default_host(struct irq_domain *host);
131
132/**
133 * irq_domain_add_linear() - Allocate and register a linear revmap irq_domain.
134 * @of_node: pointer to interrupt controller's device tree node.
135 * @size: Number of interrupts in the domain.
136 * @ops: map/unmap domain callbacks
137 * @host_data: Controller private data pointer
138 */
139static inline struct irq_domain *irq_domain_add_linear(struct device_node *of_node,
139 unsigned int size, 140 unsigned int size,
140 const struct irq_domain_ops *ops, 141 const struct irq_domain_ops *ops,
141 void *host_data); 142 void *host_data)
142struct irq_domain *irq_domain_add_nomap(struct device_node *of_node, 143{
144 return __irq_domain_add(of_node, size, size, 0, ops, host_data);
145}
146static inline struct irq_domain *irq_domain_add_nomap(struct device_node *of_node,
143 unsigned int max_irq, 147 unsigned int max_irq,
144 const struct irq_domain_ops *ops, 148 const struct irq_domain_ops *ops,
145 void *host_data); 149 void *host_data)
146struct irq_domain *irq_domain_add_tree(struct device_node *of_node, 150{
147 const struct irq_domain_ops *ops, 151 return __irq_domain_add(of_node, 0, max_irq, max_irq, ops, host_data);
148 void *host_data); 152}
149
150extern struct irq_domain *irq_find_host(struct device_node *node);
151extern void irq_set_default_host(struct irq_domain *host);
152
153static inline struct irq_domain *irq_domain_add_legacy_isa( 153static inline struct irq_domain *irq_domain_add_legacy_isa(
154 struct device_node *of_node, 154 struct device_node *of_node,
155 const struct irq_domain_ops *ops, 155 const struct irq_domain_ops *ops,
@@ -158,21 +158,40 @@ static inline struct irq_domain *irq_domain_add_legacy_isa(
158 return irq_domain_add_legacy(of_node, NUM_ISA_INTERRUPTS, 0, 0, ops, 158 return irq_domain_add_legacy(of_node, NUM_ISA_INTERRUPTS, 0, 0, ops,
159 host_data); 159 host_data);
160} 160}
161static inline struct irq_domain *irq_domain_add_tree(struct device_node *of_node,
162 const struct irq_domain_ops *ops,
163 void *host_data)
164{
165 return __irq_domain_add(of_node, 0, ~0, 0, ops, host_data);
166}
161 167
162extern void irq_domain_remove(struct irq_domain *host); 168extern void irq_domain_remove(struct irq_domain *host);
163 169
164extern int irq_domain_associate_many(struct irq_domain *domain, 170extern int irq_domain_associate(struct irq_domain *domain, unsigned int irq,
165 unsigned int irq_base, 171 irq_hw_number_t hwirq);
166 irq_hw_number_t hwirq_base, int count); 172extern void irq_domain_associate_many(struct irq_domain *domain,
167static inline int irq_domain_associate(struct irq_domain *domain, unsigned int irq, 173 unsigned int irq_base,
168 irq_hw_number_t hwirq) 174 irq_hw_number_t hwirq_base, int count);
169{
170 return irq_domain_associate_many(domain, irq, hwirq, 1);
171}
172 175
173extern unsigned int irq_create_mapping(struct irq_domain *host, 176extern unsigned int irq_create_mapping(struct irq_domain *host,
174 irq_hw_number_t hwirq); 177 irq_hw_number_t hwirq);
175extern void irq_dispose_mapping(unsigned int virq); 178extern void irq_dispose_mapping(unsigned int virq);
179
180/**
181 * irq_linear_revmap() - Find a linux irq from a hw irq number.
182 * @domain: domain owning this hardware interrupt
183 * @hwirq: hardware irq number in that domain space
184 *
185 * This is a fast path alternative to irq_find_mapping() that can be
186 * called directly by irq controller code to save a handful of
187 * instructions. It is always safe to call, but won't find irqs mapped
188 * using the radix tree.
189 */
190static inline unsigned int irq_linear_revmap(struct irq_domain *domain,
191 irq_hw_number_t hwirq)
192{
193 return hwirq < domain->revmap_size ? domain->linear_revmap[hwirq] : 0;
194}
176extern unsigned int irq_find_mapping(struct irq_domain *host, 195extern unsigned int irq_find_mapping(struct irq_domain *host,
177 irq_hw_number_t hwirq); 196 irq_hw_number_t hwirq);
178extern unsigned int irq_create_direct_mapping(struct irq_domain *host); 197extern unsigned int irq_create_direct_mapping(struct irq_domain *host);
@@ -186,9 +205,6 @@ static inline int irq_create_identity_mapping(struct irq_domain *host,
186 return irq_create_strict_mappings(host, hwirq, hwirq, 1); 205 return irq_create_strict_mappings(host, hwirq, hwirq, 1);
187} 206}
188 207
189extern unsigned int irq_linear_revmap(struct irq_domain *host,
190 irq_hw_number_t hwirq);
191
192extern const struct irq_domain_ops irq_domain_simple_ops; 208extern const struct irq_domain_ops irq_domain_simple_ops;
193 209
194/* stock xlate functions */ 210/* stock xlate functions */
@@ -202,14 +218,6 @@ int irq_domain_xlate_onetwocell(struct irq_domain *d, struct device_node *ctrlr,
202 const u32 *intspec, unsigned int intsize, 218 const u32 *intspec, unsigned int intsize,
203 irq_hw_number_t *out_hwirq, unsigned int *out_type); 219 irq_hw_number_t *out_hwirq, unsigned int *out_type);
204 220
205#if defined(CONFIG_OF_IRQ)
206extern void irq_domain_generate_simple(const struct of_device_id *match,
207 u64 phys_base, unsigned int irq_start);
208#else /* CONFIG_OF_IRQ */
209static inline void irq_domain_generate_simple(const struct of_device_id *match,
210 u64 phys_base, unsigned int irq_start) { }
211#endif /* !CONFIG_OF_IRQ */
212
213#else /* CONFIG_IRQ_DOMAIN */ 221#else /* CONFIG_IRQ_DOMAIN */
214static inline void irq_dispose_mapping(unsigned int virq) { } 222static inline void irq_dispose_mapping(unsigned int virq) { }
215#endif /* !CONFIG_IRQ_DOMAIN */ 223#endif /* !CONFIG_IRQ_DOMAIN */
diff --git a/include/linux/jiffies.h b/include/linux/jiffies.h
index 8fb8edf12417..97ba4e78a37e 100644
--- a/include/linux/jiffies.h
+++ b/include/linux/jiffies.h
@@ -139,6 +139,10 @@ static inline u64 get_jiffies_64(void)
139 ((__s64)(a) - (__s64)(b) >= 0)) 139 ((__s64)(a) - (__s64)(b) >= 0))
140#define time_before_eq64(a,b) time_after_eq64(b,a) 140#define time_before_eq64(a,b) time_after_eq64(b,a)
141 141
142#define time_in_range64(a, b, c) \
143 (time_after_eq64(a, b) && \
144 time_before_eq64(a, c))
145
142/* 146/*
143 * These four macros compare jiffies and 'a' for convenience. 147 * These four macros compare jiffies and 'a' for convenience.
144 */ 148 */
diff --git a/include/linux/kernel.h b/include/linux/kernel.h
index 7e6b97e77fb9..482ad2d84a32 100644
--- a/include/linux/kernel.h
+++ b/include/linux/kernel.h
@@ -561,9 +561,6 @@ int __trace_bprintk(unsigned long ip, const char *fmt, ...);
561extern __printf(2, 3) 561extern __printf(2, 3)
562int __trace_printk(unsigned long ip, const char *fmt, ...); 562int __trace_printk(unsigned long ip, const char *fmt, ...);
563 563
564extern int __trace_bputs(unsigned long ip, const char *str);
565extern int __trace_puts(unsigned long ip, const char *str, int size);
566
567/** 564/**
568 * trace_puts - write a string into the ftrace buffer 565 * trace_puts - write a string into the ftrace buffer
569 * @str: the string to record 566 * @str: the string to record
@@ -599,6 +596,8 @@ extern int __trace_puts(unsigned long ip, const char *str, int size);
599 else \ 596 else \
600 __trace_puts(_THIS_IP_, str, strlen(str)); \ 597 __trace_puts(_THIS_IP_, str, strlen(str)); \
601}) 598})
599extern int __trace_bputs(unsigned long ip, const char *str);
600extern int __trace_puts(unsigned long ip, const char *str, int size);
602 601
603extern void trace_dump_stack(int skip); 602extern void trace_dump_stack(int skip);
604 603
@@ -630,7 +629,7 @@ extern void ftrace_dump(enum ftrace_dump_mode oops_dump_mode);
630static inline void tracing_start(void) { } 629static inline void tracing_start(void) { }
631static inline void tracing_stop(void) { } 630static inline void tracing_stop(void) { }
632static inline void ftrace_off_permanent(void) { } 631static inline void ftrace_off_permanent(void) { }
633static inline void trace_dump_stack(void) { } 632static inline void trace_dump_stack(int skip) { }
634 633
635static inline void tracing_on(void) { } 634static inline void tracing_on(void) { }
636static inline void tracing_off(void) { } 635static inline void tracing_off(void) { }
diff --git a/include/linux/ktime.h b/include/linux/ktime.h
index bbca12804d12..debf208b7611 100644
--- a/include/linux/ktime.h
+++ b/include/linux/ktime.h
@@ -229,7 +229,8 @@ static inline ktime_t timespec_to_ktime(const struct timespec ts)
229static inline ktime_t timeval_to_ktime(const struct timeval tv) 229static inline ktime_t timeval_to_ktime(const struct timeval tv)
230{ 230{
231 return (ktime_t) { .tv = { .sec = (s32)tv.tv_sec, 231 return (ktime_t) { .tv = { .sec = (s32)tv.tv_sec,
232 .nsec = (s32)tv.tv_usec * 1000 } }; 232 .nsec = (s32)(tv.tv_usec *
233 NSEC_PER_USEC) } };
233} 234}
234 235
235/** 236/**
@@ -320,12 +321,17 @@ static inline s64 ktime_us_delta(const ktime_t later, const ktime_t earlier)
320 321
321static inline ktime_t ktime_add_us(const ktime_t kt, const u64 usec) 322static inline ktime_t ktime_add_us(const ktime_t kt, const u64 usec)
322{ 323{
323 return ktime_add_ns(kt, usec * 1000); 324 return ktime_add_ns(kt, usec * NSEC_PER_USEC);
325}
326
327static inline ktime_t ktime_add_ms(const ktime_t kt, const u64 msec)
328{
329 return ktime_add_ns(kt, msec * NSEC_PER_MSEC);
324} 330}
325 331
326static inline ktime_t ktime_sub_us(const ktime_t kt, const u64 usec) 332static inline ktime_t ktime_sub_us(const ktime_t kt, const u64 usec)
327{ 333{
328 return ktime_sub_ns(kt, usec * 1000); 334 return ktime_sub_ns(kt, usec * NSEC_PER_USEC);
329} 335}
330 336
331extern ktime_t ktime_add_safe(const ktime_t lhs, const ktime_t rhs); 337extern ktime_t ktime_add_safe(const ktime_t lhs, const ktime_t rhs);
@@ -338,7 +344,8 @@ extern ktime_t ktime_add_safe(const ktime_t lhs, const ktime_t rhs);
338 * 344 *
339 * Returns true if there was a successful conversion, false if kt was 0. 345 * Returns true if there was a successful conversion, false if kt was 0.
340 */ 346 */
341static inline bool ktime_to_timespec_cond(const ktime_t kt, struct timespec *ts) 347static inline __must_check bool ktime_to_timespec_cond(const ktime_t kt,
348 struct timespec *ts)
342{ 349{
343 if (kt.tv64) { 350 if (kt.tv64) {
344 *ts = ktime_to_timespec(kt); 351 *ts = ktime_to_timespec(kt);
@@ -366,7 +373,15 @@ extern void ktime_get_ts(struct timespec *ts);
366static inline ktime_t ns_to_ktime(u64 ns) 373static inline ktime_t ns_to_ktime(u64 ns)
367{ 374{
368 static const ktime_t ktime_zero = { .tv64 = 0 }; 375 static const ktime_t ktime_zero = { .tv64 = 0 };
376
369 return ktime_add_ns(ktime_zero, ns); 377 return ktime_add_ns(ktime_zero, ns);
370} 378}
371 379
380static inline ktime_t ms_to_ktime(u64 ms)
381{
382 static const ktime_t ktime_zero = { .tv64 = 0 };
383
384 return ktime_add_ms(ktime_zero, ms);
385}
386
372#endif 387#endif
diff --git a/include/linux/list.h b/include/linux/list.h
index b83e5657365a..f4d8a2f12a33 100644
--- a/include/linux/list.h
+++ b/include/linux/list.h
@@ -381,17 +381,6 @@ static inline void list_splice_tail_init(struct list_head *list,
381 for (pos = (head)->next; pos != (head); pos = pos->next) 381 for (pos = (head)->next; pos != (head); pos = pos->next)
382 382
383/** 383/**
384 * __list_for_each - iterate over a list
385 * @pos: the &struct list_head to use as a loop cursor.
386 * @head: the head for your list.
387 *
388 * This variant doesn't differ from list_for_each() any more.
389 * We don't do prefetching in either case.
390 */
391#define __list_for_each(pos, head) \
392 for (pos = (head)->next; pos != (head); pos = pos->next)
393
394/**
395 * list_for_each_prev - iterate over a list backwards 384 * list_for_each_prev - iterate over a list backwards
396 * @pos: the &struct list_head to use as a loop cursor. 385 * @pos: the &struct list_head to use as a loop cursor.
397 * @head: the head for your list. 386 * @head: the head for your list.
diff --git a/include/linux/llist.h b/include/linux/llist.h
index a5199f6d0e82..cdaa7f023899 100644
--- a/include/linux/llist.h
+++ b/include/linux/llist.h
@@ -142,6 +142,9 @@ static inline struct llist_node *llist_next(struct llist_node *node)
142 return node->next; 142 return node->next;
143} 143}
144 144
145extern bool llist_add_batch(struct llist_node *new_first,
146 struct llist_node *new_last,
147 struct llist_head *head);
145/** 148/**
146 * llist_add - add a new entry 149 * llist_add - add a new entry
147 * @new: new entry to be added 150 * @new: new entry to be added
@@ -151,18 +154,7 @@ static inline struct llist_node *llist_next(struct llist_node *node)
151 */ 154 */
152static inline bool llist_add(struct llist_node *new, struct llist_head *head) 155static inline bool llist_add(struct llist_node *new, struct llist_head *head)
153{ 156{
154 struct llist_node *entry, *old_entry; 157 return llist_add_batch(new, new, head);
155
156 entry = head->first;
157 for (;;) {
158 old_entry = entry;
159 new->next = entry;
160 entry = cmpxchg(&head->first, old_entry, new);
161 if (entry == old_entry)
162 break;
163 }
164
165 return old_entry == NULL;
166} 158}
167 159
168/** 160/**
@@ -178,9 +170,6 @@ static inline struct llist_node *llist_del_all(struct llist_head *head)
178 return xchg(&head->first, NULL); 170 return xchg(&head->first, NULL);
179} 171}
180 172
181extern bool llist_add_batch(struct llist_node *new_first,
182 struct llist_node *new_last,
183 struct llist_head *head);
184extern struct llist_node *llist_del_first(struct llist_head *head); 173extern struct llist_node *llist_del_first(struct llist_head *head);
185 174
186#endif /* LLIST_H */ 175#endif /* LLIST_H */
diff --git a/include/linux/lz4.h b/include/linux/lz4.h
new file mode 100644
index 000000000000..d21c13f10a64
--- /dev/null
+++ b/include/linux/lz4.h
@@ -0,0 +1,87 @@
1#ifndef __LZ4_H__
2#define __LZ4_H__
3/*
4 * LZ4 Kernel Interface
5 *
6 * Copyright (C) 2013, LG Electronics, Kyungsik Lee <kyungsik.lee@lge.com>
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11 */
12#define LZ4_MEM_COMPRESS (4096 * sizeof(unsigned char *))
13#define LZ4HC_MEM_COMPRESS (65538 * sizeof(unsigned char *))
14
15/*
16 * lz4_compressbound()
17 * Provides the maximum size that LZ4 may output in a "worst case" scenario
18 * (input data not compressible)
19 */
20static inline size_t lz4_compressbound(size_t isize)
21{
22 return isize + (isize / 255) + 16;
23}
24
25/*
26 * lz4_compress()
27 * src : source address of the original data
28 * src_len : size of the original data
29 * dst : output buffer address of the compressed data
30 * This requires 'dst' of size LZ4_COMPRESSBOUND.
31 * dst_len : is the output size, which is returned after compress done
32 * workmem : address of the working memory.
33 * This requires 'workmem' of size LZ4_MEM_COMPRESS.
34 * return : Success if return 0
35 * Error if return (< 0)
36 * note : Destination buffer and workmem must be already allocated with
37 * the defined size.
38 */
39int lz4_compress(const unsigned char *src, size_t src_len,
40 unsigned char *dst, size_t *dst_len, void *wrkmem);
41
42 /*
43 * lz4hc_compress()
44 * src : source address of the original data
45 * src_len : size of the original data
46 * dst : output buffer address of the compressed data
47 * This requires 'dst' of size LZ4_COMPRESSBOUND.
48 * dst_len : is the output size, which is returned after compress done
49 * workmem : address of the working memory.
50 * This requires 'workmem' of size LZ4HC_MEM_COMPRESS.
51 * return : Success if return 0
52 * Error if return (< 0)
53 * note : Destination buffer and workmem must be already allocated with
54 * the defined size.
55 */
56int lz4hc_compress(const unsigned char *src, size_t src_len,
57 unsigned char *dst, size_t *dst_len, void *wrkmem);
58
59/*
60 * lz4_decompress()
61 * src : source address of the compressed data
62 * src_len : is the input size, whcih is returned after decompress done
63 * dest : output buffer address of the decompressed data
64 * actual_dest_len: is the size of uncompressed data, supposing it's known
65 * return : Success if return 0
66 * Error if return (< 0)
67 * note : Destination buffer must be already allocated.
68 * slightly faster than lz4_decompress_unknownoutputsize()
69 */
70int lz4_decompress(const char *src, size_t *src_len, char *dest,
71 size_t actual_dest_len);
72
73/*
74 * lz4_decompress_unknownoutputsize()
75 * src : source address of the compressed data
76 * src_len : is the input size, therefore the compressed size
77 * dest : output buffer address of the decompressed data
78 * dest_len: is the max size of the destination buffer, which is
79 * returned with actual size of decompressed data after
80 * decompress done
81 * return : Success if return 0
82 * Error if return (< 0)
83 * note : Destination buffer must be already allocated.
84 */
85int lz4_decompress_unknownoutputsize(const char *src, size_t src_len,
86 char *dest, size_t *dest_len);
87#endif
diff --git a/include/linux/marvell_phy.h b/include/linux/marvell_phy.h
index dd3c34ebca9a..8e9a029e093d 100644
--- a/include/linux/marvell_phy.h
+++ b/include/linux/marvell_phy.h
@@ -14,6 +14,8 @@
14#define MARVELL_PHY_ID_88E1149R 0x01410e50 14#define MARVELL_PHY_ID_88E1149R 0x01410e50
15#define MARVELL_PHY_ID_88E1240 0x01410e30 15#define MARVELL_PHY_ID_88E1240 0x01410e30
16#define MARVELL_PHY_ID_88E1318S 0x01410e90 16#define MARVELL_PHY_ID_88E1318S 0x01410e90
17#define MARVELL_PHY_ID_88E1116R 0x01410e40
18#define MARVELL_PHY_ID_88E1510 0x01410dd0
17 19
18/* struct phy_device dev_flags definitions */ 20/* struct phy_device dev_flags definitions */
19#define MARVELL_PHY_M1145_FLAGS_RESISTANCE 0x00000001 21#define MARVELL_PHY_M1145_FLAGS_RESISTANCE 0x00000001
diff --git a/include/linux/mfd/88pm80x.h b/include/linux/mfd/88pm80x.h
index e94537befabd..97cb283cc8e1 100644
--- a/include/linux/mfd/88pm80x.h
+++ b/include/linux/mfd/88pm80x.h
@@ -17,7 +17,6 @@
17#include <linux/regmap.h> 17#include <linux/regmap.h>
18#include <linux/atomic.h> 18#include <linux/atomic.h>
19 19
20#define PM80X_VERSION_MASK (0xFF) /* 80X chip ID mask */
21enum { 20enum {
22 CHIP_INVALID = 0, 21 CHIP_INVALID = 0,
23 CHIP_PM800, 22 CHIP_PM800,
@@ -299,8 +298,7 @@ struct pm80x_chip {
299 struct regmap *regmap; 298 struct regmap *regmap;
300 struct regmap_irq_chip *regmap_irq_chip; 299 struct regmap_irq_chip *regmap_irq_chip;
301 struct regmap_irq_chip_data *irq_data; 300 struct regmap_irq_chip_data *irq_data;
302 unsigned char version; 301 int type;
303 int id;
304 int irq; 302 int irq;
305 int irq_mode; 303 int irq_mode;
306 unsigned long wu_flag; 304 unsigned long wu_flag;
@@ -309,8 +307,14 @@ struct pm80x_chip {
309 307
310struct pm80x_platform_data { 308struct pm80x_platform_data {
311 struct pm80x_rtc_pdata *rtc; 309 struct pm80x_rtc_pdata *rtc;
312 unsigned short power_page_addr; /* power page I2C address */ 310 /*
313 unsigned short gpadc_page_addr; /* gpadc page I2C address */ 311 * For the regulator not defined, set regulators[not_defined] to be
312 * NULL. num_regulators are the number of regulators supposed to be
313 * initialized. If all regulators are not defined, set num_regulators
314 * to be 0.
315 */
316 struct regulator_init_data *regulators[PM800_ID_RG_MAX];
317 unsigned int num_regulators;
314 int irq_mode; /* Clear interrupt by read/write(0/1) */ 318 int irq_mode; /* Clear interrupt by read/write(0/1) */
315 int batt_det; /* enable/disable */ 319 int batt_det; /* enable/disable */
316 int (*plat_config)(struct pm80x_chip *chip, 320 int (*plat_config)(struct pm80x_chip *chip,
@@ -363,7 +367,6 @@ static inline int pm80x_dev_resume(struct device *dev)
363} 367}
364#endif 368#endif
365 369
366extern int pm80x_init(struct i2c_client *client, 370extern int pm80x_init(struct i2c_client *client);
367 const struct i2c_device_id *id);
368extern int pm80x_deinit(void); 371extern int pm80x_deinit(void);
369#endif /* __LINUX_MFD_88PM80X_H */ 372#endif /* __LINUX_MFD_88PM80X_H */
diff --git a/include/linux/mfd/abx500/ab8500.h b/include/linux/mfd/abx500/ab8500.h
index 0390d5943ed6..f4acd898dac9 100644
--- a/include/linux/mfd/abx500/ab8500.h
+++ b/include/linux/mfd/abx500/ab8500.h
@@ -291,6 +291,8 @@ enum ab8500_version {
291#define AB8540_INT_FSYNC2R 213 291#define AB8540_INT_FSYNC2R 213
292#define AB8540_INT_BITCLK2F 214 292#define AB8540_INT_BITCLK2F 214
293#define AB8540_INT_BITCLK2R 215 293#define AB8540_INT_BITCLK2R 215
294/* ab8540_irq_regoffset[27] -> IT[Source|Latch|Mask]33 */
295#define AB8540_INT_RTC_1S 216
294 296
295/* 297/*
296 * AB8500_AB9540_NR_IRQS is used when configuring the IRQ numbers for the 298 * AB8500_AB9540_NR_IRQS is used when configuring the IRQ numbers for the
diff --git a/include/linux/mfd/arizona/core.h b/include/linux/mfd/arizona/core.h
index f797bb9b8b56..5cf8b91ce996 100644
--- a/include/linux/mfd/arizona/core.h
+++ b/include/linux/mfd/arizona/core.h
@@ -23,6 +23,7 @@
23enum arizona_type { 23enum arizona_type {
24 WM5102 = 1, 24 WM5102 = 1,
25 WM5110 = 2, 25 WM5110 = 2,
26 WM8997 = 3,
26}; 27};
27 28
28#define ARIZONA_IRQ_GP1 0 29#define ARIZONA_IRQ_GP1 0
@@ -121,5 +122,6 @@ int arizona_set_irq_wake(struct arizona *arizona, int irq, int on);
121 122
122int wm5102_patch(struct arizona *arizona); 123int wm5102_patch(struct arizona *arizona);
123int wm5110_patch(struct arizona *arizona); 124int wm5110_patch(struct arizona *arizona);
125int wm8997_patch(struct arizona *arizona);
124 126
125#endif 127#endif
diff --git a/include/linux/mfd/davinci_voicecodec.h b/include/linux/mfd/davinci_voicecodec.h
index 7dd6524d2aac..13a1ee95a233 100644
--- a/include/linux/mfd/davinci_voicecodec.h
+++ b/include/linux/mfd/davinci_voicecodec.h
@@ -28,6 +28,8 @@
28#include <linux/mfd/core.h> 28#include <linux/mfd/core.h>
29#include <linux/platform_data/edma.h> 29#include <linux/platform_data/edma.h>
30 30
31#include <mach/hardware.h>
32
31/* 33/*
32 * Register values. 34 * Register values.
33 */ 35 */
@@ -111,8 +113,6 @@ struct davinci_vc {
111 113
112 /* Memory resources */ 114 /* Memory resources */
113 void __iomem *base; 115 void __iomem *base;
114 resource_size_t pbase;
115 size_t base_size;
116 116
117 /* MFD cells */ 117 /* MFD cells */
118 struct mfd_cell cells[DAVINCI_VC_CELLS]; 118 struct mfd_cell cells[DAVINCI_VC_CELLS];
diff --git a/include/linux/mfd/kempld.h b/include/linux/mfd/kempld.h
new file mode 100644
index 000000000000..b911ef3add03
--- /dev/null
+++ b/include/linux/mfd/kempld.h
@@ -0,0 +1,125 @@
1/*
2 * Kontron PLD driver definitions
3 *
4 * Copyright (c) 2010-2012 Kontron Europe GmbH
5 * Author: Michael Brunner <michael.brunner@kontron.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License 2 as published
9 * by the Free Software Foundation.
10 */
11
12#ifndef _LINUX_MFD_KEMPLD_H_
13#define _LINUX_MFD_KEMPLD_H_
14
15/* kempld register definitions */
16#define KEMPLD_IOINDEX 0xa80
17#define KEMPLD_IODATA 0xa81
18#define KEMPLD_MUTEX_KEY 0x80
19#define KEMPLD_VERSION 0x00
20#define KEMPLD_VERSION_LSB 0x00
21#define KEMPLD_VERSION_MSB 0x01
22#define KEMPLD_VERSION_GET_MINOR(x) (x & 0x1f)
23#define KEMPLD_VERSION_GET_MAJOR(x) ((x >> 5) & 0x1f)
24#define KEMPLD_VERSION_GET_NUMBER(x) ((x >> 10) & 0xf)
25#define KEMPLD_VERSION_GET_TYPE(x) ((x >> 14) & 0x3)
26#define KEMPLD_BUILDNR 0x02
27#define KEMPLD_BUILDNR_LSB 0x02
28#define KEMPLD_BUILDNR_MSB 0x03
29#define KEMPLD_FEATURE 0x04
30#define KEMPLD_FEATURE_LSB 0x04
31#define KEMPLD_FEATURE_MSB 0x05
32#define KEMPLD_FEATURE_BIT_I2C (1 << 0)
33#define KEMPLD_FEATURE_BIT_WATCHDOG (1 << 1)
34#define KEMPLD_FEATURE_BIT_GPIO (1 << 2)
35#define KEMPLD_FEATURE_MASK_UART (7 << 3)
36#define KEMPLD_FEATURE_BIT_NMI (1 << 8)
37#define KEMPLD_FEATURE_BIT_SMI (1 << 9)
38#define KEMPLD_FEATURE_BIT_SCI (1 << 10)
39#define KEMPLD_SPEC 0x06
40#define KEMPLD_SPEC_GET_MINOR(x) (x & 0x0f)
41#define KEMPLD_SPEC_GET_MAJOR(x) ((x >> 4) & 0x0f)
42#define KEMPLD_IRQ_GPIO 0x35
43#define KEMPLD_IRQ_I2C 0x36
44#define KEMPLD_CFG 0x37
45#define KEMPLD_CFG_GPIO_I2C_MUX (1 << 0)
46#define KEMPLD_CFG_BIOS_WP (1 << 7)
47
48#define KEMPLD_CLK 33333333
49
50#define KEMPLD_TYPE_RELEASE 0x0
51#define KEMPLD_TYPE_DEBUG 0x1
52#define KEMPLD_TYPE_CUSTOM 0x2
53
54/**
55 * struct kempld_info - PLD device information structure
56 * @major: PLD major revision
57 * @minor: PLD minor revision
58 * @buildnr: PLD build number
59 * @number: PLD board specific index
60 * @type: PLD type
61 * @spec_major: PLD FW specification major revision
62 * @spec_minor: PLD FW specification minor revision
63 */
64struct kempld_info {
65 unsigned int major;
66 unsigned int minor;
67 unsigned int buildnr;
68 unsigned int number;
69 unsigned int type;
70 unsigned int spec_major;
71 unsigned int spec_minor;
72};
73
74/**
75 * struct kempld_device_data - Internal representation of the PLD device
76 * @io_base: Pointer to the IO memory
77 * @io_index: Pointer to the IO index register
78 * @io_data: Pointer to the IO data register
79 * @pld_clock: PLD clock frequency
80 * @feature_mask: PLD feature mask
81 * @dev: Pointer to kernel device structure
82 * @info: KEMPLD info structure
83 * @lock: PLD mutex
84 */
85struct kempld_device_data {
86 void __iomem *io_base;
87 void __iomem *io_index;
88 void __iomem *io_data;
89 u32 pld_clock;
90 u32 feature_mask;
91 struct device *dev;
92 struct kempld_info info;
93 struct mutex lock;
94};
95
96/**
97 * struct kempld_platform_data - PLD hardware configuration structure
98 * @pld_clock: PLD clock frequency
99 * @gpio_base GPIO base pin number
100 * @ioresource: IO addresses of the PLD
101 * @get_mutex: PLD specific get_mutex callback
102 * @release_mutex: PLD specific release_mutex callback
103 * @get_info: PLD specific get_info callback
104 * @register_cells: PLD specific register_cells callback
105 */
106struct kempld_platform_data {
107 u32 pld_clock;
108 int gpio_base;
109 struct resource *ioresource;
110 void (*get_hardware_mutex) (struct kempld_device_data *);
111 void (*release_hardware_mutex) (struct kempld_device_data *);
112 int (*get_info) (struct kempld_device_data *);
113 int (*register_cells) (struct kempld_device_data *);
114};
115
116extern void kempld_get_mutex(struct kempld_device_data *pld);
117extern void kempld_release_mutex(struct kempld_device_data *pld);
118extern u8 kempld_read8(struct kempld_device_data *pld, u8 index);
119extern void kempld_write8(struct kempld_device_data *pld, u8 index, u8 data);
120extern u16 kempld_read16(struct kempld_device_data *pld, u8 index);
121extern void kempld_write16(struct kempld_device_data *pld, u8 index, u16 data);
122extern u32 kempld_read32(struct kempld_device_data *pld, u8 index);
123extern void kempld_write32(struct kempld_device_data *pld, u8 index, u32 data);
124
125#endif /* _LINUX_MFD_KEMPLD_H_ */
diff --git a/include/linux/mfd/max8998-private.h b/include/linux/mfd/max8998-private.h
index effa5d3b96ae..84844e0a5704 100644
--- a/include/linux/mfd/max8998-private.h
+++ b/include/linux/mfd/max8998-private.h
@@ -132,9 +132,12 @@ enum {
132 132
133#define MAX8998_ENRAMP (1 << 4) 133#define MAX8998_ENRAMP (1 << 4)
134 134
135struct irq_domain;
136
135/** 137/**
136 * struct max8998_dev - max8998 master device for sub-drivers 138 * struct max8998_dev - max8998 master device for sub-drivers
137 * @dev: master device of the chip (can be used to access platform data) 139 * @dev: master device of the chip (can be used to access platform data)
140 * @pdata: platform data for the driver and subdrivers
138 * @i2c: i2c client private data for regulator 141 * @i2c: i2c client private data for regulator
139 * @rtc: i2c client private data for rtc 142 * @rtc: i2c client private data for rtc
140 * @iolock: mutex for serializing io access 143 * @iolock: mutex for serializing io access
@@ -148,12 +151,14 @@ enum {
148 */ 151 */
149struct max8998_dev { 152struct max8998_dev {
150 struct device *dev; 153 struct device *dev;
154 struct max8998_platform_data *pdata;
151 struct i2c_client *i2c; 155 struct i2c_client *i2c;
152 struct i2c_client *rtc; 156 struct i2c_client *rtc;
153 struct mutex iolock; 157 struct mutex iolock;
154 struct mutex irqlock; 158 struct mutex irqlock;
155 159
156 int irq_base; 160 unsigned int irq_base;
161 struct irq_domain *irq_domain;
157 int irq; 162 int irq;
158 int ono; 163 int ono;
159 u8 irq_masks_cur[MAX8998_NUM_IRQ_REGS]; 164 u8 irq_masks_cur[MAX8998_NUM_IRQ_REGS];
diff --git a/include/linux/mfd/max8998.h b/include/linux/mfd/max8998.h
index 6823548d0c0a..e3956a654cbc 100644
--- a/include/linux/mfd/max8998.h
+++ b/include/linux/mfd/max8998.h
@@ -58,10 +58,12 @@ enum {
58 * max8998_regulator_data - regulator data 58 * max8998_regulator_data - regulator data
59 * @id: regulator id 59 * @id: regulator id
60 * @initdata: regulator init data (contraints, supplies, ...) 60 * @initdata: regulator init data (contraints, supplies, ...)
61 * @reg_node: DT node of regulator (unused on non-DT platforms)
61 */ 62 */
62struct max8998_regulator_data { 63struct max8998_regulator_data {
63 int id; 64 int id;
64 struct regulator_init_data *initdata; 65 struct regulator_init_data *initdata;
66 struct device_node *reg_node;
65}; 67};
66 68
67/** 69/**
@@ -73,12 +75,8 @@ struct max8998_regulator_data {
73 * @buck_voltage_lock: Do NOT change the values of the following six 75 * @buck_voltage_lock: Do NOT change the values of the following six
74 * registers set by buck?_voltage?. The voltage of BUCK1/2 cannot 76 * registers set by buck?_voltage?. The voltage of BUCK1/2 cannot
75 * be other than the preset values. 77 * be other than the preset values.
76 * @buck1_voltage1: BUCK1 DVS mode 1 voltage register 78 * @buck1_voltage: BUCK1 DVS mode 1 voltage registers
77 * @buck1_voltage2: BUCK1 DVS mode 2 voltage register 79 * @buck2_voltage: BUCK2 DVS mode 2 voltage registers
78 * @buck1_voltage3: BUCK1 DVS mode 3 voltage register
79 * @buck1_voltage4: BUCK1 DVS mode 4 voltage register
80 * @buck2_voltage1: BUCK2 DVS mode 1 voltage register
81 * @buck2_voltage2: BUCK2 DVS mode 2 voltage register
82 * @buck1_set1: BUCK1 gpio pin 1 to set output voltage 80 * @buck1_set1: BUCK1 gpio pin 1 to set output voltage
83 * @buck1_set2: BUCK1 gpio pin 2 to set output voltage 81 * @buck1_set2: BUCK1 gpio pin 2 to set output voltage
84 * @buck1_default_idx: Default for BUCK1 gpio pin 1, 2 82 * @buck1_default_idx: Default for BUCK1 gpio pin 1, 2
@@ -100,15 +98,11 @@ struct max8998_regulator_data {
100struct max8998_platform_data { 98struct max8998_platform_data {
101 struct max8998_regulator_data *regulators; 99 struct max8998_regulator_data *regulators;
102 int num_regulators; 100 int num_regulators;
103 int irq_base; 101 unsigned int irq_base;
104 int ono; 102 int ono;
105 bool buck_voltage_lock; 103 bool buck_voltage_lock;
106 int buck1_voltage1; 104 int buck1_voltage[4];
107 int buck1_voltage2; 105 int buck2_voltage[2];
108 int buck1_voltage3;
109 int buck1_voltage4;
110 int buck2_voltage1;
111 int buck2_voltage2;
112 int buck1_set1; 106 int buck1_set1;
113 int buck1_set2; 107 int buck1_set2;
114 int buck1_default_idx; 108 int buck1_default_idx;
diff --git a/include/linux/mfd/palmas.h b/include/linux/mfd/palmas.h
index 9b81b2bdc46b..1a8dd7afe084 100644
--- a/include/linux/mfd/palmas.h
+++ b/include/linux/mfd/palmas.h
@@ -34,6 +34,19 @@
34 ((a) == PALMAS_CHIP_ID)) 34 ((a) == PALMAS_CHIP_ID))
35#define is_palmas_charger(a) ((a) == PALMAS_CHIP_CHARGER_ID) 35#define is_palmas_charger(a) ((a) == PALMAS_CHIP_CHARGER_ID)
36 36
37/**
38 * Palmas PMIC feature types
39 *
40 * PALMAS_PMIC_FEATURE_SMPS10_BOOST - used when the PMIC provides SMPS10_BOOST
41 * regulator.
42 *
43 * PALMAS_PMIC_HAS(b, f) - macro to check if a bandgap device is capable of a
44 * specific feature (above) or not. Return non-zero, if yes.
45 */
46#define PALMAS_PMIC_FEATURE_SMPS10_BOOST BIT(0)
47#define PALMAS_PMIC_HAS(b, f) \
48 ((b)->features & PALMAS_PMIC_FEATURE_ ## f)
49
37struct palmas_pmic; 50struct palmas_pmic;
38struct palmas_gpadc; 51struct palmas_gpadc;
39struct palmas_resource; 52struct palmas_resource;
@@ -54,6 +67,7 @@ struct palmas {
54 /* Stored chip id */ 67 /* Stored chip id */
55 int id; 68 int id;
56 69
70 unsigned int features;
57 /* IRQ Data */ 71 /* IRQ Data */
58 int irq; 72 int irq;
59 u32 irq_mask; 73 u32 irq_mask;
diff --git a/include/linux/mfd/rtsx_pci.h b/include/linux/mfd/rtsx_pci.h
index 86bc635f8385..7a9f7089435d 100644
--- a/include/linux/mfd/rtsx_pci.h
+++ b/include/linux/mfd/rtsx_pci.h
@@ -575,6 +575,7 @@
575 575
576#define CARD_PWR_CTL 0xFD50 576#define CARD_PWR_CTL 0xFD50
577#define CARD_CLK_SWITCH 0xFD51 577#define CARD_CLK_SWITCH 0xFD51
578#define RTL8411B_PACKAGE_MODE 0xFD51
578#define CARD_SHARE_MODE 0xFD52 579#define CARD_SHARE_MODE 0xFD52
579#define CARD_DRIVE_SEL 0xFD53 580#define CARD_DRIVE_SEL 0xFD53
580#define CARD_STOP 0xFD54 581#define CARD_STOP 0xFD54
diff --git a/include/linux/mfd/samsung/core.h b/include/linux/mfd/samsung/core.h
index f0f4de3b4ccc..378ae8a04c6a 100644
--- a/include/linux/mfd/samsung/core.h
+++ b/include/linux/mfd/samsung/core.h
@@ -14,8 +14,6 @@
14#ifndef __LINUX_MFD_SEC_CORE_H 14#ifndef __LINUX_MFD_SEC_CORE_H
15#define __LINUX_MFD_SEC_CORE_H 15#define __LINUX_MFD_SEC_CORE_H
16 16
17#define NUM_IRQ_REGS 4
18
19enum sec_device_type { 17enum sec_device_type {
20 S5M8751X, 18 S5M8751X,
21 S5M8763X, 19 S5M8763X,
@@ -44,8 +42,6 @@ struct sec_pmic_dev {
44 struct regmap *regmap; 42 struct regmap *regmap;
45 struct i2c_client *i2c; 43 struct i2c_client *i2c;
46 struct i2c_client *rtc; 44 struct i2c_client *rtc;
47 struct mutex iolock;
48 struct mutex irqlock;
49 45
50 int device_type; 46 int device_type;
51 int irq_base; 47 int irq_base;
@@ -53,8 +49,6 @@ struct sec_pmic_dev {
53 struct regmap_irq_chip_data *irq_data; 49 struct regmap_irq_chip_data *irq_data;
54 50
55 int ono; 51 int ono;
56 u8 irq_masks_cur[NUM_IRQ_REGS];
57 u8 irq_masks_cache[NUM_IRQ_REGS];
58 int type; 52 int type;
59 bool wakeup; 53 bool wakeup;
60}; 54};
diff --git a/include/linux/mfd/samsung/s2mps11.h b/include/linux/mfd/samsung/s2mps11.h
index ad2252f239d7..4e94dc65f987 100644
--- a/include/linux/mfd/samsung/s2mps11.h
+++ b/include/linux/mfd/samsung/s2mps11.h
@@ -189,6 +189,7 @@ enum s2mps11_regulators {
189#define S2MPS11_ENABLE_SHIFT 0x06 189#define S2MPS11_ENABLE_SHIFT 0x06
190#define S2MPS11_LDO_N_VOLTAGES (S2MPS11_LDO_VSEL_MASK + 1) 190#define S2MPS11_LDO_N_VOLTAGES (S2MPS11_LDO_VSEL_MASK + 1)
191#define S2MPS11_BUCK_N_VOLTAGES (S2MPS11_BUCK_VSEL_MASK + 1) 191#define S2MPS11_BUCK_N_VOLTAGES (S2MPS11_BUCK_VSEL_MASK + 1)
192#define S2MPS11_RAMP_DELAY 25000 /* uV/us */
192 193
193#define S2MPS11_PMIC_EN_SHIFT 6 194#define S2MPS11_PMIC_EN_SHIFT 6
194#define S2MPS11_REGULATOR_MAX (S2MPS11_REG_MAX - 3) 195#define S2MPS11_REGULATOR_MAX (S2MPS11_REG_MAX - 3)
diff --git a/include/linux/mfd/syscon/imx6q-iomuxc-gpr.h b/include/linux/mfd/syscon/imx6q-iomuxc-gpr.h
index dab34a1deb2c..b6bdcd66c07d 100644
--- a/include/linux/mfd/syscon/imx6q-iomuxc-gpr.h
+++ b/include/linux/mfd/syscon/imx6q-iomuxc-gpr.h
@@ -103,15 +103,15 @@
103#define IMX6Q_GPR1_EXC_MON_MASK BIT(22) 103#define IMX6Q_GPR1_EXC_MON_MASK BIT(22)
104#define IMX6Q_GPR1_EXC_MON_OKAY 0x0 104#define IMX6Q_GPR1_EXC_MON_OKAY 0x0
105#define IMX6Q_GPR1_EXC_MON_SLVE BIT(22) 105#define IMX6Q_GPR1_EXC_MON_SLVE BIT(22)
106#define IMX6Q_GPR1_MIPI_IPU2_SEL_MASK BIT(21) 106#define IMX6Q_GPR1_ENET_CLK_SEL_MASK BIT(21)
107#define IMX6Q_GPR1_MIPI_IPU2_SEL_GASKET 0x0 107#define IMX6Q_GPR1_ENET_CLK_SEL_PAD 0
108#define IMX6Q_GPR1_MIPI_IPU2_SEL_IOMUX BIT(21) 108#define IMX6Q_GPR1_ENET_CLK_SEL_ANATOP BIT(21)
109#define IMX6Q_GPR1_MIPI_IPU1_MUX_MASK BIT(20) 109#define IMX6Q_GPR1_MIPI_IPU2_MUX_MASK BIT(20)
110#define IMX6Q_GPR1_MIPI_IPU1_MUX_GASKET 0x0
111#define IMX6Q_GPR1_MIPI_IPU1_MUX_IOMUX BIT(20)
112#define IMX6Q_GPR1_MIPI_IPU2_MUX_MASK BIT(19)
113#define IMX6Q_GPR1_MIPI_IPU2_MUX_GASKET 0x0 110#define IMX6Q_GPR1_MIPI_IPU2_MUX_GASKET 0x0
114#define IMX6Q_GPR1_MIPI_IPU2_MUX_IOMUX BIT(19) 111#define IMX6Q_GPR1_MIPI_IPU2_MUX_IOMUX BIT(20)
112#define IMX6Q_GPR1_MIPI_IPU1_MUX_MASK BIT(19)
113#define IMX6Q_GPR1_MIPI_IPU1_MUX_GASKET 0x0
114#define IMX6Q_GPR1_MIPI_IPU1_MUX_IOMUX BIT(19)
115#define IMX6Q_GPR1_PCIE_TEST_PD BIT(18) 115#define IMX6Q_GPR1_PCIE_TEST_PD BIT(18)
116#define IMX6Q_GPR1_IPU_VPU_MUX_MASK BIT(17) 116#define IMX6Q_GPR1_IPU_VPU_MUX_MASK BIT(17)
117#define IMX6Q_GPR1_IPU_VPU_MUX_IPU1 0x0 117#define IMX6Q_GPR1_IPU_VPU_MUX_IPU1 0x0
@@ -279,41 +279,88 @@
279#define IMX6Q_GPR13_CAN2_STOP_REQ BIT(29) 279#define IMX6Q_GPR13_CAN2_STOP_REQ BIT(29)
280#define IMX6Q_GPR13_CAN1_STOP_REQ BIT(28) 280#define IMX6Q_GPR13_CAN1_STOP_REQ BIT(28)
281#define IMX6Q_GPR13_ENET_STOP_REQ BIT(27) 281#define IMX6Q_GPR13_ENET_STOP_REQ BIT(27)
282#define IMX6Q_GPR13_SATA_PHY_8_MASK (0x7 << 24) 282#define IMX6Q_GPR13_SATA_RX_EQ_VAL_MASK (0x7 << 24)
283#define IMX6Q_GPR13_SATA_PHY_8_0_5_DB (0x0 << 24) 283#define IMX6Q_GPR13_SATA_RX_EQ_VAL_0_5_DB (0x0 << 24)
284#define IMX6Q_GPR13_SATA_PHY_8_1_0_DB (0x1 << 24) 284#define IMX6Q_GPR13_SATA_RX_EQ_VAL_1_0_DB (0x1 << 24)
285#define IMX6Q_GPR13_SATA_PHY_8_1_5_DB (0x2 << 24) 285#define IMX6Q_GPR13_SATA_RX_EQ_VAL_1_5_DB (0x2 << 24)
286#define IMX6Q_GPR13_SATA_PHY_8_2_0_DB (0x3 << 24) 286#define IMX6Q_GPR13_SATA_RX_EQ_VAL_2_0_DB (0x3 << 24)
287#define IMX6Q_GPR13_SATA_PHY_8_2_5_DB (0x4 << 24) 287#define IMX6Q_GPR13_SATA_RX_EQ_VAL_2_5_DB (0x4 << 24)
288#define IMX6Q_GPR13_SATA_PHY_8_3_0_DB (0x5 << 24) 288#define IMX6Q_GPR13_SATA_RX_EQ_VAL_3_0_DB (0x5 << 24)
289#define IMX6Q_GPR13_SATA_PHY_8_3_5_DB (0x6 << 24) 289#define IMX6Q_GPR13_SATA_RX_EQ_VAL_3_5_DB (0x6 << 24)
290#define IMX6Q_GPR13_SATA_PHY_8_4_0_DB (0x7 << 24) 290#define IMX6Q_GPR13_SATA_RX_EQ_VAL_4_0_DB (0x7 << 24)
291#define IMX6Q_GPR13_SATA_PHY_7_MASK (0x1f << 19) 291#define IMX6Q_GPR13_SATA_RX_LOS_LVL_MASK (0x1f << 19)
292#define IMX6Q_GPR13_SATA_PHY_7_SATA1I (0x10 << 19) 292#define IMX6Q_GPR13_SATA_RX_LOS_LVL_SATA1I (0x10 << 19)
293#define IMX6Q_GPR13_SATA_PHY_7_SATA1M (0x10 << 19) 293#define IMX6Q_GPR13_SATA_RX_LOS_LVL_SATA1M (0x10 << 19)
294#define IMX6Q_GPR13_SATA_PHY_7_SATA1X (0x1a << 19) 294#define IMX6Q_GPR13_SATA_RX_LOS_LVL_SATA1X (0x1a << 19)
295#define IMX6Q_GPR13_SATA_PHY_7_SATA2I (0x12 << 19) 295#define IMX6Q_GPR13_SATA_RX_LOS_LVL_SATA2I (0x12 << 19)
296#define IMX6Q_GPR13_SATA_PHY_7_SATA2M (0x12 << 19) 296#define IMX6Q_GPR13_SATA_RX_LOS_LVL_SATA2M (0x12 << 19)
297#define IMX6Q_GPR13_SATA_PHY_7_SATA2X (0x1a << 19) 297#define IMX6Q_GPR13_SATA_RX_LOS_LVL_SATA2X (0x1a << 19)
298#define IMX6Q_GPR13_SATA_PHY_6_MASK (0x7 << 16) 298#define IMX6Q_GPR13_SATA_RX_DPLL_MODE_MASK (0x7 << 16)
299#define IMX6Q_GPR13_SATA_SPEED_MASK BIT(15) 299#define IMX6Q_GPR13_SATA_RX_DPLL_MODE_1P_1F (0x0 << 16)
300#define IMX6Q_GPR13_SATA_SPEED_1P5G 0x0 300#define IMX6Q_GPR13_SATA_RX_DPLL_MODE_2P_2F (0x1 << 16)
301#define IMX6Q_GPR13_SATA_SPEED_3P0G BIT(15) 301#define IMX6Q_GPR13_SATA_RX_DPLL_MODE_1P_4F (0x2 << 16)
302#define IMX6Q_GPR13_SATA_PHY_5 BIT(14) 302#define IMX6Q_GPR13_SATA_RX_DPLL_MODE_2P_4F (0x3 << 16)
303#define IMX6Q_GPR13_SATA_PHY_4_MASK (0x7 << 11) 303#define IMX6Q_GPR13_SATA_SPD_MODE_MASK BIT(15)
304#define IMX6Q_GPR13_SATA_PHY_4_16_16 (0x0 << 11) 304#define IMX6Q_GPR13_SATA_SPD_MODE_1P5G 0x0
305#define IMX6Q_GPR13_SATA_PHY_4_14_16 (0x1 << 11) 305#define IMX6Q_GPR13_SATA_SPD_MODE_3P0G BIT(15)
306#define IMX6Q_GPR13_SATA_PHY_4_12_16 (0x2 << 11) 306#define IMX6Q_GPR13_SATA_MPLL_SS_EN BIT(14)
307#define IMX6Q_GPR13_SATA_PHY_4_10_16 (0x3 << 11) 307#define IMX6Q_GPR13_SATA_TX_ATTEN_MASK (0x7 << 11)
308#define IMX6Q_GPR13_SATA_PHY_4_9_16 (0x4 << 11) 308#define IMX6Q_GPR13_SATA_TX_ATTEN_16_16 (0x0 << 11)
309#define IMX6Q_GPR13_SATA_PHY_4_8_16 (0x5 << 11) 309#define IMX6Q_GPR13_SATA_TX_ATTEN_14_16 (0x1 << 11)
310#define IMX6Q_GPR13_SATA_PHY_3_MASK (0xf << 7) 310#define IMX6Q_GPR13_SATA_TX_ATTEN_12_16 (0x2 << 11)
311#define IMX6Q_GPR13_SATA_PHY_3_OFF 0x7 311#define IMX6Q_GPR13_SATA_TX_ATTEN_10_16 (0x3 << 11)
312#define IMX6Q_GPR13_SATA_PHY_2_MASK (0x1f << 2) 312#define IMX6Q_GPR13_SATA_TX_ATTEN_9_16 (0x4 << 11)
313#define IMX6Q_GPR13_SATA_PHY_2_OFF 0x2 313#define IMX6Q_GPR13_SATA_TX_ATTEN_8_16 (0x5 << 11)
314#define IMX6Q_GPR13_SATA_PHY_1_MASK (0x3 << 0) 314#define IMX6Q_GPR13_SATA_TX_BOOST_MASK (0xf << 7)
315#define IMX6Q_GPR13_SATA_PHY_1_FAST (0x0 << 0) 315#define IMX6Q_GPR13_SATA_TX_BOOST_0_00_DB (0x0 << 7)
316#define IMX6Q_GPR13_SATA_PHY_1_MED (0x1 << 0) 316#define IMX6Q_GPR13_SATA_TX_BOOST_0_37_DB (0x1 << 7)
317#define IMX6Q_GPR13_SATA_PHY_1_SLOW (0x2 << 0) 317#define IMX6Q_GPR13_SATA_TX_BOOST_0_74_DB (0x2 << 7)
318 318#define IMX6Q_GPR13_SATA_TX_BOOST_1_11_DB (0x3 << 7)
319#define IMX6Q_GPR13_SATA_TX_BOOST_1_48_DB (0x4 << 7)
320#define IMX6Q_GPR13_SATA_TX_BOOST_1_85_DB (0x5 << 7)
321#define IMX6Q_GPR13_SATA_TX_BOOST_2_22_DB (0x6 << 7)
322#define IMX6Q_GPR13_SATA_TX_BOOST_2_59_DB (0x7 << 7)
323#define IMX6Q_GPR13_SATA_TX_BOOST_2_96_DB (0x8 << 7)
324#define IMX6Q_GPR13_SATA_TX_BOOST_3_33_DB (0x9 << 7)
325#define IMX6Q_GPR13_SATA_TX_BOOST_3_70_DB (0xa << 7)
326#define IMX6Q_GPR13_SATA_TX_BOOST_4_07_DB (0xb << 7)
327#define IMX6Q_GPR13_SATA_TX_BOOST_4_44_DB (0xc << 7)
328#define IMX6Q_GPR13_SATA_TX_BOOST_4_81_DB (0xd << 7)
329#define IMX6Q_GPR13_SATA_TX_BOOST_5_28_DB (0xe << 7)
330#define IMX6Q_GPR13_SATA_TX_BOOST_5_75_DB (0xf << 7)
331#define IMX6Q_GPR13_SATA_TX_LVL_MASK (0x1f << 2)
332#define IMX6Q_GPR13_SATA_TX_LVL_0_937_V (0x00 << 2)
333#define IMX6Q_GPR13_SATA_TX_LVL_0_947_V (0x01 << 2)
334#define IMX6Q_GPR13_SATA_TX_LVL_0_957_V (0x02 << 2)
335#define IMX6Q_GPR13_SATA_TX_LVL_0_966_V (0x03 << 2)
336#define IMX6Q_GPR13_SATA_TX_LVL_0_976_V (0x04 << 2)
337#define IMX6Q_GPR13_SATA_TX_LVL_0_986_V (0x05 << 2)
338#define IMX6Q_GPR13_SATA_TX_LVL_0_996_V (0x06 << 2)
339#define IMX6Q_GPR13_SATA_TX_LVL_1_005_V (0x07 << 2)
340#define IMX6Q_GPR13_SATA_TX_LVL_1_015_V (0x08 << 2)
341#define IMX6Q_GPR13_SATA_TX_LVL_1_025_V (0x09 << 2)
342#define IMX6Q_GPR13_SATA_TX_LVL_1_035_V (0x0a << 2)
343#define IMX6Q_GPR13_SATA_TX_LVL_1_045_V (0x0b << 2)
344#define IMX6Q_GPR13_SATA_TX_LVL_1_054_V (0x0c << 2)
345#define IMX6Q_GPR13_SATA_TX_LVL_1_064_V (0x0d << 2)
346#define IMX6Q_GPR13_SATA_TX_LVL_1_074_V (0x0e << 2)
347#define IMX6Q_GPR13_SATA_TX_LVL_1_084_V (0x0f << 2)
348#define IMX6Q_GPR13_SATA_TX_LVL_1_094_V (0x10 << 2)
349#define IMX6Q_GPR13_SATA_TX_LVL_1_104_V (0x11 << 2)
350#define IMX6Q_GPR13_SATA_TX_LVL_1_113_V (0x12 << 2)
351#define IMX6Q_GPR13_SATA_TX_LVL_1_123_V (0x13 << 2)
352#define IMX6Q_GPR13_SATA_TX_LVL_1_133_V (0x14 << 2)
353#define IMX6Q_GPR13_SATA_TX_LVL_1_143_V (0x15 << 2)
354#define IMX6Q_GPR13_SATA_TX_LVL_1_152_V (0x16 << 2)
355#define IMX6Q_GPR13_SATA_TX_LVL_1_162_V (0x17 << 2)
356#define IMX6Q_GPR13_SATA_TX_LVL_1_172_V (0x18 << 2)
357#define IMX6Q_GPR13_SATA_TX_LVL_1_182_V (0x19 << 2)
358#define IMX6Q_GPR13_SATA_TX_LVL_1_191_V (0x1a << 2)
359#define IMX6Q_GPR13_SATA_TX_LVL_1_201_V (0x1b << 2)
360#define IMX6Q_GPR13_SATA_TX_LVL_1_211_V (0x1c << 2)
361#define IMX6Q_GPR13_SATA_TX_LVL_1_221_V (0x1d << 2)
362#define IMX6Q_GPR13_SATA_TX_LVL_1_230_V (0x1e << 2)
363#define IMX6Q_GPR13_SATA_TX_LVL_1_240_V (0x1f << 2)
364#define IMX6Q_GPR13_SATA_MPLL_CLK_EN BIT(1)
365#define IMX6Q_GPR13_SATA_TX_EDGE_RATE BIT(0)
319#endif /* __LINUX_IMX6Q_IOMUXC_GPR_H */ 366#endif /* __LINUX_IMX6Q_IOMUXC_GPR_H */
diff --git a/include/linux/mfd/ti_am335x_tscadc.h b/include/linux/mfd/ti_am335x_tscadc.h
index c79ad5d2f271..8d73fe29796a 100644
--- a/include/linux/mfd/ti_am335x_tscadc.h
+++ b/include/linux/mfd/ti_am335x_tscadc.h
@@ -30,8 +30,8 @@
30#define REG_IDLECONFIG 0x058 30#define REG_IDLECONFIG 0x058
31#define REG_CHARGECONFIG 0x05C 31#define REG_CHARGECONFIG 0x05C
32#define REG_CHARGEDELAY 0x060 32#define REG_CHARGEDELAY 0x060
33#define REG_STEPCONFIG(n) (0x64 + ((n - 1) * 8)) 33#define REG_STEPCONFIG(n) (0x64 + ((n) * 8))
34#define REG_STEPDELAY(n) (0x68 + ((n - 1) * 8)) 34#define REG_STEPDELAY(n) (0x68 + ((n) * 8))
35#define REG_FIFO0CNT 0xE4 35#define REG_FIFO0CNT 0xE4
36#define REG_FIFO0THR 0xE8 36#define REG_FIFO0THR 0xE8
37#define REG_FIFO1CNT 0xF0 37#define REG_FIFO1CNT 0xF0
@@ -46,8 +46,6 @@
46/* Step Enable */ 46/* Step Enable */
47#define STEPENB_MASK (0x1FFFF << 0) 47#define STEPENB_MASK (0x1FFFF << 0)
48#define STEPENB(val) ((val) << 0) 48#define STEPENB(val) ((val) << 0)
49#define STPENB_STEPENB STEPENB(0x1FFFF)
50#define STPENB_STEPENB_TC STEPENB(0x1FFF)
51 49
52/* IRQ enable */ 50/* IRQ enable */
53#define IRQENB_HW_PEN BIT(0) 51#define IRQENB_HW_PEN BIT(0)
@@ -73,8 +71,6 @@
73#define STEPCONFIG_INM_ADCREFM STEPCONFIG_INM(8) 71#define STEPCONFIG_INM_ADCREFM STEPCONFIG_INM(8)
74#define STEPCONFIG_INP_MASK (0xF << 19) 72#define STEPCONFIG_INP_MASK (0xF << 19)
75#define STEPCONFIG_INP(val) ((val) << 19) 73#define STEPCONFIG_INP(val) ((val) << 19)
76#define STEPCONFIG_INP_AN2 STEPCONFIG_INP(2)
77#define STEPCONFIG_INP_AN3 STEPCONFIG_INP(3)
78#define STEPCONFIG_INP_AN4 STEPCONFIG_INP(4) 74#define STEPCONFIG_INP_AN4 STEPCONFIG_INP(4)
79#define STEPCONFIG_INP_ADCREFM STEPCONFIG_INP(8) 75#define STEPCONFIG_INP_ADCREFM STEPCONFIG_INP(8)
80#define STEPCONFIG_FIFO1 BIT(26) 76#define STEPCONFIG_FIFO1 BIT(26)
@@ -96,7 +92,6 @@
96#define STEPCHARGE_INM_AN1 STEPCHARGE_INM(1) 92#define STEPCHARGE_INM_AN1 STEPCHARGE_INM(1)
97#define STEPCHARGE_INP_MASK (0xF << 19) 93#define STEPCHARGE_INP_MASK (0xF << 19)
98#define STEPCHARGE_INP(val) ((val) << 19) 94#define STEPCHARGE_INP(val) ((val) << 19)
99#define STEPCHARGE_INP_AN1 STEPCHARGE_INP(1)
100#define STEPCHARGE_RFM_MASK (3 << 23) 95#define STEPCHARGE_RFM_MASK (3 << 23)
101#define STEPCHARGE_RFM(val) ((val) << 23) 96#define STEPCHARGE_RFM(val) ((val) << 23)
102#define STEPCHARGE_RFM_XNUR STEPCHARGE_RFM(1) 97#define STEPCHARGE_RFM_XNUR STEPCHARGE_RFM(1)
@@ -125,22 +120,17 @@
125 120
126#define TSCADC_CELLS 2 121#define TSCADC_CELLS 2
127 122
128enum tscadc_cells {
129 TSC_CELL,
130 ADC_CELL,
131};
132
133struct mfd_tscadc_board {
134 struct tsc_data *tsc_init;
135 struct adc_data *adc_init;
136};
137
138struct ti_tscadc_dev { 123struct ti_tscadc_dev {
139 struct device *dev; 124 struct device *dev;
140 struct regmap *regmap_tscadc; 125 struct regmap *regmap_tscadc;
141 void __iomem *tscadc_base; 126 void __iomem *tscadc_base;
142 int irq; 127 int irq;
128 int used_cells; /* 1-2 */
129 int tsc_cell; /* -1 if not used */
130 int adc_cell; /* -1 if not used */
143 struct mfd_cell cells[TSCADC_CELLS]; 131 struct mfd_cell cells[TSCADC_CELLS];
132 u32 reg_se_cache;
133 spinlock_t reg_lock;
144 134
145 /* tsc device */ 135 /* tsc device */
146 struct titsc *tsc; 136 struct titsc *tsc;
@@ -149,4 +139,15 @@ struct ti_tscadc_dev {
149 struct adc_device *adc; 139 struct adc_device *adc;
150}; 140};
151 141
142static inline struct ti_tscadc_dev *ti_tscadc_dev_get(struct platform_device *p)
143{
144 struct ti_tscadc_dev **tscadc_dev = p->dev.platform_data;
145
146 return *tscadc_dev;
147}
148
149void am335x_tsc_se_update(struct ti_tscadc_dev *tsadc);
150void am335x_tsc_se_set(struct ti_tscadc_dev *tsadc, u32 val);
151void am335x_tsc_se_clr(struct ti_tscadc_dev *tsadc, u32 val);
152
152#endif 153#endif
diff --git a/include/linux/mfd/tmio.h b/include/linux/mfd/tmio.h
index 99bf3e665997..ce3511326f80 100644
--- a/include/linux/mfd/tmio.h
+++ b/include/linux/mfd/tmio.h
@@ -81,10 +81,15 @@ int tmio_core_mmc_resume(void __iomem *cnf, int shift, unsigned long base);
81void tmio_core_mmc_pwr(void __iomem *cnf, int shift, int state); 81void tmio_core_mmc_pwr(void __iomem *cnf, int shift, int state);
82void tmio_core_mmc_clk_div(void __iomem *cnf, int shift, int state); 82void tmio_core_mmc_clk_div(void __iomem *cnf, int shift, int state);
83 83
84struct dma_chan;
85
84struct tmio_mmc_dma { 86struct tmio_mmc_dma {
85 void *chan_priv_tx; 87 void *chan_priv_tx;
86 void *chan_priv_rx; 88 void *chan_priv_rx;
89 int slave_id_tx;
90 int slave_id_rx;
87 int alignment_shift; 91 int alignment_shift;
92 bool (*filter)(struct dma_chan *chan, void *arg);
88}; 93};
89 94
90struct tmio_mmc_host; 95struct tmio_mmc_host;
diff --git a/include/linux/mfd/tps6507x.h b/include/linux/mfd/tps6507x.h
index c923e4864f55..c2ae56933539 100644
--- a/include/linux/mfd/tps6507x.h
+++ b/include/linux/mfd/tps6507x.h
@@ -163,7 +163,6 @@ struct tps6507x_dev {
163 163
164 /* Client devices */ 164 /* Client devices */
165 struct tps6507x_pmic *pmic; 165 struct tps6507x_pmic *pmic;
166 struct tps6507x_ts *ts;
167}; 166};
168 167
169#endif /* __LINUX_MFD_TPS6507X_H */ 168#endif /* __LINUX_MFD_TPS6507X_H */
diff --git a/include/linux/mfd/wm8994/core.h b/include/linux/mfd/wm8994/core.h
index ae5c249530b4..40854ac0ba3d 100644
--- a/include/linux/mfd/wm8994/core.h
+++ b/include/linux/mfd/wm8994/core.h
@@ -29,6 +29,7 @@ enum wm8994_type {
29 29
30struct regulator_dev; 30struct regulator_dev;
31struct regulator_bulk_data; 31struct regulator_bulk_data;
32struct irq_domain;
32 33
33#define WM8994_NUM_GPIO_REGS 11 34#define WM8994_NUM_GPIO_REGS 11
34#define WM8994_NUM_LDO_REGS 2 35#define WM8994_NUM_LDO_REGS 2
@@ -73,6 +74,7 @@ struct wm8994 {
73 74
74 int irq; 75 int irq;
75 struct regmap_irq_chip_data *irq_data; 76 struct regmap_irq_chip_data *irq_data;
77 struct irq_domain *edge_irq;
76 78
77 /* Used over suspend/resume */ 79 /* Used over suspend/resume */
78 bool suspended; 80 bool suspended;
diff --git a/include/linux/mfd/wm8994/pdata.h b/include/linux/mfd/wm8994/pdata.h
index b5046f6313a9..90c60524a496 100644
--- a/include/linux/mfd/wm8994/pdata.h
+++ b/include/linux/mfd/wm8994/pdata.h
@@ -228,6 +228,11 @@ struct wm8994_pdata {
228 * lines is mastered. 228 * lines is mastered.
229 */ 229 */
230 int max_channels_clocked[WM8994_NUM_AIF]; 230 int max_channels_clocked[WM8994_NUM_AIF];
231
232 /**
233 * GPIO for the IRQ pin if host only supports edge triggering
234 */
235 int irq_gpio;
231}; 236};
232 237
233#endif 238#endif
diff --git a/include/linux/mlx4/cmd.h b/include/linux/mlx4/cmd.h
index adf6e0648f20..bb1c8096a7eb 100644
--- a/include/linux/mlx4/cmd.h
+++ b/include/linux/mlx4/cmd.h
@@ -111,6 +111,7 @@ enum {
111 MLX4_CMD_INIT2INIT_QP = 0x2d, 111 MLX4_CMD_INIT2INIT_QP = 0x2d,
112 MLX4_CMD_SUSPEND_QP = 0x32, 112 MLX4_CMD_SUSPEND_QP = 0x32,
113 MLX4_CMD_UNSUSPEND_QP = 0x33, 113 MLX4_CMD_UNSUSPEND_QP = 0x33,
114 MLX4_CMD_UPDATE_QP = 0x61,
114 /* special QP and management commands */ 115 /* special QP and management commands */
115 MLX4_CMD_CONF_SPECIAL_QP = 0x23, 116 MLX4_CMD_CONF_SPECIAL_QP = 0x23,
116 MLX4_CMD_MAD_IFC = 0x24, 117 MLX4_CMD_MAD_IFC = 0x24,
@@ -237,7 +238,7 @@ int mlx4_set_vf_mac(struct mlx4_dev *dev, int port, int vf, u64 mac);
237int mlx4_set_vf_vlan(struct mlx4_dev *dev, int port, int vf, u16 vlan, u8 qos); 238int mlx4_set_vf_vlan(struct mlx4_dev *dev, int port, int vf, u16 vlan, u8 qos);
238int mlx4_set_vf_spoofchk(struct mlx4_dev *dev, int port, int vf, bool setting); 239int mlx4_set_vf_spoofchk(struct mlx4_dev *dev, int port, int vf, bool setting);
239int mlx4_get_vf_config(struct mlx4_dev *dev, int port, int vf, struct ifla_vf_info *ivf); 240int mlx4_get_vf_config(struct mlx4_dev *dev, int port, int vf, struct ifla_vf_info *ivf);
240 241int mlx4_set_vf_link_state(struct mlx4_dev *dev, int port, int vf, int link_state);
241 242
242#define MLX4_COMM_GET_IF_REV(cmd_chan_ver) (u8)((cmd_chan_ver) >> 8) 243#define MLX4_COMM_GET_IF_REV(cmd_chan_ver) (u8)((cmd_chan_ver) >> 8)
243 244
diff --git a/include/linux/mlx4/device.h b/include/linux/mlx4/device.h
index a51b0134ce18..52c23a892bab 100644
--- a/include/linux/mlx4/device.h
+++ b/include/linux/mlx4/device.h
@@ -157,7 +157,8 @@ enum {
157 MLX4_DEV_CAP_FLAGS2_REASSIGN_MAC_EN = 1LL << 4, 157 MLX4_DEV_CAP_FLAGS2_REASSIGN_MAC_EN = 1LL << 4,
158 MLX4_DEV_CAP_FLAG2_TS = 1LL << 5, 158 MLX4_DEV_CAP_FLAG2_TS = 1LL << 5,
159 MLX4_DEV_CAP_FLAG2_VLAN_CONTROL = 1LL << 6, 159 MLX4_DEV_CAP_FLAG2_VLAN_CONTROL = 1LL << 6,
160 MLX4_DEV_CAP_FLAG2_FSM = 1LL << 7 160 MLX4_DEV_CAP_FLAG2_FSM = 1LL << 7,
161 MLX4_DEV_CAP_FLAG2_UPDATE_QP = 1LL << 8
161}; 162};
162 163
163enum { 164enum {
diff --git a/include/linux/mlx4/qp.h b/include/linux/mlx4/qp.h
index 352eec9df1b8..262deac02c9e 100644
--- a/include/linux/mlx4/qp.h
+++ b/include/linux/mlx4/qp.h
@@ -152,6 +152,8 @@ enum { /* fl */
152}; 152};
153enum { /* vlan_control */ 153enum { /* vlan_control */
154 MLX4_VLAN_CTRL_ETH_TX_BLOCK_TAGGED = 1 << 6, 154 MLX4_VLAN_CTRL_ETH_TX_BLOCK_TAGGED = 1 << 6,
155 MLX4_VLAN_CTRL_ETH_TX_BLOCK_PRIO_TAGGED = 1 << 5, /* 802.1p priority tag */
156 MLX4_VLAN_CTRL_ETH_TX_BLOCK_UNTAGGED = 1 << 4,
155 MLX4_VLAN_CTRL_ETH_RX_BLOCK_TAGGED = 1 << 2, 157 MLX4_VLAN_CTRL_ETH_RX_BLOCK_TAGGED = 1 << 2,
156 MLX4_VLAN_CTRL_ETH_RX_BLOCK_PRIO_TAGGED = 1 << 1, /* 802.1p priority tag */ 158 MLX4_VLAN_CTRL_ETH_RX_BLOCK_PRIO_TAGGED = 1 << 1, /* 802.1p priority tag */
157 MLX4_VLAN_CTRL_ETH_RX_BLOCK_UNTAGGED = 1 << 0 159 MLX4_VLAN_CTRL_ETH_RX_BLOCK_UNTAGGED = 1 << 0
@@ -206,6 +208,40 @@ struct mlx4_qp_context {
206 u32 reserved5[10]; 208 u32 reserved5[10];
207}; 209};
208 210
211struct mlx4_update_qp_context {
212 __be64 qp_mask;
213 __be64 primary_addr_path_mask;
214 __be64 secondary_addr_path_mask;
215 u64 reserved1;
216 struct mlx4_qp_context qp_context;
217 u64 reserved2[58];
218};
219
220enum {
221 MLX4_UPD_QP_MASK_PM_STATE = 32,
222 MLX4_UPD_QP_MASK_VSD = 33,
223};
224
225enum {
226 MLX4_UPD_QP_PATH_MASK_PKEY_INDEX = 0 + 32,
227 MLX4_UPD_QP_PATH_MASK_FSM = 1 + 32,
228 MLX4_UPD_QP_PATH_MASK_MAC_INDEX = 2 + 32,
229 MLX4_UPD_QP_PATH_MASK_FVL = 3 + 32,
230 MLX4_UPD_QP_PATH_MASK_CV = 4 + 32,
231 MLX4_UPD_QP_PATH_MASK_VLAN_INDEX = 5 + 32,
232 MLX4_UPD_QP_PATH_MASK_ETH_HIDE_CQE_VLAN = 6 + 32,
233 MLX4_UPD_QP_PATH_MASK_ETH_TX_BLOCK_UNTAGGED = 7 + 32,
234 MLX4_UPD_QP_PATH_MASK_ETH_TX_BLOCK_1P = 8 + 32,
235 MLX4_UPD_QP_PATH_MASK_ETH_TX_BLOCK_TAGGED = 9 + 32,
236 MLX4_UPD_QP_PATH_MASK_ETH_RX_BLOCK_UNTAGGED = 10 + 32,
237 MLX4_UPD_QP_PATH_MASK_ETH_RX_BLOCK_1P = 11 + 32,
238 MLX4_UPD_QP_PATH_MASK_ETH_RX_BLOCK_TAGGED = 12 + 32,
239 MLX4_UPD_QP_PATH_MASK_FEUP = 13 + 32,
240 MLX4_UPD_QP_PATH_MASK_SCHED_QUEUE = 14 + 32,
241 MLX4_UPD_QP_PATH_MASK_IF_COUNTER_INDEX = 15 + 32,
242 MLX4_UPD_QP_PATH_MASK_FVL_RX = 16 + 32,
243};
244
209enum { /* param3 */ 245enum { /* param3 */
210 MLX4_STRIP_VLAN = 1 << 30 246 MLX4_STRIP_VLAN = 1 << 30
211}; 247};
diff --git a/include/linux/mlx5/cmd.h b/include/linux/mlx5/cmd.h
new file mode 100644
index 000000000000..2826a4b6071e
--- /dev/null
+++ b/include/linux/mlx5/cmd.h
@@ -0,0 +1,51 @@
1/*
2 * Copyright (c) 2013, Mellanox Technologies inc. All rights reserved.
3 *
4 * This software is available to you under a choice of one of two
5 * licenses. You may choose to be licensed under the terms of the GNU
6 * General Public License (GPL) Version 2, available from the file
7 * COPYING in the main directory of this source tree, or the
8 * OpenIB.org BSD license below:
9 *
10 * Redistribution and use in source and binary forms, with or
11 * without modification, are permitted provided that the following
12 * conditions are met:
13 *
14 * - Redistributions of source code must retain the above
15 * copyright notice, this list of conditions and the following
16 * disclaimer.
17 *
18 * - Redistributions in binary form must reproduce the above
19 * copyright notice, this list of conditions and the following
20 * disclaimer in the documentation and/or other materials
21 * provided with the distribution.
22 *
23 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
24 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
25 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
26 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
27 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
28 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
29 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
30 * SOFTWARE.
31 */
32
33#ifndef MLX5_CMD_H
34#define MLX5_CMD_H
35
36#include <linux/types.h>
37
38struct manage_pages_layout {
39 u64 ptr;
40 u32 reserved;
41 u16 num_entries;
42 u16 func_id;
43};
44
45
46struct mlx5_cmd_alloc_uar_imm_out {
47 u32 rsvd[3];
48 u32 uarn;
49};
50
51#endif /* MLX5_CMD_H */
diff --git a/include/linux/mlx5/cq.h b/include/linux/mlx5/cq.h
new file mode 100644
index 000000000000..3db67f73d96d
--- /dev/null
+++ b/include/linux/mlx5/cq.h
@@ -0,0 +1,165 @@
1/*
2 * Copyright (c) 2013, Mellanox Technologies inc. All rights reserved.
3 *
4 * This software is available to you under a choice of one of two
5 * licenses. You may choose to be licensed under the terms of the GNU
6 * General Public License (GPL) Version 2, available from the file
7 * COPYING in the main directory of this source tree, or the
8 * OpenIB.org BSD license below:
9 *
10 * Redistribution and use in source and binary forms, with or
11 * without modification, are permitted provided that the following
12 * conditions are met:
13 *
14 * - Redistributions of source code must retain the above
15 * copyright notice, this list of conditions and the following
16 * disclaimer.
17 *
18 * - Redistributions in binary form must reproduce the above
19 * copyright notice, this list of conditions and the following
20 * disclaimer in the documentation and/or other materials
21 * provided with the distribution.
22 *
23 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
24 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
25 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
26 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
27 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
28 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
29 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
30 * SOFTWARE.
31 */
32
33#ifndef MLX5_CORE_CQ_H
34#define MLX5_CORE_CQ_H
35
36#include <rdma/ib_verbs.h>
37#include <linux/mlx5/driver.h>
38
39
40struct mlx5_core_cq {
41 u32 cqn;
42 int cqe_sz;
43 __be32 *set_ci_db;
44 __be32 *arm_db;
45 atomic_t refcount;
46 struct completion free;
47 unsigned vector;
48 int irqn;
49 void (*comp) (struct mlx5_core_cq *);
50 void (*event) (struct mlx5_core_cq *, enum mlx5_event);
51 struct mlx5_uar *uar;
52 u32 cons_index;
53 unsigned arm_sn;
54 struct mlx5_rsc_debug *dbg;
55 int pid;
56};
57
58
59enum {
60 MLX5_CQE_SYNDROME_LOCAL_LENGTH_ERR = 0x01,
61 MLX5_CQE_SYNDROME_LOCAL_QP_OP_ERR = 0x02,
62 MLX5_CQE_SYNDROME_LOCAL_PROT_ERR = 0x04,
63 MLX5_CQE_SYNDROME_WR_FLUSH_ERR = 0x05,
64 MLX5_CQE_SYNDROME_MW_BIND_ERR = 0x06,
65 MLX5_CQE_SYNDROME_BAD_RESP_ERR = 0x10,
66 MLX5_CQE_SYNDROME_LOCAL_ACCESS_ERR = 0x11,
67 MLX5_CQE_SYNDROME_REMOTE_INVAL_REQ_ERR = 0x12,
68 MLX5_CQE_SYNDROME_REMOTE_ACCESS_ERR = 0x13,
69 MLX5_CQE_SYNDROME_REMOTE_OP_ERR = 0x14,
70 MLX5_CQE_SYNDROME_TRANSPORT_RETRY_EXC_ERR = 0x15,
71 MLX5_CQE_SYNDROME_RNR_RETRY_EXC_ERR = 0x16,
72 MLX5_CQE_SYNDROME_REMOTE_ABORTED_ERR = 0x22,
73};
74
75enum {
76 MLX5_CQE_OWNER_MASK = 1,
77 MLX5_CQE_REQ = 0,
78 MLX5_CQE_RESP_WR_IMM = 1,
79 MLX5_CQE_RESP_SEND = 2,
80 MLX5_CQE_RESP_SEND_IMM = 3,
81 MLX5_CQE_RESP_SEND_INV = 4,
82 MLX5_CQE_RESIZE_CQ = 0xff, /* TBD */
83 MLX5_CQE_REQ_ERR = 13,
84 MLX5_CQE_RESP_ERR = 14,
85};
86
87enum {
88 MLX5_CQ_MODIFY_RESEIZE = 0,
89 MLX5_CQ_MODIFY_MODER = 1,
90 MLX5_CQ_MODIFY_MAPPING = 2,
91};
92
93struct mlx5_cq_modify_params {
94 int type;
95 union {
96 struct {
97 u32 page_offset;
98 u8 log_cq_size;
99 } resize;
100
101 struct {
102 } moder;
103
104 struct {
105 } mapping;
106 } params;
107};
108
109enum {
110 CQE_SIZE_64 = 0,
111 CQE_SIZE_128 = 1,
112};
113
114static inline int cqe_sz_to_mlx_sz(u8 size)
115{
116 return size == 64 ? CQE_SIZE_64 : CQE_SIZE_128;
117}
118
119static inline void mlx5_cq_set_ci(struct mlx5_core_cq *cq)
120{
121 *cq->set_ci_db = cpu_to_be32(cq->cons_index & 0xffffff);
122}
123
124enum {
125 MLX5_CQ_DB_REQ_NOT_SOL = 1 << 24,
126 MLX5_CQ_DB_REQ_NOT = 0 << 24
127};
128
129static inline void mlx5_cq_arm(struct mlx5_core_cq *cq, u32 cmd,
130 void __iomem *uar_page,
131 spinlock_t *doorbell_lock)
132{
133 __be32 doorbell[2];
134 u32 sn;
135 u32 ci;
136
137 sn = cq->arm_sn & 3;
138 ci = cq->cons_index & 0xffffff;
139
140 *cq->arm_db = cpu_to_be32(sn << 28 | cmd | ci);
141
142 /* Make sure that the doorbell record in host memory is
143 * written before ringing the doorbell via PCI MMIO.
144 */
145 wmb();
146
147 doorbell[0] = cpu_to_be32(sn << 28 | cmd | ci);
148 doorbell[1] = cpu_to_be32(cq->cqn);
149
150 mlx5_write64(doorbell, uar_page + MLX5_CQ_DOORBELL, doorbell_lock);
151}
152
153int mlx5_init_cq_table(struct mlx5_core_dev *dev);
154void mlx5_cleanup_cq_table(struct mlx5_core_dev *dev);
155int mlx5_core_create_cq(struct mlx5_core_dev *dev, struct mlx5_core_cq *cq,
156 struct mlx5_create_cq_mbox_in *in, int inlen);
157int mlx5_core_destroy_cq(struct mlx5_core_dev *dev, struct mlx5_core_cq *cq);
158int mlx5_core_query_cq(struct mlx5_core_dev *dev, struct mlx5_core_cq *cq,
159 struct mlx5_query_cq_mbox_out *out);
160int mlx5_core_modify_cq(struct mlx5_core_dev *dev, struct mlx5_core_cq *cq,
161 int type, struct mlx5_cq_modify_params *params);
162int mlx5_debug_cq_add(struct mlx5_core_dev *dev, struct mlx5_core_cq *cq);
163void mlx5_debug_cq_remove(struct mlx5_core_dev *dev, struct mlx5_core_cq *cq);
164
165#endif /* MLX5_CORE_CQ_H */
diff --git a/include/linux/mlx5/device.h b/include/linux/mlx5/device.h
new file mode 100644
index 000000000000..737685e9e852
--- /dev/null
+++ b/include/linux/mlx5/device.h
@@ -0,0 +1,913 @@
1/*
2 * Copyright (c) 2013, Mellanox Technologies inc. All rights reserved.
3 *
4 * This software is available to you under a choice of one of two
5 * licenses. You may choose to be licensed under the terms of the GNU
6 * General Public License (GPL) Version 2, available from the file
7 * COPYING in the main directory of this source tree, or the
8 * OpenIB.org BSD license below:
9 *
10 * Redistribution and use in source and binary forms, with or
11 * without modification, are permitted provided that the following
12 * conditions are met:
13 *
14 * - Redistributions of source code must retain the above
15 * copyright notice, this list of conditions and the following
16 * disclaimer.
17 *
18 * - Redistributions in binary form must reproduce the above
19 * copyright notice, this list of conditions and the following
20 * disclaimer in the documentation and/or other materials
21 * provided with the distribution.
22 *
23 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
24 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
25 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
26 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
27 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
28 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
29 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
30 * SOFTWARE.
31 */
32
33#ifndef MLX5_DEVICE_H
34#define MLX5_DEVICE_H
35
36#include <linux/types.h>
37#include <rdma/ib_verbs.h>
38
39#if defined(__LITTLE_ENDIAN)
40#define MLX5_SET_HOST_ENDIANNESS 0
41#elif defined(__BIG_ENDIAN)
42#define MLX5_SET_HOST_ENDIANNESS 0x80
43#else
44#error Host endianness not defined
45#endif
46
47enum {
48 MLX5_MAX_COMMANDS = 32,
49 MLX5_CMD_DATA_BLOCK_SIZE = 512,
50 MLX5_PCI_CMD_XPORT = 7,
51};
52
53enum {
54 MLX5_EXTENDED_UD_AV = 0x80000000,
55};
56
57enum {
58 MLX5_CQ_STATE_ARMED = 9,
59 MLX5_CQ_STATE_ALWAYS_ARMED = 0xb,
60 MLX5_CQ_STATE_FIRED = 0xa,
61};
62
63enum {
64 MLX5_STAT_RATE_OFFSET = 5,
65};
66
67enum {
68 MLX5_INLINE_SEG = 0x80000000,
69};
70
71enum {
72 MLX5_PERM_LOCAL_READ = 1 << 2,
73 MLX5_PERM_LOCAL_WRITE = 1 << 3,
74 MLX5_PERM_REMOTE_READ = 1 << 4,
75 MLX5_PERM_REMOTE_WRITE = 1 << 5,
76 MLX5_PERM_ATOMIC = 1 << 6,
77 MLX5_PERM_UMR_EN = 1 << 7,
78};
79
80enum {
81 MLX5_PCIE_CTRL_SMALL_FENCE = 1 << 0,
82 MLX5_PCIE_CTRL_RELAXED_ORDERING = 1 << 2,
83 MLX5_PCIE_CTRL_NO_SNOOP = 1 << 3,
84 MLX5_PCIE_CTRL_TLP_PROCE_EN = 1 << 6,
85 MLX5_PCIE_CTRL_TPH_MASK = 3 << 4,
86};
87
88enum {
89 MLX5_ACCESS_MODE_PA = 0,
90 MLX5_ACCESS_MODE_MTT = 1,
91 MLX5_ACCESS_MODE_KLM = 2
92};
93
94enum {
95 MLX5_MKEY_REMOTE_INVAL = 1 << 24,
96 MLX5_MKEY_FLAG_SYNC_UMR = 1 << 29,
97 MLX5_MKEY_BSF_EN = 1 << 30,
98 MLX5_MKEY_LEN64 = 1 << 31,
99};
100
101enum {
102 MLX5_EN_RD = (u64)1,
103 MLX5_EN_WR = (u64)2
104};
105
106enum {
107 MLX5_BF_REGS_PER_PAGE = 4,
108 MLX5_MAX_UAR_PAGES = 1 << 8,
109 MLX5_MAX_UUARS = MLX5_MAX_UAR_PAGES * MLX5_BF_REGS_PER_PAGE,
110};
111
112enum {
113 MLX5_MKEY_MASK_LEN = 1ull << 0,
114 MLX5_MKEY_MASK_PAGE_SIZE = 1ull << 1,
115 MLX5_MKEY_MASK_START_ADDR = 1ull << 6,
116 MLX5_MKEY_MASK_PD = 1ull << 7,
117 MLX5_MKEY_MASK_EN_RINVAL = 1ull << 8,
118 MLX5_MKEY_MASK_BSF_EN = 1ull << 12,
119 MLX5_MKEY_MASK_KEY = 1ull << 13,
120 MLX5_MKEY_MASK_QPN = 1ull << 14,
121 MLX5_MKEY_MASK_LR = 1ull << 17,
122 MLX5_MKEY_MASK_LW = 1ull << 18,
123 MLX5_MKEY_MASK_RR = 1ull << 19,
124 MLX5_MKEY_MASK_RW = 1ull << 20,
125 MLX5_MKEY_MASK_A = 1ull << 21,
126 MLX5_MKEY_MASK_SMALL_FENCE = 1ull << 23,
127 MLX5_MKEY_MASK_FREE = 1ull << 29,
128};
129
130enum mlx5_event {
131 MLX5_EVENT_TYPE_COMP = 0x0,
132
133 MLX5_EVENT_TYPE_PATH_MIG = 0x01,
134 MLX5_EVENT_TYPE_COMM_EST = 0x02,
135 MLX5_EVENT_TYPE_SQ_DRAINED = 0x03,
136 MLX5_EVENT_TYPE_SRQ_LAST_WQE = 0x13,
137 MLX5_EVENT_TYPE_SRQ_RQ_LIMIT = 0x14,
138
139 MLX5_EVENT_TYPE_CQ_ERROR = 0x04,
140 MLX5_EVENT_TYPE_WQ_CATAS_ERROR = 0x05,
141 MLX5_EVENT_TYPE_PATH_MIG_FAILED = 0x07,
142 MLX5_EVENT_TYPE_WQ_INVAL_REQ_ERROR = 0x10,
143 MLX5_EVENT_TYPE_WQ_ACCESS_ERROR = 0x11,
144 MLX5_EVENT_TYPE_SRQ_CATAS_ERROR = 0x12,
145
146 MLX5_EVENT_TYPE_INTERNAL_ERROR = 0x08,
147 MLX5_EVENT_TYPE_PORT_CHANGE = 0x09,
148 MLX5_EVENT_TYPE_GPIO_EVENT = 0x15,
149 MLX5_EVENT_TYPE_REMOTE_CONFIG = 0x19,
150
151 MLX5_EVENT_TYPE_DB_BF_CONGESTION = 0x1a,
152 MLX5_EVENT_TYPE_STALL_EVENT = 0x1b,
153
154 MLX5_EVENT_TYPE_CMD = 0x0a,
155 MLX5_EVENT_TYPE_PAGE_REQUEST = 0xb,
156};
157
158enum {
159 MLX5_PORT_CHANGE_SUBTYPE_DOWN = 1,
160 MLX5_PORT_CHANGE_SUBTYPE_ACTIVE = 4,
161 MLX5_PORT_CHANGE_SUBTYPE_INITIALIZED = 5,
162 MLX5_PORT_CHANGE_SUBTYPE_LID = 6,
163 MLX5_PORT_CHANGE_SUBTYPE_PKEY = 7,
164 MLX5_PORT_CHANGE_SUBTYPE_GUID = 8,
165 MLX5_PORT_CHANGE_SUBTYPE_CLIENT_REREG = 9,
166};
167
168enum {
169 MLX5_DEV_CAP_FLAG_RC = 1LL << 0,
170 MLX5_DEV_CAP_FLAG_UC = 1LL << 1,
171 MLX5_DEV_CAP_FLAG_UD = 1LL << 2,
172 MLX5_DEV_CAP_FLAG_XRC = 1LL << 3,
173 MLX5_DEV_CAP_FLAG_SRQ = 1LL << 6,
174 MLX5_DEV_CAP_FLAG_BAD_PKEY_CNTR = 1LL << 8,
175 MLX5_DEV_CAP_FLAG_BAD_QKEY_CNTR = 1LL << 9,
176 MLX5_DEV_CAP_FLAG_APM = 1LL << 17,
177 MLX5_DEV_CAP_FLAG_ATOMIC = 1LL << 18,
178 MLX5_DEV_CAP_FLAG_ON_DMND_PG = 1LL << 24,
179 MLX5_DEV_CAP_FLAG_RESIZE_SRQ = 1LL << 32,
180 MLX5_DEV_CAP_FLAG_REMOTE_FENCE = 1LL << 38,
181 MLX5_DEV_CAP_FLAG_TLP_HINTS = 1LL << 39,
182 MLX5_DEV_CAP_FLAG_SIG_HAND_OVER = 1LL << 40,
183 MLX5_DEV_CAP_FLAG_DCT = 1LL << 41,
184 MLX5_DEV_CAP_FLAG_CMDIF_CSUM = 1LL << 46,
185};
186
187enum {
188 MLX5_OPCODE_NOP = 0x00,
189 MLX5_OPCODE_SEND_INVAL = 0x01,
190 MLX5_OPCODE_RDMA_WRITE = 0x08,
191 MLX5_OPCODE_RDMA_WRITE_IMM = 0x09,
192 MLX5_OPCODE_SEND = 0x0a,
193 MLX5_OPCODE_SEND_IMM = 0x0b,
194 MLX5_OPCODE_RDMA_READ = 0x10,
195 MLX5_OPCODE_ATOMIC_CS = 0x11,
196 MLX5_OPCODE_ATOMIC_FA = 0x12,
197 MLX5_OPCODE_ATOMIC_MASKED_CS = 0x14,
198 MLX5_OPCODE_ATOMIC_MASKED_FA = 0x15,
199 MLX5_OPCODE_BIND_MW = 0x18,
200 MLX5_OPCODE_CONFIG_CMD = 0x1f,
201
202 MLX5_RECV_OPCODE_RDMA_WRITE_IMM = 0x00,
203 MLX5_RECV_OPCODE_SEND = 0x01,
204 MLX5_RECV_OPCODE_SEND_IMM = 0x02,
205 MLX5_RECV_OPCODE_SEND_INVAL = 0x03,
206
207 MLX5_CQE_OPCODE_ERROR = 0x1e,
208 MLX5_CQE_OPCODE_RESIZE = 0x16,
209
210 MLX5_OPCODE_SET_PSV = 0x20,
211 MLX5_OPCODE_GET_PSV = 0x21,
212 MLX5_OPCODE_CHECK_PSV = 0x22,
213 MLX5_OPCODE_RGET_PSV = 0x26,
214 MLX5_OPCODE_RCHECK_PSV = 0x27,
215
216 MLX5_OPCODE_UMR = 0x25,
217
218};
219
220enum {
221 MLX5_SET_PORT_RESET_QKEY = 0,
222 MLX5_SET_PORT_GUID0 = 16,
223 MLX5_SET_PORT_NODE_GUID = 17,
224 MLX5_SET_PORT_SYS_GUID = 18,
225 MLX5_SET_PORT_GID_TABLE = 19,
226 MLX5_SET_PORT_PKEY_TABLE = 20,
227};
228
229enum {
230 MLX5_MAX_PAGE_SHIFT = 31
231};
232
233struct mlx5_inbox_hdr {
234 __be16 opcode;
235 u8 rsvd[4];
236 __be16 opmod;
237};
238
239struct mlx5_outbox_hdr {
240 u8 status;
241 u8 rsvd[3];
242 __be32 syndrome;
243};
244
245struct mlx5_cmd_query_adapter_mbox_in {
246 struct mlx5_inbox_hdr hdr;
247 u8 rsvd[8];
248};
249
250struct mlx5_cmd_query_adapter_mbox_out {
251 struct mlx5_outbox_hdr hdr;
252 u8 rsvd0[24];
253 u8 intapin;
254 u8 rsvd1[13];
255 __be16 vsd_vendor_id;
256 u8 vsd[208];
257 u8 vsd_psid[16];
258};
259
260struct mlx5_hca_cap {
261 u8 rsvd1[16];
262 u8 log_max_srq_sz;
263 u8 log_max_qp_sz;
264 u8 rsvd2;
265 u8 log_max_qp;
266 u8 log_max_strq_sz;
267 u8 log_max_srqs;
268 u8 rsvd4[2];
269 u8 rsvd5;
270 u8 log_max_cq_sz;
271 u8 rsvd6;
272 u8 log_max_cq;
273 u8 log_max_eq_sz;
274 u8 log_max_mkey;
275 u8 rsvd7;
276 u8 log_max_eq;
277 u8 max_indirection;
278 u8 log_max_mrw_sz;
279 u8 log_max_bsf_list_sz;
280 u8 log_max_klm_list_sz;
281 u8 rsvd_8_0;
282 u8 log_max_ra_req_dc;
283 u8 rsvd_8_1;
284 u8 log_max_ra_res_dc;
285 u8 rsvd9;
286 u8 log_max_ra_req_qp;
287 u8 rsvd10;
288 u8 log_max_ra_res_qp;
289 u8 rsvd11[4];
290 __be16 max_qp_count;
291 __be16 rsvd12;
292 u8 rsvd13;
293 u8 local_ca_ack_delay;
294 u8 rsvd14;
295 u8 num_ports;
296 u8 log_max_msg;
297 u8 rsvd15[3];
298 __be16 stat_rate_support;
299 u8 rsvd16[2];
300 __be64 flags;
301 u8 rsvd17;
302 u8 uar_sz;
303 u8 rsvd18;
304 u8 log_pg_sz;
305 __be16 bf_log_bf_reg_size;
306 u8 rsvd19[4];
307 __be16 max_desc_sz_sq;
308 u8 rsvd20[2];
309 __be16 max_desc_sz_rq;
310 u8 rsvd21[2];
311 __be16 max_desc_sz_sq_dc;
312 u8 rsvd22[4];
313 __be16 max_qp_mcg;
314 u8 rsvd23;
315 u8 log_max_mcg;
316 u8 rsvd24;
317 u8 log_max_pd;
318 u8 rsvd25;
319 u8 log_max_xrcd;
320 u8 rsvd26[42];
321 __be16 log_uar_page_sz;
322 u8 rsvd27[28];
323 u8 log_msx_atomic_size_qp;
324 u8 rsvd28[2];
325 u8 log_msx_atomic_size_dc;
326 u8 rsvd29[76];
327};
328
329
330struct mlx5_cmd_query_hca_cap_mbox_in {
331 struct mlx5_inbox_hdr hdr;
332 u8 rsvd[8];
333};
334
335
336struct mlx5_cmd_query_hca_cap_mbox_out {
337 struct mlx5_outbox_hdr hdr;
338 u8 rsvd0[8];
339 struct mlx5_hca_cap hca_cap;
340};
341
342
343struct mlx5_cmd_set_hca_cap_mbox_in {
344 struct mlx5_inbox_hdr hdr;
345 u8 rsvd[8];
346 struct mlx5_hca_cap hca_cap;
347};
348
349
350struct mlx5_cmd_set_hca_cap_mbox_out {
351 struct mlx5_outbox_hdr hdr;
352 u8 rsvd0[8];
353};
354
355
356struct mlx5_cmd_init_hca_mbox_in {
357 struct mlx5_inbox_hdr hdr;
358 u8 rsvd0[2];
359 __be16 profile;
360 u8 rsvd1[4];
361};
362
363struct mlx5_cmd_init_hca_mbox_out {
364 struct mlx5_outbox_hdr hdr;
365 u8 rsvd[8];
366};
367
368struct mlx5_cmd_teardown_hca_mbox_in {
369 struct mlx5_inbox_hdr hdr;
370 u8 rsvd0[2];
371 __be16 profile;
372 u8 rsvd1[4];
373};
374
375struct mlx5_cmd_teardown_hca_mbox_out {
376 struct mlx5_outbox_hdr hdr;
377 u8 rsvd[8];
378};
379
380struct mlx5_cmd_layout {
381 u8 type;
382 u8 rsvd0[3];
383 __be32 inlen;
384 __be64 in_ptr;
385 __be32 in[4];
386 __be32 out[4];
387 __be64 out_ptr;
388 __be32 outlen;
389 u8 token;
390 u8 sig;
391 u8 rsvd1;
392 u8 status_own;
393};
394
395
396struct health_buffer {
397 __be32 assert_var[5];
398 __be32 rsvd0[3];
399 __be32 assert_exit_ptr;
400 __be32 assert_callra;
401 __be32 rsvd1[2];
402 __be32 fw_ver;
403 __be32 hw_id;
404 __be32 rsvd2;
405 u8 irisc_index;
406 u8 synd;
407 __be16 ext_sync;
408};
409
410struct mlx5_init_seg {
411 __be32 fw_rev;
412 __be32 cmdif_rev_fw_sub;
413 __be32 rsvd0[2];
414 __be32 cmdq_addr_h;
415 __be32 cmdq_addr_l_sz;
416 __be32 cmd_dbell;
417 __be32 rsvd1[121];
418 struct health_buffer health;
419 __be32 rsvd2[884];
420 __be32 health_counter;
421 __be32 rsvd3[1023];
422 __be64 ieee1588_clk;
423 __be32 ieee1588_clk_type;
424 __be32 clr_intx;
425};
426
427struct mlx5_eqe_comp {
428 __be32 reserved[6];
429 __be32 cqn;
430};
431
432struct mlx5_eqe_qp_srq {
433 __be32 reserved[6];
434 __be32 qp_srq_n;
435};
436
437struct mlx5_eqe_cq_err {
438 __be32 cqn;
439 u8 reserved1[7];
440 u8 syndrome;
441};
442
443struct mlx5_eqe_dropped_packet {
444};
445
446struct mlx5_eqe_port_state {
447 u8 reserved0[8];
448 u8 port;
449};
450
451struct mlx5_eqe_gpio {
452 __be32 reserved0[2];
453 __be64 gpio_event;
454};
455
456struct mlx5_eqe_congestion {
457 u8 type;
458 u8 rsvd0;
459 u8 congestion_level;
460};
461
462struct mlx5_eqe_stall_vl {
463 u8 rsvd0[3];
464 u8 port_vl;
465};
466
467struct mlx5_eqe_cmd {
468 __be32 vector;
469 __be32 rsvd[6];
470};
471
472struct mlx5_eqe_page_req {
473 u8 rsvd0[2];
474 __be16 func_id;
475 u8 rsvd1[2];
476 __be16 num_pages;
477 __be32 rsvd2[5];
478};
479
480union ev_data {
481 __be32 raw[7];
482 struct mlx5_eqe_cmd cmd;
483 struct mlx5_eqe_comp comp;
484 struct mlx5_eqe_qp_srq qp_srq;
485 struct mlx5_eqe_cq_err cq_err;
486 struct mlx5_eqe_dropped_packet dp;
487 struct mlx5_eqe_port_state port;
488 struct mlx5_eqe_gpio gpio;
489 struct mlx5_eqe_congestion cong;
490 struct mlx5_eqe_stall_vl stall_vl;
491 struct mlx5_eqe_page_req req_pages;
492} __packed;
493
494struct mlx5_eqe {
495 u8 rsvd0;
496 u8 type;
497 u8 rsvd1;
498 u8 sub_type;
499 __be32 rsvd2[7];
500 union ev_data data;
501 __be16 rsvd3;
502 u8 signature;
503 u8 owner;
504} __packed;
505
506struct mlx5_cmd_prot_block {
507 u8 data[MLX5_CMD_DATA_BLOCK_SIZE];
508 u8 rsvd0[48];
509 __be64 next;
510 __be32 block_num;
511 u8 rsvd1;
512 u8 token;
513 u8 ctrl_sig;
514 u8 sig;
515};
516
517struct mlx5_err_cqe {
518 u8 rsvd0[32];
519 __be32 srqn;
520 u8 rsvd1[18];
521 u8 vendor_err_synd;
522 u8 syndrome;
523 __be32 s_wqe_opcode_qpn;
524 __be16 wqe_counter;
525 u8 signature;
526 u8 op_own;
527};
528
529struct mlx5_cqe64 {
530 u8 rsvd0[17];
531 u8 ml_path;
532 u8 rsvd20[4];
533 __be16 slid;
534 __be32 flags_rqpn;
535 u8 rsvd28[4];
536 __be32 srqn;
537 __be32 imm_inval_pkey;
538 u8 rsvd40[4];
539 __be32 byte_cnt;
540 __be64 timestamp;
541 __be32 sop_drop_qpn;
542 __be16 wqe_counter;
543 u8 signature;
544 u8 op_own;
545};
546
547struct mlx5_wqe_srq_next_seg {
548 u8 rsvd0[2];
549 __be16 next_wqe_index;
550 u8 signature;
551 u8 rsvd1[11];
552};
553
554union mlx5_ext_cqe {
555 struct ib_grh grh;
556 u8 inl[64];
557};
558
559struct mlx5_cqe128 {
560 union mlx5_ext_cqe inl_grh;
561 struct mlx5_cqe64 cqe64;
562};
563
564struct mlx5_srq_ctx {
565 u8 state_log_sz;
566 u8 rsvd0[3];
567 __be32 flags_xrcd;
568 __be32 pgoff_cqn;
569 u8 rsvd1[4];
570 u8 log_pg_sz;
571 u8 rsvd2[7];
572 __be32 pd;
573 __be16 lwm;
574 __be16 wqe_cnt;
575 u8 rsvd3[8];
576 __be64 db_record;
577};
578
579struct mlx5_create_srq_mbox_in {
580 struct mlx5_inbox_hdr hdr;
581 __be32 input_srqn;
582 u8 rsvd0[4];
583 struct mlx5_srq_ctx ctx;
584 u8 rsvd1[208];
585 __be64 pas[0];
586};
587
588struct mlx5_create_srq_mbox_out {
589 struct mlx5_outbox_hdr hdr;
590 __be32 srqn;
591 u8 rsvd[4];
592};
593
594struct mlx5_destroy_srq_mbox_in {
595 struct mlx5_inbox_hdr hdr;
596 __be32 srqn;
597 u8 rsvd[4];
598};
599
600struct mlx5_destroy_srq_mbox_out {
601 struct mlx5_outbox_hdr hdr;
602 u8 rsvd[8];
603};
604
605struct mlx5_query_srq_mbox_in {
606 struct mlx5_inbox_hdr hdr;
607 __be32 srqn;
608 u8 rsvd0[4];
609};
610
611struct mlx5_query_srq_mbox_out {
612 struct mlx5_outbox_hdr hdr;
613 u8 rsvd0[8];
614 struct mlx5_srq_ctx ctx;
615 u8 rsvd1[32];
616 __be64 pas[0];
617};
618
619struct mlx5_arm_srq_mbox_in {
620 struct mlx5_inbox_hdr hdr;
621 __be32 srqn;
622 __be16 rsvd;
623 __be16 lwm;
624};
625
626struct mlx5_arm_srq_mbox_out {
627 struct mlx5_outbox_hdr hdr;
628 u8 rsvd[8];
629};
630
631struct mlx5_cq_context {
632 u8 status;
633 u8 cqe_sz_flags;
634 u8 st;
635 u8 rsvd3;
636 u8 rsvd4[6];
637 __be16 page_offset;
638 __be32 log_sz_usr_page;
639 __be16 cq_period;
640 __be16 cq_max_count;
641 __be16 rsvd20;
642 __be16 c_eqn;
643 u8 log_pg_sz;
644 u8 rsvd25[7];
645 __be32 last_notified_index;
646 __be32 solicit_producer_index;
647 __be32 consumer_counter;
648 __be32 producer_counter;
649 u8 rsvd48[8];
650 __be64 db_record_addr;
651};
652
653struct mlx5_create_cq_mbox_in {
654 struct mlx5_inbox_hdr hdr;
655 __be32 input_cqn;
656 u8 rsvdx[4];
657 struct mlx5_cq_context ctx;
658 u8 rsvd6[192];
659 __be64 pas[0];
660};
661
662struct mlx5_create_cq_mbox_out {
663 struct mlx5_outbox_hdr hdr;
664 __be32 cqn;
665 u8 rsvd0[4];
666};
667
668struct mlx5_destroy_cq_mbox_in {
669 struct mlx5_inbox_hdr hdr;
670 __be32 cqn;
671 u8 rsvd0[4];
672};
673
674struct mlx5_destroy_cq_mbox_out {
675 struct mlx5_outbox_hdr hdr;
676 u8 rsvd0[8];
677};
678
679struct mlx5_query_cq_mbox_in {
680 struct mlx5_inbox_hdr hdr;
681 __be32 cqn;
682 u8 rsvd0[4];
683};
684
685struct mlx5_query_cq_mbox_out {
686 struct mlx5_outbox_hdr hdr;
687 u8 rsvd0[8];
688 struct mlx5_cq_context ctx;
689 u8 rsvd6[16];
690 __be64 pas[0];
691};
692
693struct mlx5_enable_hca_mbox_in {
694 struct mlx5_inbox_hdr hdr;
695 u8 rsvd[8];
696};
697
698struct mlx5_enable_hca_mbox_out {
699 struct mlx5_outbox_hdr hdr;
700 u8 rsvd[8];
701};
702
703struct mlx5_disable_hca_mbox_in {
704 struct mlx5_inbox_hdr hdr;
705 u8 rsvd[8];
706};
707
708struct mlx5_disable_hca_mbox_out {
709 struct mlx5_outbox_hdr hdr;
710 u8 rsvd[8];
711};
712
713struct mlx5_eq_context {
714 u8 status;
715 u8 ec_oi;
716 u8 st;
717 u8 rsvd2[7];
718 __be16 page_pffset;
719 __be32 log_sz_usr_page;
720 u8 rsvd3[7];
721 u8 intr;
722 u8 log_page_size;
723 u8 rsvd4[15];
724 __be32 consumer_counter;
725 __be32 produser_counter;
726 u8 rsvd5[16];
727};
728
729struct mlx5_create_eq_mbox_in {
730 struct mlx5_inbox_hdr hdr;
731 u8 rsvd0[3];
732 u8 input_eqn;
733 u8 rsvd1[4];
734 struct mlx5_eq_context ctx;
735 u8 rsvd2[8];
736 __be64 events_mask;
737 u8 rsvd3[176];
738 __be64 pas[0];
739};
740
741struct mlx5_create_eq_mbox_out {
742 struct mlx5_outbox_hdr hdr;
743 u8 rsvd0[3];
744 u8 eq_number;
745 u8 rsvd1[4];
746};
747
748struct mlx5_destroy_eq_mbox_in {
749 struct mlx5_inbox_hdr hdr;
750 u8 rsvd0[3];
751 u8 eqn;
752 u8 rsvd1[4];
753};
754
755struct mlx5_destroy_eq_mbox_out {
756 struct mlx5_outbox_hdr hdr;
757 u8 rsvd[8];
758};
759
760struct mlx5_map_eq_mbox_in {
761 struct mlx5_inbox_hdr hdr;
762 __be64 mask;
763 u8 mu;
764 u8 rsvd0[2];
765 u8 eqn;
766 u8 rsvd1[24];
767};
768
769struct mlx5_map_eq_mbox_out {
770 struct mlx5_outbox_hdr hdr;
771 u8 rsvd[8];
772};
773
774struct mlx5_query_eq_mbox_in {
775 struct mlx5_inbox_hdr hdr;
776 u8 rsvd0[3];
777 u8 eqn;
778 u8 rsvd1[4];
779};
780
781struct mlx5_query_eq_mbox_out {
782 struct mlx5_outbox_hdr hdr;
783 u8 rsvd[8];
784 struct mlx5_eq_context ctx;
785};
786
787struct mlx5_mkey_seg {
788 /* This is a two bit field occupying bits 31-30.
789 * bit 31 is always 0,
790 * bit 30 is zero for regular MRs and 1 (e.g free) for UMRs that do not have tanslation
791 */
792 u8 status;
793 u8 pcie_control;
794 u8 flags;
795 u8 version;
796 __be32 qpn_mkey7_0;
797 u8 rsvd1[4];
798 __be32 flags_pd;
799 __be64 start_addr;
800 __be64 len;
801 __be32 bsfs_octo_size;
802 u8 rsvd2[16];
803 __be32 xlt_oct_size;
804 u8 rsvd3[3];
805 u8 log2_page_size;
806 u8 rsvd4[4];
807};
808
809struct mlx5_query_special_ctxs_mbox_in {
810 struct mlx5_inbox_hdr hdr;
811 u8 rsvd[8];
812};
813
814struct mlx5_query_special_ctxs_mbox_out {
815 struct mlx5_outbox_hdr hdr;
816 __be32 dump_fill_mkey;
817 __be32 reserved_lkey;
818};
819
820struct mlx5_create_mkey_mbox_in {
821 struct mlx5_inbox_hdr hdr;
822 __be32 input_mkey_index;
823 u8 rsvd0[4];
824 struct mlx5_mkey_seg seg;
825 u8 rsvd1[16];
826 __be32 xlat_oct_act_size;
827 __be32 bsf_coto_act_size;
828 u8 rsvd2[168];
829 __be64 pas[0];
830};
831
832struct mlx5_create_mkey_mbox_out {
833 struct mlx5_outbox_hdr hdr;
834 __be32 mkey;
835 u8 rsvd[4];
836};
837
838struct mlx5_destroy_mkey_mbox_in {
839 struct mlx5_inbox_hdr hdr;
840 __be32 mkey;
841 u8 rsvd[4];
842};
843
844struct mlx5_destroy_mkey_mbox_out {
845 struct mlx5_outbox_hdr hdr;
846 u8 rsvd[8];
847};
848
849struct mlx5_query_mkey_mbox_in {
850 struct mlx5_inbox_hdr hdr;
851 __be32 mkey;
852};
853
854struct mlx5_query_mkey_mbox_out {
855 struct mlx5_outbox_hdr hdr;
856 __be64 pas[0];
857};
858
859struct mlx5_modify_mkey_mbox_in {
860 struct mlx5_inbox_hdr hdr;
861 __be32 mkey;
862 __be64 pas[0];
863};
864
865struct mlx5_modify_mkey_mbox_out {
866 struct mlx5_outbox_hdr hdr;
867};
868
869struct mlx5_dump_mkey_mbox_in {
870 struct mlx5_inbox_hdr hdr;
871};
872
873struct mlx5_dump_mkey_mbox_out {
874 struct mlx5_outbox_hdr hdr;
875 __be32 mkey;
876};
877
878struct mlx5_mad_ifc_mbox_in {
879 struct mlx5_inbox_hdr hdr;
880 __be16 remote_lid;
881 u8 rsvd0;
882 u8 port;
883 u8 rsvd1[4];
884 u8 data[256];
885};
886
887struct mlx5_mad_ifc_mbox_out {
888 struct mlx5_outbox_hdr hdr;
889 u8 rsvd[8];
890 u8 data[256];
891};
892
893struct mlx5_access_reg_mbox_in {
894 struct mlx5_inbox_hdr hdr;
895 u8 rsvd0[2];
896 __be16 register_id;
897 __be32 arg;
898 __be32 data[0];
899};
900
901struct mlx5_access_reg_mbox_out {
902 struct mlx5_outbox_hdr hdr;
903 u8 rsvd[8];
904 __be32 data[0];
905};
906
907#define MLX5_ATTR_EXTENDED_PORT_INFO cpu_to_be16(0xff90)
908
909enum {
910 MLX_EXT_PORT_CAP_FLAG_EXTENDED_PORT_INFO = 1 << 0
911};
912
913#endif /* MLX5_DEVICE_H */
diff --git a/include/linux/mlx5/doorbell.h b/include/linux/mlx5/doorbell.h
new file mode 100644
index 000000000000..163a818411e7
--- /dev/null
+++ b/include/linux/mlx5/doorbell.h
@@ -0,0 +1,79 @@
1/*
2 * Copyright (c) 2013, Mellanox Technologies inc. All rights reserved.
3 *
4 * This software is available to you under a choice of one of two
5 * licenses. You may choose to be licensed under the terms of the GNU
6 * General Public License (GPL) Version 2, available from the file
7 * COPYING in the main directory of this source tree, or the
8 * OpenIB.org BSD license below:
9 *
10 * Redistribution and use in source and binary forms, with or
11 * without modification, are permitted provided that the following
12 * conditions are met:
13 *
14 * - Redistributions of source code must retain the above
15 * copyright notice, this list of conditions and the following
16 * disclaimer.
17 *
18 * - Redistributions in binary form must reproduce the above
19 * copyright notice, this list of conditions and the following
20 * disclaimer in the documentation and/or other materials
21 * provided with the distribution.
22 *
23 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
24 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
25 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
26 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
27 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
28 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
29 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
30 * SOFTWARE.
31 */
32
33#ifndef MLX5_DOORBELL_H
34#define MLX5_DOORBELL_H
35
36#define MLX5_BF_OFFSET 0x800
37#define MLX5_CQ_DOORBELL 0x20
38
39#if BITS_PER_LONG == 64
40/* Assume that we can just write a 64-bit doorbell atomically. s390
41 * actually doesn't have writeq() but S/390 systems don't even have
42 * PCI so we won't worry about it.
43 */
44
45#define MLX5_DECLARE_DOORBELL_LOCK(name)
46#define MLX5_INIT_DOORBELL_LOCK(ptr) do { } while (0)
47#define MLX5_GET_DOORBELL_LOCK(ptr) (NULL)
48
49static inline void mlx5_write64(__be32 val[2], void __iomem *dest,
50 spinlock_t *doorbell_lock)
51{
52 __raw_writeq(*(u64 *)val, dest);
53}
54
55#else
56
57/* Just fall back to a spinlock to protect the doorbell if
58 * BITS_PER_LONG is 32 -- there's no portable way to do atomic 64-bit
59 * MMIO writes.
60 */
61
62#define MLX5_DECLARE_DOORBELL_LOCK(name) spinlock_t name;
63#define MLX5_INIT_DOORBELL_LOCK(ptr) spin_lock_init(ptr)
64#define MLX5_GET_DOORBELL_LOCK(ptr) (ptr)
65
66static inline void mlx5_write64(__be32 val[2], void __iomem *dest,
67 spinlock_t *doorbell_lock)
68{
69 unsigned long flags;
70
71 spin_lock_irqsave(doorbell_lock, flags);
72 __raw_writel((__force u32) val[0], dest);
73 __raw_writel((__force u32) val[1], dest + 4);
74 spin_unlock_irqrestore(doorbell_lock, flags);
75}
76
77#endif
78
79#endif /* MLX5_DOORBELL_H */
diff --git a/include/linux/mlx5/driver.h b/include/linux/mlx5/driver.h
new file mode 100644
index 000000000000..2aa258b0ced1
--- /dev/null
+++ b/include/linux/mlx5/driver.h
@@ -0,0 +1,771 @@
1/*
2 * Copyright (c) 2013, Mellanox Technologies inc. All rights reserved.
3 *
4 * This software is available to you under a choice of one of two
5 * licenses. You may choose to be licensed under the terms of the GNU
6 * General Public License (GPL) Version 2, available from the file
7 * COPYING in the main directory of this source tree, or the
8 * OpenIB.org BSD license below:
9 *
10 * Redistribution and use in source and binary forms, with or
11 * without modification, are permitted provided that the following
12 * conditions are met:
13 *
14 * - Redistributions of source code must retain the above
15 * copyright notice, this list of conditions and the following
16 * disclaimer.
17 *
18 * - Redistributions in binary form must reproduce the above
19 * copyright notice, this list of conditions and the following
20 * disclaimer in the documentation and/or other materials
21 * provided with the distribution.
22 *
23 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
24 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
25 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
26 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
27 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
28 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
29 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
30 * SOFTWARE.
31 */
32
33#ifndef MLX5_DRIVER_H
34#define MLX5_DRIVER_H
35
36#include <linux/kernel.h>
37#include <linux/completion.h>
38#include <linux/pci.h>
39#include <linux/spinlock_types.h>
40#include <linux/semaphore.h>
41#include <linux/vmalloc.h>
42#include <linux/radix-tree.h>
43#include <linux/mlx5/device.h>
44#include <linux/mlx5/doorbell.h>
45
46enum {
47 MLX5_BOARD_ID_LEN = 64,
48 MLX5_MAX_NAME_LEN = 16,
49};
50
51enum {
52 /* one minute for the sake of bringup. Generally, commands must always
53 * complete and we may need to increase this timeout value
54 */
55 MLX5_CMD_TIMEOUT_MSEC = 7200 * 1000,
56 MLX5_CMD_WQ_MAX_NAME = 32,
57};
58
59enum {
60 CMD_OWNER_SW = 0x0,
61 CMD_OWNER_HW = 0x1,
62 CMD_STATUS_SUCCESS = 0,
63};
64
65enum mlx5_sqp_t {
66 MLX5_SQP_SMI = 0,
67 MLX5_SQP_GSI = 1,
68 MLX5_SQP_IEEE_1588 = 2,
69 MLX5_SQP_SNIFFER = 3,
70 MLX5_SQP_SYNC_UMR = 4,
71};
72
73enum {
74 MLX5_MAX_PORTS = 2,
75};
76
77enum {
78 MLX5_EQ_VEC_PAGES = 0,
79 MLX5_EQ_VEC_CMD = 1,
80 MLX5_EQ_VEC_ASYNC = 2,
81 MLX5_EQ_VEC_COMP_BASE,
82};
83
84enum {
85 MLX5_MAX_EQ_NAME = 20
86};
87
88enum {
89 MLX5_ATOMIC_MODE_IB_COMP = 1 << 16,
90 MLX5_ATOMIC_MODE_CX = 2 << 16,
91 MLX5_ATOMIC_MODE_8B = 3 << 16,
92 MLX5_ATOMIC_MODE_16B = 4 << 16,
93 MLX5_ATOMIC_MODE_32B = 5 << 16,
94 MLX5_ATOMIC_MODE_64B = 6 << 16,
95 MLX5_ATOMIC_MODE_128B = 7 << 16,
96 MLX5_ATOMIC_MODE_256B = 8 << 16,
97};
98
99enum {
100 MLX5_CMD_OP_QUERY_HCA_CAP = 0x100,
101 MLX5_CMD_OP_QUERY_ADAPTER = 0x101,
102 MLX5_CMD_OP_INIT_HCA = 0x102,
103 MLX5_CMD_OP_TEARDOWN_HCA = 0x103,
104 MLX5_CMD_OP_ENABLE_HCA = 0x104,
105 MLX5_CMD_OP_DISABLE_HCA = 0x105,
106 MLX5_CMD_OP_QUERY_PAGES = 0x107,
107 MLX5_CMD_OP_MANAGE_PAGES = 0x108,
108 MLX5_CMD_OP_SET_HCA_CAP = 0x109,
109
110 MLX5_CMD_OP_CREATE_MKEY = 0x200,
111 MLX5_CMD_OP_QUERY_MKEY = 0x201,
112 MLX5_CMD_OP_DESTROY_MKEY = 0x202,
113 MLX5_CMD_OP_QUERY_SPECIAL_CONTEXTS = 0x203,
114
115 MLX5_CMD_OP_CREATE_EQ = 0x301,
116 MLX5_CMD_OP_DESTROY_EQ = 0x302,
117 MLX5_CMD_OP_QUERY_EQ = 0x303,
118
119 MLX5_CMD_OP_CREATE_CQ = 0x400,
120 MLX5_CMD_OP_DESTROY_CQ = 0x401,
121 MLX5_CMD_OP_QUERY_CQ = 0x402,
122 MLX5_CMD_OP_MODIFY_CQ = 0x403,
123
124 MLX5_CMD_OP_CREATE_QP = 0x500,
125 MLX5_CMD_OP_DESTROY_QP = 0x501,
126 MLX5_CMD_OP_RST2INIT_QP = 0x502,
127 MLX5_CMD_OP_INIT2RTR_QP = 0x503,
128 MLX5_CMD_OP_RTR2RTS_QP = 0x504,
129 MLX5_CMD_OP_RTS2RTS_QP = 0x505,
130 MLX5_CMD_OP_SQERR2RTS_QP = 0x506,
131 MLX5_CMD_OP_2ERR_QP = 0x507,
132 MLX5_CMD_OP_RTS2SQD_QP = 0x508,
133 MLX5_CMD_OP_SQD2RTS_QP = 0x509,
134 MLX5_CMD_OP_2RST_QP = 0x50a,
135 MLX5_CMD_OP_QUERY_QP = 0x50b,
136 MLX5_CMD_OP_CONF_SQP = 0x50c,
137 MLX5_CMD_OP_MAD_IFC = 0x50d,
138 MLX5_CMD_OP_INIT2INIT_QP = 0x50e,
139 MLX5_CMD_OP_SUSPEND_QP = 0x50f,
140 MLX5_CMD_OP_UNSUSPEND_QP = 0x510,
141 MLX5_CMD_OP_SQD2SQD_QP = 0x511,
142 MLX5_CMD_OP_ALLOC_QP_COUNTER_SET = 0x512,
143 MLX5_CMD_OP_DEALLOC_QP_COUNTER_SET = 0x513,
144 MLX5_CMD_OP_QUERY_QP_COUNTER_SET = 0x514,
145
146 MLX5_CMD_OP_CREATE_PSV = 0x600,
147 MLX5_CMD_OP_DESTROY_PSV = 0x601,
148 MLX5_CMD_OP_QUERY_PSV = 0x602,
149 MLX5_CMD_OP_QUERY_SIG_RULE_TABLE = 0x603,
150 MLX5_CMD_OP_QUERY_BLOCK_SIZE_TABLE = 0x604,
151
152 MLX5_CMD_OP_CREATE_SRQ = 0x700,
153 MLX5_CMD_OP_DESTROY_SRQ = 0x701,
154 MLX5_CMD_OP_QUERY_SRQ = 0x702,
155 MLX5_CMD_OP_ARM_RQ = 0x703,
156 MLX5_CMD_OP_RESIZE_SRQ = 0x704,
157
158 MLX5_CMD_OP_ALLOC_PD = 0x800,
159 MLX5_CMD_OP_DEALLOC_PD = 0x801,
160 MLX5_CMD_OP_ALLOC_UAR = 0x802,
161 MLX5_CMD_OP_DEALLOC_UAR = 0x803,
162
163 MLX5_CMD_OP_ATTACH_TO_MCG = 0x806,
164 MLX5_CMD_OP_DETACH_FROM_MCG = 0x807,
165
166
167 MLX5_CMD_OP_ALLOC_XRCD = 0x80e,
168 MLX5_CMD_OP_DEALLOC_XRCD = 0x80f,
169
170 MLX5_CMD_OP_ACCESS_REG = 0x805,
171 MLX5_CMD_OP_MAX = 0x810,
172};
173
174enum {
175 MLX5_REG_PCAP = 0x5001,
176 MLX5_REG_PMTU = 0x5003,
177 MLX5_REG_PTYS = 0x5004,
178 MLX5_REG_PAOS = 0x5006,
179 MLX5_REG_PMAOS = 0x5012,
180 MLX5_REG_PUDE = 0x5009,
181 MLX5_REG_PMPE = 0x5010,
182 MLX5_REG_PELC = 0x500e,
183 MLX5_REG_PMLP = 0, /* TBD */
184 MLX5_REG_NODE_DESC = 0x6001,
185 MLX5_REG_HOST_ENDIANNESS = 0x7004,
186};
187
188enum dbg_rsc_type {
189 MLX5_DBG_RSC_QP,
190 MLX5_DBG_RSC_EQ,
191 MLX5_DBG_RSC_CQ,
192};
193
194struct mlx5_field_desc {
195 struct dentry *dent;
196 int i;
197};
198
199struct mlx5_rsc_debug {
200 struct mlx5_core_dev *dev;
201 void *object;
202 enum dbg_rsc_type type;
203 struct dentry *root;
204 struct mlx5_field_desc fields[0];
205};
206
207enum mlx5_dev_event {
208 MLX5_DEV_EVENT_SYS_ERROR,
209 MLX5_DEV_EVENT_PORT_UP,
210 MLX5_DEV_EVENT_PORT_DOWN,
211 MLX5_DEV_EVENT_PORT_INITIALIZED,
212 MLX5_DEV_EVENT_LID_CHANGE,
213 MLX5_DEV_EVENT_PKEY_CHANGE,
214 MLX5_DEV_EVENT_GUID_CHANGE,
215 MLX5_DEV_EVENT_CLIENT_REREG,
216};
217
218struct mlx5_uuar_info {
219 struct mlx5_uar *uars;
220 int num_uars;
221 int num_low_latency_uuars;
222 unsigned long *bitmap;
223 unsigned int *count;
224 struct mlx5_bf *bfs;
225
226 /*
227 * protect uuar allocation data structs
228 */
229 struct mutex lock;
230};
231
232struct mlx5_bf {
233 void __iomem *reg;
234 void __iomem *regreg;
235 int buf_size;
236 struct mlx5_uar *uar;
237 unsigned long offset;
238 int need_lock;
239 /* protect blue flame buffer selection when needed
240 */
241 spinlock_t lock;
242
243 /* serialize 64 bit writes when done as two 32 bit accesses
244 */
245 spinlock_t lock32;
246 int uuarn;
247};
248
249struct mlx5_cmd_first {
250 __be32 data[4];
251};
252
253struct mlx5_cmd_msg {
254 struct list_head list;
255 struct cache_ent *cache;
256 u32 len;
257 struct mlx5_cmd_first first;
258 struct mlx5_cmd_mailbox *next;
259};
260
261struct mlx5_cmd_debug {
262 struct dentry *dbg_root;
263 struct dentry *dbg_in;
264 struct dentry *dbg_out;
265 struct dentry *dbg_outlen;
266 struct dentry *dbg_status;
267 struct dentry *dbg_run;
268 void *in_msg;
269 void *out_msg;
270 u8 status;
271 u16 inlen;
272 u16 outlen;
273};
274
275struct cache_ent {
276 /* protect block chain allocations
277 */
278 spinlock_t lock;
279 struct list_head head;
280};
281
282struct cmd_msg_cache {
283 struct cache_ent large;
284 struct cache_ent med;
285
286};
287
288struct mlx5_cmd_stats {
289 u64 sum;
290 u64 n;
291 struct dentry *root;
292 struct dentry *avg;
293 struct dentry *count;
294 /* protect command average calculations */
295 spinlock_t lock;
296};
297
298struct mlx5_cmd {
299 void *cmd_buf;
300 dma_addr_t dma;
301 u16 cmdif_rev;
302 u8 log_sz;
303 u8 log_stride;
304 int max_reg_cmds;
305 int events;
306 u32 __iomem *vector;
307
308 /* protect command queue allocations
309 */
310 spinlock_t alloc_lock;
311
312 /* protect token allocations
313 */
314 spinlock_t token_lock;
315 u8 token;
316 unsigned long bitmask;
317 char wq_name[MLX5_CMD_WQ_MAX_NAME];
318 struct workqueue_struct *wq;
319 struct semaphore sem;
320 struct semaphore pages_sem;
321 int mode;
322 struct mlx5_cmd_work_ent *ent_arr[MLX5_MAX_COMMANDS];
323 struct pci_pool *pool;
324 struct mlx5_cmd_debug dbg;
325 struct cmd_msg_cache cache;
326 int checksum_disabled;
327 struct mlx5_cmd_stats stats[MLX5_CMD_OP_MAX];
328};
329
330struct mlx5_port_caps {
331 int gid_table_len;
332 int pkey_table_len;
333};
334
335struct mlx5_caps {
336 u8 log_max_eq;
337 u8 log_max_cq;
338 u8 log_max_qp;
339 u8 log_max_mkey;
340 u8 log_max_pd;
341 u8 log_max_srq;
342 u32 max_cqes;
343 int max_wqes;
344 int max_sq_desc_sz;
345 int max_rq_desc_sz;
346 u64 flags;
347 u16 stat_rate_support;
348 int log_max_msg;
349 int num_ports;
350 int max_ra_res_qp;
351 int max_ra_req_qp;
352 int max_srq_wqes;
353 int bf_reg_size;
354 int bf_regs_per_page;
355 struct mlx5_port_caps port[MLX5_MAX_PORTS];
356 u8 ext_port_cap[MLX5_MAX_PORTS];
357 int max_vf;
358 u32 reserved_lkey;
359 u8 local_ca_ack_delay;
360 u8 log_max_mcg;
361 u16 max_qp_mcg;
362 int min_page_sz;
363};
364
365struct mlx5_cmd_mailbox {
366 void *buf;
367 dma_addr_t dma;
368 struct mlx5_cmd_mailbox *next;
369};
370
371struct mlx5_buf_list {
372 void *buf;
373 dma_addr_t map;
374};
375
376struct mlx5_buf {
377 struct mlx5_buf_list direct;
378 struct mlx5_buf_list *page_list;
379 int nbufs;
380 int npages;
381 int page_shift;
382 int size;
383};
384
385struct mlx5_eq {
386 struct mlx5_core_dev *dev;
387 __be32 __iomem *doorbell;
388 u32 cons_index;
389 struct mlx5_buf buf;
390 int size;
391 u8 irqn;
392 u8 eqn;
393 int nent;
394 u64 mask;
395 char name[MLX5_MAX_EQ_NAME];
396 struct list_head list;
397 int index;
398 struct mlx5_rsc_debug *dbg;
399};
400
401
402struct mlx5_core_mr {
403 u64 iova;
404 u64 size;
405 u32 key;
406 u32 pd;
407 u32 access;
408};
409
410struct mlx5_core_srq {
411 u32 srqn;
412 int max;
413 int max_gs;
414 int max_avail_gather;
415 int wqe_shift;
416 void (*event) (struct mlx5_core_srq *, enum mlx5_event);
417
418 atomic_t refcount;
419 struct completion free;
420};
421
422struct mlx5_eq_table {
423 void __iomem *update_ci;
424 void __iomem *update_arm_ci;
425 struct list_head *comp_eq_head;
426 struct mlx5_eq pages_eq;
427 struct mlx5_eq async_eq;
428 struct mlx5_eq cmd_eq;
429 struct msix_entry *msix_arr;
430 int num_comp_vectors;
431 /* protect EQs list
432 */
433 spinlock_t lock;
434};
435
436struct mlx5_uar {
437 u32 index;
438 struct list_head bf_list;
439 unsigned free_bf_bmap;
440 void __iomem *wc_map;
441 void __iomem *map;
442};
443
444
445struct mlx5_core_health {
446 struct health_buffer __iomem *health;
447 __be32 __iomem *health_counter;
448 struct timer_list timer;
449 struct list_head list;
450 u32 prev;
451 int miss_counter;
452};
453
454struct mlx5_cq_table {
455 /* protect radix tree
456 */
457 spinlock_t lock;
458 struct radix_tree_root tree;
459};
460
461struct mlx5_qp_table {
462 /* protect radix tree
463 */
464 spinlock_t lock;
465 struct radix_tree_root tree;
466};
467
468struct mlx5_srq_table {
469 /* protect radix tree
470 */
471 spinlock_t lock;
472 struct radix_tree_root tree;
473};
474
475struct mlx5_priv {
476 char name[MLX5_MAX_NAME_LEN];
477 struct mlx5_eq_table eq_table;
478 struct mlx5_uuar_info uuari;
479 MLX5_DECLARE_DOORBELL_LOCK(cq_uar_lock);
480
481 /* pages stuff */
482 struct workqueue_struct *pg_wq;
483 struct rb_root page_root;
484 int fw_pages;
485 int reg_pages;
486
487 struct mlx5_core_health health;
488
489 struct mlx5_srq_table srq_table;
490
491 /* start: qp staff */
492 struct mlx5_qp_table qp_table;
493 struct dentry *qp_debugfs;
494 struct dentry *eq_debugfs;
495 struct dentry *cq_debugfs;
496 struct dentry *cmdif_debugfs;
497 /* end: qp staff */
498
499 /* start: cq staff */
500 struct mlx5_cq_table cq_table;
501 /* end: cq staff */
502
503 /* start: alloc staff */
504 struct mutex pgdir_mutex;
505 struct list_head pgdir_list;
506 /* end: alloc staff */
507 struct dentry *dbg_root;
508
509 /* protect mkey key part */
510 spinlock_t mkey_lock;
511 u8 mkey_key;
512};
513
514struct mlx5_core_dev {
515 struct pci_dev *pdev;
516 u8 rev_id;
517 char board_id[MLX5_BOARD_ID_LEN];
518 struct mlx5_cmd cmd;
519 struct mlx5_caps caps;
520 phys_addr_t iseg_base;
521 struct mlx5_init_seg __iomem *iseg;
522 void (*event) (struct mlx5_core_dev *dev,
523 enum mlx5_dev_event event,
524 void *data);
525 struct mlx5_priv priv;
526 struct mlx5_profile *profile;
527 atomic_t num_qps;
528};
529
530struct mlx5_db {
531 __be32 *db;
532 union {
533 struct mlx5_db_pgdir *pgdir;
534 struct mlx5_ib_user_db_page *user_page;
535 } u;
536 dma_addr_t dma;
537 int index;
538};
539
540enum {
541 MLX5_DB_PER_PAGE = PAGE_SIZE / L1_CACHE_BYTES,
542};
543
544enum {
545 MLX5_COMP_EQ_SIZE = 1024,
546};
547
548struct mlx5_db_pgdir {
549 struct list_head list;
550 DECLARE_BITMAP(bitmap, MLX5_DB_PER_PAGE);
551 __be32 *db_page;
552 dma_addr_t db_dma;
553};
554
555typedef void (*mlx5_cmd_cbk_t)(int status, void *context);
556
557struct mlx5_cmd_work_ent {
558 struct mlx5_cmd_msg *in;
559 struct mlx5_cmd_msg *out;
560 mlx5_cmd_cbk_t callback;
561 void *context;
562 int idx;
563 struct completion done;
564 struct mlx5_cmd *cmd;
565 struct work_struct work;
566 struct mlx5_cmd_layout *lay;
567 int ret;
568 int page_queue;
569 u8 status;
570 u8 token;
571 struct timespec ts1;
572 struct timespec ts2;
573};
574
575struct mlx5_pas {
576 u64 pa;
577 u8 log_sz;
578};
579
580static inline void *mlx5_buf_offset(struct mlx5_buf *buf, int offset)
581{
582 if (likely(BITS_PER_LONG == 64 || buf->nbufs == 1))
583 return buf->direct.buf + offset;
584 else
585 return buf->page_list[offset >> PAGE_SHIFT].buf +
586 (offset & (PAGE_SIZE - 1));
587}
588
589extern struct workqueue_struct *mlx5_core_wq;
590
591#define STRUCT_FIELD(header, field) \
592 .struct_offset_bytes = offsetof(struct ib_unpacked_ ## header, field), \
593 .struct_size_bytes = sizeof((struct ib_unpacked_ ## header *)0)->field
594
595struct ib_field {
596 size_t struct_offset_bytes;
597 size_t struct_size_bytes;
598 int offset_bits;
599 int size_bits;
600};
601
602static inline struct mlx5_core_dev *pci2mlx5_core_dev(struct pci_dev *pdev)
603{
604 return pci_get_drvdata(pdev);
605}
606
607extern struct dentry *mlx5_debugfs_root;
608
609static inline u16 fw_rev_maj(struct mlx5_core_dev *dev)
610{
611 return ioread32be(&dev->iseg->fw_rev) & 0xffff;
612}
613
614static inline u16 fw_rev_min(struct mlx5_core_dev *dev)
615{
616 return ioread32be(&dev->iseg->fw_rev) >> 16;
617}
618
619static inline u16 fw_rev_sub(struct mlx5_core_dev *dev)
620{
621 return ioread32be(&dev->iseg->cmdif_rev_fw_sub) & 0xffff;
622}
623
624static inline u16 cmdif_rev(struct mlx5_core_dev *dev)
625{
626 return ioread32be(&dev->iseg->cmdif_rev_fw_sub) >> 16;
627}
628
629static inline void *mlx5_vzalloc(unsigned long size)
630{
631 void *rtn;
632
633 rtn = kzalloc(size, GFP_KERNEL | __GFP_NOWARN);
634 if (!rtn)
635 rtn = vzalloc(size);
636 return rtn;
637}
638
639static inline void mlx5_vfree(const void *addr)
640{
641 if (addr && is_vmalloc_addr(addr))
642 vfree(addr);
643 else
644 kfree(addr);
645}
646
647int mlx5_dev_init(struct mlx5_core_dev *dev, struct pci_dev *pdev);
648void mlx5_dev_cleanup(struct mlx5_core_dev *dev);
649int mlx5_cmd_init(struct mlx5_core_dev *dev);
650void mlx5_cmd_cleanup(struct mlx5_core_dev *dev);
651void mlx5_cmd_use_events(struct mlx5_core_dev *dev);
652void mlx5_cmd_use_polling(struct mlx5_core_dev *dev);
653int mlx5_cmd_status_to_err(struct mlx5_outbox_hdr *hdr);
654int mlx5_cmd_exec(struct mlx5_core_dev *dev, void *in, int in_size, void *out,
655 int out_size);
656int mlx5_cmd_alloc_uar(struct mlx5_core_dev *dev, u32 *uarn);
657int mlx5_cmd_free_uar(struct mlx5_core_dev *dev, u32 uarn);
658int mlx5_alloc_uuars(struct mlx5_core_dev *dev, struct mlx5_uuar_info *uuari);
659int mlx5_free_uuars(struct mlx5_core_dev *dev, struct mlx5_uuar_info *uuari);
660void mlx5_health_cleanup(void);
661void __init mlx5_health_init(void);
662void mlx5_start_health_poll(struct mlx5_core_dev *dev);
663void mlx5_stop_health_poll(struct mlx5_core_dev *dev);
664int mlx5_buf_alloc(struct mlx5_core_dev *dev, int size, int max_direct,
665 struct mlx5_buf *buf);
666void mlx5_buf_free(struct mlx5_core_dev *dev, struct mlx5_buf *buf);
667struct mlx5_cmd_mailbox *mlx5_alloc_cmd_mailbox_chain(struct mlx5_core_dev *dev,
668 gfp_t flags, int npages);
669void mlx5_free_cmd_mailbox_chain(struct mlx5_core_dev *dev,
670 struct mlx5_cmd_mailbox *head);
671int mlx5_core_create_srq(struct mlx5_core_dev *dev, struct mlx5_core_srq *srq,
672 struct mlx5_create_srq_mbox_in *in, int inlen);
673int mlx5_core_destroy_srq(struct mlx5_core_dev *dev, struct mlx5_core_srq *srq);
674int mlx5_core_query_srq(struct mlx5_core_dev *dev, struct mlx5_core_srq *srq,
675 struct mlx5_query_srq_mbox_out *out);
676int mlx5_core_arm_srq(struct mlx5_core_dev *dev, struct mlx5_core_srq *srq,
677 u16 lwm, int is_srq);
678int mlx5_core_create_mkey(struct mlx5_core_dev *dev, struct mlx5_core_mr *mr,
679 struct mlx5_create_mkey_mbox_in *in, int inlen);
680int mlx5_core_destroy_mkey(struct mlx5_core_dev *dev, struct mlx5_core_mr *mr);
681int mlx5_core_query_mkey(struct mlx5_core_dev *dev, struct mlx5_core_mr *mr,
682 struct mlx5_query_mkey_mbox_out *out, int outlen);
683int mlx5_core_dump_fill_mkey(struct mlx5_core_dev *dev, struct mlx5_core_mr *mr,
684 u32 *mkey);
685int mlx5_core_alloc_pd(struct mlx5_core_dev *dev, u32 *pdn);
686int mlx5_core_dealloc_pd(struct mlx5_core_dev *dev, u32 pdn);
687int mlx5_core_mad_ifc(struct mlx5_core_dev *dev, void *inb, void *outb,
688 u16 opmod, int port);
689void mlx5_pagealloc_init(struct mlx5_core_dev *dev);
690void mlx5_pagealloc_cleanup(struct mlx5_core_dev *dev);
691int mlx5_pagealloc_start(struct mlx5_core_dev *dev);
692void mlx5_pagealloc_stop(struct mlx5_core_dev *dev);
693void mlx5_core_req_pages_handler(struct mlx5_core_dev *dev, u16 func_id,
694 s16 npages);
695int mlx5_satisfy_startup_pages(struct mlx5_core_dev *dev, int boot);
696int mlx5_reclaim_startup_pages(struct mlx5_core_dev *dev);
697void mlx5_register_debugfs(void);
698void mlx5_unregister_debugfs(void);
699int mlx5_eq_init(struct mlx5_core_dev *dev);
700void mlx5_eq_cleanup(struct mlx5_core_dev *dev);
701void mlx5_fill_page_array(struct mlx5_buf *buf, __be64 *pas);
702void mlx5_cq_completion(struct mlx5_core_dev *dev, u32 cqn);
703void mlx5_qp_event(struct mlx5_core_dev *dev, u32 qpn, int event_type);
704void mlx5_srq_event(struct mlx5_core_dev *dev, u32 srqn, int event_type);
705struct mlx5_core_srq *mlx5_core_get_srq(struct mlx5_core_dev *dev, u32 srqn);
706void mlx5_cmd_comp_handler(struct mlx5_core_dev *dev, unsigned long vector);
707void mlx5_cq_event(struct mlx5_core_dev *dev, u32 cqn, int event_type);
708int mlx5_create_map_eq(struct mlx5_core_dev *dev, struct mlx5_eq *eq, u8 vecidx,
709 int nent, u64 mask, const char *name, struct mlx5_uar *uar);
710int mlx5_destroy_unmap_eq(struct mlx5_core_dev *dev, struct mlx5_eq *eq);
711int mlx5_start_eqs(struct mlx5_core_dev *dev);
712int mlx5_stop_eqs(struct mlx5_core_dev *dev);
713int mlx5_core_attach_mcg(struct mlx5_core_dev *dev, union ib_gid *mgid, u32 qpn);
714int mlx5_core_detach_mcg(struct mlx5_core_dev *dev, union ib_gid *mgid, u32 qpn);
715
716int mlx5_qp_debugfs_init(struct mlx5_core_dev *dev);
717void mlx5_qp_debugfs_cleanup(struct mlx5_core_dev *dev);
718int mlx5_core_access_reg(struct mlx5_core_dev *dev, void *data_in,
719 int size_in, void *data_out, int size_out,
720 u16 reg_num, int arg, int write);
721int mlx5_set_port_caps(struct mlx5_core_dev *dev, int port_num, u32 caps);
722
723int mlx5_debug_eq_add(struct mlx5_core_dev *dev, struct mlx5_eq *eq);
724void mlx5_debug_eq_remove(struct mlx5_core_dev *dev, struct mlx5_eq *eq);
725int mlx5_core_eq_query(struct mlx5_core_dev *dev, struct mlx5_eq *eq,
726 struct mlx5_query_eq_mbox_out *out, int outlen);
727int mlx5_eq_debugfs_init(struct mlx5_core_dev *dev);
728void mlx5_eq_debugfs_cleanup(struct mlx5_core_dev *dev);
729int mlx5_cq_debugfs_init(struct mlx5_core_dev *dev);
730void mlx5_cq_debugfs_cleanup(struct mlx5_core_dev *dev);
731int mlx5_db_alloc(struct mlx5_core_dev *dev, struct mlx5_db *db);
732void mlx5_db_free(struct mlx5_core_dev *dev, struct mlx5_db *db);
733
734typedef void (*health_handler_t)(struct pci_dev *pdev, struct health_buffer __iomem *buf, int size);
735int mlx5_register_health_report_handler(health_handler_t handler);
736void mlx5_unregister_health_report_handler(void);
737const char *mlx5_command_str(int command);
738int mlx5_cmdif_debugfs_init(struct mlx5_core_dev *dev);
739void mlx5_cmdif_debugfs_cleanup(struct mlx5_core_dev *dev);
740
741static inline u32 mlx5_mkey_to_idx(u32 mkey)
742{
743 return mkey >> 8;
744}
745
746static inline u32 mlx5_idx_to_mkey(u32 mkey_idx)
747{
748 return mkey_idx << 8;
749}
750
751enum {
752 MLX5_PROF_MASK_QP_SIZE = (u64)1 << 0,
753 MLX5_PROF_MASK_CMDIF_CSUM = (u64)1 << 1,
754 MLX5_PROF_MASK_MR_CACHE = (u64)1 << 2,
755};
756
757enum {
758 MAX_MR_CACHE_ENTRIES = 16,
759};
760
761struct mlx5_profile {
762 u64 mask;
763 u32 log_max_qp;
764 int cmdif_csum;
765 struct {
766 int size;
767 int limit;
768 } mr_cache[MAX_MR_CACHE_ENTRIES];
769};
770
771#endif /* MLX5_DRIVER_H */
diff --git a/include/linux/mlx5/qp.h b/include/linux/mlx5/qp.h
new file mode 100644
index 000000000000..d9e3eacb3a7f
--- /dev/null
+++ b/include/linux/mlx5/qp.h
@@ -0,0 +1,467 @@
1/*
2 * Copyright (c) 2013, Mellanox Technologies inc. All rights reserved.
3 *
4 * This software is available to you under a choice of one of two
5 * licenses. You may choose to be licensed under the terms of the GNU
6 * General Public License (GPL) Version 2, available from the file
7 * COPYING in the main directory of this source tree, or the
8 * OpenIB.org BSD license below:
9 *
10 * Redistribution and use in source and binary forms, with or
11 * without modification, are permitted provided that the following
12 * conditions are met:
13 *
14 * - Redistributions of source code must retain the above
15 * copyright notice, this list of conditions and the following
16 * disclaimer.
17 *
18 * - Redistributions in binary form must reproduce the above
19 * copyright notice, this list of conditions and the following
20 * disclaimer in the documentation and/or other materials
21 * provided with the distribution.
22 *
23 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
24 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
25 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
26 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
27 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
28 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
29 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
30 * SOFTWARE.
31 */
32
33#ifndef MLX5_QP_H
34#define MLX5_QP_H
35
36#include <linux/mlx5/device.h>
37#include <linux/mlx5/driver.h>
38
39#define MLX5_INVALID_LKEY 0x100
40
41enum mlx5_qp_optpar {
42 MLX5_QP_OPTPAR_ALT_ADDR_PATH = 1 << 0,
43 MLX5_QP_OPTPAR_RRE = 1 << 1,
44 MLX5_QP_OPTPAR_RAE = 1 << 2,
45 MLX5_QP_OPTPAR_RWE = 1 << 3,
46 MLX5_QP_OPTPAR_PKEY_INDEX = 1 << 4,
47 MLX5_QP_OPTPAR_Q_KEY = 1 << 5,
48 MLX5_QP_OPTPAR_RNR_TIMEOUT = 1 << 6,
49 MLX5_QP_OPTPAR_PRIMARY_ADDR_PATH = 1 << 7,
50 MLX5_QP_OPTPAR_SRA_MAX = 1 << 8,
51 MLX5_QP_OPTPAR_RRA_MAX = 1 << 9,
52 MLX5_QP_OPTPAR_PM_STATE = 1 << 10,
53 MLX5_QP_OPTPAR_RETRY_COUNT = 1 << 12,
54 MLX5_QP_OPTPAR_RNR_RETRY = 1 << 13,
55 MLX5_QP_OPTPAR_ACK_TIMEOUT = 1 << 14,
56 MLX5_QP_OPTPAR_PRI_PORT = 1 << 16,
57 MLX5_QP_OPTPAR_SRQN = 1 << 18,
58 MLX5_QP_OPTPAR_CQN_RCV = 1 << 19,
59 MLX5_QP_OPTPAR_DC_HS = 1 << 20,
60 MLX5_QP_OPTPAR_DC_KEY = 1 << 21,
61};
62
63enum mlx5_qp_state {
64 MLX5_QP_STATE_RST = 0,
65 MLX5_QP_STATE_INIT = 1,
66 MLX5_QP_STATE_RTR = 2,
67 MLX5_QP_STATE_RTS = 3,
68 MLX5_QP_STATE_SQER = 4,
69 MLX5_QP_STATE_SQD = 5,
70 MLX5_QP_STATE_ERR = 6,
71 MLX5_QP_STATE_SQ_DRAINING = 7,
72 MLX5_QP_STATE_SUSPENDED = 9,
73 MLX5_QP_NUM_STATE
74};
75
76enum {
77 MLX5_QP_ST_RC = 0x0,
78 MLX5_QP_ST_UC = 0x1,
79 MLX5_QP_ST_UD = 0x2,
80 MLX5_QP_ST_XRC = 0x3,
81 MLX5_QP_ST_MLX = 0x4,
82 MLX5_QP_ST_DCI = 0x5,
83 MLX5_QP_ST_DCT = 0x6,
84 MLX5_QP_ST_QP0 = 0x7,
85 MLX5_QP_ST_QP1 = 0x8,
86 MLX5_QP_ST_RAW_ETHERTYPE = 0x9,
87 MLX5_QP_ST_RAW_IPV6 = 0xa,
88 MLX5_QP_ST_SNIFFER = 0xb,
89 MLX5_QP_ST_SYNC_UMR = 0xe,
90 MLX5_QP_ST_PTP_1588 = 0xd,
91 MLX5_QP_ST_REG_UMR = 0xc,
92 MLX5_QP_ST_MAX
93};
94
95enum {
96 MLX5_QP_PM_MIGRATED = 0x3,
97 MLX5_QP_PM_ARMED = 0x0,
98 MLX5_QP_PM_REARM = 0x1
99};
100
101enum {
102 MLX5_NON_ZERO_RQ = 0 << 24,
103 MLX5_SRQ_RQ = 1 << 24,
104 MLX5_CRQ_RQ = 2 << 24,
105 MLX5_ZERO_LEN_RQ = 3 << 24
106};
107
108enum {
109 /* params1 */
110 MLX5_QP_BIT_SRE = 1 << 15,
111 MLX5_QP_BIT_SWE = 1 << 14,
112 MLX5_QP_BIT_SAE = 1 << 13,
113 /* params2 */
114 MLX5_QP_BIT_RRE = 1 << 15,
115 MLX5_QP_BIT_RWE = 1 << 14,
116 MLX5_QP_BIT_RAE = 1 << 13,
117 MLX5_QP_BIT_RIC = 1 << 4,
118};
119
120enum {
121 MLX5_WQE_CTRL_CQ_UPDATE = 2 << 2,
122 MLX5_WQE_CTRL_SOLICITED = 1 << 1,
123};
124
125enum {
126 MLX5_SEND_WQE_BB = 64,
127};
128
129enum {
130 MLX5_WQE_FMR_PERM_LOCAL_READ = 1 << 27,
131 MLX5_WQE_FMR_PERM_LOCAL_WRITE = 1 << 28,
132 MLX5_WQE_FMR_PERM_REMOTE_READ = 1 << 29,
133 MLX5_WQE_FMR_PERM_REMOTE_WRITE = 1 << 30,
134 MLX5_WQE_FMR_PERM_ATOMIC = 1 << 31
135};
136
137enum {
138 MLX5_FENCE_MODE_NONE = 0 << 5,
139 MLX5_FENCE_MODE_INITIATOR_SMALL = 1 << 5,
140 MLX5_FENCE_MODE_STRONG_ORDERING = 3 << 5,
141 MLX5_FENCE_MODE_SMALL_AND_FENCE = 4 << 5,
142};
143
144enum {
145 MLX5_QP_LAT_SENSITIVE = 1 << 28,
146 MLX5_QP_ENABLE_SIG = 1 << 31,
147};
148
149enum {
150 MLX5_RCV_DBR = 0,
151 MLX5_SND_DBR = 1,
152};
153
154struct mlx5_wqe_fmr_seg {
155 __be32 flags;
156 __be32 mem_key;
157 __be64 buf_list;
158 __be64 start_addr;
159 __be64 reg_len;
160 __be32 offset;
161 __be32 page_size;
162 u32 reserved[2];
163};
164
165struct mlx5_wqe_ctrl_seg {
166 __be32 opmod_idx_opcode;
167 __be32 qpn_ds;
168 u8 signature;
169 u8 rsvd[2];
170 u8 fm_ce_se;
171 __be32 imm;
172};
173
174struct mlx5_wqe_xrc_seg {
175 __be32 xrc_srqn;
176 u8 rsvd[12];
177};
178
179struct mlx5_wqe_masked_atomic_seg {
180 __be64 swap_add;
181 __be64 compare;
182 __be64 swap_add_mask;
183 __be64 compare_mask;
184};
185
186struct mlx5_av {
187 union {
188 struct {
189 __be32 qkey;
190 __be32 reserved;
191 } qkey;
192 __be64 dc_key;
193 } key;
194 __be32 dqp_dct;
195 u8 stat_rate_sl;
196 u8 fl_mlid;
197 __be16 rlid;
198 u8 reserved0[10];
199 u8 tclass;
200 u8 hop_limit;
201 __be32 grh_gid_fl;
202 u8 rgid[16];
203};
204
205struct mlx5_wqe_datagram_seg {
206 struct mlx5_av av;
207};
208
209struct mlx5_wqe_raddr_seg {
210 __be64 raddr;
211 __be32 rkey;
212 u32 reserved;
213};
214
215struct mlx5_wqe_atomic_seg {
216 __be64 swap_add;
217 __be64 compare;
218};
219
220struct mlx5_wqe_data_seg {
221 __be32 byte_count;
222 __be32 lkey;
223 __be64 addr;
224};
225
226struct mlx5_wqe_umr_ctrl_seg {
227 u8 flags;
228 u8 rsvd0[3];
229 __be16 klm_octowords;
230 __be16 bsf_octowords;
231 __be64 mkey_mask;
232 u8 rsvd1[32];
233};
234
235struct mlx5_seg_set_psv {
236 __be32 psv_num;
237 __be16 syndrome;
238 __be16 status;
239 __be32 transient_sig;
240 __be32 ref_tag;
241};
242
243struct mlx5_seg_get_psv {
244 u8 rsvd[19];
245 u8 num_psv;
246 __be32 l_key;
247 __be64 va;
248 __be32 psv_index[4];
249};
250
251struct mlx5_seg_check_psv {
252 u8 rsvd0[2];
253 __be16 err_coalescing_op;
254 u8 rsvd1[2];
255 __be16 xport_err_op;
256 u8 rsvd2[2];
257 __be16 xport_err_mask;
258 u8 rsvd3[7];
259 u8 num_psv;
260 __be32 l_key;
261 __be64 va;
262 __be32 psv_index[4];
263};
264
265struct mlx5_rwqe_sig {
266 u8 rsvd0[4];
267 u8 signature;
268 u8 rsvd1[11];
269};
270
271struct mlx5_wqe_signature_seg {
272 u8 rsvd0[4];
273 u8 signature;
274 u8 rsvd1[11];
275};
276
277struct mlx5_wqe_inline_seg {
278 __be32 byte_count;
279};
280
281struct mlx5_core_qp {
282 void (*event) (struct mlx5_core_qp *, int);
283 int qpn;
284 atomic_t refcount;
285 struct completion free;
286 struct mlx5_rsc_debug *dbg;
287 int pid;
288};
289
290struct mlx5_qp_path {
291 u8 fl;
292 u8 rsvd3;
293 u8 free_ar;
294 u8 pkey_index;
295 u8 rsvd0;
296 u8 grh_mlid;
297 __be16 rlid;
298 u8 ackto_lt;
299 u8 mgid_index;
300 u8 static_rate;
301 u8 hop_limit;
302 __be32 tclass_flowlabel;
303 u8 rgid[16];
304 u8 rsvd1[4];
305 u8 sl;
306 u8 port;
307 u8 rsvd2[6];
308};
309
310struct mlx5_qp_context {
311 __be32 flags;
312 __be32 flags_pd;
313 u8 mtu_msgmax;
314 u8 rq_size_stride;
315 __be16 sq_crq_size;
316 __be32 qp_counter_set_usr_page;
317 __be32 wire_qpn;
318 __be32 log_pg_sz_remote_qpn;
319 struct mlx5_qp_path pri_path;
320 struct mlx5_qp_path alt_path;
321 __be32 params1;
322 u8 reserved2[4];
323 __be32 next_send_psn;
324 __be32 cqn_send;
325 u8 reserved3[8];
326 __be32 last_acked_psn;
327 __be32 ssn;
328 __be32 params2;
329 __be32 rnr_nextrecvpsn;
330 __be32 xrcd;
331 __be32 cqn_recv;
332 __be64 db_rec_addr;
333 __be32 qkey;
334 __be32 rq_type_srqn;
335 __be32 rmsn;
336 __be16 hw_sq_wqe_counter;
337 __be16 sw_sq_wqe_counter;
338 __be16 hw_rcyclic_byte_counter;
339 __be16 hw_rq_counter;
340 __be16 sw_rcyclic_byte_counter;
341 __be16 sw_rq_counter;
342 u8 rsvd0[5];
343 u8 cgs;
344 u8 cs_req;
345 u8 cs_res;
346 __be64 dc_access_key;
347 u8 rsvd1[24];
348};
349
350struct mlx5_create_qp_mbox_in {
351 struct mlx5_inbox_hdr hdr;
352 __be32 input_qpn;
353 u8 rsvd0[4];
354 __be32 opt_param_mask;
355 u8 rsvd1[4];
356 struct mlx5_qp_context ctx;
357 u8 rsvd3[16];
358 __be64 pas[0];
359};
360
361struct mlx5_create_qp_mbox_out {
362 struct mlx5_outbox_hdr hdr;
363 __be32 qpn;
364 u8 rsvd0[4];
365};
366
367struct mlx5_destroy_qp_mbox_in {
368 struct mlx5_inbox_hdr hdr;
369 __be32 qpn;
370 u8 rsvd0[4];
371};
372
373struct mlx5_destroy_qp_mbox_out {
374 struct mlx5_outbox_hdr hdr;
375 u8 rsvd0[8];
376};
377
378struct mlx5_modify_qp_mbox_in {
379 struct mlx5_inbox_hdr hdr;
380 __be32 qpn;
381 u8 rsvd1[4];
382 __be32 optparam;
383 u8 rsvd0[4];
384 struct mlx5_qp_context ctx;
385};
386
387struct mlx5_modify_qp_mbox_out {
388 struct mlx5_outbox_hdr hdr;
389 u8 rsvd0[8];
390};
391
392struct mlx5_query_qp_mbox_in {
393 struct mlx5_inbox_hdr hdr;
394 __be32 qpn;
395 u8 rsvd[4];
396};
397
398struct mlx5_query_qp_mbox_out {
399 struct mlx5_outbox_hdr hdr;
400 u8 rsvd1[8];
401 __be32 optparam;
402 u8 rsvd0[4];
403 struct mlx5_qp_context ctx;
404 u8 rsvd2[16];
405 __be64 pas[0];
406};
407
408struct mlx5_conf_sqp_mbox_in {
409 struct mlx5_inbox_hdr hdr;
410 __be32 qpn;
411 u8 rsvd[3];
412 u8 type;
413};
414
415struct mlx5_conf_sqp_mbox_out {
416 struct mlx5_outbox_hdr hdr;
417 u8 rsvd[8];
418};
419
420struct mlx5_alloc_xrcd_mbox_in {
421 struct mlx5_inbox_hdr hdr;
422 u8 rsvd[8];
423};
424
425struct mlx5_alloc_xrcd_mbox_out {
426 struct mlx5_outbox_hdr hdr;
427 __be32 xrcdn;
428 u8 rsvd[4];
429};
430
431struct mlx5_dealloc_xrcd_mbox_in {
432 struct mlx5_inbox_hdr hdr;
433 __be32 xrcdn;
434 u8 rsvd[4];
435};
436
437struct mlx5_dealloc_xrcd_mbox_out {
438 struct mlx5_outbox_hdr hdr;
439 u8 rsvd[8];
440};
441
442static inline struct mlx5_core_qp *__mlx5_qp_lookup(struct mlx5_core_dev *dev, u32 qpn)
443{
444 return radix_tree_lookup(&dev->priv.qp_table.tree, qpn);
445}
446
447int mlx5_core_create_qp(struct mlx5_core_dev *dev,
448 struct mlx5_core_qp *qp,
449 struct mlx5_create_qp_mbox_in *in,
450 int inlen);
451int mlx5_core_qp_modify(struct mlx5_core_dev *dev, enum mlx5_qp_state cur_state,
452 enum mlx5_qp_state new_state,
453 struct mlx5_modify_qp_mbox_in *in, int sqd_event,
454 struct mlx5_core_qp *qp);
455int mlx5_core_destroy_qp(struct mlx5_core_dev *dev,
456 struct mlx5_core_qp *qp);
457int mlx5_core_qp_query(struct mlx5_core_dev *dev, struct mlx5_core_qp *qp,
458 struct mlx5_query_qp_mbox_out *out, int outlen);
459
460int mlx5_core_xrcd_alloc(struct mlx5_core_dev *dev, u32 *xrcdn);
461int mlx5_core_xrcd_dealloc(struct mlx5_core_dev *dev, u32 xrcdn);
462void mlx5_init_qp_table(struct mlx5_core_dev *dev);
463void mlx5_cleanup_qp_table(struct mlx5_core_dev *dev);
464int mlx5_debug_qp_add(struct mlx5_core_dev *dev, struct mlx5_core_qp *qp);
465void mlx5_debug_qp_remove(struct mlx5_core_dev *dev, struct mlx5_core_qp *qp);
466
467#endif /* MLX5_QP_H */
diff --git a/include/linux/mlx5/srq.h b/include/linux/mlx5/srq.h
new file mode 100644
index 000000000000..e1a363a33663
--- /dev/null
+++ b/include/linux/mlx5/srq.h
@@ -0,0 +1,41 @@
1/*
2 * Copyright (c) 2013, Mellanox Technologies inc. All rights reserved.
3 *
4 * This software is available to you under a choice of one of two
5 * licenses. You may choose to be licensed under the terms of the GNU
6 * General Public License (GPL) Version 2, available from the file
7 * COPYING in the main directory of this source tree, or the
8 * OpenIB.org BSD license below:
9 *
10 * Redistribution and use in source and binary forms, with or
11 * without modification, are permitted provided that the following
12 * conditions are met:
13 *
14 * - Redistributions of source code must retain the above
15 * copyright notice, this list of conditions and the following
16 * disclaimer.
17 *
18 * - Redistributions in binary form must reproduce the above
19 * copyright notice, this list of conditions and the following
20 * disclaimer in the documentation and/or other materials
21 * provided with the distribution.
22 *
23 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
24 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
25 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
26 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
27 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
28 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
29 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
30 * SOFTWARE.
31 */
32
33#ifndef MLX5_SRQ_H
34#define MLX5_SRQ_H
35
36#include <linux/mlx5/driver.h>
37
38void mlx5_init_srq_table(struct mlx5_core_dev *dev);
39void mlx5_cleanup_srq_table(struct mlx5_core_dev *dev);
40
41#endif /* MLX5_SRQ_H */
diff --git a/include/linux/mm.h b/include/linux/mm.h
index b87681adf0ba..f0224608d15e 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -151,12 +151,6 @@ extern unsigned int kobjsize(const void *objp);
151#define VM_STACK_FLAGS (VM_GROWSDOWN | VM_STACK_DEFAULT_FLAGS | VM_ACCOUNT) 151#define VM_STACK_FLAGS (VM_GROWSDOWN | VM_STACK_DEFAULT_FLAGS | VM_ACCOUNT)
152#endif 152#endif
153 153
154#define VM_READHINTMASK (VM_SEQ_READ | VM_RAND_READ)
155#define VM_ClearReadHint(v) (v)->vm_flags &= ~VM_READHINTMASK
156#define VM_NormalReadHint(v) (!((v)->vm_flags & VM_READHINTMASK))
157#define VM_SequentialReadHint(v) ((v)->vm_flags & VM_SEQ_READ)
158#define VM_RandomReadHint(v) ((v)->vm_flags & VM_RAND_READ)
159
160/* 154/*
161 * Special vmas that are non-mergable, non-mlock()able. 155 * Special vmas that are non-mergable, non-mlock()able.
162 * Note: mm/huge_memory.c VM_NO_THP depends on this definition. 156 * Note: mm/huge_memory.c VM_NO_THP depends on this definition.
diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h
index ace9a5f01c64..fb425aa16c01 100644
--- a/include/linux/mm_types.h
+++ b/include/linux/mm_types.h
@@ -330,12 +330,9 @@ struct mm_struct {
330 unsigned long (*get_unmapped_area) (struct file *filp, 330 unsigned long (*get_unmapped_area) (struct file *filp,
331 unsigned long addr, unsigned long len, 331 unsigned long addr, unsigned long len,
332 unsigned long pgoff, unsigned long flags); 332 unsigned long pgoff, unsigned long flags);
333 void (*unmap_area) (struct mm_struct *mm, unsigned long addr);
334#endif 333#endif
335 unsigned long mmap_base; /* base of mmap area */ 334 unsigned long mmap_base; /* base of mmap area */
336 unsigned long task_size; /* size of task vm space */ 335 unsigned long task_size; /* size of task vm space */
337 unsigned long cached_hole_size; /* if non-zero, the largest hole below free_area_cache */
338 unsigned long free_area_cache; /* first hole of size cached_hole_size or larger */
339 unsigned long highest_vm_end; /* highest vma end address */ 336 unsigned long highest_vm_end; /* highest vma end address */
340 pgd_t * pgd; 337 pgd_t * pgd;
341 atomic_t mm_users; /* How many users with user space? */ 338 atomic_t mm_users; /* How many users with user space? */
diff --git a/include/linux/mmc/card.h b/include/linux/mmc/card.h
index f31725ba49f3..842de3e21e70 100644
--- a/include/linux/mmc/card.h
+++ b/include/linux/mmc/card.h
@@ -94,7 +94,11 @@ struct mmc_ext_csd {
94 u8 raw_ext_csd_structure; /* 194 */ 94 u8 raw_ext_csd_structure; /* 194 */
95 u8 raw_card_type; /* 196 */ 95 u8 raw_card_type; /* 196 */
96 u8 out_of_int_time; /* 198 */ 96 u8 out_of_int_time; /* 198 */
97 u8 raw_s_a_timeout; /* 217 */ 97 u8 raw_pwr_cl_52_195; /* 200 */
98 u8 raw_pwr_cl_26_195; /* 201 */
99 u8 raw_pwr_cl_52_360; /* 202 */
100 u8 raw_pwr_cl_26_360; /* 203 */
101 u8 raw_s_a_timeout; /* 217 */
98 u8 raw_hc_erase_gap_size; /* 221 */ 102 u8 raw_hc_erase_gap_size; /* 221 */
99 u8 raw_erase_timeout_mult; /* 223 */ 103 u8 raw_erase_timeout_mult; /* 223 */
100 u8 raw_hc_erase_grp_size; /* 224 */ 104 u8 raw_hc_erase_grp_size; /* 224 */
@@ -102,6 +106,10 @@ struct mmc_ext_csd {
102 u8 raw_sec_erase_mult; /* 230 */ 106 u8 raw_sec_erase_mult; /* 230 */
103 u8 raw_sec_feature_support;/* 231 */ 107 u8 raw_sec_feature_support;/* 231 */
104 u8 raw_trim_mult; /* 232 */ 108 u8 raw_trim_mult; /* 232 */
109 u8 raw_pwr_cl_200_195; /* 236 */
110 u8 raw_pwr_cl_200_360; /* 237 */
111 u8 raw_pwr_cl_ddr_52_195; /* 238 */
112 u8 raw_pwr_cl_ddr_52_360; /* 239 */
105 u8 raw_bkops_status; /* 246 */ 113 u8 raw_bkops_status; /* 246 */
106 u8 raw_sectors[4]; /* 212 - 4 bytes */ 114 u8 raw_sectors[4]; /* 212 - 4 bytes */
107 115
@@ -512,6 +520,7 @@ struct mmc_driver {
512 void (*remove)(struct mmc_card *); 520 void (*remove)(struct mmc_card *);
513 int (*suspend)(struct mmc_card *); 521 int (*suspend)(struct mmc_card *);
514 int (*resume)(struct mmc_card *); 522 int (*resume)(struct mmc_card *);
523 void (*shutdown)(struct mmc_card *);
515}; 524};
516 525
517extern int mmc_register_driver(struct mmc_driver *); 526extern int mmc_register_driver(struct mmc_driver *);
diff --git a/include/linux/mmc/core.h b/include/linux/mmc/core.h
index 39613b9a6fc5..443243b241d5 100644
--- a/include/linux/mmc/core.h
+++ b/include/linux/mmc/core.h
@@ -96,6 +96,8 @@ struct mmc_command {
96 */ 96 */
97 97
98 unsigned int cmd_timeout_ms; /* in milliseconds */ 98 unsigned int cmd_timeout_ms; /* in milliseconds */
99 /* Set this flag only for blocking sanitize request */
100 bool sanitize_busy;
99 101
100 struct mmc_data *data; /* data segment associated with cmd */ 102 struct mmc_data *data; /* data segment associated with cmd */
101 struct mmc_request *mrq; /* associated request */ 103 struct mmc_request *mrq; /* associated request */
@@ -188,6 +190,9 @@ extern int __mmc_claim_host(struct mmc_host *host, atomic_t *abort);
188extern void mmc_release_host(struct mmc_host *host); 190extern void mmc_release_host(struct mmc_host *host);
189extern int mmc_try_claim_host(struct mmc_host *host); 191extern int mmc_try_claim_host(struct mmc_host *host);
190 192
193extern void mmc_get_card(struct mmc_card *card);
194extern void mmc_put_card(struct mmc_card *card);
195
191extern int mmc_flush_cache(struct mmc_card *); 196extern int mmc_flush_cache(struct mmc_card *);
192 197
193extern int mmc_detect_card_removed(struct mmc_host *host); 198extern int mmc_detect_card_removed(struct mmc_host *host);
diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h
index e326ae2882a0..3b0c33ae13e1 100644
--- a/include/linux/mmc/host.h
+++ b/include/linux/mmc/host.h
@@ -239,7 +239,7 @@ struct mmc_host {
239#define MMC_CAP_SPI (1 << 4) /* Talks only SPI protocols */ 239#define MMC_CAP_SPI (1 << 4) /* Talks only SPI protocols */
240#define MMC_CAP_NEEDS_POLL (1 << 5) /* Needs polling for card-detection */ 240#define MMC_CAP_NEEDS_POLL (1 << 5) /* Needs polling for card-detection */
241#define MMC_CAP_8_BIT_DATA (1 << 6) /* Can the host do 8 bit transfers */ 241#define MMC_CAP_8_BIT_DATA (1 << 6) /* Can the host do 8 bit transfers */
242 242#define MMC_CAP_AGGRESSIVE_PM (1 << 7) /* Suspend (e)MMC/SD at idle */
243#define MMC_CAP_NONREMOVABLE (1 << 8) /* Nonremovable e.g. eMMC */ 243#define MMC_CAP_NONREMOVABLE (1 << 8) /* Nonremovable e.g. eMMC */
244#define MMC_CAP_WAIT_WHILE_BUSY (1 << 9) /* Waits while card is busy */ 244#define MMC_CAP_WAIT_WHILE_BUSY (1 << 9) /* Waits while card is busy */
245#define MMC_CAP_ERASE (1 << 10) /* Allow erase/trim commands */ 245#define MMC_CAP_ERASE (1 << 10) /* Allow erase/trim commands */
@@ -264,7 +264,7 @@ struct mmc_host {
264 264
265#define MMC_CAP2_BOOTPART_NOACC (1 << 0) /* Boot partition no access */ 265#define MMC_CAP2_BOOTPART_NOACC (1 << 0) /* Boot partition no access */
266#define MMC_CAP2_CACHE_CTRL (1 << 1) /* Allow cache control */ 266#define MMC_CAP2_CACHE_CTRL (1 << 1) /* Allow cache control */
267#define MMC_CAP2_POWEROFF_NOTIFY (1 << 2) /* Notify poweroff supported */ 267#define MMC_CAP2_FULL_PWR_CYCLE (1 << 2) /* Can do full power cycle */
268#define MMC_CAP2_NO_MULTI_READ (1 << 3) /* Multiblock reads don't work */ 268#define MMC_CAP2_NO_MULTI_READ (1 << 3) /* Multiblock reads don't work */
269#define MMC_CAP2_NO_SLEEP_CMD (1 << 4) /* Don't allow sleep command */ 269#define MMC_CAP2_NO_SLEEP_CMD (1 << 4) /* Don't allow sleep command */
270#define MMC_CAP2_HS200_1_8V_SDR (1 << 5) /* can support */ 270#define MMC_CAP2_HS200_1_8V_SDR (1 << 5) /* can support */
@@ -272,7 +272,6 @@ struct mmc_host {
272#define MMC_CAP2_HS200 (MMC_CAP2_HS200_1_8V_SDR | \ 272#define MMC_CAP2_HS200 (MMC_CAP2_HS200_1_8V_SDR | \
273 MMC_CAP2_HS200_1_2V_SDR) 273 MMC_CAP2_HS200_1_2V_SDR)
274#define MMC_CAP2_BROKEN_VOLTAGE (1 << 7) /* Use the broken voltage */ 274#define MMC_CAP2_BROKEN_VOLTAGE (1 << 7) /* Use the broken voltage */
275#define MMC_CAP2_DETECT_ON_ERR (1 << 8) /* On I/O err check card removal */
276#define MMC_CAP2_HC_ERASE_SZ (1 << 9) /* High-capacity erase size */ 275#define MMC_CAP2_HC_ERASE_SZ (1 << 9) /* High-capacity erase size */
277#define MMC_CAP2_CD_ACTIVE_HIGH (1 << 10) /* Card-detect signal active high */ 276#define MMC_CAP2_CD_ACTIVE_HIGH (1 << 10) /* Card-detect signal active high */
278#define MMC_CAP2_RO_ACTIVE_HIGH (1 << 11) /* Write-protect signal active high */ 277#define MMC_CAP2_RO_ACTIVE_HIGH (1 << 11) /* Write-protect signal active high */
@@ -281,6 +280,7 @@ struct mmc_host {
281#define MMC_CAP2_PACKED_CMD (MMC_CAP2_PACKED_RD | \ 280#define MMC_CAP2_PACKED_CMD (MMC_CAP2_PACKED_RD | \
282 MMC_CAP2_PACKED_WR) 281 MMC_CAP2_PACKED_WR)
283#define MMC_CAP2_NO_PRESCAN_POWERUP (1 << 14) /* Don't power up before scan */ 282#define MMC_CAP2_NO_PRESCAN_POWERUP (1 << 14) /* Don't power up before scan */
283#define MMC_CAP2_SANITIZE (1 << 15) /* Support Sanitize */
284 284
285 mmc_pm_flag_t pm_caps; /* supported pm features */ 285 mmc_pm_flag_t pm_caps; /* supported pm features */
286 286
@@ -369,7 +369,7 @@ struct mmc_host *mmc_alloc_host(int extra, struct device *);
369int mmc_add_host(struct mmc_host *); 369int mmc_add_host(struct mmc_host *);
370void mmc_remove_host(struct mmc_host *); 370void mmc_remove_host(struct mmc_host *);
371void mmc_free_host(struct mmc_host *); 371void mmc_free_host(struct mmc_host *);
372void mmc_of_parse(struct mmc_host *host); 372int mmc_of_parse(struct mmc_host *host);
373 373
374static inline void *mmc_priv(struct mmc_host *host) 374static inline void *mmc_priv(struct mmc_host *host)
375{ 375{
@@ -425,10 +425,6 @@ static inline int mmc_regulator_get_supply(struct mmc_host *mmc)
425} 425}
426#endif 426#endif
427 427
428int mmc_card_awake(struct mmc_host *host);
429int mmc_card_sleep(struct mmc_host *host);
430int mmc_card_can_sleep(struct mmc_host *host);
431
432int mmc_pm_notify(struct notifier_block *notify_block, unsigned long, void *); 428int mmc_pm_notify(struct notifier_block *notify_block, unsigned long, void *);
433 429
434/* Module parameter */ 430/* Module parameter */
diff --git a/include/linux/mmc/sdhci.h b/include/linux/mmc/sdhci.h
index b838ffc49e4a..e3c6a74d980a 100644
--- a/include/linux/mmc/sdhci.h
+++ b/include/linux/mmc/sdhci.h
@@ -95,6 +95,9 @@ struct sdhci_host {
95/* The system physically doesn't support 1.8v, even if the host does */ 95/* The system physically doesn't support 1.8v, even if the host does */
96#define SDHCI_QUIRK2_NO_1_8_V (1<<2) 96#define SDHCI_QUIRK2_NO_1_8_V (1<<2)
97#define SDHCI_QUIRK2_PRESET_VALUE_BROKEN (1<<3) 97#define SDHCI_QUIRK2_PRESET_VALUE_BROKEN (1<<3)
98#define SDHCI_QUIRK2_CARD_ON_NEEDS_BUS_ON (1<<4)
99/* Controller has a non-standard host control register */
100#define SDHCI_QUIRK2_BROKEN_HOST_CONTROL (1<<5)
98 101
99 int irq; /* Device IRQ */ 102 int irq; /* Device IRQ */
100 void __iomem *ioaddr; /* Mapped address */ 103 void __iomem *ioaddr; /* Mapped address */
@@ -126,7 +129,7 @@ struct sdhci_host {
126#define SDHCI_AUTO_CMD23 (1<<7) /* Auto CMD23 support */ 129#define SDHCI_AUTO_CMD23 (1<<7) /* Auto CMD23 support */
127#define SDHCI_PV_ENABLED (1<<8) /* Preset value enabled */ 130#define SDHCI_PV_ENABLED (1<<8) /* Preset value enabled */
128#define SDHCI_SDIO_IRQ_ENABLED (1<<9) /* SDIO irq enabled */ 131#define SDHCI_SDIO_IRQ_ENABLED (1<<9) /* SDIO irq enabled */
129#define SDHCI_HS200_NEEDS_TUNING (1<<10) /* HS200 needs tuning */ 132#define SDHCI_SDR104_NEEDS_TUNING (1<<10) /* SDR104/HS200 needs tuning */
130#define SDHCI_USING_RETUNING_TIMER (1<<11) /* Host is using a retuning timer for the card */ 133#define SDHCI_USING_RETUNING_TIMER (1<<11) /* Host is using a retuning timer for the card */
131 134
132 unsigned int version; /* SDHCI spec. version */ 135 unsigned int version; /* SDHCI spec. version */
@@ -139,6 +142,7 @@ struct sdhci_host {
139 u8 pwr; /* Current voltage */ 142 u8 pwr; /* Current voltage */
140 143
141 bool runtime_suspended; /* Host is runtime suspended */ 144 bool runtime_suspended; /* Host is runtime suspended */
145 bool bus_on; /* Bus power prevents runtime suspend */
142 146
143 struct mmc_request *mrq; /* Current request */ 147 struct mmc_request *mrq; /* Current request */
144 struct mmc_command *cmd; /* Current command */ 148 struct mmc_command *cmd; /* Current command */
diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h
index ae19af5ec02c..af4a3b77a8de 100644
--- a/include/linux/mmzone.h
+++ b/include/linux/mmzone.h
@@ -869,11 +869,6 @@ static inline int is_highmem_idx(enum zone_type idx)
869#endif 869#endif
870} 870}
871 871
872static inline int is_normal_idx(enum zone_type idx)
873{
874 return (idx == ZONE_NORMAL);
875}
876
877/** 872/**
878 * is_highmem - helper function to quickly check if a struct zone is a 873 * is_highmem - helper function to quickly check if a struct zone is a
879 * highmem zone or not. This is an attempt to keep references 874 * highmem zone or not. This is an attempt to keep references
@@ -892,29 +887,6 @@ static inline int is_highmem(struct zone *zone)
892#endif 887#endif
893} 888}
894 889
895static inline int is_normal(struct zone *zone)
896{
897 return zone == zone->zone_pgdat->node_zones + ZONE_NORMAL;
898}
899
900static inline int is_dma32(struct zone *zone)
901{
902#ifdef CONFIG_ZONE_DMA32
903 return zone == zone->zone_pgdat->node_zones + ZONE_DMA32;
904#else
905 return 0;
906#endif
907}
908
909static inline int is_dma(struct zone *zone)
910{
911#ifdef CONFIG_ZONE_DMA
912 return zone == zone->zone_pgdat->node_zones + ZONE_DMA;
913#else
914 return 0;
915#endif
916}
917
918/* These two functions are used to setup the per zone pages min values */ 890/* These two functions are used to setup the per zone pages min values */
919struct ctl_table; 891struct ctl_table;
920int min_free_kbytes_sysctl_handler(struct ctl_table *, int, 892int min_free_kbytes_sysctl_handler(struct ctl_table *, int,
diff --git a/include/linux/mod_devicetable.h b/include/linux/mod_devicetable.h
index b62d4af6c667..45e921401b06 100644
--- a/include/linux/mod_devicetable.h
+++ b/include/linux/mod_devicetable.h
@@ -361,7 +361,8 @@ struct ssb_device_id {
361 __u16 vendor; 361 __u16 vendor;
362 __u16 coreid; 362 __u16 coreid;
363 __u8 revision; 363 __u8 revision;
364}; 364 __u8 __pad;
365} __attribute__((packed, aligned(2)));
365#define SSB_DEVICE(_vendor, _coreid, _revision) \ 366#define SSB_DEVICE(_vendor, _coreid, _revision) \
366 { .vendor = _vendor, .coreid = _coreid, .revision = _revision, } 367 { .vendor = _vendor, .coreid = _coreid, .revision = _revision, }
367#define SSB_DEVTABLE_END \ 368#define SSB_DEVTABLE_END \
@@ -377,7 +378,7 @@ struct bcma_device_id {
377 __u16 id; 378 __u16 id;
378 __u8 rev; 379 __u8 rev;
379 __u8 class; 380 __u8 class;
380}; 381} __attribute__((packed,aligned(2)));
381#define BCMA_CORE(_manuf, _id, _rev, _class) \ 382#define BCMA_CORE(_manuf, _id, _rev, _class) \
382 { .manuf = _manuf, .id = _id, .rev = _rev, .class = _class, } 383 { .manuf = _manuf, .id = _id, .rev = _rev, .class = _class, }
383#define BCMA_CORETABLE_END \ 384#define BCMA_CORETABLE_END \
diff --git a/include/linux/moduleparam.h b/include/linux/moduleparam.h
index 137b4198fc03..27d9da3f86ff 100644
--- a/include/linux/moduleparam.h
+++ b/include/linux/moduleparam.h
@@ -439,7 +439,7 @@ extern struct kernel_param_ops param_ops_string;
439extern int param_set_copystring(const char *val, const struct kernel_param *); 439extern int param_set_copystring(const char *val, const struct kernel_param *);
440extern int param_get_string(char *buffer, const struct kernel_param *kp); 440extern int param_get_string(char *buffer, const struct kernel_param *kp);
441 441
442/* for exporting parameters in /sys/parameters */ 442/* for exporting parameters in /sys/module/.../parameters */
443 443
444struct module; 444struct module;
445 445
diff --git a/include/linux/mutex.h b/include/linux/mutex.h
index 3793ed7feeeb..ccd4260834c5 100644
--- a/include/linux/mutex.h
+++ b/include/linux/mutex.h
@@ -78,40 +78,6 @@ struct mutex_waiter {
78#endif 78#endif
79}; 79};
80 80
81struct ww_class {
82 atomic_long_t stamp;
83 struct lock_class_key acquire_key;
84 struct lock_class_key mutex_key;
85 const char *acquire_name;
86 const char *mutex_name;
87};
88
89struct ww_acquire_ctx {
90 struct task_struct *task;
91 unsigned long stamp;
92 unsigned acquired;
93#ifdef CONFIG_DEBUG_MUTEXES
94 unsigned done_acquire;
95 struct ww_class *ww_class;
96 struct ww_mutex *contending_lock;
97#endif
98#ifdef CONFIG_DEBUG_LOCK_ALLOC
99 struct lockdep_map dep_map;
100#endif
101#ifdef CONFIG_DEBUG_WW_MUTEX_SLOWPATH
102 unsigned deadlock_inject_interval;
103 unsigned deadlock_inject_countdown;
104#endif
105};
106
107struct ww_mutex {
108 struct mutex base;
109 struct ww_acquire_ctx *ctx;
110#ifdef CONFIG_DEBUG_MUTEXES
111 struct ww_class *ww_class;
112#endif
113};
114
115#ifdef CONFIG_DEBUG_MUTEXES 81#ifdef CONFIG_DEBUG_MUTEXES
116# include <linux/mutex-debug.h> 82# include <linux/mutex-debug.h>
117#else 83#else
@@ -136,11 +102,8 @@ static inline void mutex_destroy(struct mutex *lock) {}
136#ifdef CONFIG_DEBUG_LOCK_ALLOC 102#ifdef CONFIG_DEBUG_LOCK_ALLOC
137# define __DEP_MAP_MUTEX_INITIALIZER(lockname) \ 103# define __DEP_MAP_MUTEX_INITIALIZER(lockname) \
138 , .dep_map = { .name = #lockname } 104 , .dep_map = { .name = #lockname }
139# define __WW_CLASS_MUTEX_INITIALIZER(lockname, ww_class) \
140 , .ww_class = &ww_class
141#else 105#else
142# define __DEP_MAP_MUTEX_INITIALIZER(lockname) 106# define __DEP_MAP_MUTEX_INITIALIZER(lockname)
143# define __WW_CLASS_MUTEX_INITIALIZER(lockname, ww_class)
144#endif 107#endif
145 108
146#define __MUTEX_INITIALIZER(lockname) \ 109#define __MUTEX_INITIALIZER(lockname) \
@@ -150,49 +113,13 @@ static inline void mutex_destroy(struct mutex *lock) {}
150 __DEBUG_MUTEX_INITIALIZER(lockname) \ 113 __DEBUG_MUTEX_INITIALIZER(lockname) \
151 __DEP_MAP_MUTEX_INITIALIZER(lockname) } 114 __DEP_MAP_MUTEX_INITIALIZER(lockname) }
152 115
153#define __WW_CLASS_INITIALIZER(ww_class) \
154 { .stamp = ATOMIC_LONG_INIT(0) \
155 , .acquire_name = #ww_class "_acquire" \
156 , .mutex_name = #ww_class "_mutex" }
157
158#define __WW_MUTEX_INITIALIZER(lockname, class) \
159 { .base = { \__MUTEX_INITIALIZER(lockname) } \
160 __WW_CLASS_MUTEX_INITIALIZER(lockname, class) }
161
162#define DEFINE_MUTEX(mutexname) \ 116#define DEFINE_MUTEX(mutexname) \
163 struct mutex mutexname = __MUTEX_INITIALIZER(mutexname) 117 struct mutex mutexname = __MUTEX_INITIALIZER(mutexname)
164 118
165#define DEFINE_WW_CLASS(classname) \
166 struct ww_class classname = __WW_CLASS_INITIALIZER(classname)
167
168#define DEFINE_WW_MUTEX(mutexname, ww_class) \
169 struct ww_mutex mutexname = __WW_MUTEX_INITIALIZER(mutexname, ww_class)
170
171
172extern void __mutex_init(struct mutex *lock, const char *name, 119extern void __mutex_init(struct mutex *lock, const char *name,
173 struct lock_class_key *key); 120 struct lock_class_key *key);
174 121
175/** 122/**
176 * ww_mutex_init - initialize the w/w mutex
177 * @lock: the mutex to be initialized
178 * @ww_class: the w/w class the mutex should belong to
179 *
180 * Initialize the w/w mutex to unlocked state and associate it with the given
181 * class.
182 *
183 * It is not allowed to initialize an already locked mutex.
184 */
185static inline void ww_mutex_init(struct ww_mutex *lock,
186 struct ww_class *ww_class)
187{
188 __mutex_init(&lock->base, ww_class->mutex_name, &ww_class->mutex_key);
189 lock->ctx = NULL;
190#ifdef CONFIG_DEBUG_MUTEXES
191 lock->ww_class = ww_class;
192#endif
193}
194
195/**
196 * mutex_is_locked - is the mutex locked 123 * mutex_is_locked - is the mutex locked
197 * @lock: the mutex to be queried 124 * @lock: the mutex to be queried
198 * 125 *
@@ -246,291 +173,6 @@ extern int __must_check mutex_lock_killable(struct mutex *lock);
246extern int mutex_trylock(struct mutex *lock); 173extern int mutex_trylock(struct mutex *lock);
247extern void mutex_unlock(struct mutex *lock); 174extern void mutex_unlock(struct mutex *lock);
248 175
249/**
250 * ww_acquire_init - initialize a w/w acquire context
251 * @ctx: w/w acquire context to initialize
252 * @ww_class: w/w class of the context
253 *
254 * Initializes an context to acquire multiple mutexes of the given w/w class.
255 *
256 * Context-based w/w mutex acquiring can be done in any order whatsoever within
257 * a given lock class. Deadlocks will be detected and handled with the
258 * wait/wound logic.
259 *
260 * Mixing of context-based w/w mutex acquiring and single w/w mutex locking can
261 * result in undetected deadlocks and is so forbidden. Mixing different contexts
262 * for the same w/w class when acquiring mutexes can also result in undetected
263 * deadlocks, and is hence also forbidden. Both types of abuse will be caught by
264 * enabling CONFIG_PROVE_LOCKING.
265 *
266 * Nesting of acquire contexts for _different_ w/w classes is possible, subject
267 * to the usual locking rules between different lock classes.
268 *
269 * An acquire context must be released with ww_acquire_fini by the same task
270 * before the memory is freed. It is recommended to allocate the context itself
271 * on the stack.
272 */
273static inline void ww_acquire_init(struct ww_acquire_ctx *ctx,
274 struct ww_class *ww_class)
275{
276 ctx->task = current;
277 ctx->stamp = atomic_long_inc_return(&ww_class->stamp);
278 ctx->acquired = 0;
279#ifdef CONFIG_DEBUG_MUTEXES
280 ctx->ww_class = ww_class;
281 ctx->done_acquire = 0;
282 ctx->contending_lock = NULL;
283#endif
284#ifdef CONFIG_DEBUG_LOCK_ALLOC
285 debug_check_no_locks_freed((void *)ctx, sizeof(*ctx));
286 lockdep_init_map(&ctx->dep_map, ww_class->acquire_name,
287 &ww_class->acquire_key, 0);
288 mutex_acquire(&ctx->dep_map, 0, 0, _RET_IP_);
289#endif
290#ifdef CONFIG_DEBUG_WW_MUTEX_SLOWPATH
291 ctx->deadlock_inject_interval = 1;
292 ctx->deadlock_inject_countdown = ctx->stamp & 0xf;
293#endif
294}
295
296/**
297 * ww_acquire_done - marks the end of the acquire phase
298 * @ctx: the acquire context
299 *
300 * Marks the end of the acquire phase, any further w/w mutex lock calls using
301 * this context are forbidden.
302 *
303 * Calling this function is optional, it is just useful to document w/w mutex
304 * code and clearly designated the acquire phase from actually using the locked
305 * data structures.
306 */
307static inline void ww_acquire_done(struct ww_acquire_ctx *ctx)
308{
309#ifdef CONFIG_DEBUG_MUTEXES
310 lockdep_assert_held(ctx);
311
312 DEBUG_LOCKS_WARN_ON(ctx->done_acquire);
313 ctx->done_acquire = 1;
314#endif
315}
316
317/**
318 * ww_acquire_fini - releases a w/w acquire context
319 * @ctx: the acquire context to free
320 *
321 * Releases a w/w acquire context. This must be called _after_ all acquired w/w
322 * mutexes have been released with ww_mutex_unlock.
323 */
324static inline void ww_acquire_fini(struct ww_acquire_ctx *ctx)
325{
326#ifdef CONFIG_DEBUG_MUTEXES
327 mutex_release(&ctx->dep_map, 0, _THIS_IP_);
328
329 DEBUG_LOCKS_WARN_ON(ctx->acquired);
330 if (!config_enabled(CONFIG_PROVE_LOCKING))
331 /*
332 * lockdep will normally handle this,
333 * but fail without anyway
334 */
335 ctx->done_acquire = 1;
336
337 if (!config_enabled(CONFIG_DEBUG_LOCK_ALLOC))
338 /* ensure ww_acquire_fini will still fail if called twice */
339 ctx->acquired = ~0U;
340#endif
341}
342
343extern int __must_check __ww_mutex_lock(struct ww_mutex *lock,
344 struct ww_acquire_ctx *ctx);
345extern int __must_check __ww_mutex_lock_interruptible(struct ww_mutex *lock,
346 struct ww_acquire_ctx *ctx);
347
348/**
349 * ww_mutex_lock - acquire the w/w mutex
350 * @lock: the mutex to be acquired
351 * @ctx: w/w acquire context, or NULL to acquire only a single lock.
352 *
353 * Lock the w/w mutex exclusively for this task.
354 *
355 * Deadlocks within a given w/w class of locks are detected and handled with the
356 * wait/wound algorithm. If the lock isn't immediately avaiable this function
357 * will either sleep until it is (wait case). Or it selects the current context
358 * for backing off by returning -EDEADLK (wound case). Trying to acquire the
359 * same lock with the same context twice is also detected and signalled by
360 * returning -EALREADY. Returns 0 if the mutex was successfully acquired.
361 *
362 * In the wound case the caller must release all currently held w/w mutexes for
363 * the given context and then wait for this contending lock to be available by
364 * calling ww_mutex_lock_slow. Alternatively callers can opt to not acquire this
365 * lock and proceed with trying to acquire further w/w mutexes (e.g. when
366 * scanning through lru lists trying to free resources).
367 *
368 * The mutex must later on be released by the same task that
369 * acquired it. The task may not exit without first unlocking the mutex. Also,
370 * kernel memory where the mutex resides must not be freed with the mutex still
371 * locked. The mutex must first be initialized (or statically defined) before it
372 * can be locked. memset()-ing the mutex to 0 is not allowed. The mutex must be
373 * of the same w/w lock class as was used to initialize the acquire context.
374 *
375 * A mutex acquired with this function must be released with ww_mutex_unlock.
376 */
377static inline int ww_mutex_lock(struct ww_mutex *lock, struct ww_acquire_ctx *ctx)
378{
379 if (ctx)
380 return __ww_mutex_lock(lock, ctx);
381 else {
382 mutex_lock(&lock->base);
383 return 0;
384 }
385}
386
387/**
388 * ww_mutex_lock_interruptible - acquire the w/w mutex, interruptible
389 * @lock: the mutex to be acquired
390 * @ctx: w/w acquire context
391 *
392 * Lock the w/w mutex exclusively for this task.
393 *
394 * Deadlocks within a given w/w class of locks are detected and handled with the
395 * wait/wound algorithm. If the lock isn't immediately avaiable this function
396 * will either sleep until it is (wait case). Or it selects the current context
397 * for backing off by returning -EDEADLK (wound case). Trying to acquire the
398 * same lock with the same context twice is also detected and signalled by
399 * returning -EALREADY. Returns 0 if the mutex was successfully acquired. If a
400 * signal arrives while waiting for the lock then this function returns -EINTR.
401 *
402 * In the wound case the caller must release all currently held w/w mutexes for
403 * the given context and then wait for this contending lock to be available by
404 * calling ww_mutex_lock_slow_interruptible. Alternatively callers can opt to
405 * not acquire this lock and proceed with trying to acquire further w/w mutexes
406 * (e.g. when scanning through lru lists trying to free resources).
407 *
408 * The mutex must later on be released by the same task that
409 * acquired it. The task may not exit without first unlocking the mutex. Also,
410 * kernel memory where the mutex resides must not be freed with the mutex still
411 * locked. The mutex must first be initialized (or statically defined) before it
412 * can be locked. memset()-ing the mutex to 0 is not allowed. The mutex must be
413 * of the same w/w lock class as was used to initialize the acquire context.
414 *
415 * A mutex acquired with this function must be released with ww_mutex_unlock.
416 */
417static inline int __must_check ww_mutex_lock_interruptible(struct ww_mutex *lock,
418 struct ww_acquire_ctx *ctx)
419{
420 if (ctx)
421 return __ww_mutex_lock_interruptible(lock, ctx);
422 else
423 return mutex_lock_interruptible(&lock->base);
424}
425
426/**
427 * ww_mutex_lock_slow - slowpath acquiring of the w/w mutex
428 * @lock: the mutex to be acquired
429 * @ctx: w/w acquire context
430 *
431 * Acquires a w/w mutex with the given context after a wound case. This function
432 * will sleep until the lock becomes available.
433 *
434 * The caller must have released all w/w mutexes already acquired with the
435 * context and then call this function on the contended lock.
436 *
437 * Afterwards the caller may continue to (re)acquire the other w/w mutexes it
438 * needs with ww_mutex_lock. Note that the -EALREADY return code from
439 * ww_mutex_lock can be used to avoid locking this contended mutex twice.
440 *
441 * It is forbidden to call this function with any other w/w mutexes associated
442 * with the context held. It is forbidden to call this on anything else than the
443 * contending mutex.
444 *
445 * Note that the slowpath lock acquiring can also be done by calling
446 * ww_mutex_lock directly. This function here is simply to help w/w mutex
447 * locking code readability by clearly denoting the slowpath.
448 */
449static inline void
450ww_mutex_lock_slow(struct ww_mutex *lock, struct ww_acquire_ctx *ctx)
451{
452 int ret;
453#ifdef CONFIG_DEBUG_MUTEXES
454 DEBUG_LOCKS_WARN_ON(!ctx->contending_lock);
455#endif
456 ret = ww_mutex_lock(lock, ctx);
457 (void)ret;
458}
459
460/**
461 * ww_mutex_lock_slow_interruptible - slowpath acquiring of the w/w mutex,
462 * interruptible
463 * @lock: the mutex to be acquired
464 * @ctx: w/w acquire context
465 *
466 * Acquires a w/w mutex with the given context after a wound case. This function
467 * will sleep until the lock becomes available and returns 0 when the lock has
468 * been acquired. If a signal arrives while waiting for the lock then this
469 * function returns -EINTR.
470 *
471 * The caller must have released all w/w mutexes already acquired with the
472 * context and then call this function on the contended lock.
473 *
474 * Afterwards the caller may continue to (re)acquire the other w/w mutexes it
475 * needs with ww_mutex_lock. Note that the -EALREADY return code from
476 * ww_mutex_lock can be used to avoid locking this contended mutex twice.
477 *
478 * It is forbidden to call this function with any other w/w mutexes associated
479 * with the given context held. It is forbidden to call this on anything else
480 * than the contending mutex.
481 *
482 * Note that the slowpath lock acquiring can also be done by calling
483 * ww_mutex_lock_interruptible directly. This function here is simply to help
484 * w/w mutex locking code readability by clearly denoting the slowpath.
485 */
486static inline int __must_check
487ww_mutex_lock_slow_interruptible(struct ww_mutex *lock,
488 struct ww_acquire_ctx *ctx)
489{
490#ifdef CONFIG_DEBUG_MUTEXES
491 DEBUG_LOCKS_WARN_ON(!ctx->contending_lock);
492#endif
493 return ww_mutex_lock_interruptible(lock, ctx);
494}
495
496extern void ww_mutex_unlock(struct ww_mutex *lock);
497
498/**
499 * ww_mutex_trylock - tries to acquire the w/w mutex without acquire context
500 * @lock: mutex to lock
501 *
502 * Trylocks a mutex without acquire context, so no deadlock detection is
503 * possible. Returns 1 if the mutex has been acquired successfully, 0 otherwise.
504 */
505static inline int __must_check ww_mutex_trylock(struct ww_mutex *lock)
506{
507 return mutex_trylock(&lock->base);
508}
509
510/***
511 * ww_mutex_destroy - mark a w/w mutex unusable
512 * @lock: the mutex to be destroyed
513 *
514 * This function marks the mutex uninitialized, and any subsequent
515 * use of the mutex is forbidden. The mutex must not be locked when
516 * this function is called.
517 */
518static inline void ww_mutex_destroy(struct ww_mutex *lock)
519{
520 mutex_destroy(&lock->base);
521}
522
523/**
524 * ww_mutex_is_locked - is the w/w mutex locked
525 * @lock: the mutex to be queried
526 *
527 * Returns 1 if the mutex is locked, 0 if unlocked.
528 */
529static inline bool ww_mutex_is_locked(struct ww_mutex *lock)
530{
531 return mutex_is_locked(&lock->base);
532}
533
534extern int atomic_dec_and_mutex_lock(atomic_t *cnt, struct mutex *lock); 176extern int atomic_dec_and_mutex_lock(atomic_t *cnt, struct mutex *lock);
535 177
536#ifndef CONFIG_HAVE_ARCH_MUTEX_CPU_RELAX 178#ifndef CONFIG_HAVE_ARCH_MUTEX_CPU_RELAX
diff --git a/include/linux/mv643xx_eth.h b/include/linux/mv643xx_eth.h
index 141d395bbb5f..6e8215b15998 100644
--- a/include/linux/mv643xx_eth.h
+++ b/include/linux/mv643xx_eth.h
@@ -30,6 +30,7 @@ struct mv643xx_eth_shared_platform_data {
30#define MV643XX_ETH_PHY_ADDR(x) (0x80 | (x)) 30#define MV643XX_ETH_PHY_ADDR(x) (0x80 | (x))
31#define MV643XX_ETH_PHY_NONE 0xff 31#define MV643XX_ETH_PHY_NONE 0xff
32 32
33struct device_node;
33struct mv643xx_eth_platform_data { 34struct mv643xx_eth_platform_data {
34 /* 35 /*
35 * Pointer back to our parent instance, and our port number. 36 * Pointer back to our parent instance, and our port number.
@@ -41,6 +42,7 @@ struct mv643xx_eth_platform_data {
41 * Whether a PHY is present, and if yes, at which address. 42 * Whether a PHY is present, and if yes, at which address.
42 */ 43 */
43 int phy_addr; 44 int phy_addr;
45 struct device_node *phy_node;
44 46
45 /* 47 /*
46 * Use this MAC address if it is valid, overriding the 48 * Use this MAC address if it is valid, overriding the
diff --git a/include/linux/net.h b/include/linux/net.h
index 99c9f0c103c2..4f27575ce1d6 100644
--- a/include/linux/net.h
+++ b/include/linux/net.h
@@ -79,9 +79,9 @@ enum sock_type {
79#endif /* ARCH_HAS_SOCKET_TYPES */ 79#endif /* ARCH_HAS_SOCKET_TYPES */
80 80
81enum sock_shutdown_cmd { 81enum sock_shutdown_cmd {
82 SHUT_RD = 0, 82 SHUT_RD,
83 SHUT_WR = 1, 83 SHUT_WR,
84 SHUT_RDWR = 2, 84 SHUT_RDWR,
85}; 85};
86 86
87struct socket_wq { 87struct socket_wq {
diff --git a/include/linux/netdev_features.h b/include/linux/netdev_features.h
index 09906b7ca47d..a2a89a5c7be5 100644
--- a/include/linux/netdev_features.h
+++ b/include/linux/netdev_features.h
@@ -43,8 +43,9 @@ enum {
43 NETIF_F_FSO_BIT, /* ... FCoE segmentation */ 43 NETIF_F_FSO_BIT, /* ... FCoE segmentation */
44 NETIF_F_GSO_GRE_BIT, /* ... GRE with TSO */ 44 NETIF_F_GSO_GRE_BIT, /* ... GRE with TSO */
45 NETIF_F_GSO_UDP_TUNNEL_BIT, /* ... UDP TUNNEL with TSO */ 45 NETIF_F_GSO_UDP_TUNNEL_BIT, /* ... UDP TUNNEL with TSO */
46 NETIF_F_GSO_MPLS_BIT, /* ... MPLS segmentation */
46 /**/NETIF_F_GSO_LAST = /* last bit, see GSO_MASK */ 47 /**/NETIF_F_GSO_LAST = /* last bit, see GSO_MASK */
47 NETIF_F_GSO_UDP_TUNNEL_BIT, 48 NETIF_F_GSO_MPLS_BIT,
48 49
49 NETIF_F_FCOE_CRC_BIT, /* FCoE CRC32 */ 50 NETIF_F_FCOE_CRC_BIT, /* FCoE CRC32 */
50 NETIF_F_SCTP_CSUM_BIT, /* SCTP checksum offload */ 51 NETIF_F_SCTP_CSUM_BIT, /* SCTP checksum offload */
@@ -107,6 +108,7 @@ enum {
107#define NETIF_F_RXALL __NETIF_F(RXALL) 108#define NETIF_F_RXALL __NETIF_F(RXALL)
108#define NETIF_F_GSO_GRE __NETIF_F(GSO_GRE) 109#define NETIF_F_GSO_GRE __NETIF_F(GSO_GRE)
109#define NETIF_F_GSO_UDP_TUNNEL __NETIF_F(GSO_UDP_TUNNEL) 110#define NETIF_F_GSO_UDP_TUNNEL __NETIF_F(GSO_UDP_TUNNEL)
111#define NETIF_F_GSO_MPLS __NETIF_F(GSO_MPLS)
110#define NETIF_F_HW_VLAN_STAG_FILTER __NETIF_F(HW_VLAN_STAG_FILTER) 112#define NETIF_F_HW_VLAN_STAG_FILTER __NETIF_F(HW_VLAN_STAG_FILTER)
111#define NETIF_F_HW_VLAN_STAG_RX __NETIF_F(HW_VLAN_STAG_RX) 113#define NETIF_F_HW_VLAN_STAG_RX __NETIF_F(HW_VLAN_STAG_RX)
112#define NETIF_F_HW_VLAN_STAG_TX __NETIF_F(HW_VLAN_STAG_TX) 114#define NETIF_F_HW_VLAN_STAG_TX __NETIF_F(HW_VLAN_STAG_TX)
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 96e4c21e15e0..9a4156845e93 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -324,12 +324,15 @@ struct napi_struct {
324 struct sk_buff *gro_list; 324 struct sk_buff *gro_list;
325 struct sk_buff *skb; 325 struct sk_buff *skb;
326 struct list_head dev_list; 326 struct list_head dev_list;
327 struct hlist_node napi_hash_node;
328 unsigned int napi_id;
327}; 329};
328 330
329enum { 331enum {
330 NAPI_STATE_SCHED, /* Poll is scheduled */ 332 NAPI_STATE_SCHED, /* Poll is scheduled */
331 NAPI_STATE_DISABLE, /* Disable pending */ 333 NAPI_STATE_DISABLE, /* Disable pending */
332 NAPI_STATE_NPSVC, /* Netpoll - don't dequeue from poll_list */ 334 NAPI_STATE_NPSVC, /* Netpoll - don't dequeue from poll_list */
335 NAPI_STATE_HASHED, /* In NAPI hash */
333}; 336};
334 337
335enum gro_result { 338enum gro_result {
@@ -446,6 +449,32 @@ extern void __napi_complete(struct napi_struct *n);
446extern void napi_complete(struct napi_struct *n); 449extern void napi_complete(struct napi_struct *n);
447 450
448/** 451/**
452 * napi_by_id - lookup a NAPI by napi_id
453 * @napi_id: hashed napi_id
454 *
455 * lookup @napi_id in napi_hash table
456 * must be called under rcu_read_lock()
457 */
458extern struct napi_struct *napi_by_id(unsigned int napi_id);
459
460/**
461 * napi_hash_add - add a NAPI to global hashtable
462 * @napi: napi context
463 *
464 * generate a new napi_id and store a @napi under it in napi_hash
465 */
466extern void napi_hash_add(struct napi_struct *napi);
467
468/**
469 * napi_hash_del - remove a NAPI from global table
470 * @napi: napi context
471 *
472 * Warning: caller must observe rcu grace period
473 * before freeing memory containing @napi
474 */
475extern void napi_hash_del(struct napi_struct *napi);
476
477/**
449 * napi_disable - prevent NAPI from scheduling 478 * napi_disable - prevent NAPI from scheduling
450 * @n: napi context 479 * @n: napi context
451 * 480 *
@@ -800,6 +829,7 @@ struct netdev_fcoe_hbainfo {
800 * int (*ndo_set_vf_spoofchk)(struct net_device *dev, int vf, bool setting); 829 * int (*ndo_set_vf_spoofchk)(struct net_device *dev, int vf, bool setting);
801 * int (*ndo_get_vf_config)(struct net_device *dev, 830 * int (*ndo_get_vf_config)(struct net_device *dev,
802 * int vf, struct ifla_vf_info *ivf); 831 * int vf, struct ifla_vf_info *ivf);
832 * int (*ndo_set_vf_link_state)(struct net_device *dev, int vf, int link_state);
803 * int (*ndo_set_vf_port)(struct net_device *dev, int vf, 833 * int (*ndo_set_vf_port)(struct net_device *dev, int vf,
804 * struct nlattr *port[]); 834 * struct nlattr *port[]);
805 * int (*ndo_get_vf_port)(struct net_device *dev, int vf, struct sk_buff *skb); 835 * int (*ndo_get_vf_port)(struct net_device *dev, int vf, struct sk_buff *skb);
@@ -943,6 +973,9 @@ struct net_device_ops {
943 gfp_t gfp); 973 gfp_t gfp);
944 void (*ndo_netpoll_cleanup)(struct net_device *dev); 974 void (*ndo_netpoll_cleanup)(struct net_device *dev);
945#endif 975#endif
976#ifdef CONFIG_NET_RX_BUSY_POLL
977 int (*ndo_busy_poll)(struct napi_struct *dev);
978#endif
946 int (*ndo_set_vf_mac)(struct net_device *dev, 979 int (*ndo_set_vf_mac)(struct net_device *dev,
947 int queue, u8 *mac); 980 int queue, u8 *mac);
948 int (*ndo_set_vf_vlan)(struct net_device *dev, 981 int (*ndo_set_vf_vlan)(struct net_device *dev,
@@ -954,6 +987,8 @@ struct net_device_ops {
954 int (*ndo_get_vf_config)(struct net_device *dev, 987 int (*ndo_get_vf_config)(struct net_device *dev,
955 int vf, 988 int vf,
956 struct ifla_vf_info *ivf); 989 struct ifla_vf_info *ivf);
990 int (*ndo_set_vf_link_state)(struct net_device *dev,
991 int vf, int link_state);
957 int (*ndo_set_vf_port)(struct net_device *dev, 992 int (*ndo_set_vf_port)(struct net_device *dev,
958 int vf, 993 int vf,
959 struct nlattr *port[]); 994 struct nlattr *port[]);
@@ -1088,6 +1123,8 @@ struct net_device {
1088 * need to set them appropriately. 1123 * need to set them appropriately.
1089 */ 1124 */
1090 netdev_features_t hw_enc_features; 1125 netdev_features_t hw_enc_features;
1126 /* mask of fetures inheritable by MPLS */
1127 netdev_features_t mpls_features;
1091 1128
1092 /* Interface index. Unique device identifier */ 1129 /* Interface index. Unique device identifier */
1093 int ifindex; 1130 int ifindex;
@@ -1140,8 +1177,10 @@ struct net_device {
1140 unsigned char addr_assign_type; /* hw address assignment type */ 1177 unsigned char addr_assign_type; /* hw address assignment type */
1141 unsigned char addr_len; /* hardware address length */ 1178 unsigned char addr_len; /* hardware address length */
1142 unsigned char neigh_priv_len; 1179 unsigned char neigh_priv_len;
1143 unsigned short dev_id; /* for shared network cards */ 1180 unsigned short dev_id; /* Used to differentiate devices
1144 1181 * that share the same link
1182 * layer address
1183 */
1145 spinlock_t addr_list_lock; 1184 spinlock_t addr_list_lock;
1146 struct netdev_hw_addr_list uc; /* Unicast mac addresses */ 1185 struct netdev_hw_addr_list uc; /* Unicast mac addresses */
1147 struct netdev_hw_addr_list mc; /* Multicast mac addresses */ 1186 struct netdev_hw_addr_list mc; /* Multicast mac addresses */
@@ -1593,9 +1632,34 @@ struct packet_offload {
1593#define NETDEV_RELEASE 0x0012 1632#define NETDEV_RELEASE 0x0012
1594#define NETDEV_NOTIFY_PEERS 0x0013 1633#define NETDEV_NOTIFY_PEERS 0x0013
1595#define NETDEV_JOIN 0x0014 1634#define NETDEV_JOIN 0x0014
1635#define NETDEV_CHANGEUPPER 0x0015
1596 1636
1597extern int register_netdevice_notifier(struct notifier_block *nb); 1637extern int register_netdevice_notifier(struct notifier_block *nb);
1598extern int unregister_netdevice_notifier(struct notifier_block *nb); 1638extern int unregister_netdevice_notifier(struct notifier_block *nb);
1639
1640struct netdev_notifier_info {
1641 struct net_device *dev;
1642};
1643
1644struct netdev_notifier_change_info {
1645 struct netdev_notifier_info info; /* must be first */
1646 unsigned int flags_changed;
1647};
1648
1649static inline void netdev_notifier_info_init(struct netdev_notifier_info *info,
1650 struct net_device *dev)
1651{
1652 info->dev = dev;
1653}
1654
1655static inline struct net_device *
1656netdev_notifier_info_to_dev(const struct netdev_notifier_info *info)
1657{
1658 return info->dev;
1659}
1660
1661extern int call_netdevice_notifiers_info(unsigned long val, struct net_device *dev,
1662 struct netdev_notifier_info *info);
1599extern int call_netdevice_notifiers(unsigned long val, struct net_device *dev); 1663extern int call_netdevice_notifiers(unsigned long val, struct net_device *dev);
1600 1664
1601 1665
@@ -1779,6 +1843,19 @@ static inline int unregister_gifconf(unsigned int family)
1779 return register_gifconf(family, NULL); 1843 return register_gifconf(family, NULL);
1780} 1844}
1781 1845
1846#ifdef CONFIG_NET_FLOW_LIMIT
1847#define FLOW_LIMIT_HISTORY (1 << 7) /* must be ^2 and !overflow buckets */
1848struct sd_flow_limit {
1849 u64 count;
1850 unsigned int num_buckets;
1851 unsigned int history_head;
1852 u16 history[FLOW_LIMIT_HISTORY];
1853 u8 buckets[];
1854};
1855
1856extern int netdev_flow_limit_table_len;
1857#endif /* CONFIG_NET_FLOW_LIMIT */
1858
1782/* 1859/*
1783 * Incoming packets are placed on per-cpu queues 1860 * Incoming packets are placed on per-cpu queues
1784 */ 1861 */
@@ -1808,6 +1885,10 @@ struct softnet_data {
1808 unsigned int dropped; 1885 unsigned int dropped;
1809 struct sk_buff_head input_pkt_queue; 1886 struct sk_buff_head input_pkt_queue;
1810 struct napi_struct backlog; 1887 struct napi_struct backlog;
1888
1889#ifdef CONFIG_NET_FLOW_LIMIT
1890 struct sd_flow_limit __rcu *flow_limit;
1891#endif
1811}; 1892};
1812 1893
1813static inline void input_queue_head_incr(struct softnet_data *sd) 1894static inline void input_queue_head_incr(struct softnet_data *sd)
diff --git a/include/linux/netfilter.h b/include/linux/netfilter.h
index 0060fde3160e..de70f7b45b68 100644
--- a/include/linux/netfilter.h
+++ b/include/linux/netfilter.h
@@ -35,7 +35,7 @@ static inline void nf_inet_addr_mask(const union nf_inet_addr *a1,
35 result->all[3] = a1->all[3] & mask->all[3]; 35 result->all[3] = a1->all[3] & mask->all[3];
36} 36}
37 37
38extern void netfilter_init(void); 38extern int netfilter_init(void);
39 39
40/* Largest hook number + 1 */ 40/* Largest hook number + 1 */
41#define NF_MAX_HOOKS 8 41#define NF_MAX_HOOKS 8
diff --git a/include/linux/netlink.h b/include/linux/netlink.h
index 6358da5eeee8..7a6c396a263b 100644
--- a/include/linux/netlink.h
+++ b/include/linux/netlink.h
@@ -46,6 +46,7 @@ struct netlink_kernel_cfg {
46 void (*input)(struct sk_buff *skb); 46 void (*input)(struct sk_buff *skb);
47 struct mutex *cb_mutex; 47 struct mutex *cb_mutex;
48 void (*bind)(int group); 48 void (*bind)(int group);
49 bool (*compare)(struct net *net, struct sock *sk);
49}; 50};
50 51
51extern struct sock *__netlink_kernel_create(struct net *net, int unit, 52extern struct sock *__netlink_kernel_create(struct net *net, int unit,
@@ -84,6 +85,22 @@ int netlink_attachskb(struct sock *sk, struct sk_buff *skb,
84void netlink_detachskb(struct sock *sk, struct sk_buff *skb); 85void netlink_detachskb(struct sock *sk, struct sk_buff *skb);
85int netlink_sendskb(struct sock *sk, struct sk_buff *skb); 86int netlink_sendskb(struct sock *sk, struct sk_buff *skb);
86 87
88static inline struct sk_buff *
89netlink_skb_clone(struct sk_buff *skb, gfp_t gfp_mask)
90{
91 struct sk_buff *nskb;
92
93 nskb = skb_clone(skb, gfp_mask);
94 if (!nskb)
95 return NULL;
96
97 /* This is a large skb, set destructor callback to release head */
98 if (is_vmalloc_addr(skb->head))
99 nskb->destructor = skb->destructor;
100
101 return nskb;
102}
103
87/* 104/*
88 * skb should fit one page. This choice is good for headerless malloc. 105 * skb should fit one page. This choice is good for headerless malloc.
89 * But we should limit to 8K so that userspace does not have to 106 * But we should limit to 8K so that userspace does not have to
@@ -144,4 +161,14 @@ static inline int netlink_dump_start(struct sock *ssk, struct sk_buff *skb,
144 return __netlink_dump_start(ssk, skb, nlh, control); 161 return __netlink_dump_start(ssk, skb, nlh, control);
145} 162}
146 163
164struct netlink_tap {
165 struct net_device *dev;
166 struct module *module;
167 struct list_head list;
168};
169
170extern int netlink_add_tap(struct netlink_tap *nt);
171extern int __netlink_remove_tap(struct netlink_tap *nt);
172extern int netlink_remove_tap(struct netlink_tap *nt);
173
147#endif /* __LINUX_NETLINK_H */ 174#endif /* __LINUX_NETLINK_H */
diff --git a/include/linux/netpoll.h b/include/linux/netpoll.h
index fa2cb76a7029..f3c7c24bec1c 100644
--- a/include/linux/netpoll.h
+++ b/include/linux/netpoll.h
@@ -53,10 +53,10 @@ struct netpoll_info {
53}; 53};
54 54
55#ifdef CONFIG_NETPOLL 55#ifdef CONFIG_NETPOLL
56extern int netpoll_rx_disable(struct net_device *dev); 56extern void netpoll_rx_disable(struct net_device *dev);
57extern void netpoll_rx_enable(struct net_device *dev); 57extern void netpoll_rx_enable(struct net_device *dev);
58#else 58#else
59static inline int netpoll_rx_disable(struct net_device *dev) { return 0; } 59static inline void netpoll_rx_disable(struct net_device *dev) { return; }
60static inline void netpoll_rx_enable(struct net_device *dev) { return; } 60static inline void netpoll_rx_enable(struct net_device *dev) { return; }
61#endif 61#endif
62 62
diff --git a/include/linux/nfs4.h b/include/linux/nfs4.h
index 7b8fc73810ad..e36dee52f224 100644
--- a/include/linux/nfs4.h
+++ b/include/linux/nfs4.h
@@ -32,6 +32,15 @@ struct nfs4_acl {
32 struct nfs4_ace aces[0]; 32 struct nfs4_ace aces[0];
33}; 33};
34 34
35#define NFS4_MAXLABELLEN 2048
36
37struct nfs4_label {
38 uint32_t lfs;
39 uint32_t pi;
40 u32 len;
41 char *label;
42};
43
35typedef struct { char data[NFS4_VERIFIER_SIZE]; } nfs4_verifier; 44typedef struct { char data[NFS4_VERIFIER_SIZE]; } nfs4_verifier;
36 45
37struct nfs_stateid4 { 46struct nfs_stateid4 {
@@ -219,6 +228,14 @@ enum nfsstat4 {
219 NFS4ERR_REJECT_DELEG = 10085, /* on callback */ 228 NFS4ERR_REJECT_DELEG = 10085, /* on callback */
220 NFS4ERR_RETURNCONFLICT = 10086, /* outstanding layoutreturn */ 229 NFS4ERR_RETURNCONFLICT = 10086, /* outstanding layoutreturn */
221 NFS4ERR_DELEG_REVOKED = 10087, /* deleg./layout revoked */ 230 NFS4ERR_DELEG_REVOKED = 10087, /* deleg./layout revoked */
231
232 /* nfs42 */
233 NFS4ERR_PARTNER_NOTSUPP = 10088,
234 NFS4ERR_PARTNER_NO_AUTH = 10089,
235 NFS4ERR_METADATA_NOTSUPP = 10090,
236 NFS4ERR_OFFLOAD_DENIED = 10091,
237 NFS4ERR_WRONG_LFS = 10092,
238 NFS4ERR_BADLABEL = 10093,
222}; 239};
223 240
224static inline bool seqid_mutating_err(u32 err) 241static inline bool seqid_mutating_err(u32 err)
@@ -378,6 +395,7 @@ enum lock_type4 {
378#define FATTR4_WORD1_FS_LAYOUT_TYPES (1UL << 30) 395#define FATTR4_WORD1_FS_LAYOUT_TYPES (1UL << 30)
379#define FATTR4_WORD2_LAYOUT_BLKSIZE (1UL << 1) 396#define FATTR4_WORD2_LAYOUT_BLKSIZE (1UL << 1)
380#define FATTR4_WORD2_MDSTHRESHOLD (1UL << 4) 397#define FATTR4_WORD2_MDSTHRESHOLD (1UL << 4)
398#define FATTR4_WORD2_SECURITY_LABEL (1UL << 17)
381 399
382/* MDS threshold bitmap bits */ 400/* MDS threshold bitmap bits */
383#define THRESHOLD_RD (1UL << 0) 401#define THRESHOLD_RD (1UL << 0)
@@ -390,11 +408,15 @@ enum lock_type4 {
390#define NFS4_VERSION 4 408#define NFS4_VERSION 4
391#define NFS4_MINOR_VERSION 0 409#define NFS4_MINOR_VERSION 0
392 410
411#if defined(CONFIG_NFS_V4_2)
412#define NFS4_MAX_MINOR_VERSION 2
413#else
393#if defined(CONFIG_NFS_V4_1) 414#if defined(CONFIG_NFS_V4_1)
394#define NFS4_MAX_MINOR_VERSION 1 415#define NFS4_MAX_MINOR_VERSION 1
395#else 416#else
396#define NFS4_MAX_MINOR_VERSION 0 417#define NFS4_MAX_MINOR_VERSION 0
397#endif /* CONFIG_NFS_V4_1 */ 418#endif /* CONFIG_NFS_V4_1 */
419#endif /* CONFIG_NFS_V4_2 */
398 420
399#define NFS4_DEBUG 1 421#define NFS4_DEBUG 1
400 422
diff --git a/include/linux/nfs_fs.h b/include/linux/nfs_fs.h
index fc01d5cb4cf1..7125cef74164 100644
--- a/include/linux/nfs_fs.h
+++ b/include/linux/nfs_fs.h
@@ -207,6 +207,7 @@ struct nfs_inode {
207#define NFS_INO_INVALID_ACL 0x0010 /* cached acls are invalid */ 207#define NFS_INO_INVALID_ACL 0x0010 /* cached acls are invalid */
208#define NFS_INO_REVAL_PAGECACHE 0x0020 /* must revalidate pagecache */ 208#define NFS_INO_REVAL_PAGECACHE 0x0020 /* must revalidate pagecache */
209#define NFS_INO_REVAL_FORCED 0x0040 /* force revalidation ignoring a delegation */ 209#define NFS_INO_REVAL_FORCED 0x0040 /* force revalidation ignoring a delegation */
210#define NFS_INO_INVALID_LABEL 0x0080 /* cached label is invalid */
210 211
211/* 212/*
212 * Bit offsets in flags field 213 * Bit offsets in flags field
@@ -336,7 +337,7 @@ extern void nfs_zap_mapping(struct inode *inode, struct address_space *mapping);
336extern void nfs_zap_caches(struct inode *); 337extern void nfs_zap_caches(struct inode *);
337extern void nfs_invalidate_atime(struct inode *); 338extern void nfs_invalidate_atime(struct inode *);
338extern struct inode *nfs_fhget(struct super_block *, struct nfs_fh *, 339extern struct inode *nfs_fhget(struct super_block *, struct nfs_fh *,
339 struct nfs_fattr *); 340 struct nfs_fattr *, struct nfs4_label *);
340extern int nfs_refresh_inode(struct inode *, struct nfs_fattr *); 341extern int nfs_refresh_inode(struct inode *, struct nfs_fattr *);
341extern int nfs_post_op_update_inode(struct inode *inode, struct nfs_fattr *fattr); 342extern int nfs_post_op_update_inode(struct inode *inode, struct nfs_fattr *fattr);
342extern int nfs_post_op_update_inode_force_wcc(struct inode *inode, struct nfs_fattr *fattr); 343extern int nfs_post_op_update_inode_force_wcc(struct inode *inode, struct nfs_fattr *fattr);
@@ -347,15 +348,19 @@ extern int nfs_permission(struct inode *, int);
347extern int nfs_open(struct inode *, struct file *); 348extern int nfs_open(struct inode *, struct file *);
348extern int nfs_release(struct inode *, struct file *); 349extern int nfs_release(struct inode *, struct file *);
349extern int nfs_attribute_timeout(struct inode *inode); 350extern int nfs_attribute_timeout(struct inode *inode);
351extern int nfs_attribute_cache_expired(struct inode *inode);
350extern int nfs_revalidate_inode(struct nfs_server *server, struct inode *inode); 352extern int nfs_revalidate_inode(struct nfs_server *server, struct inode *inode);
351extern int __nfs_revalidate_inode(struct nfs_server *, struct inode *); 353extern int __nfs_revalidate_inode(struct nfs_server *, struct inode *);
352extern int nfs_revalidate_mapping(struct inode *inode, struct address_space *mapping); 354extern int nfs_revalidate_mapping(struct inode *inode, struct address_space *mapping);
353extern int nfs_setattr(struct dentry *, struct iattr *); 355extern int nfs_setattr(struct dentry *, struct iattr *);
354extern void nfs_setattr_update_inode(struct inode *inode, struct iattr *attr); 356extern void nfs_setattr_update_inode(struct inode *inode, struct iattr *attr);
357extern void nfs_setsecurity(struct inode *inode, struct nfs_fattr *fattr,
358 struct nfs4_label *label);
355extern struct nfs_open_context *get_nfs_open_context(struct nfs_open_context *ctx); 359extern struct nfs_open_context *get_nfs_open_context(struct nfs_open_context *ctx);
356extern void put_nfs_open_context(struct nfs_open_context *ctx); 360extern void put_nfs_open_context(struct nfs_open_context *ctx);
357extern struct nfs_open_context *nfs_find_open_context(struct inode *inode, struct rpc_cred *cred, fmode_t mode); 361extern struct nfs_open_context *nfs_find_open_context(struct inode *inode, struct rpc_cred *cred, fmode_t mode);
358extern struct nfs_open_context *alloc_nfs_open_context(struct dentry *dentry, fmode_t f_mode); 362extern struct nfs_open_context *alloc_nfs_open_context(struct dentry *dentry, fmode_t f_mode);
363extern void nfs_inode_attach_open_context(struct nfs_open_context *ctx);
359extern void nfs_file_set_open_context(struct file *filp, struct nfs_open_context *ctx); 364extern void nfs_file_set_open_context(struct file *filp, struct nfs_open_context *ctx);
360extern struct nfs_lock_context *nfs_get_lock_context(struct nfs_open_context *ctx); 365extern struct nfs_lock_context *nfs_get_lock_context(struct nfs_open_context *ctx);
361extern void nfs_put_lock_context(struct nfs_lock_context *l_ctx); 366extern void nfs_put_lock_context(struct nfs_lock_context *l_ctx);
@@ -468,7 +473,8 @@ extern const struct file_operations nfs_dir_operations;
468extern const struct dentry_operations nfs_dentry_operations; 473extern const struct dentry_operations nfs_dentry_operations;
469 474
470extern void nfs_force_lookup_revalidate(struct inode *dir); 475extern void nfs_force_lookup_revalidate(struct inode *dir);
471extern int nfs_instantiate(struct dentry *dentry, struct nfs_fh *fh, struct nfs_fattr *fattr); 476extern int nfs_instantiate(struct dentry *dentry, struct nfs_fh *fh,
477 struct nfs_fattr *fattr, struct nfs4_label *label);
472extern int nfs_may_open(struct inode *inode, struct rpc_cred *cred, int openflags); 478extern int nfs_may_open(struct inode *inode, struct rpc_cred *cred, int openflags);
473extern void nfs_access_zap_cache(struct inode *inode); 479extern void nfs_access_zap_cache(struct inode *inode);
474 480
@@ -497,6 +503,24 @@ extern int nfs_mountpoint_expiry_timeout;
497extern void nfs_release_automount_timer(void); 503extern void nfs_release_automount_timer(void);
498 504
499/* 505/*
506 * linux/fs/nfs/nfs4proc.c
507 */
508#ifdef CONFIG_NFS_V4_SECURITY_LABEL
509extern struct nfs4_label *nfs4_label_alloc(struct nfs_server *server, gfp_t flags);
510static inline void nfs4_label_free(struct nfs4_label *label)
511{
512 if (label) {
513 kfree(label->label);
514 kfree(label);
515 }
516 return;
517}
518#else
519static inline struct nfs4_label *nfs4_label_alloc(struct nfs_server *server, gfp_t flags) { return NULL; }
520static inline void nfs4_label_free(void *label) {}
521#endif
522
523/*
500 * linux/fs/nfs/unlink.c 524 * linux/fs/nfs/unlink.c
501 */ 525 */
502extern void nfs_complete_unlink(struct dentry *dentry, struct inode *); 526extern void nfs_complete_unlink(struct dentry *dentry, struct inode *);
diff --git a/include/linux/nfs_fs_sb.h b/include/linux/nfs_fs_sb.h
index 3b7fa2abecca..d2212432c456 100644
--- a/include/linux/nfs_fs_sb.h
+++ b/include/linux/nfs_fs_sb.h
@@ -146,7 +146,12 @@ struct nfs_server {
146 u32 attr_bitmask[3];/* V4 bitmask representing the set 146 u32 attr_bitmask[3];/* V4 bitmask representing the set
147 of attributes supported on this 147 of attributes supported on this
148 filesystem */ 148 filesystem */
149 u32 cache_consistency_bitmask[2]; 149 u32 attr_bitmask_nl[3];
150 /* V4 bitmask representing the
151 set of attributes supported
152 on this filesystem excluding
153 the label support bit. */
154 u32 cache_consistency_bitmask[3];
150 /* V4 bitmask representing the subset 155 /* V4 bitmask representing the subset
151 of change attribute, size, ctime 156 of change attribute, size, ctime
152 and mtime attributes supported by 157 and mtime attributes supported by
@@ -200,5 +205,6 @@ struct nfs_server {
200#define NFS_CAP_UIDGID_NOMAP (1U << 15) 205#define NFS_CAP_UIDGID_NOMAP (1U << 15)
201#define NFS_CAP_STATEID_NFSV41 (1U << 16) 206#define NFS_CAP_STATEID_NFSV41 (1U << 16)
202#define NFS_CAP_ATOMIC_OPEN_V1 (1U << 17) 207#define NFS_CAP_ATOMIC_OPEN_V1 (1U << 17)
208#define NFS_CAP_SECURITY_LABEL (1U << 18)
203 209
204#endif 210#endif
diff --git a/include/linux/nfs_xdr.h b/include/linux/nfs_xdr.h
index 104b62f23ee0..8651574a305b 100644
--- a/include/linux/nfs_xdr.h
+++ b/include/linux/nfs_xdr.h
@@ -101,6 +101,7 @@ struct nfs_fattr {
101#define NFS_ATTR_FATTR_MOUNTED_ON_FILEID (1U << 22) 101#define NFS_ATTR_FATTR_MOUNTED_ON_FILEID (1U << 22)
102#define NFS_ATTR_FATTR_OWNER_NAME (1U << 23) 102#define NFS_ATTR_FATTR_OWNER_NAME (1U << 23)
103#define NFS_ATTR_FATTR_GROUP_NAME (1U << 24) 103#define NFS_ATTR_FATTR_GROUP_NAME (1U << 24)
104#define NFS_ATTR_FATTR_V4_SECURITY_LABEL (1U << 25)
104 105
105#define NFS_ATTR_FATTR (NFS_ATTR_FATTR_TYPE \ 106#define NFS_ATTR_FATTR (NFS_ATTR_FATTR_TYPE \
106 | NFS_ATTR_FATTR_MODE \ 107 | NFS_ATTR_FATTR_MODE \
@@ -120,7 +121,8 @@ struct nfs_fattr {
120#define NFS_ATTR_FATTR_V3 (NFS_ATTR_FATTR \ 121#define NFS_ATTR_FATTR_V3 (NFS_ATTR_FATTR \
121 | NFS_ATTR_FATTR_SPACE_USED) 122 | NFS_ATTR_FATTR_SPACE_USED)
122#define NFS_ATTR_FATTR_V4 (NFS_ATTR_FATTR \ 123#define NFS_ATTR_FATTR_V4 (NFS_ATTR_FATTR \
123 | NFS_ATTR_FATTR_SPACE_USED) 124 | NFS_ATTR_FATTR_SPACE_USED \
125 | NFS_ATTR_FATTR_V4_SECURITY_LABEL)
124 126
125/* 127/*
126 * Info on the file system 128 * Info on the file system
@@ -246,6 +248,7 @@ struct nfs4_layoutget_res {
246struct nfs4_layoutget { 248struct nfs4_layoutget {
247 struct nfs4_layoutget_args args; 249 struct nfs4_layoutget_args args;
248 struct nfs4_layoutget_res res; 250 struct nfs4_layoutget_res res;
251 struct rpc_cred *cred;
249 gfp_t gfp_flags; 252 gfp_t gfp_flags;
250}; 253};
251 254
@@ -347,6 +350,7 @@ struct nfs_openargs {
347 const u32 * open_bitmap; 350 const u32 * open_bitmap;
348 __u32 claim; 351 __u32 claim;
349 enum createmode4 createmode; 352 enum createmode4 createmode;
353 const struct nfs4_label *label;
350}; 354};
351 355
352struct nfs_openres { 356struct nfs_openres {
@@ -356,6 +360,7 @@ struct nfs_openres {
356 struct nfs4_change_info cinfo; 360 struct nfs4_change_info cinfo;
357 __u32 rflags; 361 __u32 rflags;
358 struct nfs_fattr * f_attr; 362 struct nfs_fattr * f_attr;
363 struct nfs4_label *f_label;
359 struct nfs_seqid * seqid; 364 struct nfs_seqid * seqid;
360 const struct nfs_server *server; 365 const struct nfs_server *server;
361 fmode_t delegation_type; 366 fmode_t delegation_type;
@@ -598,6 +603,7 @@ struct nfs_entry {
598 int eof; 603 int eof;
599 struct nfs_fh * fh; 604 struct nfs_fh * fh;
600 struct nfs_fattr * fattr; 605 struct nfs_fattr * fattr;
606 struct nfs4_label *label;
601 unsigned char d_type; 607 unsigned char d_type;
602 struct nfs_server * server; 608 struct nfs_server * server;
603}; 609};
@@ -630,6 +636,7 @@ struct nfs_setattrargs {
630 struct iattr * iap; 636 struct iattr * iap;
631 const struct nfs_server * server; /* Needed for name mapping */ 637 const struct nfs_server * server; /* Needed for name mapping */
632 const u32 * bitmask; 638 const u32 * bitmask;
639 const struct nfs4_label *label;
633}; 640};
634 641
635struct nfs_setaclargs { 642struct nfs_setaclargs {
@@ -665,6 +672,7 @@ struct nfs_getaclres {
665struct nfs_setattrres { 672struct nfs_setattrres {
666 struct nfs4_sequence_res seq_res; 673 struct nfs4_sequence_res seq_res;
667 struct nfs_fattr * fattr; 674 struct nfs_fattr * fattr;
675 struct nfs4_label *label;
668 const struct nfs_server * server; 676 const struct nfs_server * server;
669}; 677};
670 678
@@ -862,6 +870,7 @@ struct nfs4_create_arg {
862 const struct iattr * attrs; 870 const struct iattr * attrs;
863 const struct nfs_fh * dir_fh; 871 const struct nfs_fh * dir_fh;
864 const u32 * bitmask; 872 const u32 * bitmask;
873 const struct nfs4_label *label;
865}; 874};
866 875
867struct nfs4_create_res { 876struct nfs4_create_res {
@@ -869,6 +878,7 @@ struct nfs4_create_res {
869 const struct nfs_server * server; 878 const struct nfs_server * server;
870 struct nfs_fh * fh; 879 struct nfs_fh * fh;
871 struct nfs_fattr * fattr; 880 struct nfs_fattr * fattr;
881 struct nfs4_label *label;
872 struct nfs4_change_info dir_cinfo; 882 struct nfs4_change_info dir_cinfo;
873}; 883};
874 884
@@ -893,6 +903,7 @@ struct nfs4_getattr_res {
893 struct nfs4_sequence_res seq_res; 903 struct nfs4_sequence_res seq_res;
894 const struct nfs_server * server; 904 const struct nfs_server * server;
895 struct nfs_fattr * fattr; 905 struct nfs_fattr * fattr;
906 struct nfs4_label *label;
896}; 907};
897 908
898struct nfs4_link_arg { 909struct nfs4_link_arg {
@@ -907,6 +918,7 @@ struct nfs4_link_res {
907 struct nfs4_sequence_res seq_res; 918 struct nfs4_sequence_res seq_res;
908 const struct nfs_server * server; 919 const struct nfs_server * server;
909 struct nfs_fattr * fattr; 920 struct nfs_fattr * fattr;
921 struct nfs4_label *label;
910 struct nfs4_change_info cinfo; 922 struct nfs4_change_info cinfo;
911 struct nfs_fattr * dir_attr; 923 struct nfs_fattr * dir_attr;
912}; 924};
@@ -924,6 +936,7 @@ struct nfs4_lookup_res {
924 const struct nfs_server * server; 936 const struct nfs_server * server;
925 struct nfs_fattr * fattr; 937 struct nfs_fattr * fattr;
926 struct nfs_fh * fh; 938 struct nfs_fh * fh;
939 struct nfs4_label *label;
927}; 940};
928 941
929struct nfs4_lookup_root_arg { 942struct nfs4_lookup_root_arg {
@@ -1366,11 +1379,12 @@ struct nfs_rpc_ops {
1366 struct dentry *(*try_mount) (int, const char *, struct nfs_mount_info *, 1379 struct dentry *(*try_mount) (int, const char *, struct nfs_mount_info *,
1367 struct nfs_subversion *); 1380 struct nfs_subversion *);
1368 int (*getattr) (struct nfs_server *, struct nfs_fh *, 1381 int (*getattr) (struct nfs_server *, struct nfs_fh *,
1369 struct nfs_fattr *); 1382 struct nfs_fattr *, struct nfs4_label *);
1370 int (*setattr) (struct dentry *, struct nfs_fattr *, 1383 int (*setattr) (struct dentry *, struct nfs_fattr *,
1371 struct iattr *); 1384 struct iattr *);
1372 int (*lookup) (struct inode *, struct qstr *, 1385 int (*lookup) (struct inode *, struct qstr *,
1373 struct nfs_fh *, struct nfs_fattr *); 1386 struct nfs_fh *, struct nfs_fattr *,
1387 struct nfs4_label *);
1374 int (*access) (struct inode *, struct nfs_access_entry *); 1388 int (*access) (struct inode *, struct nfs_access_entry *);
1375 int (*readlink)(struct inode *, struct page *, unsigned int, 1389 int (*readlink)(struct inode *, struct page *, unsigned int,
1376 unsigned int); 1390 unsigned int);
diff --git a/include/linux/nmi.h b/include/linux/nmi.h
index db50840e6355..6a45fb583ff1 100644
--- a/include/linux/nmi.h
+++ b/include/linux/nmi.h
@@ -46,7 +46,7 @@ static inline bool trigger_all_cpu_backtrace(void)
46#ifdef CONFIG_LOCKUP_DETECTOR 46#ifdef CONFIG_LOCKUP_DETECTOR
47int hw_nmi_is_cpu_stuck(struct pt_regs *); 47int hw_nmi_is_cpu_stuck(struct pt_regs *);
48u64 hw_nmi_get_sample_period(int watchdog_thresh); 48u64 hw_nmi_get_sample_period(int watchdog_thresh);
49extern int watchdog_enabled; 49extern int watchdog_user_enabled;
50extern int watchdog_thresh; 50extern int watchdog_thresh;
51struct ctl_table; 51struct ctl_table;
52extern int proc_dowatchdog(struct ctl_table *, int , 52extern int proc_dowatchdog(struct ctl_table *, int ,
diff --git a/include/linux/of_device.h b/include/linux/of_device.h
index 901b7435e890..9d27475feec1 100644
--- a/include/linux/of_device.h
+++ b/include/linux/of_device.h
@@ -4,12 +4,12 @@
4#include <linux/platform_device.h> 4#include <linux/platform_device.h>
5#include <linux/of_platform.h> /* temporary until merge */ 5#include <linux/of_platform.h> /* temporary until merge */
6 6
7#ifdef CONFIG_OF_DEVICE
8#include <linux/of.h> 7#include <linux/of.h>
9#include <linux/mod_devicetable.h> 8#include <linux/mod_devicetable.h>
10 9
11struct device; 10struct device;
12 11
12#ifdef CONFIG_OF
13extern const struct of_device_id *of_match_device( 13extern const struct of_device_id *of_match_device(
14 const struct of_device_id *matches, const struct device *dev); 14 const struct of_device_id *matches, const struct device *dev);
15extern void of_device_make_bus_id(struct device *dev); 15extern void of_device_make_bus_id(struct device *dev);
@@ -43,7 +43,7 @@ static inline void of_device_node_put(struct device *dev)
43 of_node_put(dev->of_node); 43 of_node_put(dev->of_node);
44} 44}
45 45
46#else /* CONFIG_OF_DEVICE */ 46#else /* CONFIG_OF */
47 47
48static inline int of_driver_match_device(struct device *dev, 48static inline int of_driver_match_device(struct device *dev,
49 struct device_driver *drv) 49 struct device_driver *drv)
@@ -67,6 +67,6 @@ static inline const struct of_device_id *of_match_device(
67{ 67{
68 return NULL; 68 return NULL;
69} 69}
70#endif /* CONFIG_OF_DEVICE */ 70#endif /* CONFIG_OF */
71 71
72#endif /* _LINUX_OF_DEVICE_H */ 72#endif /* _LINUX_OF_DEVICE_H */
diff --git a/include/linux/of_dma.h b/include/linux/of_dma.h
index 364dda734877..ae36298ba076 100644
--- a/include/linux/of_dma.h
+++ b/include/linux/of_dma.h
@@ -21,7 +21,6 @@ struct device_node;
21struct of_dma { 21struct of_dma {
22 struct list_head of_dma_controllers; 22 struct list_head of_dma_controllers;
23 struct device_node *of_node; 23 struct device_node *of_node;
24 int of_dma_nbcells;
25 struct dma_chan *(*of_dma_xlate) 24 struct dma_chan *(*of_dma_xlate)
26 (struct of_phandle_args *, struct of_dma *); 25 (struct of_phandle_args *, struct of_dma *);
27 void *of_dma_data; 26 void *of_dma_data;
diff --git a/include/linux/of_platform.h b/include/linux/of_platform.h
index 2a93b64a3869..05cb4a928252 100644
--- a/include/linux/of_platform.h
+++ b/include/linux/of_platform.h
@@ -13,8 +13,6 @@
13 13
14#include <linux/device.h> 14#include <linux/device.h>
15#include <linux/mod_devicetable.h> 15#include <linux/mod_devicetable.h>
16
17#ifdef CONFIG_OF_DEVICE
18#include <linux/pm.h> 16#include <linux/pm.h>
19#include <linux/of_device.h> 17#include <linux/of_device.h>
20#include <linux/platform_device.h> 18#include <linux/platform_device.h>
@@ -53,27 +51,6 @@ struct of_dev_auxdata {
53 { .compatible = _compat, .phys_addr = _phys, .name = _name, \ 51 { .compatible = _compat, .phys_addr = _phys, .name = _name, \
54 .platform_data = _pdata } 52 .platform_data = _pdata }
55 53
56/**
57 * of_platform_driver - Legacy of-aware driver for platform devices.
58 *
59 * An of_platform_driver driver is attached to a basic platform_device on
60 * the ibm ebus (ibmebus_bus_type).
61 */
62struct of_platform_driver
63{
64 int (*probe)(struct platform_device* dev,
65 const struct of_device_id *match);
66 int (*remove)(struct platform_device* dev);
67
68 int (*suspend)(struct platform_device* dev, pm_message_t state);
69 int (*resume)(struct platform_device* dev);
70 int (*shutdown)(struct platform_device* dev);
71
72 struct device_driver driver;
73};
74#define to_of_platform_driver(drv) \
75 container_of(drv,struct of_platform_driver, driver)
76
77extern const struct of_device_id of_default_bus_match_table[]; 54extern const struct of_device_id of_default_bus_match_table[];
78 55
79/* Platform drivers register/unregister */ 56/* Platform drivers register/unregister */
@@ -82,7 +59,6 @@ extern struct platform_device *of_device_alloc(struct device_node *np,
82 struct device *parent); 59 struct device *parent);
83extern struct platform_device *of_find_device_by_node(struct device_node *np); 60extern struct platform_device *of_find_device_by_node(struct device_node *np);
84 61
85#ifdef CONFIG_OF_ADDRESS /* device reg helpers depend on OF_ADDRESS */
86/* Platform devices and busses creation */ 62/* Platform devices and busses creation */
87extern struct platform_device *of_platform_device_create(struct device_node *np, 63extern struct platform_device *of_platform_device_create(struct device_node *np,
88 const char *bus_id, 64 const char *bus_id,
@@ -91,17 +67,12 @@ extern struct platform_device *of_platform_device_create(struct device_node *np,
91extern int of_platform_bus_probe(struct device_node *root, 67extern int of_platform_bus_probe(struct device_node *root,
92 const struct of_device_id *matches, 68 const struct of_device_id *matches,
93 struct device *parent); 69 struct device *parent);
70#ifdef CONFIG_OF_ADDRESS
94extern int of_platform_populate(struct device_node *root, 71extern int of_platform_populate(struct device_node *root,
95 const struct of_device_id *matches, 72 const struct of_device_id *matches,
96 const struct of_dev_auxdata *lookup, 73 const struct of_dev_auxdata *lookup,
97 struct device *parent); 74 struct device *parent);
98#endif /* CONFIG_OF_ADDRESS */ 75#else
99
100#endif /* CONFIG_OF_DEVICE */
101
102#if !defined(CONFIG_OF_ADDRESS)
103struct of_dev_auxdata;
104struct device_node;
105static inline int of_platform_populate(struct device_node *root, 76static inline int of_platform_populate(struct device_node *root,
106 const struct of_device_id *matches, 77 const struct of_device_id *matches,
107 const struct of_dev_auxdata *lookup, 78 const struct of_dev_auxdata *lookup,
@@ -109,6 +80,6 @@ static inline int of_platform_populate(struct device_node *root,
109{ 80{
110 return -ENODEV; 81 return -ENODEV;
111} 82}
112#endif /* !CONFIG_OF_ADDRESS */ 83#endif
113 84
114#endif /* _LINUX_OF_PLATFORM_H */ 85#endif /* _LINUX_OF_PLATFORM_H */
diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h
index 8873f82c7baa..c43f6eabad5b 100644
--- a/include/linux/perf_event.h
+++ b/include/linux/perf_event.h
@@ -826,7 +826,7 @@ static inline void perf_restore_debug_store(void) { }
826 */ 826 */
827#define perf_cpu_notifier(fn) \ 827#define perf_cpu_notifier(fn) \
828do { \ 828do { \
829 static struct notifier_block fn##_nb __cpuinitdata = \ 829 static struct notifier_block fn##_nb = \
830 { .notifier_call = fn, .priority = CPU_PRI_PERF }; \ 830 { .notifier_call = fn, .priority = CPU_PRI_PERF }; \
831 unsigned long cpu = smp_processor_id(); \ 831 unsigned long cpu = smp_processor_id(); \
832 unsigned long flags; \ 832 unsigned long flags; \
diff --git a/include/linux/phy.h b/include/linux/phy.h
index 9e11039dd7a3..64ab823f7b74 100644
--- a/include/linux/phy.h
+++ b/include/linux/phy.h
@@ -49,6 +49,7 @@
49 49
50#define PHY_HAS_INTERRUPT 0x00000001 50#define PHY_HAS_INTERRUPT 0x00000001
51#define PHY_HAS_MAGICANEG 0x00000002 51#define PHY_HAS_MAGICANEG 0x00000002
52#define PHY_IS_INTERNAL 0x00000004
52 53
53/* Interface Mode definitions */ 54/* Interface Mode definitions */
54typedef enum { 55typedef enum {
@@ -57,6 +58,7 @@ typedef enum {
57 PHY_INTERFACE_MODE_GMII, 58 PHY_INTERFACE_MODE_GMII,
58 PHY_INTERFACE_MODE_SGMII, 59 PHY_INTERFACE_MODE_SGMII,
59 PHY_INTERFACE_MODE_TBI, 60 PHY_INTERFACE_MODE_TBI,
61 PHY_INTERFACE_MODE_REVMII,
60 PHY_INTERFACE_MODE_RMII, 62 PHY_INTERFACE_MODE_RMII,
61 PHY_INTERFACE_MODE_RGMII, 63 PHY_INTERFACE_MODE_RGMII,
62 PHY_INTERFACE_MODE_RGMII_ID, 64 PHY_INTERFACE_MODE_RGMII_ID,
@@ -261,6 +263,7 @@ struct phy_c45_device_ids {
261 * phy_id: UID for this device found during discovery 263 * phy_id: UID for this device found during discovery
262 * c45_ids: 802.3-c45 Device Identifers if is_c45. 264 * c45_ids: 802.3-c45 Device Identifers if is_c45.
263 * is_c45: Set to true if this phy uses clause 45 addressing. 265 * is_c45: Set to true if this phy uses clause 45 addressing.
266 * is_internal: Set to true if this phy is internal to a MAC.
264 * state: state of the PHY for management purposes 267 * state: state of the PHY for management purposes
265 * dev_flags: Device-specific flags used by the PHY driver. 268 * dev_flags: Device-specific flags used by the PHY driver.
266 * addr: Bus address of PHY 269 * addr: Bus address of PHY
@@ -298,6 +301,7 @@ struct phy_device {
298 301
299 struct phy_c45_device_ids c45_ids; 302 struct phy_c45_device_ids c45_ids;
300 bool is_c45; 303 bool is_c45;
304 bool is_internal;
301 305
302 enum phy_state state; 306 enum phy_state state;
303 307
@@ -508,6 +512,27 @@ static inline int phy_write(struct phy_device *phydev, u32 regnum, u16 val)
508 return mdiobus_write(phydev->bus, phydev->addr, regnum, val); 512 return mdiobus_write(phydev->bus, phydev->addr, regnum, val);
509} 513}
510 514
515/**
516 * phy_interrupt_is_valid - Convenience function for testing a given PHY irq
517 * @phydev: the phy_device struct
518 *
519 * NOTE: must be kept in sync with addition/removal of PHY_POLL and
520 * PHY_IGNORE_INTERRUPT
521 */
522static inline bool phy_interrupt_is_valid(struct phy_device *phydev)
523{
524 return phydev->irq != PHY_POLL && phydev->irq != PHY_IGNORE_INTERRUPT;
525}
526
527/**
528 * phy_is_internal - Convenience function for testing if a PHY is internal
529 * @phydev: the phy_device struct
530 */
531static inline bool phy_is_internal(struct phy_device *phydev)
532{
533 return phydev->is_internal;
534}
535
511struct phy_device *phy_device_create(struct mii_bus *bus, int addr, int phy_id, 536struct phy_device *phy_device_create(struct mii_bus *bus, int addr, int phy_id,
512 bool is_c45, struct phy_c45_device_ids *c45_ids); 537 bool is_c45, struct phy_c45_device_ids *c45_ids);
513struct phy_device *get_phy_device(struct mii_bus *bus, int addr, bool is_c45); 538struct phy_device *get_phy_device(struct mii_bus *bus, int addr, bool is_c45);
@@ -545,6 +570,8 @@ void phy_drivers_unregister(struct phy_driver *drv, int n);
545int phy_driver_register(struct phy_driver *new_driver); 570int phy_driver_register(struct phy_driver *new_driver);
546int phy_drivers_register(struct phy_driver *new_driver, int n); 571int phy_drivers_register(struct phy_driver *new_driver, int n);
547void phy_state_machine(struct work_struct *work); 572void phy_state_machine(struct work_struct *work);
573void phy_change(struct work_struct *work);
574void phy_mac_interrupt(struct phy_device *phydev, int new_link);
548void phy_start_machine(struct phy_device *phydev, 575void phy_start_machine(struct phy_device *phydev,
549 void (*handler)(struct net_device *)); 576 void (*handler)(struct net_device *));
550void phy_stop_machine(struct phy_device *phydev); 577void phy_stop_machine(struct phy_device *phydev);
diff --git a/include/linux/platform_data/brcmfmac-sdio.h b/include/linux/platform_data/brcmfmac-sdio.h
index 1ade657d5fc1..b7174998c24a 100644
--- a/include/linux/platform_data/brcmfmac-sdio.h
+++ b/include/linux/platform_data/brcmfmac-sdio.h
@@ -90,6 +90,10 @@ void __init brcmfmac_init_pdata(void)
90 * oob_irq_nr, oob_irq_flags: the OOB interrupt information. The values are 90 * oob_irq_nr, oob_irq_flags: the OOB interrupt information. The values are
91 * used for registering the irq using request_irq function. 91 * used for registering the irq using request_irq function.
92 * 92 *
93 * broken_sg_support: flag for broken sg list support of SDIO host controller.
94 * Set this to true if the SDIO host controller has higher align requirement
95 * than 32 bytes for each scatterlist item.
96 *
93 * power_on: This function is called by the brcmfmac when the module gets 97 * power_on: This function is called by the brcmfmac when the module gets
94 * loaded. This can be particularly useful for low power devices. The platform 98 * loaded. This can be particularly useful for low power devices. The platform
95 * spcific routine may for example decide to power up the complete device. 99 * spcific routine may for example decide to power up the complete device.
@@ -116,6 +120,7 @@ struct brcmfmac_sdio_platform_data {
116 bool oob_irq_supported; 120 bool oob_irq_supported;
117 unsigned int oob_irq_nr; 121 unsigned int oob_irq_nr;
118 unsigned long oob_irq_flags; 122 unsigned long oob_irq_flags;
123 bool broken_sg_support;
119 void (*power_on)(void); 124 void (*power_on)(void);
120 void (*power_off)(void); 125 void (*power_off)(void);
121 void (*reset)(void); 126 void (*reset)(void);
diff --git a/include/linux/platform_data/cyttsp4.h b/include/linux/platform_data/cyttsp4.h
new file mode 100644
index 000000000000..6eba54aff1dc
--- /dev/null
+++ b/include/linux/platform_data/cyttsp4.h
@@ -0,0 +1,76 @@
1/*
2 * Header file for:
3 * Cypress TrueTouch(TM) Standard Product (TTSP) touchscreen drivers.
4 * For use with Cypress Txx3xx parts.
5 * Supported parts include:
6 * CY8CTST341
7 * CY8CTMA340
8 *
9 * Copyright (C) 2009, 2010, 2011 Cypress Semiconductor, Inc.
10 * Copyright (C) 2012 Javier Martinez Canillas <javier@dowhile0.org>
11 *
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * version 2, and only version 2, as published by the
15 * Free Software Foundation.
16 *
17 * This program is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
21 *
22 * You should have received a copy of the GNU General Public License along
23 * with this program; if not, write to the Free Software Foundation, Inc.,
24 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
25 *
26 * Contact Cypress Semiconductor at www.cypress.com (kev@cypress.com)
27 *
28 */
29#ifndef _CYTTSP4_H_
30#define _CYTTSP4_H_
31
32#define CYTTSP4_MT_NAME "cyttsp4_mt"
33#define CYTTSP4_I2C_NAME "cyttsp4_i2c_adapter"
34#define CYTTSP4_SPI_NAME "cyttsp4_spi_adapter"
35
36#define CY_TOUCH_SETTINGS_MAX 32
37
38struct touch_framework {
39 const uint16_t *abs;
40 uint8_t size;
41 uint8_t enable_vkeys;
42} __packed;
43
44struct cyttsp4_mt_platform_data {
45 struct touch_framework *frmwrk;
46 unsigned short flags;
47 char const *inp_dev_name;
48};
49
50struct touch_settings {
51 const uint8_t *data;
52 uint32_t size;
53 uint8_t tag;
54} __packed;
55
56struct cyttsp4_core_platform_data {
57 int irq_gpio;
58 int rst_gpio;
59 int level_irq_udelay;
60 int (*xres)(struct cyttsp4_core_platform_data *pdata,
61 struct device *dev);
62 int (*init)(struct cyttsp4_core_platform_data *pdata,
63 int on, struct device *dev);
64 int (*power)(struct cyttsp4_core_platform_data *pdata,
65 int on, struct device *dev, atomic_t *ignore_irq);
66 int (*irq_stat)(struct cyttsp4_core_platform_data *pdata,
67 struct device *dev);
68 struct touch_settings *sett[CY_TOUCH_SETTINGS_MAX];
69};
70
71struct cyttsp4_platform_data {
72 struct cyttsp4_core_platform_data *core_pdata;
73 struct cyttsp4_mt_platform_data *mt_pdata;
74};
75
76#endif /* _CYTTSP4_H_ */
diff --git a/include/linux/platform_data/dma-atmel.h b/include/linux/platform_data/dma-atmel.h
index cab0997be3de..e95f19c65873 100644
--- a/include/linux/platform_data/dma-atmel.h
+++ b/include/linux/platform_data/dma-atmel.h
@@ -35,16 +35,20 @@ struct at_dma_slave {
35 35
36 36
37/* Platform-configurable bits in CFG */ 37/* Platform-configurable bits in CFG */
38#define ATC_PER_MSB(h) ((0x30U & (h)) >> 4) /* Extract most significant bits of a handshaking identifier */
39
38#define ATC_SRC_PER(h) (0xFU & (h)) /* Channel src rq associated with periph handshaking ifc h */ 40#define ATC_SRC_PER(h) (0xFU & (h)) /* Channel src rq associated with periph handshaking ifc h */
39#define ATC_DST_PER(h) ((0xFU & (h)) << 4) /* Channel dst rq associated with periph handshaking ifc h */ 41#define ATC_DST_PER(h) ((0xFU & (h)) << 4) /* Channel dst rq associated with periph handshaking ifc h */
40#define ATC_SRC_REP (0x1 << 8) /* Source Replay Mod */ 42#define ATC_SRC_REP (0x1 << 8) /* Source Replay Mod */
41#define ATC_SRC_H2SEL (0x1 << 9) /* Source Handshaking Mod */ 43#define ATC_SRC_H2SEL (0x1 << 9) /* Source Handshaking Mod */
42#define ATC_SRC_H2SEL_SW (0x0 << 9) 44#define ATC_SRC_H2SEL_SW (0x0 << 9)
43#define ATC_SRC_H2SEL_HW (0x1 << 9) 45#define ATC_SRC_H2SEL_HW (0x1 << 9)
46#define ATC_SRC_PER_MSB(h) (ATC_PER_MSB(h) << 10) /* Channel src rq (most significant bits) */
44#define ATC_DST_REP (0x1 << 12) /* Destination Replay Mod */ 47#define ATC_DST_REP (0x1 << 12) /* Destination Replay Mod */
45#define ATC_DST_H2SEL (0x1 << 13) /* Destination Handshaking Mod */ 48#define ATC_DST_H2SEL (0x1 << 13) /* Destination Handshaking Mod */
46#define ATC_DST_H2SEL_SW (0x0 << 13) 49#define ATC_DST_H2SEL_SW (0x0 << 13)
47#define ATC_DST_H2SEL_HW (0x1 << 13) 50#define ATC_DST_H2SEL_HW (0x1 << 13)
51#define ATC_DST_PER_MSB(h) (ATC_PER_MSB(h) << 14) /* Channel dst rq (most significant bits) */
48#define ATC_SOD (0x1 << 16) /* Stop On Done */ 52#define ATC_SOD (0x1 << 16) /* Stop On Done */
49#define ATC_LOCK_IF (0x1 << 20) /* Interface Lock */ 53#define ATC_LOCK_IF (0x1 << 20) /* Interface Lock */
50#define ATC_LOCK_B (0x1 << 21) /* AHB Bus Lock */ 54#define ATC_LOCK_B (0x1 << 21) /* AHB Bus Lock */
diff --git a/include/linux/platform_data/dma-imx.h b/include/linux/platform_data/dma-imx.h
index f6d30cc1cb77..beac6b8b6a7b 100644
--- a/include/linux/platform_data/dma-imx.h
+++ b/include/linux/platform_data/dma-imx.h
@@ -60,10 +60,8 @@ static inline int imx_dma_is_ipu(struct dma_chan *chan)
60 60
61static inline int imx_dma_is_general_purpose(struct dma_chan *chan) 61static inline int imx_dma_is_general_purpose(struct dma_chan *chan)
62{ 62{
63 return strstr(dev_name(chan->device->dev), "sdma") || 63 return !strcmp(chan->device->dev->driver->name, "imx-sdma") ||
64 !strcmp(dev_name(chan->device->dev), "imx1-dma") || 64 !strcmp(chan->device->dev->driver->name, "imx-dma");
65 !strcmp(dev_name(chan->device->dev), "imx21-dma") ||
66 !strcmp(dev_name(chan->device->dev), "imx27-dma");
67} 65}
68 66
69#endif 67#endif
diff --git a/include/linux/platform_data/keypad-pxa27x.h b/include/linux/platform_data/keypad-pxa27x.h
index 5ce8d5e6ea51..24625569d16d 100644
--- a/include/linux/platform_data/keypad-pxa27x.h
+++ b/include/linux/platform_data/keypad-pxa27x.h
@@ -36,10 +36,9 @@
36struct pxa27x_keypad_platform_data { 36struct pxa27x_keypad_platform_data {
37 37
38 /* code map for the matrix keys */ 38 /* code map for the matrix keys */
39 const struct matrix_keymap_data *matrix_keymap_data;
39 unsigned int matrix_key_rows; 40 unsigned int matrix_key_rows;
40 unsigned int matrix_key_cols; 41 unsigned int matrix_key_cols;
41 unsigned int *matrix_key_map;
42 int matrix_key_map_size;
43 42
44 /* direct keys */ 43 /* direct keys */
45 int direct_key_num; 44 int direct_key_num;
diff --git a/include/linux/platform_data/mmc-esdhc-imx.h b/include/linux/platform_data/mmc-esdhc-imx.h
index b4a0521ce411..d44912d81578 100644
--- a/include/linux/platform_data/mmc-esdhc-imx.h
+++ b/include/linux/platform_data/mmc-esdhc-imx.h
@@ -40,5 +40,6 @@ struct esdhc_platform_data {
40 enum wp_types wp_type; 40 enum wp_types wp_type;
41 enum cd_types cd_type; 41 enum cd_types cd_type;
42 int max_bus_width; 42 int max_bus_width;
43 unsigned int f_max;
43}; 44};
44#endif /* __ASM_ARCH_IMX_ESDHC_H */ 45#endif /* __ASM_ARCH_IMX_ESDHC_H */
diff --git a/include/linux/platform_data/mmc-pxamci.h b/include/linux/platform_data/mmc-pxamci.h
index 9eb515bb799d..1706b3597ce0 100644
--- a/include/linux/platform_data/mmc-pxamci.h
+++ b/include/linux/platform_data/mmc-pxamci.h
@@ -12,7 +12,7 @@ struct pxamci_platform_data {
12 unsigned long detect_delay_ms; /* delay in millisecond before detecting cards after interrupt */ 12 unsigned long detect_delay_ms; /* delay in millisecond before detecting cards after interrupt */
13 int (*init)(struct device *, irq_handler_t , void *); 13 int (*init)(struct device *, irq_handler_t , void *);
14 int (*get_ro)(struct device *); 14 int (*get_ro)(struct device *);
15 void (*setpower)(struct device *, unsigned int); 15 int (*setpower)(struct device *, unsigned int);
16 void (*exit)(struct device *, void *); 16 void (*exit)(struct device *, void *);
17 int gpio_card_detect; /* gpio detecting card insertion */ 17 int gpio_card_detect; /* gpio detecting card insertion */
18 int gpio_card_ro; /* gpio detecting read only toggle */ 18 int gpio_card_ro; /* gpio detecting read only toggle */
diff --git a/include/linux/platform_data/net-cw1200.h b/include/linux/platform_data/net-cw1200.h
new file mode 100644
index 000000000000..c6fbc3ce4ab0
--- /dev/null
+++ b/include/linux/platform_data/net-cw1200.h
@@ -0,0 +1,81 @@
1/*
2 * Copyright (C) ST-Ericsson SA 2011
3 *
4 * Author: Dmitry Tarnyagin <dmitry.tarnyagin@stericsson.com>
5 * License terms: GNU General Public License (GPL) version 2
6 */
7
8#ifndef CW1200_PLAT_H_INCLUDED
9#define CW1200_PLAT_H_INCLUDED
10
11struct cw1200_platform_data_spi {
12 u8 spi_bits_per_word; /* REQUIRED */
13 u16 ref_clk; /* REQUIRED (in KHz) */
14
15 /* All others are optional */
16 bool have_5ghz;
17 int reset; /* GPIO to RSTn signal (0 disables) */
18 int powerup; /* GPIO to POWERUP signal (0 disables) */
19 int (*power_ctrl)(const struct cw1200_platform_data_spi *pdata,
20 bool enable); /* Control 3v3 / 1v8 supply */
21 int (*clk_ctrl)(const struct cw1200_platform_data_spi *pdata,
22 bool enable); /* Control CLK32K */
23 const u8 *macaddr; /* if NULL, use cw1200_mac_template module parameter */
24 const char *sdd_file; /* if NULL, will use default for detected hw type */
25};
26
27struct cw1200_platform_data_sdio {
28 u16 ref_clk; /* REQUIRED (in KHz) */
29
30 /* All others are optional */
31 bool have_5ghz;
32 bool no_nptb; /* SDIO hardware does not support non-power-of-2-blocksizes */
33 int reset; /* GPIO to RSTn signal (0 disables) */
34 int powerup; /* GPIO to POWERUP signal (0 disables) */
35 int irq; /* IRQ line or 0 to use SDIO IRQ */
36 int (*power_ctrl)(const struct cw1200_platform_data_sdio *pdata,
37 bool enable); /* Control 3v3 / 1v8 supply */
38 int (*clk_ctrl)(const struct cw1200_platform_data_sdio *pdata,
39 bool enable); /* Control CLK32K */
40 const u8 *macaddr; /* if NULL, use cw1200_mac_template module parameter */
41 const char *sdd_file; /* if NULL, will use default for detected hw type */
42};
43
44
45/* An example of SPI support in your board setup file:
46
47 static struct cw1200_platform_data_spi cw1200_platform_data = {
48 .ref_clk = 38400,
49 .spi_bits_per_word = 16,
50 .reset = GPIO_RF_RESET,
51 .powerup = GPIO_RF_POWERUP,
52 .macaddr = wifi_mac_addr,
53 .sdd_file = "sdd_sagrad_1091_1098.bin",
54 };
55 static struct spi_board_info myboard_spi_devices[] __initdata = {
56 {
57 .modalias = "cw1200_wlan_spi",
58 .max_speed_hz = 52000000,
59 .bus_num = 0,
60 .irq = WIFI_IRQ,
61 .platform_data = &cw1200_platform_data,
62 .chip_select = 0,
63 },
64 };
65
66 */
67
68/* An example of SDIO support in your board setup file:
69
70 static struct cw1200_platform_data_sdio my_cw1200_platform_data = {
71 .ref_clk = 38400,
72 .have_5ghz = false,
73 .sdd_file = "sdd_myplatform.bin",
74 };
75 cw1200_sdio_set_platform_data(&my_cw1200_platform_data);
76
77 */
78
79void __init cw1200_sdio_set_platform_data(struct cw1200_platform_data_sdio *pdata);
80
81#endif /* CW1200_PLAT_H_INCLUDED */
diff --git a/include/linux/platform_data/pwm-renesas-tpu.h b/include/linux/platform_data/pwm-renesas-tpu.h
new file mode 100644
index 000000000000..a7220b10ddab
--- /dev/null
+++ b/include/linux/platform_data/pwm-renesas-tpu.h
@@ -0,0 +1,16 @@
1#ifndef __PWM_RENESAS_TPU_H__
2#define __PWM_RENESAS_TPU_H__
3
4#include <linux/pwm.h>
5
6#define TPU_CHANNEL_MAX 4
7
8struct tpu_pwm_channel_data {
9 enum pwm_polarity polarity;
10};
11
12struct tpu_pwm_platform_data {
13 struct tpu_pwm_channel_data channels[TPU_CHANNEL_MAX];
14};
15
16#endif /* __PWM_RENESAS_TPU_H__ */
diff --git a/include/linux/platform_data/rcar-du.h b/include/linux/platform_data/rcar-du.h
new file mode 100644
index 000000000000..80587fdbba3e
--- /dev/null
+++ b/include/linux/platform_data/rcar-du.h
@@ -0,0 +1,54 @@
1/*
2 * rcar_du.h -- R-Car Display Unit DRM driver
3 *
4 * Copyright (C) 2013 Renesas Corporation
5 *
6 * Contact: Laurent Pinchart (laurent.pinchart@ideasonboard.com)
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 */
13
14#ifndef __RCAR_DU_H__
15#define __RCAR_DU_H__
16
17#include <drm/drm_mode.h>
18
19enum rcar_du_encoder_type {
20 RCAR_DU_ENCODER_UNUSED = 0,
21 RCAR_DU_ENCODER_VGA,
22 RCAR_DU_ENCODER_LVDS,
23};
24
25struct rcar_du_panel_data {
26 unsigned int width_mm; /* Panel width in mm */
27 unsigned int height_mm; /* Panel height in mm */
28 struct drm_mode_modeinfo mode;
29};
30
31struct rcar_du_encoder_lvds_data {
32 struct rcar_du_panel_data panel;
33};
34
35struct rcar_du_encoder_vga_data {
36 /* TODO: Add DDC information for EDID retrieval */
37};
38
39struct rcar_du_encoder_data {
40 enum rcar_du_encoder_type encoder;
41 unsigned int output;
42
43 union {
44 struct rcar_du_encoder_lvds_data lvds;
45 struct rcar_du_encoder_vga_data vga;
46 } u;
47};
48
49struct rcar_du_platform_data {
50 struct rcar_du_encoder_data *encoders;
51 unsigned int num_encoders;
52};
53
54#endif /* __RCAR_DU_H__ */
diff --git a/include/linux/platform_data/remoteproc-omap.h b/include/linux/platform_data/remoteproc-omap.h
index 3c1c6444ec4b..bfbd12b41162 100644
--- a/include/linux/platform_data/remoteproc-omap.h
+++ b/include/linux/platform_data/remoteproc-omap.h
@@ -50,7 +50,7 @@ void __init omap_rproc_reserve_cma(void);
50 50
51#else 51#else
52 52
53void __init omap_rproc_reserve_cma(void) 53static inline void __init omap_rproc_reserve_cma(void)
54{ 54{
55} 55}
56 56
diff --git a/include/linux/platform_data/ti_am335x_adc.h b/include/linux/platform_data/ti_am335x_adc.h
deleted file mode 100644
index e41d5834cb84..000000000000
--- a/include/linux/platform_data/ti_am335x_adc.h
+++ /dev/null
@@ -1,14 +0,0 @@
1#ifndef __LINUX_TI_AM335X_ADC_H
2#define __LINUX_TI_AM335X_ADC_H
3
4/**
5 * struct adc_data ADC Input information
6 * @adc_channels: Number of analog inputs
7 * available for ADC.
8 */
9
10struct adc_data {
11 unsigned int adc_channels;
12};
13
14#endif
diff --git a/include/linux/platform_device.h b/include/linux/platform_device.h
index cd46ee58b9dc..ce8e4ffd78c7 100644
--- a/include/linux/platform_device.h
+++ b/include/linux/platform_device.h
@@ -180,6 +180,9 @@ struct platform_driver {
180 const struct platform_device_id *id_table; 180 const struct platform_device_id *id_table;
181}; 181};
182 182
183#define to_platform_driver(drv) (container_of((drv), struct platform_driver, \
184 driver))
185
183/* 186/*
184 * use a macro to avoid include chaining to get THIS_MODULE 187 * use a macro to avoid include chaining to get THIS_MODULE
185 */ 188 */
diff --git a/include/linux/pm_wakeup.h b/include/linux/pm_wakeup.h
index 569781faa504..a0f70808d7f4 100644
--- a/include/linux/pm_wakeup.h
+++ b/include/linux/pm_wakeup.h
@@ -36,8 +36,8 @@
36 * @last_time: Monotonic clock when the wakeup source's was touched last time. 36 * @last_time: Monotonic clock when the wakeup source's was touched last time.
37 * @prevent_sleep_time: Total time this source has been preventing autosleep. 37 * @prevent_sleep_time: Total time this source has been preventing autosleep.
38 * @event_count: Number of signaled wakeup events. 38 * @event_count: Number of signaled wakeup events.
39 * @active_count: Number of times the wakeup sorce was activated. 39 * @active_count: Number of times the wakeup source was activated.
40 * @relax_count: Number of times the wakeup sorce was deactivated. 40 * @relax_count: Number of times the wakeup source was deactivated.
41 * @expire_count: Number of times the wakeup source's timeout has expired. 41 * @expire_count: Number of times the wakeup source's timeout has expired.
42 * @wakeup_count: Number of times the wakeup source might abort suspend. 42 * @wakeup_count: Number of times the wakeup source might abort suspend.
43 * @active: Status of the wakeup source. 43 * @active: Status of the wakeup source.
diff --git a/include/linux/posix-timers.h b/include/linux/posix-timers.h
index 7794d75ed155..907f3fd191ac 100644
--- a/include/linux/posix-timers.h
+++ b/include/linux/posix-timers.h
@@ -7,14 +7,20 @@
7#include <linux/timex.h> 7#include <linux/timex.h>
8#include <linux/alarmtimer.h> 8#include <linux/alarmtimer.h>
9 9
10union cpu_time_count { 10
11 cputime_t cpu; 11static inline unsigned long long cputime_to_expires(cputime_t expires)
12 unsigned long long sched; 12{
13}; 13 return (__force unsigned long long)expires;
14}
15
16static inline cputime_t expires_to_cputime(unsigned long long expires)
17{
18 return (__force cputime_t)expires;
19}
14 20
15struct cpu_timer_list { 21struct cpu_timer_list {
16 struct list_head entry; 22 struct list_head entry;
17 union cpu_time_count expires, incr; 23 unsigned long long expires, incr;
18 struct task_struct *task; 24 struct task_struct *task;
19 int firing; 25 int firing;
20}; 26};
diff --git a/include/linux/power_supply.h b/include/linux/power_supply.h
index 3828cefb4f65..804b90643a85 100644
--- a/include/linux/power_supply.h
+++ b/include/linux/power_supply.h
@@ -162,6 +162,8 @@ union power_supply_propval {
162 const char *strval; 162 const char *strval;
163}; 163};
164 164
165struct device_node;
166
165struct power_supply { 167struct power_supply {
166 const char *name; 168 const char *name;
167 enum power_supply_type type; 169 enum power_supply_type type;
@@ -173,9 +175,7 @@ struct power_supply {
173 175
174 char **supplied_from; 176 char **supplied_from;
175 size_t num_supplies; 177 size_t num_supplies;
176#ifdef CONFIG_OF
177 struct device_node *of_node; 178 struct device_node *of_node;
178#endif
179 179
180 int (*get_property)(struct power_supply *psy, 180 int (*get_property)(struct power_supply *psy,
181 enum power_supply_property psp, 181 enum power_supply_property psp,
diff --git a/include/linux/ptrace.h b/include/linux/ptrace.h
index 89573a33ab3c..07d0df6bf768 100644
--- a/include/linux/ptrace.h
+++ b/include/linux/ptrace.h
@@ -142,9 +142,6 @@ static inline void ptrace_init_task(struct task_struct *child, bool ptrace)
142{ 142{
143 INIT_LIST_HEAD(&child->ptrace_entry); 143 INIT_LIST_HEAD(&child->ptrace_entry);
144 INIT_LIST_HEAD(&child->ptraced); 144 INIT_LIST_HEAD(&child->ptraced);
145#ifdef CONFIG_HAVE_HW_BREAKPOINT
146 atomic_set(&child->ptrace_bp_refcnt, 1);
147#endif
148 child->jobctl = 0; 145 child->jobctl = 0;
149 child->ptrace = 0; 146 child->ptrace = 0;
150 child->parent = child->real_parent; 147 child->parent = child->real_parent;
@@ -351,11 +348,4 @@ extern int task_current_syscall(struct task_struct *target, long *callno,
351 unsigned long args[6], unsigned int maxargs, 348 unsigned long args[6], unsigned int maxargs,
352 unsigned long *sp, unsigned long *pc); 349 unsigned long *sp, unsigned long *pc);
353 350
354#ifdef CONFIG_HAVE_HW_BREAKPOINT
355extern int ptrace_get_breakpoints(struct task_struct *tsk);
356extern void ptrace_put_breakpoints(struct task_struct *tsk);
357#else
358static inline void ptrace_put_breakpoints(struct task_struct *tsk) { }
359#endif /* CONFIG_HAVE_HW_BREAKPOINT */
360
361#endif 351#endif
diff --git a/include/linux/pvclock_gtod.h b/include/linux/pvclock_gtod.h
index 0ca75825b60d..a71d2dbd3610 100644
--- a/include/linux/pvclock_gtod.h
+++ b/include/linux/pvclock_gtod.h
@@ -3,6 +3,13 @@
3 3
4#include <linux/notifier.h> 4#include <linux/notifier.h>
5 5
6/*
7 * The pvclock gtod notifier is called when the system time is updated
8 * and is used to keep guest time synchronized with host time.
9 *
10 * The 'action' parameter in the notifier function is false (0), or
11 * true (non-zero) if system time was stepped.
12 */
6extern int pvclock_gtod_register_notifier(struct notifier_block *nb); 13extern int pvclock_gtod_register_notifier(struct notifier_block *nb);
7extern int pvclock_gtod_unregister_notifier(struct notifier_block *nb); 14extern int pvclock_gtod_unregister_notifier(struct notifier_block *nb);
8 15
diff --git a/include/linux/pwm.h b/include/linux/pwm.h
index a4df2042b79c..f0feafd184a0 100644
--- a/include/linux/pwm.h
+++ b/include/linux/pwm.h
@@ -76,6 +76,7 @@ enum pwm_polarity {
76enum { 76enum {
77 PWMF_REQUESTED = 1 << 0, 77 PWMF_REQUESTED = 1 << 0,
78 PWMF_ENABLED = 1 << 1, 78 PWMF_ENABLED = 1 << 1,
79 PWMF_EXPORTED = 1 << 2,
79}; 80};
80 81
81struct pwm_device { 82struct pwm_device {
@@ -86,7 +87,9 @@ struct pwm_device {
86 struct pwm_chip *chip; 87 struct pwm_chip *chip;
87 void *chip_data; 88 void *chip_data;
88 89
89 unsigned int period; /* in nanoseconds */ 90 unsigned int period; /* in nanoseconds */
91 unsigned int duty_cycle; /* in nanoseconds */
92 enum pwm_polarity polarity;
90}; 93};
91 94
92static inline void pwm_set_period(struct pwm_device *pwm, unsigned int period) 95static inline void pwm_set_period(struct pwm_device *pwm, unsigned int period)
@@ -100,6 +103,17 @@ static inline unsigned int pwm_get_period(struct pwm_device *pwm)
100 return pwm ? pwm->period : 0; 103 return pwm ? pwm->period : 0;
101} 104}
102 105
106static inline void pwm_set_duty_cycle(struct pwm_device *pwm, unsigned int duty)
107{
108 if (pwm)
109 pwm->duty_cycle = duty;
110}
111
112static inline unsigned int pwm_get_duty_cycle(struct pwm_device *pwm)
113{
114 return pwm ? pwm->duty_cycle : 0;
115}
116
103/* 117/*
104 * pwm_set_polarity - configure the polarity of a PWM signal 118 * pwm_set_polarity - configure the polarity of a PWM signal
105 */ 119 */
@@ -278,4 +292,17 @@ static inline void pwm_add_table(struct pwm_lookup *table, size_t num)
278} 292}
279#endif 293#endif
280 294
295#ifdef CONFIG_PWM_SYSFS
296void pwmchip_sysfs_export(struct pwm_chip *chip);
297void pwmchip_sysfs_unexport(struct pwm_chip *chip);
298#else
299static inline void pwmchip_sysfs_export(struct pwm_chip *chip)
300{
301}
302
303static inline void pwmchip_sysfs_unexport(struct pwm_chip *chip)
304{
305}
306#endif /* CONFIG_PWM_SYSFS */
307
281#endif /* __LINUX_PWM_H */ 308#endif /* __LINUX_PWM_H */
diff --git a/include/linux/reboot.h b/include/linux/reboot.h
index 23b36304cd88..8e00f9f6f963 100644
--- a/include/linux/reboot.h
+++ b/include/linux/reboot.h
@@ -10,6 +10,31 @@
10#define SYS_HALT 0x0002 /* Notify of system halt */ 10#define SYS_HALT 0x0002 /* Notify of system halt */
11#define SYS_POWER_OFF 0x0003 /* Notify of system power off */ 11#define SYS_POWER_OFF 0x0003 /* Notify of system power off */
12 12
13enum reboot_mode {
14 REBOOT_COLD = 0,
15 REBOOT_WARM,
16 REBOOT_HARD,
17 REBOOT_SOFT,
18 REBOOT_GPIO,
19};
20extern enum reboot_mode reboot_mode;
21
22enum reboot_type {
23 BOOT_TRIPLE = 't',
24 BOOT_KBD = 'k',
25 BOOT_BIOS = 'b',
26 BOOT_ACPI = 'a',
27 BOOT_EFI = 'e',
28 BOOT_CF9 = 'p',
29 BOOT_CF9_COND = 'q',
30};
31extern enum reboot_type reboot_type;
32
33extern int reboot_default;
34extern int reboot_cpu;
35extern int reboot_force;
36
37
13extern int register_reboot_notifier(struct notifier_block *); 38extern int register_reboot_notifier(struct notifier_block *);
14extern int unregister_reboot_notifier(struct notifier_block *); 39extern int unregister_reboot_notifier(struct notifier_block *);
15 40
@@ -26,7 +51,7 @@ extern void machine_shutdown(void);
26struct pt_regs; 51struct pt_regs;
27extern void machine_crash_shutdown(struct pt_regs *); 52extern void machine_crash_shutdown(struct pt_regs *);
28 53
29/* 54/*
30 * Architecture independent implemenations of sys_reboot commands. 55 * Architecture independent implemenations of sys_reboot commands.
31 */ 56 */
32 57
diff --git a/include/linux/regmap.h b/include/linux/regmap.h
index 75981d0b57dc..580a5320cc96 100644
--- a/include/linux/regmap.h
+++ b/include/linux/regmap.h
@@ -15,6 +15,7 @@
15 15
16#include <linux/list.h> 16#include <linux/list.h>
17#include <linux/rbtree.h> 17#include <linux/rbtree.h>
18#include <linux/err.h>
18 19
19struct module; 20struct module;
20struct device; 21struct device;
diff --git a/include/linux/reservation.h b/include/linux/reservation.h
new file mode 100644
index 000000000000..813dae960ebd
--- /dev/null
+++ b/include/linux/reservation.h
@@ -0,0 +1,62 @@
1/*
2 * Header file for reservations for dma-buf and ttm
3 *
4 * Copyright(C) 2011 Linaro Limited. All rights reserved.
5 * Copyright (C) 2012-2013 Canonical Ltd
6 * Copyright (C) 2012 Texas Instruments
7 *
8 * Authors:
9 * Rob Clark <rob.clark@linaro.org>
10 * Maarten Lankhorst <maarten.lankhorst@canonical.com>
11 * Thomas Hellstrom <thellstrom-at-vmware-dot-com>
12 *
13 * Based on bo.c which bears the following copyright notice,
14 * but is dual licensed:
15 *
16 * Copyright (c) 2006-2009 VMware, Inc., Palo Alto, CA., USA
17 * All Rights Reserved.
18 *
19 * Permission is hereby granted, free of charge, to any person obtaining a
20 * copy of this software and associated documentation files (the
21 * "Software"), to deal in the Software without restriction, including
22 * without limitation the rights to use, copy, modify, merge, publish,
23 * distribute, sub license, and/or sell copies of the Software, and to
24 * permit persons to whom the Software is furnished to do so, subject to
25 * the following conditions:
26 *
27 * The above copyright notice and this permission notice (including the
28 * next paragraph) shall be included in all copies or substantial portions
29 * of the Software.
30 *
31 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
32 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
33 * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
34 * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM,
35 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
36 * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
37 * USE OR OTHER DEALINGS IN THE SOFTWARE.
38 */
39#ifndef _LINUX_RESERVATION_H
40#define _LINUX_RESERVATION_H
41
42#include <linux/ww_mutex.h>
43
44extern struct ww_class reservation_ww_class;
45
46struct reservation_object {
47 struct ww_mutex lock;
48};
49
50static inline void
51reservation_object_init(struct reservation_object *obj)
52{
53 ww_mutex_init(&obj->lock, &reservation_ww_class);
54}
55
56static inline void
57reservation_object_fini(struct reservation_object *obj)
58{
59 ww_mutex_destroy(&obj->lock);
60}
61
62#endif /* _LINUX_RESERVATION_H */
diff --git a/include/linux/scatterlist.h b/include/linux/scatterlist.h
index 26806775b11b..adae88f5b0ab 100644
--- a/include/linux/scatterlist.h
+++ b/include/linux/scatterlist.h
@@ -244,6 +244,11 @@ size_t sg_copy_from_buffer(struct scatterlist *sgl, unsigned int nents,
244size_t sg_copy_to_buffer(struct scatterlist *sgl, unsigned int nents, 244size_t sg_copy_to_buffer(struct scatterlist *sgl, unsigned int nents,
245 void *buf, size_t buflen); 245 void *buf, size_t buflen);
246 246
247size_t sg_pcopy_from_buffer(struct scatterlist *sgl, unsigned int nents,
248 void *buf, size_t buflen, off_t skip);
249size_t sg_pcopy_to_buffer(struct scatterlist *sgl, unsigned int nents,
250 void *buf, size_t buflen, off_t skip);
251
247/* 252/*
248 * Maximum number of entries that will be allocated in one piece, if 253 * Maximum number of entries that will be allocated in one piece, if
249 * a list larger than this is required then chaining will be utilized. 254 * a list larger than this is required then chaining will be utilized.
diff --git a/include/linux/sched.h b/include/linux/sched.h
index cdd5407b37e2..d722490da030 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -322,8 +322,6 @@ extern unsigned long
322arch_get_unmapped_area_topdown(struct file *filp, unsigned long addr, 322arch_get_unmapped_area_topdown(struct file *filp, unsigned long addr,
323 unsigned long len, unsigned long pgoff, 323 unsigned long len, unsigned long pgoff,
324 unsigned long flags); 324 unsigned long flags);
325extern void arch_unmap_area(struct mm_struct *, unsigned long);
326extern void arch_unmap_area_topdown(struct mm_struct *, unsigned long);
327#else 325#else
328static inline void arch_pick_mmap_layout(struct mm_struct *mm) {} 326static inline void arch_pick_mmap_layout(struct mm_struct *mm) {}
329#endif 327#endif
@@ -1401,9 +1399,6 @@ struct task_struct {
1401 } memcg_batch; 1399 } memcg_batch;
1402 unsigned int memcg_kmem_skip_account; 1400 unsigned int memcg_kmem_skip_account;
1403#endif 1401#endif
1404#ifdef CONFIG_HAVE_HW_BREAKPOINT
1405 atomic_t ptrace_bp_refcnt;
1406#endif
1407#ifdef CONFIG_UPROBES 1402#ifdef CONFIG_UPROBES
1408 struct uprobe_task *utask; 1403 struct uprobe_task *utask;
1409#endif 1404#endif
@@ -1633,6 +1628,7 @@ extern void thread_group_cputime_adjusted(struct task_struct *p, cputime_t *ut,
1633#define PF_MEMPOLICY 0x10000000 /* Non-default NUMA mempolicy */ 1628#define PF_MEMPOLICY 0x10000000 /* Non-default NUMA mempolicy */
1634#define PF_MUTEX_TESTER 0x20000000 /* Thread belongs to the rt mutex tester */ 1629#define PF_MUTEX_TESTER 0x20000000 /* Thread belongs to the rt mutex tester */
1635#define PF_FREEZER_SKIP 0x40000000 /* Freezer should not count it as freezable */ 1630#define PF_FREEZER_SKIP 0x40000000 /* Freezer should not count it as freezable */
1631#define PF_SUSPEND_TASK 0x80000000 /* this thread called freeze_processes and should not be frozen */
1636 1632
1637/* 1633/*
1638 * Only the _current_ task can read/write to tsk->flags, but other 1634 * Only the _current_ task can read/write to tsk->flags, but other
@@ -2437,6 +2433,15 @@ extern int __cond_resched_softirq(void);
2437 __cond_resched_softirq(); \ 2433 __cond_resched_softirq(); \
2438}) 2434})
2439 2435
2436static inline void cond_resched_rcu(void)
2437{
2438#if defined(CONFIG_DEBUG_ATOMIC_SLEEP) || !defined(CONFIG_PREEMPT_RCU)
2439 rcu_read_unlock();
2440 cond_resched();
2441 rcu_read_lock();
2442#endif
2443}
2444
2440/* 2445/*
2441 * Does a critical section need to be broken due to another 2446 * Does a critical section need to be broken due to another
2442 * task waiting?: (technically does not depend on CONFIG_PREEMPT, 2447 * task waiting?: (technically does not depend on CONFIG_PREEMPT,
diff --git a/include/linux/sched_clock.h b/include/linux/sched_clock.h
new file mode 100644
index 000000000000..fa7922c80a41
--- /dev/null
+++ b/include/linux/sched_clock.h
@@ -0,0 +1,21 @@
1/*
2 * sched_clock.h: support for extending counters to full 64-bit ns counter
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 */
8#ifndef LINUX_SCHED_CLOCK
9#define LINUX_SCHED_CLOCK
10
11#ifdef CONFIG_GENERIC_SCHED_CLOCK
12extern void sched_clock_postinit(void);
13#else
14static inline void sched_clock_postinit(void) { }
15#endif
16
17extern void setup_sched_clock(u32 (*read)(void), int bits, unsigned long rate);
18
19extern unsigned long long (*sched_clock_func)(void);
20
21#endif
diff --git a/include/linux/security.h b/include/linux/security.h
index 40560f41e3d5..7ce53ae1266b 100644
--- a/include/linux/security.h
+++ b/include/linux/security.h
@@ -26,6 +26,7 @@
26#include <linux/capability.h> 26#include <linux/capability.h>
27#include <linux/slab.h> 27#include <linux/slab.h>
28#include <linux/err.h> 28#include <linux/err.h>
29#include <linux/string.h>
29 30
30struct linux_binprm; 31struct linux_binprm;
31struct cred; 32struct cred;
@@ -60,6 +61,9 @@ struct mm_struct;
60#define SECURITY_CAP_NOAUDIT 0 61#define SECURITY_CAP_NOAUDIT 0
61#define SECURITY_CAP_AUDIT 1 62#define SECURITY_CAP_AUDIT 1
62 63
64/* LSM Agnostic defines for sb_set_mnt_opts */
65#define SECURITY_LSM_NATIVE_LABELS 1
66
63struct ctl_table; 67struct ctl_table;
64struct audit_krule; 68struct audit_krule;
65struct user_namespace; 69struct user_namespace;
@@ -306,6 +310,15 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
306 * Parse a string of security data filling in the opts structure 310 * Parse a string of security data filling in the opts structure
307 * @options string containing all mount options known by the LSM 311 * @options string containing all mount options known by the LSM
308 * @opts binary data structure usable by the LSM 312 * @opts binary data structure usable by the LSM
313 * @dentry_init_security:
314 * Compute a context for a dentry as the inode is not yet available
315 * since NFSv4 has no label backed by an EA anyway.
316 * @dentry dentry to use in calculating the context.
317 * @mode mode used to determine resource type.
318 * @name name of the last path component used to create file
319 * @ctx pointer to place the pointer to the resulting context in.
320 * @ctxlen point to place the length of the resulting context.
321 *
309 * 322 *
310 * Security hooks for inode operations. 323 * Security hooks for inode operations.
311 * 324 *
@@ -1313,6 +1326,13 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
1313 * @pages contains the number of pages. 1326 * @pages contains the number of pages.
1314 * Return 0 if permission is granted. 1327 * Return 0 if permission is granted.
1315 * 1328 *
1329 * @ismaclabel:
1330 * Check if the extended attribute specified by @name
1331 * represents a MAC label. Returns 1 if name is a MAC
1332 * attribute otherwise returns 0.
1333 * @name full extended attribute name to check against
1334 * LSM as a MAC label.
1335 *
1316 * @secid_to_secctx: 1336 * @secid_to_secctx:
1317 * Convert secid to security context. If secdata is NULL the length of 1337 * Convert secid to security context. If secdata is NULL the length of
1318 * the result will be returned in seclen, but no secdata will be returned. 1338 * the result will be returned in seclen, but no secdata will be returned.
@@ -1440,10 +1460,16 @@ struct security_operations {
1440 int (*sb_pivotroot) (struct path *old_path, 1460 int (*sb_pivotroot) (struct path *old_path,
1441 struct path *new_path); 1461 struct path *new_path);
1442 int (*sb_set_mnt_opts) (struct super_block *sb, 1462 int (*sb_set_mnt_opts) (struct super_block *sb,
1443 struct security_mnt_opts *opts); 1463 struct security_mnt_opts *opts,
1464 unsigned long kern_flags,
1465 unsigned long *set_kern_flags);
1444 int (*sb_clone_mnt_opts) (const struct super_block *oldsb, 1466 int (*sb_clone_mnt_opts) (const struct super_block *oldsb,
1445 struct super_block *newsb); 1467 struct super_block *newsb);
1446 int (*sb_parse_opts_str) (char *options, struct security_mnt_opts *opts); 1468 int (*sb_parse_opts_str) (char *options, struct security_mnt_opts *opts);
1469 int (*dentry_init_security) (struct dentry *dentry, int mode,
1470 struct qstr *name, void **ctx,
1471 u32 *ctxlen);
1472
1447 1473
1448#ifdef CONFIG_SECURITY_PATH 1474#ifdef CONFIG_SECURITY_PATH
1449 int (*path_unlink) (struct path *dir, struct dentry *dentry); 1475 int (*path_unlink) (struct path *dir, struct dentry *dentry);
@@ -1591,6 +1617,7 @@ struct security_operations {
1591 1617
1592 int (*getprocattr) (struct task_struct *p, char *name, char **value); 1618 int (*getprocattr) (struct task_struct *p, char *name, char **value);
1593 int (*setprocattr) (struct task_struct *p, char *name, void *value, size_t size); 1619 int (*setprocattr) (struct task_struct *p, char *name, void *value, size_t size);
1620 int (*ismaclabel) (const char *name);
1594 int (*secid_to_secctx) (u32 secid, char **secdata, u32 *seclen); 1621 int (*secid_to_secctx) (u32 secid, char **secdata, u32 *seclen);
1595 int (*secctx_to_secid) (const char *secdata, u32 seclen, u32 *secid); 1622 int (*secctx_to_secid) (const char *secdata, u32 seclen, u32 *secid);
1596 void (*release_secctx) (char *secdata, u32 seclen); 1623 void (*release_secctx) (char *secdata, u32 seclen);
@@ -1726,10 +1753,16 @@ int security_sb_mount(const char *dev_name, struct path *path,
1726 const char *type, unsigned long flags, void *data); 1753 const char *type, unsigned long flags, void *data);
1727int security_sb_umount(struct vfsmount *mnt, int flags); 1754int security_sb_umount(struct vfsmount *mnt, int flags);
1728int security_sb_pivotroot(struct path *old_path, struct path *new_path); 1755int security_sb_pivotroot(struct path *old_path, struct path *new_path);
1729int security_sb_set_mnt_opts(struct super_block *sb, struct security_mnt_opts *opts); 1756int security_sb_set_mnt_opts(struct super_block *sb,
1757 struct security_mnt_opts *opts,
1758 unsigned long kern_flags,
1759 unsigned long *set_kern_flags);
1730int security_sb_clone_mnt_opts(const struct super_block *oldsb, 1760int security_sb_clone_mnt_opts(const struct super_block *oldsb,
1731 struct super_block *newsb); 1761 struct super_block *newsb);
1732int security_sb_parse_opts_str(char *options, struct security_mnt_opts *opts); 1762int security_sb_parse_opts_str(char *options, struct security_mnt_opts *opts);
1763int security_dentry_init_security(struct dentry *dentry, int mode,
1764 struct qstr *name, void **ctx,
1765 u32 *ctxlen);
1733 1766
1734int security_inode_alloc(struct inode *inode); 1767int security_inode_alloc(struct inode *inode);
1735void security_inode_free(struct inode *inode); 1768void security_inode_free(struct inode *inode);
@@ -1841,6 +1874,7 @@ void security_d_instantiate(struct dentry *dentry, struct inode *inode);
1841int security_getprocattr(struct task_struct *p, char *name, char **value); 1874int security_getprocattr(struct task_struct *p, char *name, char **value);
1842int security_setprocattr(struct task_struct *p, char *name, void *value, size_t size); 1875int security_setprocattr(struct task_struct *p, char *name, void *value, size_t size);
1843int security_netlink_send(struct sock *sk, struct sk_buff *skb); 1876int security_netlink_send(struct sock *sk, struct sk_buff *skb);
1877int security_ismaclabel(const char *name);
1844int security_secid_to_secctx(u32 secid, char **secdata, u32 *seclen); 1878int security_secid_to_secctx(u32 secid, char **secdata, u32 *seclen);
1845int security_secctx_to_secid(const char *secdata, u32 seclen, u32 *secid); 1879int security_secctx_to_secid(const char *secdata, u32 seclen, u32 *secid);
1846void security_release_secctx(char *secdata, u32 seclen); 1880void security_release_secctx(char *secdata, u32 seclen);
@@ -2012,7 +2046,9 @@ static inline int security_sb_pivotroot(struct path *old_path,
2012} 2046}
2013 2047
2014static inline int security_sb_set_mnt_opts(struct super_block *sb, 2048static inline int security_sb_set_mnt_opts(struct super_block *sb,
2015 struct security_mnt_opts *opts) 2049 struct security_mnt_opts *opts,
2050 unsigned long kern_flags,
2051 unsigned long *set_kern_flags)
2016{ 2052{
2017 return 0; 2053 return 0;
2018} 2054}
@@ -2036,6 +2072,16 @@ static inline int security_inode_alloc(struct inode *inode)
2036static inline void security_inode_free(struct inode *inode) 2072static inline void security_inode_free(struct inode *inode)
2037{ } 2073{ }
2038 2074
2075static inline int security_dentry_init_security(struct dentry *dentry,
2076 int mode,
2077 struct qstr *name,
2078 void **ctx,
2079 u32 *ctxlen)
2080{
2081 return -EOPNOTSUPP;
2082}
2083
2084
2039static inline int security_inode_init_security(struct inode *inode, 2085static inline int security_inode_init_security(struct inode *inode,
2040 struct inode *dir, 2086 struct inode *dir,
2041 const struct qstr *qstr, 2087 const struct qstr *qstr,
@@ -2521,6 +2567,11 @@ static inline int security_netlink_send(struct sock *sk, struct sk_buff *skb)
2521 return cap_netlink_send(sk, skb); 2567 return cap_netlink_send(sk, skb);
2522} 2568}
2523 2569
2570static inline int security_ismaclabel(const char *name)
2571{
2572 return 0;
2573}
2574
2524static inline int security_secid_to_secctx(u32 secid, char **secdata, u32 *seclen) 2575static inline int security_secid_to_secctx(u32 secid, char **secdata, u32 *seclen)
2525{ 2576{
2526 return -EOPNOTSUPP; 2577 return -EOPNOTSUPP;
diff --git a/include/linux/sem.h b/include/linux/sem.h
index 53d42650b193..976ce3a19f1b 100644
--- a/include/linux/sem.h
+++ b/include/linux/sem.h
@@ -12,10 +12,12 @@ struct task_struct;
12struct sem_array { 12struct sem_array {
13 struct kern_ipc_perm ____cacheline_aligned_in_smp 13 struct kern_ipc_perm ____cacheline_aligned_in_smp
14 sem_perm; /* permissions .. see ipc.h */ 14 sem_perm; /* permissions .. see ipc.h */
15 time_t sem_otime; /* last semop time */
16 time_t sem_ctime; /* last change time */ 15 time_t sem_ctime; /* last change time */
17 struct sem *sem_base; /* ptr to first semaphore in array */ 16 struct sem *sem_base; /* ptr to first semaphore in array */
18 struct list_head sem_pending; /* pending operations to be processed */ 17 struct list_head pending_alter; /* pending operations */
18 /* that alter the array */
19 struct list_head pending_const; /* pending complex operations */
20 /* that do not alter semvals */
19 struct list_head list_id; /* undo requests on this array */ 21 struct list_head list_id; /* undo requests on this array */
20 int sem_nsems; /* no. of semaphores in array */ 22 int sem_nsems; /* no. of semaphores in array */
21 int complex_count; /* pending complex operations */ 23 int complex_count; /* pending complex operations */
diff --git a/include/linux/seq_file.h b/include/linux/seq_file.h
index 2da29ac178fc..4e32edc8f506 100644
--- a/include/linux/seq_file.h
+++ b/include/linux/seq_file.h
@@ -173,4 +173,10 @@ extern struct hlist_node *seq_hlist_start_head_rcu(struct hlist_head *head,
173extern struct hlist_node *seq_hlist_next_rcu(void *v, 173extern struct hlist_node *seq_hlist_next_rcu(void *v,
174 struct hlist_head *head, 174 struct hlist_head *head,
175 loff_t *ppos); 175 loff_t *ppos);
176
177/* Helpers for iterating over per-cpu hlist_head-s in seq_files */
178extern struct hlist_node *seq_hlist_start_percpu(struct hlist_head __percpu *head, int *cpu, loff_t pos);
179
180extern struct hlist_node *seq_hlist_next_percpu(void *v, struct hlist_head __percpu *head, int *cpu, loff_t *pos);
181
176#endif 182#endif
diff --git a/include/linux/sh_dma.h b/include/linux/sh_dma.h
index b64d6bec6f90..4e83f3e034f3 100644
--- a/include/linux/sh_dma.h
+++ b/include/linux/sh_dma.h
@@ -99,6 +99,4 @@ struct sh_dmae_pdata {
99#define CHCR_TE 0x00000002 99#define CHCR_TE 0x00000002
100#define CHCR_IE 0x00000004 100#define CHCR_IE 0x00000004
101 101
102bool shdma_chan_filter(struct dma_chan *chan, void *arg);
103
104#endif 102#endif
diff --git a/include/linux/shdma-base.h b/include/linux/shdma-base.h
index a3728bf66f0e..5b1c9848124c 100644
--- a/include/linux/shdma-base.h
+++ b/include/linux/shdma-base.h
@@ -68,6 +68,8 @@ struct shdma_chan {
68 int id; /* Raw id of this channel */ 68 int id; /* Raw id of this channel */
69 int irq; /* Channel IRQ */ 69 int irq; /* Channel IRQ */
70 int slave_id; /* Client ID for slave DMA */ 70 int slave_id; /* Client ID for slave DMA */
71 int hw_req; /* DMA request line for slave DMA - same
72 * as MID/RID, used with DT */
71 enum shdma_pm_state pm_state; 73 enum shdma_pm_state pm_state;
72}; 74};
73 75
@@ -122,5 +124,10 @@ void shdma_chan_remove(struct shdma_chan *schan);
122int shdma_init(struct device *dev, struct shdma_dev *sdev, 124int shdma_init(struct device *dev, struct shdma_dev *sdev,
123 int chan_num); 125 int chan_num);
124void shdma_cleanup(struct shdma_dev *sdev); 126void shdma_cleanup(struct shdma_dev *sdev);
127#if IS_ENABLED(CONFIG_SH_DMAE_BASE)
128bool shdma_chan_filter(struct dma_chan *chan, void *arg);
129#else
130#define shdma_chan_filter NULL
131#endif
125 132
126#endif 133#endif
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index dec1748cd002..3b71a4e83642 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -319,6 +319,8 @@ enum {
319 SKB_GSO_GRE = 1 << 6, 319 SKB_GSO_GRE = 1 << 6,
320 320
321 SKB_GSO_UDP_TUNNEL = 1 << 7, 321 SKB_GSO_UDP_TUNNEL = 1 << 7,
322
323 SKB_GSO_MPLS = 1 << 8,
322}; 324};
323 325
324#if BITS_PER_LONG > 32 326#if BITS_PER_LONG > 32
@@ -384,11 +386,13 @@ typedef unsigned char *sk_buff_data_t;
384 * @no_fcs: Request NIC to treat last 4 bytes as Ethernet FCS 386 * @no_fcs: Request NIC to treat last 4 bytes as Ethernet FCS
385 * @dma_cookie: a cookie to one of several possible DMA operations 387 * @dma_cookie: a cookie to one of several possible DMA operations
386 * done by skb DMA functions 388 * done by skb DMA functions
389 * @napi_id: id of the NAPI struct this skb came from
387 * @secmark: security marking 390 * @secmark: security marking
388 * @mark: Generic packet mark 391 * @mark: Generic packet mark
389 * @dropcount: total number of sk_receive_queue overflows 392 * @dropcount: total number of sk_receive_queue overflows
390 * @vlan_proto: vlan encapsulation protocol 393 * @vlan_proto: vlan encapsulation protocol
391 * @vlan_tci: vlan tag control information 394 * @vlan_tci: vlan tag control information
395 * @inner_protocol: Protocol (encapsulation)
392 * @inner_transport_header: Inner transport layer header (encapsulation) 396 * @inner_transport_header: Inner transport layer header (encapsulation)
393 * @inner_network_header: Network layer header (encapsulation) 397 * @inner_network_header: Network layer header (encapsulation)
394 * @inner_mac_header: Link layer header (encapsulation) 398 * @inner_mac_header: Link layer header (encapsulation)
@@ -497,8 +501,11 @@ struct sk_buff {
497 /* 7/9 bit hole (depending on ndisc_nodetype presence) */ 501 /* 7/9 bit hole (depending on ndisc_nodetype presence) */
498 kmemcheck_bitfield_end(flags2); 502 kmemcheck_bitfield_end(flags2);
499 503
500#ifdef CONFIG_NET_DMA 504#if defined CONFIG_NET_DMA || defined CONFIG_NET_RX_BUSY_POLL
501 dma_cookie_t dma_cookie; 505 union {
506 unsigned int napi_id;
507 dma_cookie_t dma_cookie;
508 };
502#endif 509#endif
503#ifdef CONFIG_NETWORK_SECMARK 510#ifdef CONFIG_NETWORK_SECMARK
504 __u32 secmark; 511 __u32 secmark;
@@ -509,12 +516,13 @@ struct sk_buff {
509 __u32 reserved_tailroom; 516 __u32 reserved_tailroom;
510 }; 517 };
511 518
512 sk_buff_data_t inner_transport_header; 519 __be16 inner_protocol;
513 sk_buff_data_t inner_network_header; 520 __u16 inner_transport_header;
514 sk_buff_data_t inner_mac_header; 521 __u16 inner_network_header;
515 sk_buff_data_t transport_header; 522 __u16 inner_mac_header;
516 sk_buff_data_t network_header; 523 __u16 transport_header;
517 sk_buff_data_t mac_header; 524 __u16 network_header;
525 __u16 mac_header;
518 /* These elements must be at the end, see alloc_skb() for details. */ 526 /* These elements must be at the end, see alloc_skb() for details. */
519 sk_buff_data_t tail; 527 sk_buff_data_t tail;
520 sk_buff_data_t end; 528 sk_buff_data_t end;
@@ -1388,6 +1396,7 @@ static inline void skb_set_tail_pointer(struct sk_buff *skb, const int offset)
1388 skb_reset_tail_pointer(skb); 1396 skb_reset_tail_pointer(skb);
1389 skb->tail += offset; 1397 skb->tail += offset;
1390} 1398}
1399
1391#else /* NET_SKBUFF_DATA_USES_OFFSET */ 1400#else /* NET_SKBUFF_DATA_USES_OFFSET */
1392static inline unsigned char *skb_tail_pointer(const struct sk_buff *skb) 1401static inline unsigned char *skb_tail_pointer(const struct sk_buff *skb)
1393{ 1402{
@@ -1528,7 +1537,6 @@ static inline void skb_reset_mac_len(struct sk_buff *skb)
1528 skb->mac_len = skb->network_header - skb->mac_header; 1537 skb->mac_len = skb->network_header - skb->mac_header;
1529} 1538}
1530 1539
1531#ifdef NET_SKBUFF_DATA_USES_OFFSET
1532static inline unsigned char *skb_inner_transport_header(const struct sk_buff 1540static inline unsigned char *skb_inner_transport_header(const struct sk_buff
1533 *skb) 1541 *skb)
1534{ 1542{
@@ -1582,7 +1590,7 @@ static inline void skb_set_inner_mac_header(struct sk_buff *skb,
1582} 1590}
1583static inline bool skb_transport_header_was_set(const struct sk_buff *skb) 1591static inline bool skb_transport_header_was_set(const struct sk_buff *skb)
1584{ 1592{
1585 return skb->transport_header != ~0U; 1593 return skb->transport_header != (typeof(skb->transport_header))~0U;
1586} 1594}
1587 1595
1588static inline unsigned char *skb_transport_header(const struct sk_buff *skb) 1596static inline unsigned char *skb_transport_header(const struct sk_buff *skb)
@@ -1625,7 +1633,7 @@ static inline unsigned char *skb_mac_header(const struct sk_buff *skb)
1625 1633
1626static inline int skb_mac_header_was_set(const struct sk_buff *skb) 1634static inline int skb_mac_header_was_set(const struct sk_buff *skb)
1627{ 1635{
1628 return skb->mac_header != ~0U; 1636 return skb->mac_header != (typeof(skb->mac_header))~0U;
1629} 1637}
1630 1638
1631static inline void skb_reset_mac_header(struct sk_buff *skb) 1639static inline void skb_reset_mac_header(struct sk_buff *skb)
@@ -1639,112 +1647,6 @@ static inline void skb_set_mac_header(struct sk_buff *skb, const int offset)
1639 skb->mac_header += offset; 1647 skb->mac_header += offset;
1640} 1648}
1641 1649
1642#else /* NET_SKBUFF_DATA_USES_OFFSET */
1643static inline unsigned char *skb_inner_transport_header(const struct sk_buff
1644 *skb)
1645{
1646 return skb->inner_transport_header;
1647}
1648
1649static inline void skb_reset_inner_transport_header(struct sk_buff *skb)
1650{
1651 skb->inner_transport_header = skb->data;
1652}
1653
1654static inline void skb_set_inner_transport_header(struct sk_buff *skb,
1655 const int offset)
1656{
1657 skb->inner_transport_header = skb->data + offset;
1658}
1659
1660static inline unsigned char *skb_inner_network_header(const struct sk_buff *skb)
1661{
1662 return skb->inner_network_header;
1663}
1664
1665static inline void skb_reset_inner_network_header(struct sk_buff *skb)
1666{
1667 skb->inner_network_header = skb->data;
1668}
1669
1670static inline void skb_set_inner_network_header(struct sk_buff *skb,
1671 const int offset)
1672{
1673 skb->inner_network_header = skb->data + offset;
1674}
1675
1676static inline unsigned char *skb_inner_mac_header(const struct sk_buff *skb)
1677{
1678 return skb->inner_mac_header;
1679}
1680
1681static inline void skb_reset_inner_mac_header(struct sk_buff *skb)
1682{
1683 skb->inner_mac_header = skb->data;
1684}
1685
1686static inline void skb_set_inner_mac_header(struct sk_buff *skb,
1687 const int offset)
1688{
1689 skb->inner_mac_header = skb->data + offset;
1690}
1691static inline bool skb_transport_header_was_set(const struct sk_buff *skb)
1692{
1693 return skb->transport_header != NULL;
1694}
1695
1696static inline unsigned char *skb_transport_header(const struct sk_buff *skb)
1697{
1698 return skb->transport_header;
1699}
1700
1701static inline void skb_reset_transport_header(struct sk_buff *skb)
1702{
1703 skb->transport_header = skb->data;
1704}
1705
1706static inline void skb_set_transport_header(struct sk_buff *skb,
1707 const int offset)
1708{
1709 skb->transport_header = skb->data + offset;
1710}
1711
1712static inline unsigned char *skb_network_header(const struct sk_buff *skb)
1713{
1714 return skb->network_header;
1715}
1716
1717static inline void skb_reset_network_header(struct sk_buff *skb)
1718{
1719 skb->network_header = skb->data;
1720}
1721
1722static inline void skb_set_network_header(struct sk_buff *skb, const int offset)
1723{
1724 skb->network_header = skb->data + offset;
1725}
1726
1727static inline unsigned char *skb_mac_header(const struct sk_buff *skb)
1728{
1729 return skb->mac_header;
1730}
1731
1732static inline int skb_mac_header_was_set(const struct sk_buff *skb)
1733{
1734 return skb->mac_header != NULL;
1735}
1736
1737static inline void skb_reset_mac_header(struct sk_buff *skb)
1738{
1739 skb->mac_header = skb->data;
1740}
1741
1742static inline void skb_set_mac_header(struct sk_buff *skb, const int offset)
1743{
1744 skb->mac_header = skb->data + offset;
1745}
1746#endif /* NET_SKBUFF_DATA_USES_OFFSET */
1747
1748static inline void skb_probe_transport_header(struct sk_buff *skb, 1650static inline void skb_probe_transport_header(struct sk_buff *skb,
1749 const int offset_hint) 1651 const int offset_hint)
1750{ 1652{
@@ -2483,6 +2385,7 @@ extern void skb_split(struct sk_buff *skb,
2483 struct sk_buff *skb1, const u32 len); 2385 struct sk_buff *skb1, const u32 len);
2484extern int skb_shift(struct sk_buff *tgt, struct sk_buff *skb, 2386extern int skb_shift(struct sk_buff *tgt, struct sk_buff *skb,
2485 int shiftlen); 2387 int shiftlen);
2388extern void skb_scrub_packet(struct sk_buff *skb);
2486 2389
2487extern struct sk_buff *skb_segment(struct sk_buff *skb, 2390extern struct sk_buff *skb_segment(struct sk_buff *skb,
2488 netdev_features_t features); 2391 netdev_features_t features);
diff --git a/include/linux/slab.h b/include/linux/slab.h
index 0c621752caa6..6c5cc0ea8713 100644
--- a/include/linux/slab.h
+++ b/include/linux/slab.h
@@ -169,11 +169,7 @@ struct kmem_cache {
169 struct list_head list; /* List of all slab caches on the system */ 169 struct list_head list; /* List of all slab caches on the system */
170}; 170};
171 171
172#define KMALLOC_MAX_SIZE (1UL << 30) 172#endif /* CONFIG_SLOB */
173
174#include <linux/slob_def.h>
175
176#else /* CONFIG_SLOB */
177 173
178/* 174/*
179 * Kmalloc array related definitions 175 * Kmalloc array related definitions
@@ -195,7 +191,9 @@ struct kmem_cache {
195#ifndef KMALLOC_SHIFT_LOW 191#ifndef KMALLOC_SHIFT_LOW
196#define KMALLOC_SHIFT_LOW 5 192#define KMALLOC_SHIFT_LOW 5
197#endif 193#endif
198#else 194#endif
195
196#ifdef CONFIG_SLUB
199/* 197/*
200 * SLUB allocates up to order 2 pages directly and otherwise 198 * SLUB allocates up to order 2 pages directly and otherwise
201 * passes the request to the page allocator. 199 * passes the request to the page allocator.
@@ -207,6 +205,19 @@ struct kmem_cache {
207#endif 205#endif
208#endif 206#endif
209 207
208#ifdef CONFIG_SLOB
209/*
210 * SLOB passes all page size and larger requests to the page allocator.
211 * No kmalloc array is necessary since objects of different sizes can
212 * be allocated from the same page.
213 */
214#define KMALLOC_SHIFT_MAX 30
215#define KMALLOC_SHIFT_HIGH PAGE_SHIFT
216#ifndef KMALLOC_SHIFT_LOW
217#define KMALLOC_SHIFT_LOW 3
218#endif
219#endif
220
210/* Maximum allocatable size */ 221/* Maximum allocatable size */
211#define KMALLOC_MAX_SIZE (1UL << KMALLOC_SHIFT_MAX) 222#define KMALLOC_MAX_SIZE (1UL << KMALLOC_SHIFT_MAX)
212/* Maximum size for which we actually use a slab cache */ 223/* Maximum size for which we actually use a slab cache */
@@ -221,6 +232,7 @@ struct kmem_cache {
221#define KMALLOC_MIN_SIZE (1 << KMALLOC_SHIFT_LOW) 232#define KMALLOC_MIN_SIZE (1 << KMALLOC_SHIFT_LOW)
222#endif 233#endif
223 234
235#ifndef CONFIG_SLOB
224extern struct kmem_cache *kmalloc_caches[KMALLOC_SHIFT_HIGH + 1]; 236extern struct kmem_cache *kmalloc_caches[KMALLOC_SHIFT_HIGH + 1];
225#ifdef CONFIG_ZONE_DMA 237#ifdef CONFIG_ZONE_DMA
226extern struct kmem_cache *kmalloc_dma_caches[KMALLOC_SHIFT_HIGH + 1]; 238extern struct kmem_cache *kmalloc_dma_caches[KMALLOC_SHIFT_HIGH + 1];
@@ -275,13 +287,18 @@ static __always_inline int kmalloc_index(size_t size)
275 /* Will never be reached. Needed because the compiler may complain */ 287 /* Will never be reached. Needed because the compiler may complain */
276 return -1; 288 return -1;
277} 289}
290#endif /* !CONFIG_SLOB */
278 291
279#ifdef CONFIG_SLAB 292#ifdef CONFIG_SLAB
280#include <linux/slab_def.h> 293#include <linux/slab_def.h>
281#elif defined(CONFIG_SLUB) 294#endif
295
296#ifdef CONFIG_SLUB
282#include <linux/slub_def.h> 297#include <linux/slub_def.h>
283#else 298#endif
284#error "Unknown slab allocator" 299
300#ifdef CONFIG_SLOB
301#include <linux/slob_def.h>
285#endif 302#endif
286 303
287/* 304/*
@@ -291,6 +308,7 @@ static __always_inline int kmalloc_index(size_t size)
291 */ 308 */
292static __always_inline int kmalloc_size(int n) 309static __always_inline int kmalloc_size(int n)
293{ 310{
311#ifndef CONFIG_SLOB
294 if (n > 2) 312 if (n > 2)
295 return 1 << n; 313 return 1 << n;
296 314
@@ -299,10 +317,9 @@ static __always_inline int kmalloc_size(int n)
299 317
300 if (n == 2 && KMALLOC_MIN_SIZE <= 64) 318 if (n == 2 && KMALLOC_MIN_SIZE <= 64)
301 return 192; 319 return 192;
302 320#endif
303 return 0; 321 return 0;
304} 322}
305#endif /* !CONFIG_SLOB */
306 323
307/* 324/*
308 * Setting ARCH_SLAB_MINALIGN in arch headers allows a different alignment. 325 * Setting ARCH_SLAB_MINALIGN in arch headers allows a different alignment.
@@ -356,9 +373,8 @@ int cache_show(struct kmem_cache *s, struct seq_file *m);
356void print_slabinfo_header(struct seq_file *m); 373void print_slabinfo_header(struct seq_file *m);
357 374
358/** 375/**
359 * kmalloc_array - allocate memory for an array. 376 * kmalloc - allocate memory
360 * @n: number of elements. 377 * @size: how many bytes of memory are required.
361 * @size: element size.
362 * @flags: the type of memory to allocate. 378 * @flags: the type of memory to allocate.
363 * 379 *
364 * The @flags argument may be one of: 380 * The @flags argument may be one of:
@@ -405,6 +421,17 @@ void print_slabinfo_header(struct seq_file *m);
405 * There are other flags available as well, but these are not intended 421 * There are other flags available as well, but these are not intended
406 * for general use, and so are not documented here. For a full list of 422 * for general use, and so are not documented here. For a full list of
407 * potential flags, always refer to linux/gfp.h. 423 * potential flags, always refer to linux/gfp.h.
424 *
425 * kmalloc is the normal method of allocating memory
426 * in the kernel.
427 */
428static __always_inline void *kmalloc(size_t size, gfp_t flags);
429
430/**
431 * kmalloc_array - allocate memory for an array.
432 * @n: number of elements.
433 * @size: element size.
434 * @flags: the type of memory to allocate (see kmalloc).
408 */ 435 */
409static inline void *kmalloc_array(size_t n, size_t size, gfp_t flags) 436static inline void *kmalloc_array(size_t n, size_t size, gfp_t flags)
410{ 437{
@@ -428,7 +455,7 @@ static inline void *kcalloc(size_t n, size_t size, gfp_t flags)
428/** 455/**
429 * kmalloc_node - allocate memory from a specific node 456 * kmalloc_node - allocate memory from a specific node
430 * @size: how many bytes of memory are required. 457 * @size: how many bytes of memory are required.
431 * @flags: the type of memory to allocate (see kcalloc). 458 * @flags: the type of memory to allocate (see kmalloc).
432 * @node: node to allocate from. 459 * @node: node to allocate from.
433 * 460 *
434 * kmalloc() for non-local nodes, used to allocate from a specific node 461 * kmalloc() for non-local nodes, used to allocate from a specific node
diff --git a/include/linux/slob_def.h b/include/linux/slob_def.h
index f28e14a12e3f..095a5a4a8516 100644
--- a/include/linux/slob_def.h
+++ b/include/linux/slob_def.h
@@ -18,14 +18,6 @@ static __always_inline void *kmalloc_node(size_t size, gfp_t flags, int node)
18 return __kmalloc_node(size, flags, node); 18 return __kmalloc_node(size, flags, node);
19} 19}
20 20
21/**
22 * kmalloc - allocate memory
23 * @size: how many bytes of memory are required.
24 * @flags: the type of memory to allocate (see kcalloc).
25 *
26 * kmalloc is the normal method of allocating memory
27 * in the kernel.
28 */
29static __always_inline void *kmalloc(size_t size, gfp_t flags) 21static __always_inline void *kmalloc(size_t size, gfp_t flags)
30{ 22{
31 return __kmalloc_node(size, flags, NUMA_NO_NODE); 23 return __kmalloc_node(size, flags, NUMA_NO_NODE);
diff --git a/include/linux/socket.h b/include/linux/socket.h
index b10ce4b341ea..230c04bda3e2 100644
--- a/include/linux/socket.h
+++ b/include/linux/socket.h
@@ -167,6 +167,7 @@ struct ucred {
167#define AF_PPPOX 24 /* PPPoX sockets */ 167#define AF_PPPOX 24 /* PPPoX sockets */
168#define AF_WANPIPE 25 /* Wanpipe API Sockets */ 168#define AF_WANPIPE 25 /* Wanpipe API Sockets */
169#define AF_LLC 26 /* Linux LLC */ 169#define AF_LLC 26 /* Linux LLC */
170#define AF_IB 27 /* Native InfiniBand address */
170#define AF_CAN 29 /* Controller Area Network */ 171#define AF_CAN 29 /* Controller Area Network */
171#define AF_TIPC 30 /* TIPC sockets */ 172#define AF_TIPC 30 /* TIPC sockets */
172#define AF_BLUETOOTH 31 /* Bluetooth sockets */ 173#define AF_BLUETOOTH 31 /* Bluetooth sockets */
@@ -211,6 +212,7 @@ struct ucred {
211#define PF_PPPOX AF_PPPOX 212#define PF_PPPOX AF_PPPOX
212#define PF_WANPIPE AF_WANPIPE 213#define PF_WANPIPE AF_WANPIPE
213#define PF_LLC AF_LLC 214#define PF_LLC AF_LLC
215#define PF_IB AF_IB
214#define PF_CAN AF_CAN 216#define PF_CAN AF_CAN
215#define PF_TIPC AF_TIPC 217#define PF_TIPC AF_TIPC
216#define PF_BLUETOOTH AF_BLUETOOTH 218#define PF_BLUETOOTH AF_BLUETOOTH
diff --git a/include/linux/spinlock_api_smp.h b/include/linux/spinlock_api_smp.h
index 51df117abe46..bdb9993f0fda 100644
--- a/include/linux/spinlock_api_smp.h
+++ b/include/linux/spinlock_api_smp.h
@@ -144,7 +144,7 @@ static inline void __raw_spin_lock(raw_spinlock_t *lock)
144 LOCK_CONTENDED(lock, do_raw_spin_trylock, do_raw_spin_lock); 144 LOCK_CONTENDED(lock, do_raw_spin_trylock, do_raw_spin_lock);
145} 145}
146 146
147#endif /* CONFIG_PREEMPT */ 147#endif /* !CONFIG_GENERIC_LOCKBREAK || CONFIG_DEBUG_LOCK_ALLOC */
148 148
149static inline void __raw_spin_unlock(raw_spinlock_t *lock) 149static inline void __raw_spin_unlock(raw_spinlock_t *lock)
150{ 150{
diff --git a/include/linux/ssb/ssb_driver_mips.h b/include/linux/ssb/ssb_driver_mips.h
index afe79d40a99e..6535e4718fde 100644
--- a/include/linux/ssb/ssb_driver_mips.h
+++ b/include/linux/ssb/ssb_driver_mips.h
@@ -20,6 +20,18 @@ struct ssb_pflash {
20 u32 window_size; 20 u32 window_size;
21}; 21};
22 22
23#ifdef CONFIG_SSB_SFLASH
24struct ssb_sflash {
25 bool present;
26 u32 window;
27 u32 blocksize;
28 u16 numblocks;
29 u32 size;
30
31 void *priv;
32};
33#endif
34
23struct ssb_mipscore { 35struct ssb_mipscore {
24 struct ssb_device *dev; 36 struct ssb_device *dev;
25 37
@@ -27,6 +39,9 @@ struct ssb_mipscore {
27 struct ssb_serial_port serial_ports[4]; 39 struct ssb_serial_port serial_ports[4];
28 40
29 struct ssb_pflash pflash; 41 struct ssb_pflash pflash;
42#ifdef CONFIG_SSB_SFLASH
43 struct ssb_sflash sflash;
44#endif
30}; 45};
31 46
32extern void ssb_mipscore_init(struct ssb_mipscore *mcore); 47extern void ssb_mipscore_init(struct ssb_mipscore *mcore);
diff --git a/include/linux/ssb/ssb_regs.h b/include/linux/ssb/ssb_regs.h
index 3a7256955b10..f9f931c89e3e 100644
--- a/include/linux/ssb/ssb_regs.h
+++ b/include/linux/ssb/ssb_regs.h
@@ -172,6 +172,7 @@
172#define SSB_SPROMSIZE_WORDS_R4 220 172#define SSB_SPROMSIZE_WORDS_R4 220
173#define SSB_SPROMSIZE_BYTES_R123 (SSB_SPROMSIZE_WORDS_R123 * sizeof(u16)) 173#define SSB_SPROMSIZE_BYTES_R123 (SSB_SPROMSIZE_WORDS_R123 * sizeof(u16))
174#define SSB_SPROMSIZE_BYTES_R4 (SSB_SPROMSIZE_WORDS_R4 * sizeof(u16)) 174#define SSB_SPROMSIZE_BYTES_R4 (SSB_SPROMSIZE_WORDS_R4 * sizeof(u16))
175#define SSB_SPROMSIZE_WORDS_R10 230
175#define SSB_SPROM_BASE1 0x1000 176#define SSB_SPROM_BASE1 0x1000
176#define SSB_SPROM_BASE31 0x0800 177#define SSB_SPROM_BASE31 0x0800
177#define SSB_SPROM_REVISION 0x007E 178#define SSB_SPROM_REVISION 0x007E
diff --git a/include/linux/stmmac.h b/include/linux/stmmac.h
index c1b3ed3fb787..9e495d31516e 100644
--- a/include/linux/stmmac.h
+++ b/include/linux/stmmac.h
@@ -80,6 +80,10 @@ struct stmmac_mdio_bus_data {
80 unsigned int phy_mask; 80 unsigned int phy_mask;
81 int *irqs; 81 int *irqs;
82 int probed_phy_irq; 82 int probed_phy_irq;
83#ifdef CONFIG_OF
84 int reset_gpio, active_low;
85 u32 delays[3];
86#endif
83}; 87};
84 88
85struct stmmac_dma_cfg { 89struct stmmac_dma_cfg {
diff --git a/include/linux/sunrpc/cache.h b/include/linux/sunrpc/cache.h
index 303399b1ba59..6ce690de447f 100644
--- a/include/linux/sunrpc/cache.h
+++ b/include/linux/sunrpc/cache.h
@@ -57,6 +57,7 @@ struct cache_head {
57#define CACHE_VALID 0 /* Entry contains valid data */ 57#define CACHE_VALID 0 /* Entry contains valid data */
58#define CACHE_NEGATIVE 1 /* Negative entry - there is no match for the key */ 58#define CACHE_NEGATIVE 1 /* Negative entry - there is no match for the key */
59#define CACHE_PENDING 2 /* An upcall has been sent but no reply received yet*/ 59#define CACHE_PENDING 2 /* An upcall has been sent but no reply received yet*/
60#define CACHE_CLEANED 3 /* Entry has been cleaned from cache */
60 61
61#define CACHE_NEW_EXPIRY 120 /* keep new things pending confirmation for 120 seconds */ 62#define CACHE_NEW_EXPIRY 120 /* keep new things pending confirmation for 120 seconds */
62 63
@@ -148,6 +149,24 @@ struct cache_deferred_req {
148 int too_many); 149 int too_many);
149}; 150};
150 151
152/*
153 * timestamps kept in the cache are expressed in seconds
154 * since boot. This is the best for measuring differences in
155 * real time.
156 */
157static inline time_t seconds_since_boot(void)
158{
159 struct timespec boot;
160 getboottime(&boot);
161 return get_seconds() - boot.tv_sec;
162}
163
164static inline time_t convert_to_wallclock(time_t sinceboot)
165{
166 struct timespec boot;
167 getboottime(&boot);
168 return boot.tv_sec + sinceboot;
169}
151 170
152extern const struct file_operations cache_file_operations_pipefs; 171extern const struct file_operations cache_file_operations_pipefs;
153extern const struct file_operations content_file_operations_pipefs; 172extern const struct file_operations content_file_operations_pipefs;
@@ -181,15 +200,10 @@ static inline void cache_put(struct cache_head *h, struct cache_detail *cd)
181 kref_put(&h->ref, cd->cache_put); 200 kref_put(&h->ref, cd->cache_put);
182} 201}
183 202
184static inline int cache_valid(struct cache_head *h) 203static inline int cache_is_expired(struct cache_detail *detail, struct cache_head *h)
185{ 204{
186 /* If an item has been unhashed pending removal when 205 return (h->expiry_time < seconds_since_boot()) ||
187 * the refcount drops to 0, the expiry_time will be 206 (detail->flush_time > h->last_refresh);
188 * set to 0. We don't want to consider such items
189 * valid in this context even though CACHE_VALID is
190 * set.
191 */
192 return (h->expiry_time != 0 && test_bit(CACHE_VALID, &h->flags));
193} 207}
194 208
195extern int cache_check(struct cache_detail *detail, 209extern int cache_check(struct cache_detail *detail,
@@ -250,25 +264,6 @@ static inline int get_uint(char **bpp, unsigned int *anint)
250 return 0; 264 return 0;
251} 265}
252 266
253/*
254 * timestamps kept in the cache are expressed in seconds
255 * since boot. This is the best for measuring differences in
256 * real time.
257 */
258static inline time_t seconds_since_boot(void)
259{
260 struct timespec boot;
261 getboottime(&boot);
262 return get_seconds() - boot.tv_sec;
263}
264
265static inline time_t convert_to_wallclock(time_t sinceboot)
266{
267 struct timespec boot;
268 getboottime(&boot);
269 return boot.tv_sec + sinceboot;
270}
271
272static inline time_t get_expiry(char **bpp) 267static inline time_t get_expiry(char **bpp)
273{ 268{
274 int rv; 269 int rv;
diff --git a/include/linux/sunrpc/gss_api.h b/include/linux/sunrpc/gss_api.h
index 161463e59624..1f911ccb2a75 100644
--- a/include/linux/sunrpc/gss_api.h
+++ b/include/linux/sunrpc/gss_api.h
@@ -151,6 +151,8 @@ struct gss_api_mech *gss_mech_get_by_pseudoflavor(u32);
151/* Fill in an array with a list of supported pseudoflavors */ 151/* Fill in an array with a list of supported pseudoflavors */
152int gss_mech_list_pseudoflavors(rpc_authflavor_t *, int); 152int gss_mech_list_pseudoflavors(rpc_authflavor_t *, int);
153 153
154struct gss_api_mech * gss_mech_get(struct gss_api_mech *);
155
154/* For every successful gss_mech_get or gss_mech_get_by_* call there must be a 156/* For every successful gss_mech_get or gss_mech_get_by_* call there must be a
155 * corresponding call to gss_mech_put. */ 157 * corresponding call to gss_mech_put. */
156void gss_mech_put(struct gss_api_mech *); 158void gss_mech_put(struct gss_api_mech *);
diff --git a/include/linux/sunrpc/rpc_pipe_fs.h b/include/linux/sunrpc/rpc_pipe_fs.h
index a7b422b33eda..aa5b582cc471 100644
--- a/include/linux/sunrpc/rpc_pipe_fs.h
+++ b/include/linux/sunrpc/rpc_pipe_fs.h
@@ -73,12 +73,12 @@ extern ssize_t rpc_pipe_generic_upcall(struct file *, struct rpc_pipe_msg *,
73extern int rpc_queue_upcall(struct rpc_pipe *, struct rpc_pipe_msg *); 73extern int rpc_queue_upcall(struct rpc_pipe *, struct rpc_pipe_msg *);
74 74
75struct rpc_clnt; 75struct rpc_clnt;
76extern struct dentry *rpc_create_client_dir(struct dentry *, struct qstr *, struct rpc_clnt *); 76extern struct dentry *rpc_create_client_dir(struct dentry *, const char *, struct rpc_clnt *);
77extern int rpc_remove_client_dir(struct dentry *); 77extern int rpc_remove_client_dir(struct dentry *);
78 78
79struct cache_detail; 79struct cache_detail;
80extern struct dentry *rpc_create_cache_dir(struct dentry *, 80extern struct dentry *rpc_create_cache_dir(struct dentry *,
81 struct qstr *, 81 const char *,
82 umode_t umode, 82 umode_t umode,
83 struct cache_detail *); 83 struct cache_detail *);
84extern void rpc_remove_cache_dir(struct dentry *); 84extern void rpc_remove_cache_dir(struct dentry *);
diff --git a/include/linux/sunrpc/sched.h b/include/linux/sunrpc/sched.h
index 84ca436b76c2..6d870353674a 100644
--- a/include/linux/sunrpc/sched.h
+++ b/include/linux/sunrpc/sched.h
@@ -88,15 +88,6 @@ struct rpc_task {
88 tk_rebind_retry : 2; 88 tk_rebind_retry : 2;
89}; 89};
90 90
91/* support walking a list of tasks on a wait queue */
92#define task_for_each(task, pos, head) \
93 list_for_each(pos, head) \
94 if ((task=list_entry(pos, struct rpc_task, u.tk_wait.list)),1)
95
96#define task_for_first(task, head) \
97 if (!list_empty(head) && \
98 ((task=list_entry((head)->next, struct rpc_task, u.tk_wait.list)),1))
99
100typedef void (*rpc_action)(struct rpc_task *); 91typedef void (*rpc_action)(struct rpc_task *);
101 92
102struct rpc_call_ops { 93struct rpc_call_ops {
@@ -238,7 +229,6 @@ struct rpc_task *rpc_wake_up_first(struct rpc_wait_queue *,
238 bool (*)(struct rpc_task *, void *), 229 bool (*)(struct rpc_task *, void *),
239 void *); 230 void *);
240void rpc_wake_up_status(struct rpc_wait_queue *, int); 231void rpc_wake_up_status(struct rpc_wait_queue *, int);
241int rpc_queue_empty(struct rpc_wait_queue *);
242void rpc_delay(struct rpc_task *, unsigned long); 232void rpc_delay(struct rpc_task *, unsigned long);
243void * rpc_malloc(struct rpc_task *, size_t); 233void * rpc_malloc(struct rpc_task *, size_t);
244void rpc_free(void *); 234void rpc_free(void *);
@@ -259,16 +249,6 @@ static inline int rpc_wait_for_completion_task(struct rpc_task *task)
259 return __rpc_wait_for_completion_task(task, NULL); 249 return __rpc_wait_for_completion_task(task, NULL);
260} 250}
261 251
262static inline void rpc_task_set_priority(struct rpc_task *task, unsigned char prio)
263{
264 task->tk_priority = prio - RPC_PRIORITY_LOW;
265}
266
267static inline int rpc_task_has_priority(struct rpc_task *task, unsigned char prio)
268{
269 return (task->tk_priority + RPC_PRIORITY_LOW == prio);
270}
271
272#if defined(RPC_DEBUG) || defined (RPC_TRACEPOINTS) 252#if defined(RPC_DEBUG) || defined (RPC_TRACEPOINTS)
273static inline const char * rpc_qname(const struct rpc_wait_queue *q) 253static inline const char * rpc_qname(const struct rpc_wait_queue *q)
274{ 254{
diff --git a/include/linux/sunrpc/svcauth.h b/include/linux/sunrpc/svcauth.h
index ff374ab30839..8d71d6577459 100644
--- a/include/linux/sunrpc/svcauth.h
+++ b/include/linux/sunrpc/svcauth.h
@@ -14,6 +14,7 @@
14#include <linux/string.h> 14#include <linux/string.h>
15#include <linux/sunrpc/msg_prot.h> 15#include <linux/sunrpc/msg_prot.h>
16#include <linux/sunrpc/cache.h> 16#include <linux/sunrpc/cache.h>
17#include <linux/sunrpc/gss_api.h>
17#include <linux/hash.h> 18#include <linux/hash.h>
18#include <linux/cred.h> 19#include <linux/cred.h>
19 20
@@ -23,13 +24,23 @@ struct svc_cred {
23 struct group_info *cr_group_info; 24 struct group_info *cr_group_info;
24 u32 cr_flavor; /* pseudoflavor */ 25 u32 cr_flavor; /* pseudoflavor */
25 char *cr_principal; /* for gss */ 26 char *cr_principal; /* for gss */
27 struct gss_api_mech *cr_gss_mech;
26}; 28};
27 29
30static inline void init_svc_cred(struct svc_cred *cred)
31{
32 cred->cr_group_info = NULL;
33 cred->cr_principal = NULL;
34 cred->cr_gss_mech = NULL;
35}
36
28static inline void free_svc_cred(struct svc_cred *cred) 37static inline void free_svc_cred(struct svc_cred *cred)
29{ 38{
30 if (cred->cr_group_info) 39 if (cred->cr_group_info)
31 put_group_info(cred->cr_group_info); 40 put_group_info(cred->cr_group_info);
32 kfree(cred->cr_principal); 41 kfree(cred->cr_principal);
42 gss_mech_put(cred->cr_gss_mech);
43 init_svc_cred(cred);
33} 44}
34 45
35struct svc_rqst; /* forward decl */ 46struct svc_rqst; /* forward decl */
diff --git a/include/linux/sysfs.h b/include/linux/sysfs.h
index e2cee22f578a..9e8a9b555ad6 100644
--- a/include/linux/sysfs.h
+++ b/include/linux/sysfs.h
@@ -17,10 +17,12 @@
17#include <linux/list.h> 17#include <linux/list.h>
18#include <linux/lockdep.h> 18#include <linux/lockdep.h>
19#include <linux/kobject_ns.h> 19#include <linux/kobject_ns.h>
20#include <linux/stat.h>
20#include <linux/atomic.h> 21#include <linux/atomic.h>
21 22
22struct kobject; 23struct kobject;
23struct module; 24struct module;
25struct bin_attribute;
24enum kobj_ns_type; 26enum kobj_ns_type;
25 27
26struct attribute { 28struct attribute {
@@ -59,26 +61,28 @@ struct attribute_group {
59 umode_t (*is_visible)(struct kobject *, 61 umode_t (*is_visible)(struct kobject *,
60 struct attribute *, int); 62 struct attribute *, int);
61 struct attribute **attrs; 63 struct attribute **attrs;
64 struct bin_attribute **bin_attrs;
62}; 65};
63 66
64
65
66/** 67/**
67 * Use these macros to make defining attributes easier. See include/linux/device.h 68 * Use these macros to make defining attributes easier. See include/linux/device.h
68 * for examples.. 69 * for examples..
69 */ 70 */
70 71
71#define __ATTR(_name,_mode,_show,_store) { \ 72#define __ATTR(_name,_mode,_show,_store) { \
72 .attr = {.name = __stringify(_name), .mode = _mode }, \ 73 .attr = {.name = __stringify(_name), .mode = _mode }, \
73 .show = _show, \ 74 .show = _show, \
74 .store = _store, \ 75 .store = _store, \
75} 76}
76 77
77#define __ATTR_RO(_name) { \ 78#define __ATTR_RO(_name) { \
78 .attr = { .name = __stringify(_name), .mode = 0444 }, \ 79 .attr = { .name = __stringify(_name), .mode = S_IRUGO }, \
79 .show = _name##_show, \ 80 .show = _name##_show, \
80} 81}
81 82
83#define __ATTR_RW(_name) __ATTR(_name, (S_IWUSR | S_IRUGO), \
84 _name##_show, _name##_store)
85
82#define __ATTR_NULL { .attr = { .name = NULL } } 86#define __ATTR_NULL { .attr = { .name = NULL } }
83 87
84#ifdef CONFIG_DEBUG_LOCK_ALLOC 88#ifdef CONFIG_DEBUG_LOCK_ALLOC
@@ -92,6 +96,18 @@ struct attribute_group {
92#define __ATTR_IGNORE_LOCKDEP __ATTR 96#define __ATTR_IGNORE_LOCKDEP __ATTR
93#endif 97#endif
94 98
99#define __ATTRIBUTE_GROUPS(_name) \
100static const struct attribute_group *_name##_groups[] = { \
101 &_name##_group, \
102 NULL, \
103}
104
105#define ATTRIBUTE_GROUPS(_name) \
106static const struct attribute_group _name##_group = { \
107 .attrs = _name##_attrs, \
108}; \
109__ATTRIBUTE_GROUPS(_name)
110
95#define attr_name(_attr) (_attr).attr.name 111#define attr_name(_attr) (_attr).attr.name
96 112
97struct file; 113struct file;
@@ -121,6 +137,36 @@ struct bin_attribute {
121 */ 137 */
122#define sysfs_bin_attr_init(bin_attr) sysfs_attr_init(&(bin_attr)->attr) 138#define sysfs_bin_attr_init(bin_attr) sysfs_attr_init(&(bin_attr)->attr)
123 139
140/* macros to create static binary attributes easier */
141#define __BIN_ATTR(_name, _mode, _read, _write, _size) { \
142 .attr = { .name = __stringify(_name), .mode = _mode }, \
143 .read = _read, \
144 .write = _write, \
145 .size = _size, \
146}
147
148#define __BIN_ATTR_RO(_name, _size) { \
149 .attr = { .name = __stringify(_name), .mode = S_IRUGO }, \
150 .read = _name##_read, \
151 .size = _size, \
152}
153
154#define __BIN_ATTR_RW(_name, _size) __BIN_ATTR(_name, \
155 (S_IWUSR | S_IRUGO), _name##_read, \
156 _name##_write)
157
158#define __BIN_ATTR_NULL __ATTR_NULL
159
160#define BIN_ATTR(_name, _mode, _read, _write, _size) \
161struct bin_attribute bin_attr_##_name = __BIN_ATTR(_name, _mode, _read, \
162 _write, _size)
163
164#define BIN_ATTR_RO(_name, _size) \
165struct bin_attribute bin_attr_##_name = __BIN_ATTR_RO(_name, _size)
166
167#define BIN_ATTR_RW(_name, _size) \
168struct bin_attribute bin_attr_##_name = __BIN_ATTR_RW(_name, _size)
169
124struct sysfs_ops { 170struct sysfs_ops {
125 ssize_t (*show)(struct kobject *, struct attribute *,char *); 171 ssize_t (*show)(struct kobject *, struct attribute *,char *);
126 ssize_t (*store)(struct kobject *,struct attribute *,const char *, size_t); 172 ssize_t (*store)(struct kobject *,struct attribute *,const char *, size_t);
diff --git a/include/linux/tcp.h b/include/linux/tcp.h
index 5adbc33d1ab3..472120b4fac5 100644
--- a/include/linux/tcp.h
+++ b/include/linux/tcp.h
@@ -246,7 +246,6 @@ struct tcp_sock {
246 246
247 /* from STCP, retrans queue hinting */ 247 /* from STCP, retrans queue hinting */
248 struct sk_buff* lost_skb_hint; 248 struct sk_buff* lost_skb_hint;
249 struct sk_buff *scoreboard_skb_hint;
250 struct sk_buff *retransmit_skb_hint; 249 struct sk_buff *retransmit_skb_hint;
251 250
252 struct sk_buff_head out_of_order_queue; /* Out of order segments go here */ 251 struct sk_buff_head out_of_order_queue; /* Out of order segments go here */
diff --git a/include/linux/tick.h b/include/linux/tick.h
index 9180f4b85e6d..62bd8b72873c 100644
--- a/include/linux/tick.h
+++ b/include/linux/tick.h
@@ -174,10 +174,4 @@ static inline void tick_nohz_task_switch(struct task_struct *tsk) { }
174#endif 174#endif
175 175
176 176
177# ifdef CONFIG_CPU_IDLE_GOV_MENU
178extern void menu_hrtimer_cancel(void);
179# else
180static inline void menu_hrtimer_cancel(void) {}
181# endif /* CONFIG_CPU_IDLE_GOV_MENU */
182
183#endif 177#endif
diff --git a/include/linux/usb.h b/include/linux/usb.h
index a232b7ece1f6..0eec2689b955 100644
--- a/include/linux/usb.h
+++ b/include/linux/usb.h
@@ -367,17 +367,6 @@ struct usb_bus {
367 367
368/* ----------------------------------------------------------------------- */ 368/* ----------------------------------------------------------------------- */
369 369
370/* This is arbitrary.
371 * From USB 2.0 spec Table 11-13, offset 7, a hub can
372 * have up to 255 ports. The most yet reported is 10.
373 *
374 * Current Wireless USB host hardware (Intel i1480 for example) allows
375 * up to 22 devices to connect. Upcoming hardware might raise that
376 * limit. Because the arrays need to add a bit for hub status data, we
377 * do 31, so plus one evens out to four bytes.
378 */
379#define USB_MAXCHILDREN (31)
380
381struct usb_tt; 370struct usb_tt;
382 371
383enum usb_device_removable { 372enum usb_device_removable {
diff --git a/include/linux/user_namespace.h b/include/linux/user_namespace.h
index b6b215f13b45..14105c26a836 100644
--- a/include/linux/user_namespace.h
+++ b/include/linux/user_namespace.h
@@ -23,6 +23,7 @@ struct user_namespace {
23 struct uid_gid_map projid_map; 23 struct uid_gid_map projid_map;
24 atomic_t count; 24 atomic_t count;
25 struct user_namespace *parent; 25 struct user_namespace *parent;
26 int level;
26 kuid_t owner; 27 kuid_t owner;
27 kgid_t group; 28 kgid_t group;
28 unsigned int proc_inum; 29 unsigned int proc_inum;
diff --git a/include/linux/vexpress.h b/include/linux/vexpress.h
index ea7168a68081..617c01b8f74a 100644
--- a/include/linux/vexpress.h
+++ b/include/linux/vexpress.h
@@ -15,6 +15,7 @@
15#define _LINUX_VEXPRESS_H 15#define _LINUX_VEXPRESS_H
16 16
17#include <linux/device.h> 17#include <linux/device.h>
18#include <linux/reboot.h>
18 19
19#define VEXPRESS_SITE_MB 0 20#define VEXPRESS_SITE_MB 0
20#define VEXPRESS_SITE_DB1 1 21#define VEXPRESS_SITE_DB1 1
diff --git a/include/linux/virtio.h b/include/linux/virtio.h
index e94c75ded111..36d36cc89329 100644
--- a/include/linux/virtio.h
+++ b/include/linux/virtio.h
@@ -63,6 +63,10 @@ void virtqueue_disable_cb(struct virtqueue *vq);
63 63
64bool virtqueue_enable_cb(struct virtqueue *vq); 64bool virtqueue_enable_cb(struct virtqueue *vq);
65 65
66unsigned virtqueue_enable_cb_prepare(struct virtqueue *vq);
67
68bool virtqueue_poll(struct virtqueue *vq, unsigned);
69
66bool virtqueue_enable_cb_delayed(struct virtqueue *vq); 70bool virtqueue_enable_cb_delayed(struct virtqueue *vq);
67 71
68void *virtqueue_detach_unused_buf(struct virtqueue *vq); 72void *virtqueue_detach_unused_buf(struct virtqueue *vq);
diff --git a/include/linux/virtio_ring.h b/include/linux/virtio_ring.h
index ca3ad41c2c82..b300787af8e0 100644
--- a/include/linux/virtio_ring.h
+++ b/include/linux/virtio_ring.h
@@ -1,6 +1,7 @@
1#ifndef _LINUX_VIRTIO_RING_H 1#ifndef _LINUX_VIRTIO_RING_H
2#define _LINUX_VIRTIO_RING_H 2#define _LINUX_VIRTIO_RING_H
3 3
4#include <asm/barrier.h>
4#include <linux/irqreturn.h> 5#include <linux/irqreturn.h>
5#include <uapi/linux/virtio_ring.h> 6#include <uapi/linux/virtio_ring.h>
6 7
diff --git a/include/linux/vmalloc.h b/include/linux/vmalloc.h
index dd0a2c810529..4b8a89189a29 100644
--- a/include/linux/vmalloc.h
+++ b/include/linux/vmalloc.h
@@ -10,12 +10,12 @@
10struct vm_area_struct; /* vma defining user mapping in mm_types.h */ 10struct vm_area_struct; /* vma defining user mapping in mm_types.h */
11 11
12/* bits in flags of vmalloc's vm_struct below */ 12/* bits in flags of vmalloc's vm_struct below */
13#define VM_IOREMAP 0x00000001 /* ioremap() and friends */ 13#define VM_IOREMAP 0x00000001 /* ioremap() and friends */
14#define VM_ALLOC 0x00000002 /* vmalloc() */ 14#define VM_ALLOC 0x00000002 /* vmalloc() */
15#define VM_MAP 0x00000004 /* vmap()ed pages */ 15#define VM_MAP 0x00000004 /* vmap()ed pages */
16#define VM_USERMAP 0x00000008 /* suitable for remap_vmalloc_range */ 16#define VM_USERMAP 0x00000008 /* suitable for remap_vmalloc_range */
17#define VM_VPAGES 0x00000010 /* buffer for pages was vmalloc'ed */ 17#define VM_VPAGES 0x00000010 /* buffer for pages was vmalloc'ed */
18#define VM_UNLIST 0x00000020 /* vm_struct is not listed in vmlist */ 18#define VM_UNINITIALIZED 0x00000020 /* vm_struct is not fully initialized */
19/* bits [20..32] reserved for arch specific ioremap internals */ 19/* bits [20..32] reserved for arch specific ioremap internals */
20 20
21/* 21/*
diff --git a/include/linux/vmpressure.h b/include/linux/vmpressure.h
index 76be077340ea..7dc17e2456de 100644
--- a/include/linux/vmpressure.h
+++ b/include/linux/vmpressure.h
@@ -12,7 +12,7 @@ struct vmpressure {
12 unsigned long scanned; 12 unsigned long scanned;
13 unsigned long reclaimed; 13 unsigned long reclaimed;
14 /* The lock is used to keep the scanned/reclaimed above in sync. */ 14 /* The lock is used to keep the scanned/reclaimed above in sync. */
15 struct mutex sr_lock; 15 struct spinlock sr_lock;
16 16
17 /* The list of vmpressure_event structs. */ 17 /* The list of vmpressure_event structs. */
18 struct list_head events; 18 struct list_head events;
@@ -30,6 +30,7 @@ extern void vmpressure(gfp_t gfp, struct mem_cgroup *memcg,
30extern void vmpressure_prio(gfp_t gfp, struct mem_cgroup *memcg, int prio); 30extern void vmpressure_prio(gfp_t gfp, struct mem_cgroup *memcg, int prio);
31 31
32extern void vmpressure_init(struct vmpressure *vmpr); 32extern void vmpressure_init(struct vmpressure *vmpr);
33extern void vmpressure_cleanup(struct vmpressure *vmpr);
33extern struct vmpressure *memcg_to_vmpressure(struct mem_cgroup *memcg); 34extern struct vmpressure *memcg_to_vmpressure(struct mem_cgroup *memcg);
34extern struct cgroup_subsys_state *vmpressure_to_css(struct vmpressure *vmpr); 35extern struct cgroup_subsys_state *vmpressure_to_css(struct vmpressure *vmpr);
35extern struct vmpressure *css_to_vmpressure(struct cgroup_subsys_state *css); 36extern struct vmpressure *css_to_vmpressure(struct cgroup_subsys_state *css);
diff --git a/include/linux/writeback.h b/include/linux/writeback.h
index abfe11787af3..4e198ca1f685 100644
--- a/include/linux/writeback.h
+++ b/include/linux/writeback.h
@@ -47,11 +47,16 @@ enum wb_reason {
47 WB_REASON_LAPTOP_TIMER, 47 WB_REASON_LAPTOP_TIMER,
48 WB_REASON_FREE_MORE_MEM, 48 WB_REASON_FREE_MORE_MEM,
49 WB_REASON_FS_FREE_SPACE, 49 WB_REASON_FS_FREE_SPACE,
50 /*
51 * There is no bdi forker thread any more and works are done
52 * by emergency worker, however, this is TPs userland visible
53 * and we'll be exposing exactly the same information,
54 * so it has a mismatch name.
55 */
50 WB_REASON_FORKER_THREAD, 56 WB_REASON_FORKER_THREAD,
51 57
52 WB_REASON_MAX, 58 WB_REASON_MAX,
53}; 59};
54extern const char *wb_reason_name[];
55 60
56/* 61/*
57 * A control structure which tells the writeback code what to do. These are 62 * A control structure which tells the writeback code what to do. These are
@@ -95,7 +100,6 @@ int try_to_writeback_inodes_sb_nr(struct super_block *, unsigned long nr,
95void sync_inodes_sb(struct super_block *); 100void sync_inodes_sb(struct super_block *);
96long writeback_inodes_wb(struct bdi_writeback *wb, long nr_pages, 101long writeback_inodes_wb(struct bdi_writeback *wb, long nr_pages,
97 enum wb_reason reason); 102 enum wb_reason reason);
98long wb_do_writeback(struct bdi_writeback *wb, int force_wait);
99void wakeup_flusher_threads(long nr_pages, enum wb_reason reason); 103void wakeup_flusher_threads(long nr_pages, enum wb_reason reason);
100void inode_wait_for_writeback(struct inode *inode); 104void inode_wait_for_writeback(struct inode *inode);
101 105
diff --git a/include/linux/ww_mutex.h b/include/linux/ww_mutex.h
new file mode 100644
index 000000000000..760399a470bd
--- /dev/null
+++ b/include/linux/ww_mutex.h
@@ -0,0 +1,378 @@
1/*
2 * Wound/Wait Mutexes: blocking mutual exclusion locks with deadlock avoidance
3 *
4 * Original mutex implementation started by Ingo Molnar:
5 *
6 * Copyright (C) 2004, 2005, 2006 Red Hat, Inc., Ingo Molnar <mingo@redhat.com>
7 *
8 * Wound/wait implementation:
9 * Copyright (C) 2013 Canonical Ltd.
10 *
11 * This file contains the main data structure and API definitions.
12 */
13
14#ifndef __LINUX_WW_MUTEX_H
15#define __LINUX_WW_MUTEX_H
16
17#include <linux/mutex.h>
18
19struct ww_class {
20 atomic_long_t stamp;
21 struct lock_class_key acquire_key;
22 struct lock_class_key mutex_key;
23 const char *acquire_name;
24 const char *mutex_name;
25};
26
27struct ww_acquire_ctx {
28 struct task_struct *task;
29 unsigned long stamp;
30 unsigned acquired;
31#ifdef CONFIG_DEBUG_MUTEXES
32 unsigned done_acquire;
33 struct ww_class *ww_class;
34 struct ww_mutex *contending_lock;
35#endif
36#ifdef CONFIG_DEBUG_LOCK_ALLOC
37 struct lockdep_map dep_map;
38#endif
39#ifdef CONFIG_DEBUG_WW_MUTEX_SLOWPATH
40 unsigned deadlock_inject_interval;
41 unsigned deadlock_inject_countdown;
42#endif
43};
44
45struct ww_mutex {
46 struct mutex base;
47 struct ww_acquire_ctx *ctx;
48#ifdef CONFIG_DEBUG_MUTEXES
49 struct ww_class *ww_class;
50#endif
51};
52
53#ifdef CONFIG_DEBUG_LOCK_ALLOC
54# define __WW_CLASS_MUTEX_INITIALIZER(lockname, ww_class) \
55 , .ww_class = &ww_class
56#else
57# define __WW_CLASS_MUTEX_INITIALIZER(lockname, ww_class)
58#endif
59
60#define __WW_CLASS_INITIALIZER(ww_class) \
61 { .stamp = ATOMIC_LONG_INIT(0) \
62 , .acquire_name = #ww_class "_acquire" \
63 , .mutex_name = #ww_class "_mutex" }
64
65#define __WW_MUTEX_INITIALIZER(lockname, class) \
66 { .base = { \__MUTEX_INITIALIZER(lockname) } \
67 __WW_CLASS_MUTEX_INITIALIZER(lockname, class) }
68
69#define DEFINE_WW_CLASS(classname) \
70 struct ww_class classname = __WW_CLASS_INITIALIZER(classname)
71
72#define DEFINE_WW_MUTEX(mutexname, ww_class) \
73 struct ww_mutex mutexname = __WW_MUTEX_INITIALIZER(mutexname, ww_class)
74
75/**
76 * ww_mutex_init - initialize the w/w mutex
77 * @lock: the mutex to be initialized
78 * @ww_class: the w/w class the mutex should belong to
79 *
80 * Initialize the w/w mutex to unlocked state and associate it with the given
81 * class.
82 *
83 * It is not allowed to initialize an already locked mutex.
84 */
85static inline void ww_mutex_init(struct ww_mutex *lock,
86 struct ww_class *ww_class)
87{
88 __mutex_init(&lock->base, ww_class->mutex_name, &ww_class->mutex_key);
89 lock->ctx = NULL;
90#ifdef CONFIG_DEBUG_MUTEXES
91 lock->ww_class = ww_class;
92#endif
93}
94
95/**
96 * ww_acquire_init - initialize a w/w acquire context
97 * @ctx: w/w acquire context to initialize
98 * @ww_class: w/w class of the context
99 *
100 * Initializes an context to acquire multiple mutexes of the given w/w class.
101 *
102 * Context-based w/w mutex acquiring can be done in any order whatsoever within
103 * a given lock class. Deadlocks will be detected and handled with the
104 * wait/wound logic.
105 *
106 * Mixing of context-based w/w mutex acquiring and single w/w mutex locking can
107 * result in undetected deadlocks and is so forbidden. Mixing different contexts
108 * for the same w/w class when acquiring mutexes can also result in undetected
109 * deadlocks, and is hence also forbidden. Both types of abuse will be caught by
110 * enabling CONFIG_PROVE_LOCKING.
111 *
112 * Nesting of acquire contexts for _different_ w/w classes is possible, subject
113 * to the usual locking rules between different lock classes.
114 *
115 * An acquire context must be released with ww_acquire_fini by the same task
116 * before the memory is freed. It is recommended to allocate the context itself
117 * on the stack.
118 */
119static inline void ww_acquire_init(struct ww_acquire_ctx *ctx,
120 struct ww_class *ww_class)
121{
122 ctx->task = current;
123 ctx->stamp = atomic_long_inc_return(&ww_class->stamp);
124 ctx->acquired = 0;
125#ifdef CONFIG_DEBUG_MUTEXES
126 ctx->ww_class = ww_class;
127 ctx->done_acquire = 0;
128 ctx->contending_lock = NULL;
129#endif
130#ifdef CONFIG_DEBUG_LOCK_ALLOC
131 debug_check_no_locks_freed((void *)ctx, sizeof(*ctx));
132 lockdep_init_map(&ctx->dep_map, ww_class->acquire_name,
133 &ww_class->acquire_key, 0);
134 mutex_acquire(&ctx->dep_map, 0, 0, _RET_IP_);
135#endif
136#ifdef CONFIG_DEBUG_WW_MUTEX_SLOWPATH
137 ctx->deadlock_inject_interval = 1;
138 ctx->deadlock_inject_countdown = ctx->stamp & 0xf;
139#endif
140}
141
142/**
143 * ww_acquire_done - marks the end of the acquire phase
144 * @ctx: the acquire context
145 *
146 * Marks the end of the acquire phase, any further w/w mutex lock calls using
147 * this context are forbidden.
148 *
149 * Calling this function is optional, it is just useful to document w/w mutex
150 * code and clearly designated the acquire phase from actually using the locked
151 * data structures.
152 */
153static inline void ww_acquire_done(struct ww_acquire_ctx *ctx)
154{
155#ifdef CONFIG_DEBUG_MUTEXES
156 lockdep_assert_held(ctx);
157
158 DEBUG_LOCKS_WARN_ON(ctx->done_acquire);
159 ctx->done_acquire = 1;
160#endif
161}
162
163/**
164 * ww_acquire_fini - releases a w/w acquire context
165 * @ctx: the acquire context to free
166 *
167 * Releases a w/w acquire context. This must be called _after_ all acquired w/w
168 * mutexes have been released with ww_mutex_unlock.
169 */
170static inline void ww_acquire_fini(struct ww_acquire_ctx *ctx)
171{
172#ifdef CONFIG_DEBUG_MUTEXES
173 mutex_release(&ctx->dep_map, 0, _THIS_IP_);
174
175 DEBUG_LOCKS_WARN_ON(ctx->acquired);
176 if (!config_enabled(CONFIG_PROVE_LOCKING))
177 /*
178 * lockdep will normally handle this,
179 * but fail without anyway
180 */
181 ctx->done_acquire = 1;
182
183 if (!config_enabled(CONFIG_DEBUG_LOCK_ALLOC))
184 /* ensure ww_acquire_fini will still fail if called twice */
185 ctx->acquired = ~0U;
186#endif
187}
188
189extern int __must_check __ww_mutex_lock(struct ww_mutex *lock,
190 struct ww_acquire_ctx *ctx);
191extern int __must_check __ww_mutex_lock_interruptible(struct ww_mutex *lock,
192 struct ww_acquire_ctx *ctx);
193
194/**
195 * ww_mutex_lock - acquire the w/w mutex
196 * @lock: the mutex to be acquired
197 * @ctx: w/w acquire context, or NULL to acquire only a single lock.
198 *
199 * Lock the w/w mutex exclusively for this task.
200 *
201 * Deadlocks within a given w/w class of locks are detected and handled with the
202 * wait/wound algorithm. If the lock isn't immediately avaiable this function
203 * will either sleep until it is (wait case). Or it selects the current context
204 * for backing off by returning -EDEADLK (wound case). Trying to acquire the
205 * same lock with the same context twice is also detected and signalled by
206 * returning -EALREADY. Returns 0 if the mutex was successfully acquired.
207 *
208 * In the wound case the caller must release all currently held w/w mutexes for
209 * the given context and then wait for this contending lock to be available by
210 * calling ww_mutex_lock_slow. Alternatively callers can opt to not acquire this
211 * lock and proceed with trying to acquire further w/w mutexes (e.g. when
212 * scanning through lru lists trying to free resources).
213 *
214 * The mutex must later on be released by the same task that
215 * acquired it. The task may not exit without first unlocking the mutex. Also,
216 * kernel memory where the mutex resides must not be freed with the mutex still
217 * locked. The mutex must first be initialized (or statically defined) before it
218 * can be locked. memset()-ing the mutex to 0 is not allowed. The mutex must be
219 * of the same w/w lock class as was used to initialize the acquire context.
220 *
221 * A mutex acquired with this function must be released with ww_mutex_unlock.
222 */
223static inline int ww_mutex_lock(struct ww_mutex *lock, struct ww_acquire_ctx *ctx)
224{
225 if (ctx)
226 return __ww_mutex_lock(lock, ctx);
227
228 mutex_lock(&lock->base);
229 return 0;
230}
231
232/**
233 * ww_mutex_lock_interruptible - acquire the w/w mutex, interruptible
234 * @lock: the mutex to be acquired
235 * @ctx: w/w acquire context
236 *
237 * Lock the w/w mutex exclusively for this task.
238 *
239 * Deadlocks within a given w/w class of locks are detected and handled with the
240 * wait/wound algorithm. If the lock isn't immediately avaiable this function
241 * will either sleep until it is (wait case). Or it selects the current context
242 * for backing off by returning -EDEADLK (wound case). Trying to acquire the
243 * same lock with the same context twice is also detected and signalled by
244 * returning -EALREADY. Returns 0 if the mutex was successfully acquired. If a
245 * signal arrives while waiting for the lock then this function returns -EINTR.
246 *
247 * In the wound case the caller must release all currently held w/w mutexes for
248 * the given context and then wait for this contending lock to be available by
249 * calling ww_mutex_lock_slow_interruptible. Alternatively callers can opt to
250 * not acquire this lock and proceed with trying to acquire further w/w mutexes
251 * (e.g. when scanning through lru lists trying to free resources).
252 *
253 * The mutex must later on be released by the same task that
254 * acquired it. The task may not exit without first unlocking the mutex. Also,
255 * kernel memory where the mutex resides must not be freed with the mutex still
256 * locked. The mutex must first be initialized (or statically defined) before it
257 * can be locked. memset()-ing the mutex to 0 is not allowed. The mutex must be
258 * of the same w/w lock class as was used to initialize the acquire context.
259 *
260 * A mutex acquired with this function must be released with ww_mutex_unlock.
261 */
262static inline int __must_check ww_mutex_lock_interruptible(struct ww_mutex *lock,
263 struct ww_acquire_ctx *ctx)
264{
265 if (ctx)
266 return __ww_mutex_lock_interruptible(lock, ctx);
267 else
268 return mutex_lock_interruptible(&lock->base);
269}
270
271/**
272 * ww_mutex_lock_slow - slowpath acquiring of the w/w mutex
273 * @lock: the mutex to be acquired
274 * @ctx: w/w acquire context
275 *
276 * Acquires a w/w mutex with the given context after a wound case. This function
277 * will sleep until the lock becomes available.
278 *
279 * The caller must have released all w/w mutexes already acquired with the
280 * context and then call this function on the contended lock.
281 *
282 * Afterwards the caller may continue to (re)acquire the other w/w mutexes it
283 * needs with ww_mutex_lock. Note that the -EALREADY return code from
284 * ww_mutex_lock can be used to avoid locking this contended mutex twice.
285 *
286 * It is forbidden to call this function with any other w/w mutexes associated
287 * with the context held. It is forbidden to call this on anything else than the
288 * contending mutex.
289 *
290 * Note that the slowpath lock acquiring can also be done by calling
291 * ww_mutex_lock directly. This function here is simply to help w/w mutex
292 * locking code readability by clearly denoting the slowpath.
293 */
294static inline void
295ww_mutex_lock_slow(struct ww_mutex *lock, struct ww_acquire_ctx *ctx)
296{
297 int ret;
298#ifdef CONFIG_DEBUG_MUTEXES
299 DEBUG_LOCKS_WARN_ON(!ctx->contending_lock);
300#endif
301 ret = ww_mutex_lock(lock, ctx);
302 (void)ret;
303}
304
305/**
306 * ww_mutex_lock_slow_interruptible - slowpath acquiring of the w/w mutex, interruptible
307 * @lock: the mutex to be acquired
308 * @ctx: w/w acquire context
309 *
310 * Acquires a w/w mutex with the given context after a wound case. This function
311 * will sleep until the lock becomes available and returns 0 when the lock has
312 * been acquired. If a signal arrives while waiting for the lock then this
313 * function returns -EINTR.
314 *
315 * The caller must have released all w/w mutexes already acquired with the
316 * context and then call this function on the contended lock.
317 *
318 * Afterwards the caller may continue to (re)acquire the other w/w mutexes it
319 * needs with ww_mutex_lock. Note that the -EALREADY return code from
320 * ww_mutex_lock can be used to avoid locking this contended mutex twice.
321 *
322 * It is forbidden to call this function with any other w/w mutexes associated
323 * with the given context held. It is forbidden to call this on anything else
324 * than the contending mutex.
325 *
326 * Note that the slowpath lock acquiring can also be done by calling
327 * ww_mutex_lock_interruptible directly. This function here is simply to help
328 * w/w mutex locking code readability by clearly denoting the slowpath.
329 */
330static inline int __must_check
331ww_mutex_lock_slow_interruptible(struct ww_mutex *lock,
332 struct ww_acquire_ctx *ctx)
333{
334#ifdef CONFIG_DEBUG_MUTEXES
335 DEBUG_LOCKS_WARN_ON(!ctx->contending_lock);
336#endif
337 return ww_mutex_lock_interruptible(lock, ctx);
338}
339
340extern void ww_mutex_unlock(struct ww_mutex *lock);
341
342/**
343 * ww_mutex_trylock - tries to acquire the w/w mutex without acquire context
344 * @lock: mutex to lock
345 *
346 * Trylocks a mutex without acquire context, so no deadlock detection is
347 * possible. Returns 1 if the mutex has been acquired successfully, 0 otherwise.
348 */
349static inline int __must_check ww_mutex_trylock(struct ww_mutex *lock)
350{
351 return mutex_trylock(&lock->base);
352}
353
354/***
355 * ww_mutex_destroy - mark a w/w mutex unusable
356 * @lock: the mutex to be destroyed
357 *
358 * This function marks the mutex uninitialized, and any subsequent
359 * use of the mutex is forbidden. The mutex must not be locked when
360 * this function is called.
361 */
362static inline void ww_mutex_destroy(struct ww_mutex *lock)
363{
364 mutex_destroy(&lock->base);
365}
366
367/**
368 * ww_mutex_is_locked - is the w/w mutex locked
369 * @lock: the mutex to be queried
370 *
371 * Returns 1 if the mutex is locked, 0 if unlocked.
372 */
373static inline bool ww_mutex_is_locked(struct ww_mutex *lock)
374{
375 return mutex_is_locked(&lock->base);
376}
377
378#endif
diff --git a/include/linux/zbud.h b/include/linux/zbud.h
new file mode 100644
index 000000000000..2571a5cfa5fc
--- /dev/null
+++ b/include/linux/zbud.h
@@ -0,0 +1,22 @@
1#ifndef _ZBUD_H_
2#define _ZBUD_H_
3
4#include <linux/types.h>
5
6struct zbud_pool;
7
8struct zbud_ops {
9 int (*evict)(struct zbud_pool *pool, unsigned long handle);
10};
11
12struct zbud_pool *zbud_create_pool(gfp_t gfp, struct zbud_ops *ops);
13void zbud_destroy_pool(struct zbud_pool *pool);
14int zbud_alloc(struct zbud_pool *pool, int size, gfp_t gfp,
15 unsigned long *handle);
16void zbud_free(struct zbud_pool *pool, unsigned long handle);
17int zbud_reclaim_page(struct zbud_pool *pool, unsigned int retries);
18void *zbud_map(struct zbud_pool *pool, unsigned long handle);
19void zbud_unmap(struct zbud_pool *pool, unsigned long handle);
20u64 zbud_get_pool_size(struct zbud_pool *pool);
21
22#endif /* _ZBUD_H_ */